/* =====================================================================
   BOARDROOM GAMBIT — styles (mobile-first)
   ===================================================================== */
:root {
  --bg: #070b14;
  --bg2: #0d1424;
  --panel: rgba(13, 19, 34, 0.86);
  --panel2: rgba(22, 30, 52, 0.92);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef2f8;
  --muted: #9aa7bd;
  --gold: #e2b857;
  --gold2: #f7d98b;
  --good: #3ddc97;
  --bad: #ff5d73;
  --blue: #5ab0ff;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ticker-h: 30px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body { font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif; font-size: 15px; line-height: 1.45; touch-action: manipulation; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; }
input { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

#app { position: fixed; inset: 0; overflow: hidden; }
#app.shake { animation: shake .45s; }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
#backdrop { position: absolute; inset: 0; opacity: .55; filter: saturate(1.1); }
#backdrop svg { width: 100%; height: 100%; display: block; }
#backdrop::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 20%, rgba(7, 11, 20, .1), rgba(7, 11, 20, .85) 75%); }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* ---------- Screens ---------- */
.screen { position: absolute; inset: 0; display: none; z-index: 2; }
.screen.active { display: block; animation: fadeIn .5s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Buttons ---------- */
.btn { display: block; width: 100%; padding: 15px 18px; border-radius: 14px; font-weight: 700; letter-spacing: .02em; background: var(--panel2); border: 1px solid var(--line); transition: transform .15s, background .2s, box-shadow .2s; text-align: center; }
.btn:active { transform: scale(.97); }
.btn-gold { background: linear-gradient(135deg, #f7d98b, #e2b857 45%, #b88a2a); color: #1b1305; border: 0; box-shadow: 0 8px 28px rgba(226, 184, 87, .28), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn-gold:hover { box-shadow: 0 10px 34px rgba(226, 184, 87, .42), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn-ghost { background: rgba(255, 255, 255, .04); }
a.btn { color: var(--text); text-decoration: none; }
.setup-step a, .leaderboard-submit a { color: #8cc4ff; }
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }
.btn-ghost:hover, .btn:hover { background-color: rgba(255, 255, 255, .08); }
.btn-gold:hover { background-color: transparent; }
.btn.big { padding: 18px; font-size: 17px; }
.btn.small { padding: 10px; font-size: 13px; margin-top: 8px; }
.btn.danger { color: #ff9aa8; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); font-size: 18px; display: grid; place-items: center; }

/* ---------- Title ---------- */
.title-wrap { container-type: inline-size; position: relative; height: 100%; max-width: 460px; margin: 0 auto; padding: calc(28px + var(--safe-t)) 22px calc(14px + var(--safe-b)); display: flex; flex-direction: column; justify-content: center; gap: 22px; overflow-y: auto; }
.logo { text-align: center; }
.logo-kicker { font-size: 11px; letter-spacing: .5em; color: var(--gold); font-weight: 700; opacity: 0; animation: up .8s .1s forwards; }
.logo-main { font-family: "Playfair Display", Georgia, serif; font-weight: 900; margin: 10px 0 8px; line-height: .9; display: flex; flex-direction: column; font-size: clamp(32px, 12vw, 56px); font-size: clamp(32px, 13.5cqi, 64px); letter-spacing: .01em; white-space: nowrap; }
.logo-main span { opacity: 0; animation: up .9s .25s forwards; text-shadow: 0 6px 30px rgba(0, 0, 0, .6); }
.logo-main .gold { animation-delay: .45s; background: linear-gradient(100deg, #b88a2a 0%, #f7d98b 30%, #fff6d8 45%, #e2b857 60%, #b88a2a 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: up .9s .45s forwards, shine 5s 1.5s linear infinite; }
@keyframes shine { to { background-position: -250% 0; } }
@keyframes up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.logo-tag { color: var(--muted); font-size: 14px; opacity: 0; animation: up .8s .7s forwards; }
.title-buttons { display: flex; flex-direction: column; gap: 10px; opacity: 0; animation: up .8s .9s forwards; }
.title-stats { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); text-align: center; }
.title-stats b { color: var(--gold2); }
.title-foot { text-align: center; font-size: 11px; color: #6c7891; }
.title-foot a { color: #93a3c2; }

/* ---------- Ads ---------- */
.ad-slot { min-height: 0; width: 100%; margin: 6px 0; text-align: center; overflow: hidden; }
.ad-slot:empty { display: none; }
.ad-placeholder { border: 1px dashed rgba(255, 255, 255, .18); border-radius: 10px; padding: 18px 10px; font-size: 11px; color: #6c7891; letter-spacing: .05em; background: rgba(255, 255, 255, .02); }

/* ---------- Setup ---------- */
.setup-wrap { height: 100%; max-width: 560px; margin: 0 auto; padding: calc(14px + var(--safe-t)) 18px calc(18px + var(--safe-b)); display: flex; flex-direction: column; }
.setup-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.setup-head > span { width: 40px; }
.steps { display: flex; gap: 6px; }
.steps i { width: 26px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .15); transition: background .3s; }
.steps i.on { background: var(--gold); }
.setup-step { display: none; flex-direction: column; gap: 14px; overflow-y: auto; padding-bottom: 20px; flex: 1; }
.setup-step.active { display: flex; animation: up .45s ease; }
.setup-step h2 { font-family: "Playfair Display", Georgia, serif; font-size: 28px; margin: 8px 0 0; line-height: 1.15; }
.input { width: 100%; padding: 16px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 17px; outline: none; transition: border .2s; }
.input:focus { border-color: var(--gold); }
.input.err { animation: shake .4s; border-color: var(--bad); }
.lbl { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: -6px; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.cards.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { display: flex; gap: 14px; text-align: left; padding: 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); transition: transform .15s, border-color .2s, background .2s; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.card:hover { border-color: rgba(226, 184, 87, .5); background: var(--panel2); }
.card:active { transform: scale(.98); }
.card b { display: block; font-size: 16px; margin-bottom: 3px; }
.card small { color: var(--muted); font-size: 13px; line-height: 1.35; display: block; }
.card-icon { font-size: 30px; line-height: 1; flex: none; }
.card.mini { flex-direction: column; gap: 6px; padding: 14px; }
.card.mini small { font-size: 12px; }
.card-stats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.card-stats span { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 3px 7px; border-radius: 20px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg button { padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; }
.seg button small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.seg button.on { border-color: var(--gold); background: rgba(226, 184, 87, .12); color: var(--gold2); }

/* ---------- Game layout ---------- */
#scr-game.active { display: flex; flex-direction: column; max-width: 860px; margin: 0 auto; box-shadow: 0 0 80px rgba(0, 0, 0, .7); }
#hud { position: relative; z-index: 10; padding: calc(8px + var(--safe-t)) 12px 8px; background: linear-gradient(180deg, rgba(7, 11, 20, .97), rgba(10, 15, 28, .92)); border-bottom: 1px solid var(--line); }
.hud-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hud-co { display: flex; flex-direction: column; min-width: 0; }
.hud-co b { font-family: "Playfair Display", Georgia, serif; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-co span { font-size: 11px; letter-spacing: .14em; color: var(--gold); font-weight: 700; text-transform: uppercase; }
.hud-top .icon-btn { width: 36px; height: 36px; flex: none; }
.own-pill { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: 20px; background: rgba(226, 184, 87, .1); border: 1px solid rgba(226, 184, 87, .35); color: var(--gold2); white-space: nowrap; max-width: 58vw; overflow: hidden; text-overflow: ellipsis; }
.own-pill em { font-style: normal; color: #ff9aa8; margin-left: 4px; }
.own-pill.danger { border-color: var(--bad); background: rgba(255, 93, 115, .12); animation: blinkbar 1.6s infinite; }
/* Ownership bar */
.capbar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: rgba(255, 255, 255, .06); }
.capbar i { display: block; height: 100%; transition: width .8s ease; }
.caplegend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: #d6deec; margin-top: 8px; }
.caplegend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--c); margin-right: 5px; vertical-align: 0; }
.caplegend b { margin-left: 3px; }
.capbox { background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.capbox > small { display: block; font-size: 10px; letter-spacing: .12em; color: var(--muted); font-weight: 700; margin-bottom: 8px; text-transform: uppercase; }
.capnote { font-size: 12px; color: var(--muted); margin-top: 8px; }
.capnote.warn { color: #ff9aa8; }
.dchip.own { background: rgba(192, 132, 252, .12); } .dchip.own b { color: #d8b4fe; }
.dchip.own.bad { background: rgba(255, 93, 115, .14); } .dchip.own.bad b { color: var(--bad); }
.pending { font-size: 12.5px; color: #ffcf7a; background: rgba(255, 196, 92, .07); border-radius: 10px; padding: 8px 10px; }
.hud-fin { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 8px 0; }
.fin { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; position: relative; }
.fin small { display: block; font-size: 9px; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.fin b { font-size: 15px; font-variant-numeric: tabular-nums; }
.fin em { position: absolute; right: 7px; top: 5px; font-style: normal; font-size: 10px; font-weight: 700; }
.fin.neg b { color: var(--bad); }
em.up, .up { color: var(--good); }
em.down, .down { color: var(--bad); }
.fin.pulse-up { animation: pulseUp .9s; }
.fin.pulse-down { animation: pulseDown .9s; }
@keyframes pulseUp { 30% { background: rgba(61, 220, 151, .25); border-color: var(--good); } }
@keyframes pulseDown { 30% { background: rgba(255, 93, 115, .25); border-color: var(--bad); } }
.hud-meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.meter { position: relative; display: flex; align-items: center; gap: 5px; }
.meter svg { width: 16px; height: 16px; fill: var(--c); flex: none; }
.meter-body { flex: 1; min-width: 0; }
.meter-lbl { display: flex; justify-content: space-between; font-size: 9px; letter-spacing: .08em; font-weight: 700; color: var(--muted); }
.meter-lbl b { color: var(--text); font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 2px; }
.bar i { display: block; height: 100%; width: 50%; background: var(--c); border-radius: 6px; transition: width .9s cubic-bezier(.2, .9, .3, 1.2); box-shadow: 0 0 10px var(--c); }
.meter.danger .bar i { background: var(--bad); box-shadow: 0 0 10px var(--bad); animation: blinkbar 1s infinite; }
.meter.danger svg { fill: var(--bad); }
@keyframes blinkbar { 50% { opacity: .45; } }
.meter.flash-up { animation: mUp 1s; }
.meter.flash-down { animation: mDown 1s; }
@keyframes mUp { 30% { transform: scale(1.08); filter: brightness(1.5); } }
@keyframes mDown { 20% { transform: translateX(-3px); } 40% { transform: translateX(3px); filter: brightness(1.4) hue-rotate(-40deg); } 60% { transform: translateX(-2px); } }
.float { position: absolute; right: 0; top: -4px; font-size: 12px; font-weight: 800; opacity: 0; pointer-events: none; }
.float.show { animation: floatUp 1.5s ease forwards; }
.float.up { color: var(--good); } .float.down { color: var(--bad); }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(8px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-18px); } }

/* ---------- Stage ---------- */
#stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #05070d; }
#scene { position: absolute; inset: 0; }
.scene-layer { position: absolute; inset: 0; opacity: 0; transform: scale(1.06); transition: opacity .7s ease, transform 6s ease-out; }
.scene-layer.in { opacity: 1; transform: scale(1); }
.scene-svg { width: 100%; height: 100%; display: block; }
#scene-title { position: absolute; left: 0; right: 0; top: 14px; text-align: center; font-family: "Playfair Display", Georgia, serif; font-weight: 700; font-size: clamp(17px, 4.6vw, 24px); padding: 0 50px; text-shadow: 0 2px 14px rgba(0, 0, 0, .9); opacity: 0; z-index: 3; pointer-events: none; }
#scene-title.show { animation: titleIn 4s ease forwards; }
@keyframes titleIn { 0% { opacity: 0; letter-spacing: .2em; } 15% { opacity: 1; letter-spacing: .01em; } 80% { opacity: 1; } 100% { opacity: .0; } }

/* SVG scene animations */
.tw { animation: twinkle 3.5s infinite ease-in-out; }
.tw2 { animation: winflick 7s infinite steps(1); }
.blink { animation: twinkle 1.6s infinite; }
.drift { animation: drift 40s linear infinite alternate; }
.flicker { animation: flick 4s infinite; }
.belt { animation: belt 1s linear infinite; }
.boxes { animation: boxes 9s linear infinite; }
.arm { transform-origin: 21px 84px; animation: arm 3s ease-in-out infinite alternate; }
.flash { opacity: 0; animation: flash 4s infinite; }
.dash { stroke-dasharray: 200; stroke-dashoffset: 200; animation: dash 3s ease forwards infinite alternate; }
.bubble { animation: bubble 2.5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: bottom; }
.speak { animation: twinkle 1.2s infinite; }
.crowd { animation: crowd 1.4s ease-in-out infinite alternate; }
@keyframes twinkle { 0%, 100% { opacity: .9; } 50% { opacity: .25; } }
@keyframes winflick { 0% { opacity: .9; } 50% { opacity: .1; } }
@keyframes drift { to { transform: translateX(60px); } }
@keyframes flick { 0%, 100% { opacity: .18; } 47% { opacity: .2; } 48% { opacity: .05; } 50% { opacity: .22; } }
@keyframes belt { to { stroke-dashoffset: -14; } }
@keyframes boxes { from { transform: translateX(-90px); } to { transform: translateX(0); } }
@keyframes arm { to { transform: rotate(-24deg); } }
@keyframes flash { 0%, 92%, 100% { opacity: 0; } 94% { opacity: .9; } }
@keyframes dash { to { stroke-dashoffset: 0; } }
@keyframes bubble { to { transform: scaleY(.75); } }
@keyframes crowd { to { transform: translateY(-3px); } }

/* ---------- Actors ---------- */
#actors { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.actor { position: absolute; bottom: 0; height: 78%; aspect-ratio: 200 / 240; max-width: 52%; transition: transform .55s cubic-bezier(.2, .9, .3, 1.1), opacity .45s, filter .4s, left .5s, right .5s; opacity: 0; filter: brightness(.55) saturate(.8); }
.actor.slot-0 { left: 4%; transform: translateX(-40px); }
.actor.slot-1 { right: 4%; transform: translateX(40px); }
#actors.solo .actor.slot-0 { left: 50%; transform: translateX(-50%); }
#actors.solo .actor.slot-1 { right: 50%; transform: translateX(50%); }
.actor.in { opacity: 1; }
.actor.slot-0.in { transform: none; }
.actor.slot-1.in { transform: none; }
#actors.solo .actor.slot-0.in { transform: translateX(-50%); }
#actors.solo .actor.slot-1.in { transform: translateX(50%); }
.actor.speaking { filter: none; z-index: 2; }
.actor.leave { opacity: 0 !important; }
.actor-inner { width: 100%; height: 100%; animation: breathe 4.5s ease-in-out infinite; transform-origin: bottom center; }
.actor-shadow { position: absolute; left: 10%; right: 10%; bottom: -6px; height: 18px; background: radial-gradient(ellipse, rgba(0, 0, 0, .6), transparent 70%); }
.avatar-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .55)); }
@keyframes breathe { 50% { transform: scale(1.012) translateY(-2px); } }
.av-eyes { animation: blinkEyes 5s infinite; transform-origin: 100px 98px; transform-box: view-box; }
@keyframes blinkEyes { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }
.actor.talking .av-mouth { animation: talk .22s infinite alternate; transform-origin: 100px 130px; transform-box: view-box; }
@keyframes talk { from { transform: scaleY(1); } to { transform: scaleY(1.9) translateY(-1px); } }
.actor.speaking .av-head { animation: nod 3s ease-in-out infinite; transform-origin: 100px 150px; transform-box: view-box; }
@keyframes nod { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-1.5deg); } 70% { transform: rotate(1.2deg); } }

/* ---------- Dialog ---------- */
#dialog { position: absolute; left: 10px; right: 10px; bottom: calc(var(--ticker-h) + 10px + var(--safe-b)); z-index: 12; background: linear-gradient(180deg, rgba(14, 20, 36, .92), rgba(9, 13, 24, .97)); border: 1px solid rgba(226, 184, 87, .28); border-radius: 18px; padding: 22px 18px 18px; min-height: 120px; box-shadow: 0 -10px 40px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .05); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); cursor: pointer; }
#scr-game.active #dialog { max-width: 840px; margin: 0 auto; }
.nameplate { position: absolute; top: -15px; left: 16px; background: linear-gradient(135deg, #f7d98b, #e2b857 50%, #b88a2a); color: #1b1305; border-radius: 10px; padding: 4px 12px 5px; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nameplate b { font-size: 14px; }
.nameplate span { font-size: 11px; font-weight: 600; opacity: .75; margin-left: 6px; }
.dtext { font-size: 16.5px; line-height: 1.5; min-height: 50px; }
#dialog.narration .dtext { font-style: italic; color: #cfd8ea; font-family: "Playfair Display", Georgia, serif; font-size: 17.5px; }
.dnext { position: absolute; right: 16px; bottom: 8px; color: var(--gold); font-size: 13px; opacity: 0; }
.dnext.show { opacity: 1; animation: bob 1s infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }

/* ---------- Choices ---------- */
#choices { position: absolute; left: 0; right: 0; bottom: calc(var(--ticker-h) + var(--safe-b)); z-index: 14; max-height: 74%; overflow-y: auto; padding: 14px 10px 12px; background: linear-gradient(180deg, rgba(7, 11, 20, 0), rgba(7, 11, 20, .94) 42px, rgba(7, 11, 20, .98)); animation: up .35s ease; }
#scr-game.active #choices { max-width: 860px; margin: 0 auto; }
.choices-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 6px 10px; }
.choices-head > span { font-family: "Playfair Display", Georgia, serif; font-size: 19px; font-weight: 700; }
.hint-btn { font-size: 12px; font-weight: 700; padding: 7px 11px; border-radius: 30px; background: rgba(226, 184, 87, .12); border: 1px solid rgba(226, 184, 87, .4); color: var(--gold2); }
.hint-btn b { background: var(--gold); color: #1b1305; border-radius: 10px; padding: 0 6px; margin-left: 3px; }
.hint-btn b.ad { background: #fff; }
.hint-btn:disabled { opacity: .7; }
.choice-list { display: flex; flex-direction: column; gap: 9px; }
.choice { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; text-align: left; padding: 14px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); opacity: 0; animation: choiceIn .4s var(--d) ease forwards; transition: transform .15s, border-color .2s, background .2s, opacity .3s; }
.choice:hover { border-color: rgba(226, 184, 87, .55); background: rgba(30, 40, 66, .95); }
.choice:active { transform: scale(.98); }
.choice.picked { border-color: var(--gold); background: rgba(226, 184, 87, .18); transform: scale(1.02); }
.choice.dim { opacity: .25 !important; }
@keyframes choiceIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.choice-n { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(226, 184, 87, .14); color: var(--gold2); font-weight: 800; font-size: 13px; }
.choice-t { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; }
.gamble { font-style: normal; font-size: 9px; font-weight: 800; letter-spacing: .1em; padding: 2px 6px; border-radius: 6px; background: rgba(192, 132, 252, .18); color: #d8b4fe; vertical-align: 2px; margin-left: 4px; }
.choice-hint { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 5px; padding-left: 40px; animation: up .3s; }
.pchip { font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: rgba(255, 255, 255, .06); }
.pchip.up { color: var(--good); background: rgba(61, 220, 151, .1); }
.pchip.down { color: var(--bad); background: rgba(255, 93, 115, .1); }
.pchip.risk { color: #d8b4fe; background: rgba(192, 132, 252, .12); }
.pchip.warn { color: #ffcf7a; background: rgba(255, 196, 92, .12); }
.pchip.danger { color: #ff9aa8; background: rgba(255, 93, 115, .16); }
.pchip.neutral { color: var(--muted); }

/* ---------- Ticker ---------- */
#ticker { position: relative; z-index: 15; height: calc(var(--ticker-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; align-items: center; background: #0a0f1c; border-top: 1px solid rgba(226, 184, 87, .25); overflow: hidden; }
.ticker-label { flex: none; height: 100%; display: grid; place-items: center; padding: 0 10px; background: var(--gold); color: #1b1305; font-family: "Playfair Display", Georgia, serif; font-weight: 900; font-size: 11px; letter-spacing: .08em; }
.ticker-track { flex: 1; overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
#ticker-text { display: inline-block; padding-left: 100%; font-size: 12px; color: #cfd8ea; animation: ticker 40s linear infinite; }
@keyframes ticker { to { transform: translateX(-100%); } }

/* ---------- Quarter intro ---------- */
#qintro { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: radial-gradient(ellipse at center, rgba(20, 28, 50, .97), rgba(4, 6, 12, .99)); opacity: 0; transition: opacity .4s; padding: 20px; }
#qintro.show { opacity: 1; }
.qi-year { font-size: 12px; letter-spacing: .5em; color: var(--gold); font-weight: 700; }
.qi-q { font-family: "Playfair Display", Georgia, serif; font-weight: 900; font-size: clamp(96px, 30vw, 170px); line-height: 1.15; padding: 0 .08em .12em;background: linear-gradient(180deg, #fff6d8, #e2b857 60%, #8a6520); -webkit-background-clip: text; background-clip: text; color: transparent; }
#qintro.show .qi-q { animation: qzoom 2.2s ease; }
#qintro.show .qi-year { animation: up .6s; }
#qintro.show .qi-macro { animation: up .6s .5s both; }
.qi-macro { max-width: 420px; color: #cfd8ea; font-size: 14px; }
@keyframes qzoom { 0% { transform: scale(1.6); opacity: 0; letter-spacing: .3em; filter: blur(8px); } 30% { transform: scale(1); opacity: 1; letter-spacing: 0; filter: none; } 100% { transform: scale(.96); } }

/* ---------- Modal ---------- */
#modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(3, 5, 10, 0); transition: background .25s; padding: 0; }
#modal.open { background: rgba(3, 5, 10, .62); }
.modal-card { width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: linear-gradient(180deg, #121a2e, #0b1120); border: 1px solid rgba(226, 184, 87, .25); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 22px 18px calc(18px + var(--safe-b)); transform: translateY(100%); transition: transform .35s cubic-bezier(.2, .9, .3, 1.05); box-shadow: 0 -20px 60px rgba(0, 0, 0, .6); display: flex; flex-direction: column; gap: 12px; }
#modal.open .modal-card { transform: none; }
@media (min-width: 700px) { #modal { align-items: center; } .modal-card { border-radius: 22px; border-bottom: 1px solid rgba(226, 184, 87, .25); } }
.modal-card.result.good { border-top: 3px solid var(--good); }
.modal-card.result.bad { border-top: 3px solid var(--bad); }
.badge { align-self: flex-start; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 5px 10px; border-radius: 20px; background: rgba(255, 255, 255, .07); color: var(--muted); }
.badge.good, .badge.win { color: var(--good); background: rgba(61, 220, 151, .12); }
.badge.bad, .badge.lose { color: var(--bad); background: rgba(255, 93, 115, .12); }
.res-title { font-family: "Playfair Display", Georgia, serif; font-size: 24px; margin: 0; line-height: 1.2; }
.res-text { margin: 0; color: #d6deec; font-size: 15.5px; }
.res-note { font-size: 13px; color: #ffcf7a; background: rgba(255, 196, 92, .08); border-radius: 10px; padding: 8px 10px; }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; }
.dchip { font-size: 12px; padding: 6px 9px; border-radius: 9px; background: rgba(255, 255, 255, .06); color: var(--muted); animation: pop .4s both; }
.dchip:nth-child(2) { animation-delay: .06s; } .dchip:nth-child(3) { animation-delay: .12s; } .dchip:nth-child(4) { animation-delay: .18s; } .dchip:nth-child(5) { animation-delay: .24s; } .dchip:nth-child(6) { animation-delay: .3s; } .dchip:nth-child(n+7) { animation-delay: .36s; }
.dchip b { color: var(--text); margin-left: 3px; }
.dchip.up { background: rgba(61, 220, 151, .1); } .dchip.up b { color: var(--good); }
.dchip.down { background: rgba(255, 93, 115, .1); } .dchip.down b { color: var(--bad); }
@keyframes pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
.paper { background: #f3ecd9; color: #1d1a14; border-radius: 6px; padding: 10px 14px 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); transform: rotate(-.6deg); animation: paper .6s .2s both; }
@keyframes paper { from { opacity: 0; transform: rotate(-8deg) scale(.6); } to { opacity: 1; transform: rotate(-.6deg); } }
.paper-mast { font-family: "Playfair Display", Georgia, serif; font-weight: 900; font-size: 12px; letter-spacing: .25em; border-bottom: 2px solid #1d1a14; padding-bottom: 4px; margin-bottom: 6px; text-align: center; }
.paper-head { font-family: "Playfair Display", Georgia, serif; font-weight: 800; font-size: 17px; line-height: 1.2; }
.casefile { background: rgba(90, 176, 255, .07); border: 1px solid rgba(90, 176, 255, .22); border-radius: 12px; padding: 10px 12px; }
.casefile summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: #a8d1ff; list-style: none; }
.casefile summary::-webkit-details-marker { display: none; }
.casefile summary::after { content: " ▾"; opacity: .6; }
.casefile[open] summary::after { content: " ▴"; }
.casefile p { margin: 8px 0 4px; font-size: 14px; color: #d6deec; }
.casefile small { color: #6c7891; font-size: 11px; }
.casefile.locked { color: #6c7891; font-size: 13px; background: rgba(255, 255, 255, .03); border-color: var(--line); }
.new { background: var(--gold); color: #1b1305; font-size: 9px; padding: 1px 5px; border-radius: 4px; vertical-align: 1px; }
.case-list { display: flex; flex-direction: column; gap: 6px; }
.progress { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #5ab0ff, #c084fc); }

/* Report */
.rep-kicker { font-size: 11px; letter-spacing: .3em; color: var(--gold); font-weight: 700; }
.rep-title { font-family: "Playfair Display", Georgia, serif; font-size: 26px; margin: -6px 0 0; }
.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; animation: pop .45s both; }
.tile:nth-child(2) { animation-delay: .08s; } .tile:nth-child(3) { animation-delay: .16s; } .tile:nth-child(4) { animation-delay: .24s; }
.tile small { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.tile b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; margin: 2px 0; }
.tile b.neg { color: var(--bad); }
.tile em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); }
.chart-wrap { position: relative; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.chart-wrap canvas { width: 100%; height: 140px; display: block; }
.chart-lbl { position: absolute; left: 12px; top: 8px; font-size: 10px; color: var(--muted); letter-spacing: .06em; }
.analyst { margin: 0; font-style: italic; color: #cfd8ea; font-family: "Playfair Display", Georgia, serif; font-size: 15px; }
.annual { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .05); color: #d6deec; }
.annual.up { border-left: 3px solid var(--good); } .annual.down { border-left: 3px solid var(--bad); }
.annual b { font-size: 11px; letter-spacing: .1em; }

/* Ending */
.end-icon { font-size: 52px; text-align: center; animation: pop .6s both; }
.modal-card.ending .rep-kicker { text-align: center; }
.end-title { font-family: "Playfair Display", Georgia, serif; font-size: 32px; margin: -4px 0 0; text-align: center; background: linear-gradient(180deg, #fff6d8, #e2b857); -webkit-background-clip: text; background-clip: text; color: transparent; }
.modal-card.ending .res-text { text-align: center; }
.grade { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.grade > span { font-family: "Playfair Display", Georgia, serif; font-weight: 900; font-size: 54px; line-height: 1; width: 70px; height: 70px; display: grid; place-items: center; border-radius: 16px; background: rgba(255, 255, 255, .06); animation: pop .6s .3s both; }
.grade-S > span { color: #1b1305; background: linear-gradient(135deg, #fff6d8, #e2b857); box-shadow: 0 0 30px rgba(226, 184, 87, .6); }
.grade-A > span { color: var(--good); } .grade-B > span { color: var(--blue); } .grade-C > span { color: #ffcf7a; } .grade-D > span { color: var(--bad); }
.grade b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.grade small { color: var(--gold2); font-size: 10px; letter-spacing: .12em; font-weight: 700; }
.timeline { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.timeline > b { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tl { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .04); color: #d6deec; }
.tl span { display: block; font-size: 10px; color: var(--gold); letter-spacing: .1em; font-weight: 700; }
.tl i { color: var(--muted); }

/* Menus */
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.team-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.team-av { width: 54px; height: 64px; flex: none; }
.team-info { flex: 1; min-width: 0; }
.team-info b { display: block; }
.team-info small { color: var(--muted); font-size: 12px; }
.bar.loyal { height: 6px; margin-top: 5px; }
.bar.loyal i { box-shadow: none; }
.team-v { font-weight: 800; font-variant-numeric: tabular-nums; width: 28px; text-align: right; }
.award { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .03); opacity: .5; }
.award.on { opacity: 1; background: rgba(226, 184, 87, .08); }
.award span { font-size: 24px; }
.award b { display: block; } .award small { color: var(--muted); font-size: 12px; }
.how p { margin: 0 0 10px; color: #d6deec; font-size: 14.5px; }
.how b { color: var(--gold2); }

/* Toast */
#toast { position: fixed; left: 0; right: 0; top: calc(12px + var(--safe-t)); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: rgba(18, 26, 46, .97); border: 1px solid var(--line); border-radius: 30px; padding: 10px 16px; font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: toastIn .4s cubic-bezier(.2, .9, .3, 1.3); max-width: 92vw; text-align: center; }
.toast.gold { border-color: var(--gold); color: var(--gold2); }
.toast.out { opacity: 0; transform: translateY(-10px); transition: all .5s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(.9); } }

/* ---------- Responsive ---------- */
@media (min-width: 700px) {
  .hud-meters { gap: 14px; }
  .fin b { font-size: 17px; }
  .dtext { font-size: 18px; }
  #dialog { left: 18px; right: 18px; padding: 24px 24px 20px; }
  .actor { height: 84%; }
  .choice-list { display: grid; grid-template-columns: 1fr; }
}
@media (max-height: 640px) {
  .hud-fin { margin: 5px 0; }
  .fin b { font-size: 13px; }
  #dialog { min-height: 96px; padding: 18px 14px 14px; }
  .dtext { font-size: 15px; }
  .actor { height: 72%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
 .leaderboard-submit { margin: 20px 0; padding: 18px; border: 1px solid #314058; border-radius: 12px; }
