:root {
  --ink: #0b0a10;
  --ink2: #15121a;
  --parch: #efe4c8;
  --text: #e8dcc4;
  --dim: #a8997e;
  --brass: #c89a4a;
  --brass2: #f0c870;
  --blood: #8a1a24;
  --blood2: #d0303a;
  --teal: #7ad8ff;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --display: 'IM Fell English SC', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); overflow: hidden; font-family: var(--serif); user-select: none; -webkit-user-select: none; }
body { touch-action: none; }
#scene, #overlay { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { pointer-events: none; z-index: 2; }
[hidden] { display: none !important; }
kbd { font-family: var(--serif); font-weight: 700; font-size: 0.8em; border: 1px solid rgba(200,154,74,0.5); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--brass2); background: rgba(0,0,0,0.3); }

/* ── shared ───────────────────────────────────────────────────────────── */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; }
.screen.center { flex-direction: column; text-align: center; gap: 18px; background: radial-gradient(ellipse at center, #1a1520 0%, var(--ink) 70%); }
.logo { font-family: var(--display); font-weight: 400; font-size: clamp(44px, 8vw, 104px); letter-spacing: 0.06em; margin: 0; line-height: 0.95;
  background: linear-gradient(180deg, #fff4d6 0%, #f0c870 45%, #8a5a20 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,0.6)) drop-shadow(0 0 24px rgba(240,180,80,0.25)); }
.logo.small { font-size: 42px; }
.menu-left .logo { font-size: clamp(40px, 5.4vw, 78px); white-space: nowrap; }
.eyebrow { font-family: var(--display); color: var(--brass); letter-spacing: 0.3em; text-transform: lowercase; font-size: 15px; opacity: 0.9; }
.btn { font-family: var(--display); font-size: 18px; letter-spacing: 0.06em; color: var(--parch); background: linear-gradient(180deg, rgba(60,40,30,0.85), rgba(25,18,16,0.9));
  border: 1px solid rgba(200,154,74,0.55); border-radius: 3px; padding: 10px 20px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255,220,160,0.15), 0 2px 10px rgba(0,0,0,0.5); transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s; }
.btn:hover { border-color: var(--brass2); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,220,160,0.25), 0 0 18px rgba(240,180,80,0.25); }
.btn:active { transform: translateY(1px); }
.btn.big { font-size: 22px; padding: 13px 28px; background: linear-gradient(180deg, #8a2a2a, #4a1016); border-color: var(--brass2); }
.btn.ghost { background: rgba(0,0,0,0.25); border-color: rgba(200,154,74,0.3); color: var(--dim); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.panel { background: linear-gradient(180deg, rgba(28,22,26,0.96), rgba(14,11,14,0.97)); border: 1px solid rgba(200,154,74,0.45); outline: 1px solid rgba(200,154,74,0.15); outline-offset: 4px;
  border-radius: 4px; padding: 26px 30px; max-width: 640px; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 20px 80px rgba(0,0,0,0.7); position: relative; }
.panel.wide { max-width: 1000px; }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 36px; margin: 0 0 6px; color: var(--brass2); letter-spacing: 0.04em; text-align: center; }
.panel h3 { font-family: var(--display); font-weight: 400; color: var(--brass); margin: 10px 0 8px; font-size: 20px; }
.panel .sub { text-align: center; color: var(--dim); margin: 0 0 16px; font-style: italic; font-size: 18px; }
.panel-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.panel-foot .thread-count { margin-right: auto; }
.thread-count { font-family: var(--display); color: var(--parch); font-size: 20px; }
.thread-count b { color: var(--brass2); }

/* ── loading ──────────────────────────────────────────────────────────── */
.loadbar { width: 260px; height: 4px; background: rgba(200,154,74,0.15); border-radius: 2px; overflow: hidden; }
#load-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brass), var(--brass2)); transition: width 0.2s; }
.load-note { color: var(--dim); font-style: italic; font-size: 17px; }

/* ── title ────────────────────────────────────────────────────────────── */
#menu { justify-content: flex-start; align-items: stretch; background: linear-gradient(90deg, rgba(8,6,10,0.92) 0%, rgba(8,6,10,0.65) 38%, rgba(8,6,10,0) 65%); }
.menu-left { display: flex; flex-direction: column; justify-content: center; gap: 14px; max-width: 520px; padding: 20px 20px 20px clamp(16px, 6vw, 90px); }
.tagline { font-size: 20px; line-height: 1.35; color: var(--text); margin: 0; font-style: italic; opacity: 0.9; }
.menu-buttons { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-top: 6px; }
.menu-buttons .btn { min-width: 250px; justify-content: flex-start; }
.menu-buttons .btn.big { min-width: 320px; }
.menu-char { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-left: 2px solid var(--brass); background: linear-gradient(90deg, rgba(200,154,74,0.12), transparent); cursor: pointer; }
.menu-char .mc-icon { font-size: 30px; }
.menu-char .mc-name { font-family: var(--display); font-size: 22px; color: var(--parch); }
.menu-char .mc-title { color: var(--brass); font-style: italic; }
.menu-char .mc-arrows { margin-left: auto; color: var(--dim); font-size: 14px; }
.menu-help { position: absolute; right: 20px; bottom: 16px; text-align: right; color: var(--dim); font-size: 16px; line-height: 1.6; }

/* ── characters ───────────────────────────────────────────────────────── */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; margin-top: 14px; }
.char-card { border: 1px solid rgba(200,154,74,0.3); border-radius: 3px; padding: 14px; background: rgba(0,0,0,0.3); cursor: pointer; transition: border-color 0.15s, transform 0.15s; position: relative; }
.char-card:hover { border-color: var(--brass2); transform: translateY(-2px); }
.char-card.selected { border-color: var(--brass2); box-shadow: 0 0 0 1px var(--brass2), 0 0 22px rgba(240,180,80,0.25); background: rgba(200,154,74,0.08); }
.char-card.locked { opacity: 0.75; }
.char-card .cc-top { display: flex; align-items: center; gap: 10px; }
.char-card .cc-sw { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; border: 2px solid; }
.char-card .cc-name { font-family: var(--display); font-size: 20px; color: var(--parch); line-height: 1; }
.char-card .cc-title { color: var(--brass); font-style: italic; font-size: 15px; }
.char-card .cc-weapon { margin-top: 10px; font-size: 15px; color: var(--text); }
.char-card .cc-passive { margin-top: 4px; font-size: 15px; color: var(--dim); line-height: 1.25; }
.char-card .cc-lock { margin-top: 10px; }
.char-card .cc-best { font-size: 13px; color: var(--dim); margin-top: 6px; }

/* ── shop ─────────────────────────────────────────────────────────────── */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.shop-item { border: 1px solid rgba(200,154,74,0.3); padding: 12px; border-radius: 3px; background: rgba(0,0,0,0.3); display: flex; flex-direction: column; gap: 6px; }
.shop-item .si-top { display: flex; gap: 10px; align-items: center; }
.shop-item .si-icon { font-size: 26px; }
.shop-item .si-name { font-family: var(--display); font-size: 18px; color: var(--parch); }
.shop-item .si-desc { color: var(--dim); font-size: 15px; }
.pips { display: flex; gap: 4px; }
.pips i { width: 14px; height: 6px; background: rgba(200,154,74,0.2); border-radius: 1px; }
.pips i.on { background: var(--brass2); box-shadow: 0 0 6px rgba(240,200,112,0.6); }
.shop-item .btn { padding: 6px 12px; font-size: 16px; }

.records { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; font-size: 19px; }
.records span:nth-child(2n) { color: var(--brass2); text-align: right; font-family: var(--display); }
.settings { display: flex; flex-direction: column; gap: 14px; font-size: 19px; }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.settings label.check { justify-content: flex-start; }
.settings input[type=range] { width: 55%; accent-color: var(--brass); }
.settings select { background: var(--ink2); color: var(--text); border: 1px solid rgba(200,154,74,0.4); padding: 4px 8px; font-family: var(--serif); font-size: 17px; }

/* ── HUD ──────────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#hud button { pointer-events: auto; }
.xpbar { position: absolute; top: 0; left: 0; right: 0; height: 12px; background: rgba(10,8,14,0.75); border-bottom: 1px solid rgba(200,154,74,0.4); }
#xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, #2a8aa8, #7ad8ff 70%, #dff6ff); box-shadow: 0 0 12px rgba(122,216,255,0.7); transition: width 0.12s; }
.xp-level { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); font-family: var(--display); font-size: 15px; color: var(--teal); background: rgba(10,8,14,0.8); padding: 1px 12px 3px; border: 1px solid rgba(122,216,255,0.3); border-top: 0; border-radius: 0 0 6px 6px; }
.xp-level b { font-weight: 400; color: #fff; font-size: 17px; }
.hud-tl { position: absolute; top: 24px; left: 18px; display: flex; gap: 12px; align-items: center; }
.portrait { width: 58px; height: 58px; border-radius: 50%; border: 2px solid var(--brass); background: radial-gradient(circle at 40% 35%, #3a2a30, #0e0a0e); display: grid; place-items: center; font-size: 28px; box-shadow: 0 0 0 3px rgba(0,0,0,0.5), 0 0 14px rgba(200,154,74,0.3); }
.vitals { display: flex; flex-direction: column; gap: 6px; }
.hpbar { position: relative; width: clamp(180px, 22vw, 300px); height: 20px; background: rgba(20,6,8,0.85); border: 1px solid rgba(200,154,74,0.55); border-radius: 2px; overflow: hidden; }
#hp-fill, #hp-lag { position: absolute; inset: 0; width: 100%; transition: width 0.08s; }
#hp-lag { background: #f0e0c0; transition: width 0.6s 0.15s; opacity: 0.8; }
#hp-fill { background: linear-gradient(180deg, #e04048, #8a1a24 60%, #5a0e14); }
#hp-text { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 14px; color: #fff; text-shadow: 0 1px 2px #000; }
.counters { display: flex; gap: 14px; font-family: var(--display); font-size: 17px; color: var(--parch); text-shadow: 0 1px 3px #000; }
.counters b { font-weight: 400; color: var(--brass2); }
.dash-pip { font-size: 12px; letter-spacing: 0.1em; padding: 1px 6px; border: 1px solid var(--teal); color: var(--teal); border-radius: 2px; align-self: center; transition: opacity 0.1s; }
.dash-pip.cd { opacity: 0.25; }
.hud-timer { position: absolute; top: 38px; left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 6px #000; }
#hud-time { font-family: var(--display); font-size: 38px; color: var(--parch); line-height: 1; }
#hud-act { font-style: italic; color: var(--brass); font-size: 16px; }
.curtain-meter { width: 160px; height: 3px; margin: 5px auto 0; background: rgba(200,154,74,0.18); }
#curtain-fill { height: 100%; width: 0; background: var(--blood2); box-shadow: 0 0 8px var(--blood2); }
.hud-tr { position: absolute; top: 24px; right: 18px; }
#minimap { width: 150px; height: 150px; border-radius: 50%; border: 2px solid rgba(200,154,74,0.6); background: rgba(8,6,10,0.6); box-shadow: 0 0 0 3px rgba(0,0,0,0.4); }
.hud-bl { position: absolute; left: 18px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.slots { display: flex; gap: 5px; flex-wrap: wrap; max-width: 60vw; }
.slot { width: 44px; height: 44px; border: 1px solid rgba(200,154,74,0.5); background: rgba(10,8,12,0.75); border-radius: 3px; position: relative; display: grid; place-items: center; font-size: 22px; }
.slot .lv { position: absolute; right: 1px; bottom: -1px; font-family: var(--display); font-size: 12px; color: var(--brass2); text-shadow: 0 0 3px #000, 0 0 3px #000; }
.slot.max { border-color: var(--brass2); box-shadow: 0 0 10px rgba(240,200,112,0.45); }
.slots.tomes .slot { width: 34px; height: 34px; font-size: 16px; }
.slots.items .slot { width: 30px; height: 30px; font-size: 15px; }
.hud-br { position: absolute; right: 18px; bottom: 16px; display: flex; gap: 8px; }
.auto-btn { font-family: var(--display); font-size: 18px; letter-spacing: 0.12em; color: var(--dim); background: rgba(10,8,12,0.8); border: 1px solid rgba(200,154,74,0.4); padding: 10px 16px; border-radius: 3px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.auto-dot { width: 10px; height: 10px; border-radius: 50%; background: #3a3030; }
.auto-btn.on { color: var(--teal); border-color: var(--teal); box-shadow: 0 0 16px rgba(122,216,255,0.35); }
.auto-btn.on .auto-dot { background: var(--teal); box-shadow: 0 0 8px var(--teal); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.icon-btn { width: 44px; font-size: 16px; color: var(--parch); background: rgba(10,8,12,0.8); border: 1px solid rgba(200,154,74,0.4); border-radius: 3px; cursor: pointer; }
#boss-bar { position: absolute; top: 108px; left: 50%; transform: translateX(-50%); width: min(620px, 80vw); text-align: center; }
.boss-name { font-family: var(--display); font-size: 24px; color: #ffd8c8; text-shadow: 0 0 12px rgba(255,60,60,0.6), 0 2px 4px #000; margin-bottom: 4px; }
.boss-track { position: relative; height: 14px; border: 1px solid rgba(255,120,100,0.6); background: rgba(20,4,6,0.85); overflow: hidden; }
#boss-fill, #boss-lag { position: absolute; inset: 0; width: 100%; }
#boss-lag { background: #ffe0c0; transition: width 0.5s 0.2s; }
#boss-fill { background: linear-gradient(180deg, #ff5040, #9a1018); transition: width 0.08s; }
#combo { position: absolute; right: 24px; top: 210px; text-align: right; font-family: var(--display); color: var(--parch); text-shadow: 0 2px 8px #000; transform-origin: right center; }
#combo b { font-weight: 400; font-size: 44px; color: var(--brass2); display: block; line-height: 1; }
#combo span { font-size: 15px; letter-spacing: 0.3em; color: var(--dim); }
#streak { position: absolute; right: 24px; top: 280px; font-family: var(--display); font-size: 30px; color: #ffe6a0; text-shadow: 0 0 18px rgba(255,180,60,0.8), 0 2px 4px #000; opacity: 0; transform-origin: right center; }
#streak.show { animation: streak 1.8s ease-out forwards; }
@keyframes streak { 0% { opacity: 0; transform: scale(2) rotate(-4deg); } 12% { opacity: 1; transform: scale(1) rotate(-2deg); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(0.95) translateY(-10px); } }
#prompt { position: absolute; left: 50%; bottom: 25%; transform: translateX(-50%); font-family: var(--display); font-size: 20px; color: var(--parch); background: rgba(10,8,12,0.8); padding: 6px 16px; border: 1px solid rgba(200,154,74,0.5); border-radius: 3px; }
#prompt.poor { color: #ff9a8a; }
#banner { position: absolute; left: 0; right: 0; top: 22%; text-align: center; opacity: 0; pointer-events: none; }
#banner.show { animation: banner 2.6s ease-out forwards; }
#banner .b-title { font-family: var(--display); font-size: clamp(34px, 5vw, 60px); color: var(--parch); text-shadow: 0 0 30px rgba(240,180,80,0.5), 0 3px 6px #000; }
#banner .b-sub { font-style: italic; color: var(--brass); font-size: 20px; text-shadow: 0 2px 4px #000; }
#banner.boss .b-title { color: #ffcfc0; text-shadow: 0 0 40px rgba(255,40,40,0.8), 0 3px 6px #000; font-size: clamp(40px, 6vw, 76px); }
@keyframes banner { 0% { opacity: 0; transform: scale(1.3); letter-spacing: 0.3em; } 12% { opacity: 1; transform: scale(1); letter-spacing: 0.04em; } 80% { opacity: 1; } 100% { opacity: 0; } }
#hint { position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); font-style: italic; font-size: 20px; color: #ffe0a0; text-shadow: 0 2px 4px #000; opacity: 0; transition: opacity 0.3s; }
#hint.show { opacity: 1; }
#lock-hint { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); color: var(--dim); font-size: 15px; font-style: italic; text-shadow: 0 1px 3px #000; white-space: nowrap; }

#stick { position: fixed; z-index: 6; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 2px solid rgba(200,154,74,0.4); background: rgba(0,0,0,0.2); pointer-events: none; }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%; background: rgba(200,154,74,0.5); transform: translate(-50%,-50%); }

/* ── modals ───────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 16px; background: radial-gradient(ellipse at center, rgba(10,6,12,0.55), rgba(6,4,8,0.88)); animation: fadein 0.2s ease-out; }
@keyframes fadein { from { opacity: 0; } }
.lu-head { text-align: center; }
.lu-title { font-family: var(--display); font-size: clamp(38px, 5vw, 58px); color: var(--brass2); text-shadow: 0 0 30px rgba(240,180,80,0.5), 0 3px 6px #000; animation: pop 0.35s cubic-bezier(.2,1.6,.4,1); }
.lu-sub { font-style: italic; color: var(--dim); font-size: 19px; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
.cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; max-width: 1100px; }
.card { --rc: #c9bfa8; width: 230px; min-height: 300px; padding: 18px 16px; border: 2px solid var(--rc); border-radius: 4px; cursor: pointer; position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(30,24,28,0.97), rgba(12,10,12,0.98)); box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 10px 40px rgba(0,0,0,0.6), inset 0 0 40px color-mix(in srgb, var(--rc) 15%, transparent);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; animation: cardin 0.4s cubic-bezier(.2,1.3,.4,1) backwards; transition: transform 0.12s, box-shadow 0.12s; }
.card:nth-child(2) { animation-delay: 0.06s; } .card:nth-child(3) { animation-delay: 0.12s; } .card:nth-child(4) { animation-delay: 0.18s; }
@keyframes cardin { from { transform: translateY(40px) rotateX(40deg); opacity: 0; } }
.card:hover, .card.focus { transform: translateY(-6px) scale(1.03); box-shadow: 0 0 0 1px var(--rc), 0 0 34px color-mix(in srgb, var(--rc) 55%, transparent), inset 0 0 50px color-mix(in srgb, var(--rc) 22%, transparent); }
.card .c-key { position: absolute; top: 6px; left: 9px; font-family: var(--display); color: var(--dim); font-size: 15px; }
.card .c-rar { font-family: var(--display); color: var(--rc); letter-spacing: 0.18em; font-size: 13px; text-transform: uppercase; }
.card .c-icon { font-size: 54px; line-height: 1.2; filter: drop-shadow(0 0 12px color-mix(in srgb, var(--rc) 60%, transparent)); }
.card .c-name { font-family: var(--display); font-size: 22px; color: var(--parch); line-height: 1.05; }
.card .c-tag { font-style: italic; color: var(--brass); font-size: 15px; }
.card .c-desc { font-size: 17px; color: var(--text); line-height: 1.3; margin-top: 4px; }
.card .c-desc b { color: var(--rc); font-weight: 700; }
.card.r3::after, .card.r4::after { content: ''; position: absolute; inset: -50%; background: linear-gradient(115deg, transparent 40%, color-mix(in srgb, var(--rc) 35%, transparent) 50%, transparent 60%); animation: shine 2.2s infinite; pointer-events: none; }
@keyframes shine { from { transform: translateX(-40%); } to { transform: translateX(40%); } }
.lu-foot { display: flex; gap: 12px; }

.reel-wrap { position: relative; width: min(760px, 92vw); height: 120px; overflow: hidden; border: 1px solid rgba(200,154,74,0.5); background: rgba(8,6,10,0.85); mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
.reel { position: absolute; left: 0; top: 10px; display: flex; gap: 10px; will-change: transform; }
.reel .ri { width: 100px; height: 100px; flex: none; border: 2px solid var(--rc, #555); border-radius: 4px; display: grid; place-items: center; font-size: 46px; background: radial-gradient(circle, color-mix(in srgb, var(--rc) 25%, transparent), rgba(0,0,0,0.4)); }
.reel-marker { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--brass2); box-shadow: 0 0 12px var(--brass2); z-index: 2; transform: translateX(-50%); }
.chest-reveal { min-height: 150px; text-align: center; }
.chest-reveal .cr { animation: pop 0.45s cubic-bezier(.2,1.6,.4,1); }
.chest-reveal .cr-icon { font-size: 70px; filter: drop-shadow(0 0 22px var(--rc)); }
.chest-reveal .cr-rar { font-family: var(--display); letter-spacing: 0.2em; color: var(--rc); text-transform: uppercase; }
.chest-reveal .cr-name { font-family: var(--display); font-size: 32px; color: var(--parch); }
.chest-reveal .cr-desc { font-size: 19px; color: var(--text); }
.chest-reveal .cr-count { font-style: italic; color: var(--dim); }

.pause-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 26px; }
@media (max-width: 720px) { .pause-cols { grid-template-columns: 1fr; } }
.build-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid rgba(200,154,74,0.12); font-size: 17px; }
.build-row .bi { font-size: 22px; width: 30px; text-align: center; }
.build-row .bl { margin-left: auto; font-family: var(--display); color: var(--brass2); }
.statlist { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 17px; }
.statlist span:nth-child(2n) { color: var(--brass2); text-align: right; }
.item-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.item-chips span { border: 1px solid var(--rc); padding: 2px 8px; border-radius: 12px; font-size: 15px; }

.go-title { font-size: 48px !important; color: #ffcfc0 !important; text-shadow: 0 0 30px rgba(255,40,40,0.4); }
#gameover { background: radial-gradient(ellipse at center, rgba(30,6,10,0.7), rgba(6,4,8,0.95)); }
#gameover .eyebrow { text-align: center; }
.go-stats { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; font-size: 20px; margin-top: 12px; }
.go-stats span:nth-child(2n) { color: var(--brass2); text-align: right; font-family: var(--display); }
.go-stats .rec { color: #7aff9a; font-size: 14px; margin-left: 6px; font-family: var(--serif); font-style: italic; }
.go-thread { text-align: center; margin-top: 18px; font-family: var(--display); font-size: 28px; color: var(--parch); }
.go-thread b { color: var(--brass2); }

/* ── curtain (act transitions) ────────────────────────────────────────── */
#curtain { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#curtain .c-left, #curtain .c-right { position: absolute; top: 0; bottom: 0; width: 51%; transition: transform 0.9s cubic-bezier(.6,0,.3,1);
  background: repeating-linear-gradient(90deg, #4a0810 0px, #7a1420 22px, #5a0c16 40px, #3a060c 58px); box-shadow: inset 0 -80px 60px rgba(0,0,0,0.6), 0 0 40px rgba(0,0,0,0.8); }
#curtain .c-left { left: 0; transform: translateX(-102%); border-right: 6px solid #c89a4a; }
#curtain .c-right { right: 0; transform: translateX(102%); border-left: 6px solid #c89a4a; }
#curtain.closed .c-left, #curtain.closed .c-right { transform: translateX(0); }
#curtain .c-title { position: absolute; left: 0; right: 0; top: 42%; text-align: center; font-family: var(--display); font-size: clamp(34px, 5vw, 64px); color: var(--brass2); text-shadow: 0 3px 8px #000, 0 0 30px rgba(240,180,80,0.4); opacity: 0; transition: opacity 0.4s; white-space: pre-line; line-height: 1.1; }
#curtain.closed .c-title { opacity: 1; transition-delay: 0.6s; }
#flash { position: fixed; inset: 0; z-index: 35; pointer-events: none; background: #fff6e0; opacity: 0; }

@media (max-height: 520px) {
  .cards { gap: 10px; }
  .card { min-height: 0; padding: 10px 10px 12px; gap: 4px; width: 200px; }
  .card .c-icon { font-size: 34px; }
  .card .c-name { font-size: 18px; }
  .card .c-desc { font-size: 15px; }
  .lu-title { font-size: 34px; }
  .modal { gap: 10px; }
  .reel-wrap { height: 100px; }
  .reel .ri { width: 80px; height: 80px; font-size: 36px; }
}
@media (max-width: 700px) {
  .menu-left { max-width: none; }
  .menu-help { display: none; }
  .hud-timer { top: 90px; }
  #hud-time { font-size: 28px; }
  #minimap { width: 100px; height: 100px; }
  #boss-bar { top: 150px; }
  .card { width: 44vw; min-height: 240px; padding: 12px 8px; }
  .card .c-icon { font-size: 40px; }
  .card .c-name { font-size: 18px; }
  .card .c-desc { font-size: 15px; }
  #lock-hint { display: none; }
}

/* ── duel HUD ─────────────────────────────────────────────────────────── */
.stambar { width: clamp(180px, 22vw, 300px); height: 6px; background: rgba(10,14,8,0.85); border: 1px solid rgba(160,200,120,0.4); }
#stam-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #6a9a3a, #b8e070); transition: width 0.05s; }
#stambar.low #stam-fill { background: #c05a3a; }
.posture-track { position: relative; height: 6px; margin: 4px auto 0; width: 70%; background: rgba(20,14,4,0.85); border: 1px solid rgba(255,210,120,0.5); }
#posture-fill { position: absolute; left: 50%; top: 0; bottom: 0; width: 0; transform: translateX(-50%); background: linear-gradient(90deg, #ffb040, #fff0b0, #ffb040); box-shadow: 0 0 10px rgba(255,200,90,0.8); }
#hud-omens { margin-top: 6px; font-size: 18px; letter-spacing: 4px; pointer-events: auto; }
#hud-omens span { cursor: help; }
#duel-keys { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 15px; color: var(--dim); text-shadow: 0 1px 3px #000; white-space: nowrap; }
#duel-keys .gold { color: #ffe070; font-style: italic; }
#duel-keys .red { color: #ff6a5a; font-style: italic; }
#duel-touch { position: absolute; right: 16px; bottom: 80px; display: grid; grid-template-columns: repeat(3, 64px); gap: 10px; pointer-events: auto; }
#duel-touch button { width: 64px; height: 64px; border-radius: 50%; font-size: 26px; background: rgba(20,14,18,0.75); border: 2px solid rgba(200,154,74,0.6); color: var(--parch); }
.pact { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pact .pl { font-family: var(--display); color: var(--dim); font-size: 15px; margin-right: 4px; letter-spacing: 0.1em; }
.pact button { font-family: var(--display); font-size: 15px; padding: 5px 12px; background: rgba(0,0,0,0.35); color: var(--dim); border: 1px solid rgba(200,154,74,0.3); border-radius: 3px; cursor: pointer; }
.pact button.on { color: var(--parch); border-color: var(--brass2); background: rgba(138,26,36,0.5); box-shadow: 0 0 10px rgba(240,180,80,0.25); }
.pact .pd { width: 100%; font-style: italic; color: var(--dim); font-size: 15px; }

#lockon { position: absolute; left: 0; top: 0; width: 46px; height: 46px; margin: -23px 0 0 -23px; pointer-events: none; }
#lockon i { position: absolute; inset: 0; border: 2px solid #ffe6a0; border-radius: 50%; box-shadow: 0 0 12px rgba(255,220,140,0.7), inset 0 0 8px rgba(255,220,140,0.4); animation: lockspin 3s linear infinite; border-top-color: transparent; border-bottom-color: transparent; }
#lockon.stun i { border-color: #fff; box-shadow: 0 0 20px #ffd070; animation-duration: 0.8s; }
@keyframes lockspin { to { transform: rotate(360deg); } }
.auto-btn.sub { font-size: 14px; padding: 10px 12px; }
#btn-autobuy:not(.on) { opacity: 0.7; }

/* ── the Theatre hub ─────────────────────────────────────────────────── */
#hub { background: radial-gradient(ellipse at center, rgba(22,16,22,0.94), rgba(8,6,10,0.98)); align-items: stretch; padding: 12px; }
.hub-wrap { width: min(1100px, 100%); margin: 0 auto; display: flex; flex-direction: column; min-height: 0; }
.hub-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 4px 4px 10px; }
.hub-title { font-family: var(--display); font-size: 34px; color: var(--brass2); letter-spacing: 0.08em; }
.hub-stats { display: flex; gap: 16px; font-family: var(--display); font-size: 20px; color: var(--parch); margin-left: auto; }
.hub-stats b { color: var(--brass2); font-weight: 400; }
.hub-tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid rgba(200,154,74,0.35); padding-bottom: 8px; }
.hub-tabs button { font-family: var(--display); font-size: 18px; padding: 7px 16px; background: rgba(0,0,0,0.3); color: var(--dim); border: 1px solid rgba(200,154,74,0.25); border-radius: 3px 3px 0 0; cursor: pointer; }
.hub-tabs button:hover { color: var(--parch); }
.hub-tabs button.on { color: var(--parch); background: rgba(138,26,36,0.45); border-color: var(--brass2); }
.hub-body { flex: 1; overflow-y: auto; padding: 14px 4px 24px; min-height: 0; }
.hub-body h3 { font-family: var(--display); font-weight: 400; color: var(--brass); font-size: 22px; margin: 18px 0 8px; }
.hub-body h3 small, .hub-body h4 small { color: var(--dim); font-size: 14px; font-family: var(--serif); font-style: italic; }
.hub-body h4 { font-family: var(--display); font-weight: 400; color: var(--brass); font-size: 16px; margin: 0 0 6px; letter-spacing: 0.06em; }
.loop-tip { color: var(--text); font-size: 17px; line-height: 1.35; margin: 10px 0 14px; padding: 8px 12px; border-left: 2px solid var(--brass); background: rgba(200,154,74,0.07); }
.loop-tip b { color: var(--brass2); }
.dim { color: var(--dim); font-style: italic; }
.setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { font-family: var(--display); font-size: 15px; padding: 5px 11px; background: rgba(0,0,0,0.35); color: var(--dim); border: 1px solid rgba(200,154,74,0.3); border-radius: 3px; cursor: pointer; }
.chips button.on { color: var(--parch); border-color: var(--brass2); background: rgba(138,26,36,0.5); }
.kit { font-size: 16px; color: var(--text); line-height: 1.35; }
.stage-list { display: flex; flex-direction: column; gap: 10px; }
.stage { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid rgba(200,154,74,0.3); border-radius: 3px; background: rgba(0,0,0,0.3); }
.stage.cleared { border-color: rgba(122,255,154,0.4); }
.stage.locked { opacity: 0.45; }
.st-n { font-family: var(--display); font-size: 34px; color: var(--brass); width: 34px; text-align: center; }
.st-main { flex: 1; min-width: 0; }
.st-name { font-family: var(--display); font-size: 22px; color: var(--parch); }
.st-name .tag { font-family: var(--serif); font-style: italic; font-size: 14px; color: #7aff9a; margin-left: 6px; }
.st-blurb { font-style: italic; color: var(--dim); font-size: 16px; }
.st-duel { font-size: 16px; color: var(--text); margin-top: 2px; }
.st-duel .twist { color: #ff9a6a; font-size: 14px; margin-left: 6px; }
.st-meta { font-size: 14px; color: var(--dim); margin-top: 2px; }
.st-meta .ok { color: #7aff9a; } .st-meta .warn { color: #ffb070; }
.st-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.st-actions .btn { padding: 8px 16px; font-size: 17px; }
.lock-note { color: var(--dim); font-style: italic; font-size: 15px; }
.sword-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.sword { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid rgba(200,154,74,0.3); border-radius: 3px; background: rgba(0,0,0,0.3); }
.sword.eq { border-color: var(--brass2); box-shadow: 0 0 14px rgba(240,180,80,0.2); }
.sw-icon { font-size: 30px; } .sw-main { flex: 1; }
.relics { display: flex; gap: 8px; flex-wrap: wrap; }
.relic { --rc: #c9bfa8; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; font-family: var(--serif); font-size: 15px; color: var(--text); background: rgba(0,0,0,0.4); border: 1px solid var(--rc); border-radius: 14px; cursor: pointer; }
.relic span { font-size: 14px; }
.relic.eq { background: color-mix(in srgb, var(--rc) 18%, transparent); }
.relic.empty { border-style: dashed; border-color: rgba(200,154,74,0.25); color: var(--dim); cursor: default; }
.relic:disabled { opacity: 0.4; cursor: default; }
.pips i.lock { background: rgba(120,60,60,0.35); }
.shop-item small { color: var(--brass); font-family: var(--serif); font-size: 14px; }
.records.wide { grid-template-columns: 1fr auto; max-width: 620px; }

/* ── The Quarter ─────────────────────────────────────────────────────── */
.q-wrap { display: flex; gap: 16px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
#q-canvas { height: min(calc(100vh - 150px), 780px); aspect-ratio: 600 / 780; border: 2px solid rgba(200,154,74,0.55); border-radius: 6px; box-shadow: 0 0 40px rgba(0,0,0,0.6); touch-action: none; cursor: crosshair; background: #120c10; }
.q-side { width: min(380px, 100%); display: flex; flex-direction: column; gap: 10px; }
.q-drop { display: flex; gap: 8px; }
.q-drop .btn { flex: 1; } .q-drop .btn small { font-size: 14px; opacity: 0.8; }
.q-drop .btn.on { border-color: var(--teal); color: var(--teal); }
.q-card { padding: 12px 14px; border: 1px solid rgba(200,154,74,0.3); border-radius: 4px; background: rgba(0,0,0,0.35); }
.q-card.run { border-color: #e08aa8; } .q-card.duel { border-color: #e8b050; }
.q-card h4 { margin: 0 0 6px; font-size: 18px; }
.q-card p { margin: 4px 0 10px; font-size: 16px; line-height: 1.3; }
.q-card .btn { width: 100%; }
.q-builds { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.q-build { display: flex; align-items: center; gap: 10px; text-align: left; padding: 7px 10px; background: rgba(0,0,0,0.35); border: 1px solid rgba(200,154,74,0.3); border-left: 3px solid; border-radius: 3px; color: var(--text); cursor: pointer; font-family: var(--serif); }
.q-build.run { border-left-color: #e08aa8; } .q-build.duel { border-left-color: #e8b050; } .q-build.util { border-left-color: #7ac8ff; }
.q-build:hover:not(:disabled) { background: rgba(200,154,74,0.12); }
.q-build:disabled { opacity: 0.45; cursor: default; }
.qb-i { font-size: 24px; } .qb-t { flex: 1; display: flex; flex-direction: column; } .qb-t b { font-family: var(--display); font-weight: 400; font-size: 17px; } .qb-t small { color: var(--dim); font-size: 13px; }
.qb-c { font-size: 14px; color: var(--brass2); white-space: nowrap; }
.meter { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px; align-items: center; font-size: 15px; margin: 4px 0; }
.mbar { height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.mbar i { display: block; height: 100%; background: linear-gradient(90deg, #a05030, #e0a050); }
.mbar i.ok { background: linear-gradient(90deg, #3a9a5a, #7aff9a); }
.mbar.small { height: 5px; margin-top: 4px; } .mbar.small i { background: var(--brass2); }
.btn.wide { width: 100%; }
/* ── The Tour ────────────────────────────────────────────────────────── */
.tour { display: flex; flex-direction: column; gap: 14px; max-width: 900px; margin: 0 auto; }
.night-card { padding: 20px 24px; border: 1px solid var(--brass2); border-radius: 6px; background: linear-gradient(135deg, rgba(90,16,28,0.55), rgba(14,10,14,0.9)); box-shadow: 0 0 30px rgba(240,180,80,0.12); }
.nc-eyebrow { font-family: var(--display); color: var(--brass); letter-spacing: 0.2em; font-size: 14px; text-transform: uppercase; }
.nc-name { font-family: var(--display); font-size: 40px; color: var(--parch); line-height: 1.1; }
.nc-blurb { font-style: italic; color: var(--dim); font-size: 18px; }
.nc-flow { display: flex; gap: 10px; list-style: none; padding: 0; margin: 14px 0; flex-wrap: wrap; counter-reset: f; }
.nc-flow li { flex: 1; min-width: 180px; padding: 8px 12px; background: rgba(0,0,0,0.35); border: 1px solid rgba(200,154,74,0.25); border-radius: 4px; font-size: 16px; }
.nc-flow li b { font-family: var(--display); font-weight: 400; color: var(--brass2); display: block; font-size: 18px; }
.nc-ready { display: flex; gap: 22px; flex-wrap: wrap; font-size: 17px; margin-bottom: 6px; }
.nc-ready .ok { color: #7aff9a; } .nc-ready .warn { color: #ffb070; } .nc-ready .bad { color: #ff6a5a; }
.nc-reward { color: var(--text); font-size: 16px; margin-bottom: 12px; }
.btn.begin { width: 100%; font-size: 26px; padding: 14px; }
.stage-track { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.stile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; background: rgba(0,0,0,0.35); border: 1px solid rgba(200,154,74,0.25); border-radius: 4px; color: var(--text); cursor: pointer; font-family: var(--serif); }
.stile.sel { border-color: var(--brass2); background: rgba(138,26,36,0.45); }
.stile.done { border-color: rgba(122,255,154,0.45); }
.stile:disabled { opacity: 0.35; cursor: default; }
.stile .sn { font-family: var(--display); font-size: 20px; color: var(--brass); } .stile .sname { font-size: 12px; text-align: center; line-height: 1.1; } .stile .sstat { font-size: 16px; }
@media (max-width: 760px) { .stage-track { grid-template-columns: repeat(4, 1fr); } }
.chips button small { color: var(--dim); font-size: 12px; }
.chips button:disabled { opacity: 0.35; cursor: default; }
label.ab { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 15px; color: var(--text); cursor: pointer; }
.prestige { padding: 16px 20px; border: 1px solid #ffe070; border-radius: 6px; background: rgba(255,220,100,0.07); }
.prestige h3 { margin: 0 0 6px; color: #ffe070; }
#hub-stats span { cursor: help; }
/* ── pick feed (auto-buy) ────────────────────────────────────────────── */
#feed { position: absolute; left: 18px; bottom: 150px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.feed-item { --fc: #e8dcc4; display: flex; gap: 8px; align-items: center; padding: 4px 12px 4px 8px; background: rgba(10,8,12,0.78); border-left: 3px solid var(--fc); border-radius: 2px; font-size: 16px; color: var(--parch); animation: feedin 0.25s ease-out; transition: opacity 0.5s, transform 0.5s; }
.feed-item span { font-size: 20px; } .feed-item b { color: var(--fc); font-weight: 600; } .feed-item small { color: var(--dim); margin-left: 4px; }
.feed-item.out { opacity: 0; transform: translateX(-20px); }
@keyframes feedin { from { opacity: 0; transform: translateX(-20px); } }
.go-note { font-size: 17px; font-family: var(--serif); margin-top: 8px; color: var(--text); }
.btn.gold { border-color: #ffc040; color: #ffe6a0; background: linear-gradient(180deg, rgba(120,80,20,0.8), rgba(40,26,8,0.9)); }
