/* シインクラッド */
:root { --bg: #14121c; --ink: #f2e9d8; --gold: #ffd25a; --red: #e0503a; --dim: #9a90a8; --line: #4a4356; --card: #1f1b2a; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: 'DotGothic16', monospace; -webkit-user-select: none; user-select: none; }
button { font: inherit; cursor: pointer; }
canvas#cv { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }
b { font-weight: 400; color: var(--gold); }

.screen { display: none; }
.screen.on { display: block; }

/* ---------- タイトル ---------- */
#title { position: fixed; inset: 0; overflow-y: auto; z-index: 2; }
.tbg { position: fixed; inset: 0; background:
  linear-gradient(180deg, rgba(20,18,28,.2), rgba(20,18,28,.95) 75%),
  repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 2px, transparent 2px 48px),
  radial-gradient(ellipse at 50% 0%, #3a2a50, #14121c 70%); z-index: -1; }
.tbg::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 26vh; background:
  repeating-linear-gradient(90deg, #2a2434 0 30px, #24202e 30px 60px); box-shadow: 0 -6px 0 #5a4e6a; }
.ticker { position: sticky; top: 0; overflow: hidden; white-space: nowrap; background: #0c0a10; border-bottom: 2px solid var(--line); padding: max(8px, env(safe-area-inset-top)) 0 8px; font-size: 14px; color: #cfc6b8; z-index: 3; }
.ticker span { display: inline-block; padding-left: 100%; animation: tick 30s linear infinite; }
@keyframes tick { to { transform: translateX(-100%); } }
.tmain { max-width: 460px; margin: 0 auto; padding: 28px 18px 40px; text-align: center; position: relative; }
.tmain h1 { margin: 10px 0 2px; font-size: clamp(38px, 11vw, 56px); font-weight: 400; color: var(--gold); letter-spacing: .08em; text-shadow: 0 4px 0 #6a3a10, 0 8px 0 #000; }
.catch { margin: 6px 0 18px; color: #cfc6b8; font-size: 16px; }
.now { background: rgba(31,27,42,.9); border: 3px solid #6a6176; box-shadow: 0 0 0 4px #0c0a10; padding: 14px 12px; margin: 0 0 16px; }
.now .lab { font-size: 13px; color: var(--dim); }
.now .lv { font-size: 24px; margin: 6px 0; }
.now .lv b { font-size: 34px; }
.nums { display: flex; justify-content: center; gap: 18px; font-size: 14px; color: #cfc6b8; flex-wrap: wrap; }
.go { margin: 6px 0 4px; font-size: 22px; padding: 12px 32px; background: var(--red); color: #fff; border: 0; box-shadow: 0 5px 0 #7a2216; }
.go:active { transform: translateY(3px); box-shadow: 0 2px 0 #7a2216; }
.row { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.sub { margin: 4px 2px; font-size: 14px; padding: 8px 12px; background: rgba(20,18,28,.7); color: #d8d0c4; border: 2px solid var(--line); }
.sub:active { background: #2a2436; }
.total { margin-top: 20px; color: var(--dim); }
.total b { font-size: 22px; }
.home { display: inline-block; margin-top: 8px; color: var(--dim); font-size: 13px; }

/* ---------- 層をえらぶ ---------- */
#select { position: fixed; inset: 0; overflow-y: auto; z-index: 2; background: var(--bg); padding: max(10px, env(safe-area-inset-top)) 12px 30px; }
#select header { display: flex; align-items: center; gap: 10px; max-width: 760px; margin: 0 auto; }
#select h2 { font-weight: 400; margin: 0; font-size: 22px; color: var(--gold); }
.note { color: var(--dim); font-size: 13px; line-height: 1.6; max-width: 760px; margin: 8px auto; }
.sel-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; max-width: 760px; margin: 0 auto; }
.fl { position: relative; background: var(--card); border: 2px solid var(--line); color: var(--ink); padding: 8px 4px; min-height: 76px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.fl b { font-size: 22px; }
.fl small { font-size: 11px; color: #cfc6b8; }
.fl i { font-style: normal; font-size: 11px; color: var(--dim); }
.fl u { position: absolute; right: 4px; top: 3px; text-decoration: none; font-size: 11px; color: #8fe08f; }
.fl.boss { border-color: #8a5a3a; }
.fl.gate { border-color: #c03a3a; box-shadow: inset 0 0 0 2px #4a1010; }
.fl.now { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.fl.lock { opacity: .35; cursor: default; }
.tier { grid-column: 1 / -1; text-align: center; color: var(--dim); font-size: 13px; padding: 6px 0 2px; }

/* ---------- 遊ぶ ---------- */
#game { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#game > * { pointer-events: auto; }
.hud { position: fixed; left: 0; right: 0; top: 0; display: flex; gap: 8px; white-space: nowrap; align-items: center; padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left)); font-size: 15px; text-shadow: 0 2px 0 #000; pointer-events: none !important; }
.hud > * { pointer-events: none; }
.hud .hb { pointer-events: auto; background: rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.25); color: #fff; width: 34px; height: 30px; padding: 0; font-size: 15px; }
.hud .hfl { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
@media (max-width: 480px) { .hud .hfl small { display: none; } }
.hud .hfl small { font-size: 13px; color: #cfc6b8; }
.hud .hfl em { font-style: normal; font-size: 12px; color: #9fd0ff; }
.hud .sp { flex: 1; }
.prog { position: fixed; left: 12px; right: 12px; top: calc(max(6px, env(safe-area-inset-top)) + 36px); height: 6px; background: rgba(255,255,255,.14); pointer-events: none !important; }
.prog i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gold); }
.prog u { position: absolute; top: -3px; width: 3px; height: 12px; background: #fff; }
.name { position: fixed; left: 50%; top: calc(max(6px, env(safe-area-inset-top)) + 48px); transform: translateX(-50%); font-size: 14px; color: #e8e0d0; text-shadow: 0 2px 0 #000; pointer-events: none !important; white-space: nowrap; }
.stuck { position: fixed; right: max(10px, env(safe-area-inset-right)); top: calc(max(6px, env(safe-area-inset-top)) + 50px); font-size: 12px; padding: 4px 8px; background: rgba(0,0,0,.4); color: #d8d0c4; border: 1px solid rgba(255,255,255,.25); }
.stone { position: fixed; left: max(10px, env(safe-area-inset-left)); top: calc(max(6px, env(safe-area-inset-top)) + 50px); font-size: 12px; padding: 4px 8px; background: rgba(60,50,70,.7); color: var(--gold); border: 1px solid var(--gold); }
.btns { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 0 max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-bottom)); pointer-events: none !important; }
.btns div { display: flex; gap: 12px; }
.b { pointer-events: auto; width: 72px; height: 72px; border-radius: 16px; border: 2px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff; font-size: 26px; display: flex; align-items: center; justify-content: center; touch-action: none; }
.b.on { background: rgba(255,210,90,.35); }
.b.j { width: 92px; height: 92px; border-radius: 50%; flex-direction: column; line-height: 1; }
.b.j small { font-size: 12px; margin-top: 4px; }
@media (hover: hover) and (pointer: fine) { .btns { display: none; } }
.watchbar { display: none; position: fixed; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); text-align: center; }
.watchbar small { display: block; color: #cfc6b8; text-shadow: 0 2px 0 #000; margin-top: 4px; }
#game.watching .watchbar { display: block; }
#game.watching .btns, #game.watching .stuck, #game.watching .name { display: none; }
.loading { display: none; position: fixed; inset: 0; background: rgba(10,8,14,.85); align-items: center; justify-content: center; font-size: 18px; color: #cfc6b8; z-index: 4; }
.loading.on { display: flex; }

.pop { position: fixed; padding: 6px 10px; background: rgba(10,8,14,.92); border: 2px solid #6a6176; font-size: 14px; line-height: 1.5; pointer-events: none; white-space: nowrap; transform: translate(-50%, -115%); display: none; z-index: 6; }
.toast { position: fixed; left: 50%; top: 36%; transform: translate(-50%, -50%); font-size: clamp(22px, 6vw, 32px); color: #fff; text-shadow: 0 3px 0 #000, 0 0 12px rgba(0,0,0,.8); pointer-events: none; opacity: 0; transition: opacity .2s; text-align: center; white-space: nowrap; z-index: 7; }
.toast small { display: block; font-size: 15px; color: #e0d8cc; margin-top: 6px; white-space: normal; }
.toast.in { opacity: 1; }

/* ---------- 箱 ---------- */
.modal { display: none; position: fixed; inset: 0; background: rgba(10,8,14,.78); z-index: 8; align-items: center; justify-content: center; padding: 16px; }
.modal.on { display: flex; }
.card { width: min(440px, 100%); max-height: calc(100% - 20px); overflow-y: auto; background: var(--card); border: 3px solid #6a6176; padding: 18px 16px; text-align: center; box-shadow: 0 0 0 4px #0c0a10; }
.card.wide { width: min(560px, 100%); }
.card h3 { margin: 0 0 10px; font-weight: 400; font-size: 22px; color: var(--gold); }
.card p { margin: 8px 0; font-size: 15px; line-height: 1.7; text-align: left; }
.card .k { color: #9fd0ff; font-size: 14px; }
.clear .big { font-size: clamp(26px, 7vw, 34px); line-height: 1.4; margin: 6px 0; }
.clear .big b { font-size: 1.3em; }
.csub { color: #cfc6b8; }
.cmsg { text-align: center !important; color: #8fe08f; }
.first { border: 2px dashed var(--gold); padding: 8px 10px; margin: 10px 0; }
.xin { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 18px; }
.xin input { font: inherit; font-size: 17px; width: 200px; padding: 6px 8px; background: #0c0a10; color: #fff; border: 2px solid var(--line); -webkit-user-select: text; user-select: text; }
.tiny { font-size: 12px !important; color: var(--dim); text-align: center !important; }
.tabs { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.tabs button { background: transparent; border: 2px solid var(--line); color: #cfc6b8; padding: 6px 14px; }
.tabs button.on { border-color: var(--gold); color: var(--gold); }
.gbody { text-align: left; max-height: 60vh; overflow-y: auto; }
.names { list-style: none; padding: 0; margin: 0; }
.names li { padding: 6px 4px; border-bottom: 1px solid #2e2838; font-size: 15px; }
.names li small { float: right; color: var(--dim); font-size: 12px; }
.names .x { color: #9fd0ff; }
.shimg { width: 100%; height: auto; border: 2px solid var(--line); image-rendering: auto; }
.shtext { white-space: pre-wrap; text-align: left; font: inherit; font-size: 13px; color: #cfc6b8; background: #0c0a10; padding: 8px; }
.how p { font-size: 14px; }
@media (max-height: 500px) {
  .card { padding: 10px 12px; }
  .clear .big { font-size: 22px; }
  .card p { margin: 4px 0; font-size: 13px; }
  .go { font-size: 18px; padding: 8px 24px; }
  .b { width: 60px; height: 60px; } .b.j { width: 76px; height: 76px; }
}

.hud .hb.wide { width: auto; padding: 0 8px; font-size: 13px; }
#game.watching #g-share { display: none; }
