:root {
  --bg0: #0b0618;
  --bg1: #1a0d33;
  --ink: #fff7ea;
  --mute: #b9a9d6;
  --gold: #ffcf4a;
  --gold2: #ff9f1c;
  --pink: #ff4f9a;
  --teal: #2fe6c8;
  --red: #ff4b55;
  --green: #3ee08f;
  --glass: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .14);
  --head: 'Bricolage Grotesque', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg0); color: var(--ink); font-family: var(--body); overflow: hidden; }
body { overscroll-behavior: none; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; overflow: hidden; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s; }
#flash.red { background: radial-gradient(ellipse at center, rgba(255, 40, 70, .0) 30%, rgba(255, 40, 70, .55)); opacity: 1; transition: none; }
#flash.gold { background: radial-gradient(ellipse at center, rgba(255, 210, 80, .35), rgba(255, 160, 30, .0) 70%); opacity: 1; transition: none; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
.topbar { position: absolute; top: calc(var(--st) + 12px); left: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bankbox { pointer-events: none; display: flex; flex-direction: column; padding: 8px 14px 8px 12px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); min-width: 104px; }
.bankbox .lbl { font-size: 10px; letter-spacing: .18em; color: var(--mute); text-transform: uppercase; font-weight: 600; }
.bankbox .val { display: flex; align-items: center; gap: 6px; font: 800 20px/1.1 var(--head); font-variant-numeric: tabular-nums; }
.bankbox.bump { animation: bump .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
.chip { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, var(--gold) 0 34%, #b8740c 35% 44%, var(--gold) 45% 100%); box-shadow: 0 0 0 2px rgba(0, 0, 0, .25) inset, 0 0 10px rgba(255, 200, 60, .55); flex: none; }
.chip.big { width: 34px; height: 34px; }

.pips { display: flex; gap: 7px; align-items: center; padding: 10px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.pip { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, .16); transition: all .3s; }
.pip.now { background: var(--ink); box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); animation: pulse 1.2s infinite; }
.pip.bank { background: var(--green); box-shadow: 0 0 10px rgba(62, 224, 143, .7); }
.pip.big { background: var(--gold); box-shadow: 0 0 12px rgba(255, 207, 74, .9); }
.pip.bust { background: var(--red); box-shadow: 0 0 10px rgba(255, 75, 85, .6); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 255, 255, .06); } }
.iconbtn { pointer-events: auto; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.iconbtn svg { width: 20px; height: 20px; fill: var(--ink); }

.potwrap { position: absolute; left: 0; right: 0; top: calc(var(--st) + 78px); text-align: center; }
.potlbl { font-size: 11px; letter-spacing: .32em; color: var(--mute); font-weight: 600; }
.pot { font: 800 clamp(48px, 15vw, 76px)/1 var(--head); font-variant-numeric: tabular-nums; letter-spacing: -.02em; background: linear-gradient(180deg, #fff 10%, #ffe7a8 60%, var(--gold) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 18px rgba(255, 190, 60, .28)); transition: transform .15s; }
.pot.pop { animation: potpop .35s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes potpop { 0% { transform: scale(1); } 35% { transform: scale(1.12); } 100% { transform: scale(1); } }
.heat { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); font-weight: 800; font-size: 15px; }
.heat .flame { filter: grayscale(1) opacity(.5); transition: filter .3s; font-size: 14px; }
.heat.on .flame { filter: none; animation: flick .6s infinite alternate; }
.heat.on { background: linear-gradient(90deg, rgba(255, 120, 40, .28), rgba(255, 60, 120, .28)); border-color: rgba(255, 150, 80, .5); }
.heat .nxt { font-weight: 600; color: var(--mute); font-size: 12px; }
@keyframes flick { to { transform: scale(1.15) rotate(-6deg); } }
.heat.up { animation: heatup .7s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes heatup { 0% { transform: scale(1); } 30% { transform: scale(1.35); } 100% { transform: scale(1); } }
.heatbar { width: 120px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.heatbar i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--pink)); transition: width .3s; }

.bottom { position: absolute; left: 0; right: 0; bottom: calc(var(--sb) + 16px); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.quip { min-height: 22px; font-size: 14px; font-style: italic; color: #e9dcff; opacity: 0; transform: translateY(6px); transition: all .35s; text-align: center; padding: 0 24px; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); }
.quip.show { opacity: 1; transform: none; }
.hint { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); opacity: .8; transition: opacity .4s; }
.hint.gone { opacity: 0; }
.bankbtn { pointer-events: auto; display: flex; align-items: baseline; justify-content: center; gap: 10px; min-width: 230px; padding: 16px 30px; border-radius: 999px; background: linear-gradient(180deg, #ffe07a, var(--gold) 45%, var(--gold2)); color: #2a1600; box-shadow: 0 10px 30px rgba(255, 170, 40, .35), 0 2px 0 rgba(255, 255, 255, .7) inset, 0 -3px 0 rgba(150, 80, 0, .35) inset; transition: transform .12s, filter .3s, opacity .3s; }
.bankbtn .t { font: 800 20px/1 var(--head); letter-spacing: .08em; }
.bankbtn .a { font: 800 20px/1 var(--head); font-variant-numeric: tabular-nums; opacity: .8; }
.bankbtn:active { transform: scale(.95); }
.bankbtn:disabled { filter: grayscale(.9) brightness(.6); opacity: .55; }
.bankbtn.hot { animation: hot 1s infinite; }
@keyframes hot { 50% { box-shadow: 0 10px 40px rgba(255, 90, 60, .6), 0 2px 0 rgba(255, 255, 255, .7) inset, 0 -3px 0 rgba(150, 80, 0, .35) inset; } }
.perkbar { display: flex; gap: 6px; min-height: 26px; flex-wrap: wrap; justify-content: center; padding: 0 16px; }
.perkbar span { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); color: #e8dcff; }
.perkbar span.armed { border-color: var(--pink); background: rgba(255, 79, 154, .18); }

/* ---------- toasts ---------- */
#toasts { position: absolute; left: 0; right: 0; top: 40%; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.toast { font: 800 34px/1 var(--head); letter-spacing: .02em; text-shadow: 0 4px 24px rgba(0, 0, 0, .5); animation: toast 1.1s cubic-bezier(.2, 1.4, .4, 1) forwards; white-space: nowrap; }
.toast.sm { font-size: 20px; }
.toast.xl { font-size: 52px; }
.toast.perfect { color: #fff; text-shadow: 0 0 24px rgba(255, 255, 255, .6); }
.toast.gold { background: linear-gradient(180deg, #fff6c8, var(--gold) 50%, var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(255, 190, 40, .7)); }
.toast.heat { color: #ffb36b; text-shadow: 0 0 22px rgba(255, 90, 40, .8); }
.toast.bust { color: var(--red); text-shadow: 0 0 30px rgba(255, 40, 60, .8); }
.toast.bank { color: var(--green); text-shadow: 0 0 26px rgba(62, 224, 143, .7); }
.toast.near { color: #ffd2e6; }
.toast.save { color: var(--teal); }
@keyframes toast { 0% { opacity: 0; transform: translateY(16px) scale(.6); } 18% { opacity: 1; transform: translateY(0) scale(1.08); } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px) scale(.96); } }

/* ---------- screens ---------- */
.screen, .modal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: calc(var(--st) + 20px) 18px calc(var(--sb) + 20px); }
.modal { background: rgba(8, 4, 20, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 20; }
#draft, #over { background: rgba(8, 4, 20, .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 10; }
.screen .sheet, .modal .sheet { width: 100%; max-width: 420px; max-height: 100%; overflow: auto; padding: 24px 20px 20px; border-radius: 28px; background: linear-gradient(180deg, rgba(48, 26, 86, .92), rgba(22, 12, 44, .94)); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .15) inset; animation: sheet .45s cubic-bezier(.2, 1.3, .4, 1); text-align: center; }
@keyframes sheet { from { opacity: 0; transform: translateY(30px) scale(.96); } }
h2 { font: 800 28px/1.1 var(--head); margin: 4px 0 8px; }
.sub { color: var(--mute); margin: 0 0 16px; font-size: 14px; }
.big { display: block; width: 100%; padding: 17px 20px; border-radius: 18px; font: 800 20px/1 var(--head); letter-spacing: .02em; margin-top: 12px; transition: transform .12s; }
.big:active { transform: scale(.97); }
.primary { background: linear-gradient(180deg, #ffe07a, var(--gold) 45%, var(--gold2)); color: #2a1600; box-shadow: 0 12px 30px rgba(255, 170, 40, .3), 0 2px 0 rgba(255, 255, 255, .7) inset, 0 -3px 0 rgba(150, 80, 0, .3) inset; }
.daily { background: linear-gradient(135deg, rgba(255, 79, 154, .28), rgba(47, 230, 200, .2)); border: 1px solid rgba(255, 255, 255, .2); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.daily small { font: 600 12px/1 var(--body); color: #ecdfff; opacity: .85; letter-spacing: 0; }
.daily.done { opacity: .8; }
.ghost { padding: 12px 16px; border-radius: 14px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.ghost.wide { width: 100%; margin-top: 10px; }
.row { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* title */
#title { flex-direction: column; background: radial-gradient(ellipse at 50% 120%, rgba(255, 79, 154, .25), transparent 60%); }
.tcard { width: 100%; max-width: 380px; text-align: center; animation: sheet .6s cubic-bezier(.2, 1.3, .4, 1); }
.logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 8px; }
.logo h1 { margin: 0; font: 800 clamp(64px, 21vw, 96px)/.82 var(--head); letter-spacing: -.035em; display: flex; flex-direction: column; }
.logo h1 span:first-child { background: linear-gradient(180deg, #fff, #ffd9ef); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo h1 span:last-child { background: linear-gradient(180deg, #ffe58f, var(--gold) 50%, var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 24px rgba(255, 170, 40, .35)); }
.mark { position: relative; width: 84px; height: 70px; }
.mark i { position: absolute; left: 50%; height: 14px; border-radius: 4px; transform: translateX(-50%) skewX(-12deg); box-shadow: 0 4px 0 rgba(0, 0, 0, .25); animation: mk 2.4s ease-in-out infinite; }
.mark i:nth-child(1) { bottom: 0; width: 76px; background: linear-gradient(90deg, #ff4f9a, #ff7ab5); }
.mark i:nth-child(2) { bottom: 17px; width: 66px; background: linear-gradient(90deg, #a35cff, #c79bff); margin-left: 3px; animation-delay: .1s; }
.mark i:nth-child(3) { bottom: 34px; width: 56px; background: linear-gradient(90deg, #2fe6c8, #8ff5e4); margin-left: -4px; animation-delay: .2s; }
.mark i:nth-child(4) { bottom: 51px; width: 48px; background: linear-gradient(90deg, #ffcf4a, #ffe9a3); margin-left: 2px; animation-delay: .3s; }
@keyframes mk { 50% { transform: translateX(-50%) skewX(-12deg) translateY(-3px); } }
.tag { color: #e5d8ff; font-size: 16px; margin: 6px 0 22px; }
.tag em { color: var(--gold); font-style: normal; font-weight: 600; }
.best { margin-top: 18px; color: var(--mute); font-size: 13px; min-height: 18px; }
.best b { color: var(--ink); }
.foot { position: absolute; bottom: calc(var(--sb) + 12px); font-size: 12px; color: rgba(255, 255, 255, .4); }
.foot a { color: rgba(255, 255, 255, .6); }

/* draft */
.res { display: inline-flex; align-items: center; gap: 8px; font: 800 15px/1 var(--head); padding: 8px 14px; border-radius: 999px; margin-bottom: 10px; letter-spacing: .04em; }
.res.bank { background: rgba(62, 224, 143, .15); color: var(--green); border: 1px solid rgba(62, 224, 143, .35); }
.res.bust { background: rgba(255, 75, 85, .15); color: #ff8a92; border: 1px solid rgba(255, 75, 85, .35); }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { position: relative; display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px; border-radius: 20px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); transition: transform .15s, background .2s; animation: cardin .5s cubic-bezier(.2, 1.4, .4, 1) backwards; }
.card:nth-child(2) { animation-delay: .07s; }
.card:nth-child(3) { animation-delay: .14s; }
@keyframes cardin { from { opacity: 0; transform: translateX(-24px) rotate(-2deg); } }
.card:active { transform: scale(.97); }
.card:hover { background: rgba(255, 255, 255, .1); }
.card .ic { font-size: 30px; width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 16px; background: rgba(255, 255, 255, .08); }
.card .nm { font: 800 17px/1.15 var(--head); }
.card .ds { font-size: 13px; color: #dccff5; margin-top: 3px; line-height: 1.35; }
.card .tr { position: absolute; top: 10px; right: 12px; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; opacity: .7; }
.card.rare { border-color: rgba(47, 230, 200, .4); }
.card.rare .tr { color: var(--teal); }
.card.wild { border-color: rgba(255, 79, 154, .5); background: linear-gradient(135deg, rgba(255, 79, 154, .14), rgba(255, 207, 74, .08)); }
.card.wild .tr { color: var(--pink); }
.card .lv { font-size: 11px; color: var(--gold); font-weight: 700; margin-left: 6px; }

/* over */
.kicker { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--mute); font-weight: 600; }
.total { display: flex; align-items: center; justify-content: center; gap: 12px; font: 800 64px/1.05 var(--head); font-variant-numeric: tabular-nums; margin: 6px 0; background: linear-gradient(180deg, #fff, #ffe7a8 60%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.newbest { display: inline-block; padding: 6px 14px; border-radius: 999px; background: linear-gradient(90deg, var(--pink), var(--gold)); color: #1b0a00; font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; animation: bump .8s cubic-bezier(.2, 1.6, .4, 1) .3s backwards; }
.hands { display: flex; flex-direction: column; gap: 6px; margin: 16px 0 12px; }
.hrow { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .05); font-size: 14px; }
.hrow .l { display: flex; gap: 10px; align-items: center; }
.hrow .dot { width: 10px; height: 10px; border-radius: 50%; }
.hrow.bank .dot { background: var(--green); }
.hrow.big .dot { background: var(--gold); }
.hrow.bust .dot { background: var(--red); }
.hrow .r { font-weight: 800; font-variant-numeric: tabular-nums; }
.hrow.bust .r { color: #ff8a92; }
.hrow .h { color: var(--mute); font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 0; }
.grid div { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .05); text-align: left; }
.grid b { display: block; font: 800 22px/1.1 var(--head); font-variant-numeric: tabular-nums; }
.grid span { font-size: 11px; color: var(--mute); letter-spacing: .08em; text-transform: uppercase; }
.verdict { color: #e7dbff; font-style: italic; margin: 12px 0 0; }

/* how */
.steps { text-align: left; padding-left: 22px; margin: 8px 0 12px; line-height: 1.45; color: #eee4ff; font-size: 15px; }
.steps li { margin-bottom: 8px; }
.legend { display: flex; flex-direction: column; gap: 8px; text-align: left; font-size: 13px; color: #dccff5; background: rgba(255, 255, 255, .05); border-radius: 16px; padding: 12px 14px; }
.legend span { display: flex; align-items: center; gap: 10px; }
.sw { width: 22px; height: 12px; border-radius: 3px; flex: none; transform: skewX(-14deg); }
.sw.gold { background: linear-gradient(90deg, #ffe58f, #ff9f1c); box-shadow: 0 0 10px rgba(255, 190, 40, .6); }
.sw.glass { background: rgba(170, 240, 255, .35); border: 1px solid rgba(255, 255, 255, .8); }
.sw.perf { background: #fff; box-shadow: 0 0 10px #fff; }
.toggles { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; text-align: left; }
.toggles label { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); font-weight: 600; }
.toggles input { width: 20px; height: 20px; accent-color: var(--gold); }

@media (min-height: 760px) { .potwrap { top: calc(var(--st) + 96px); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; } }

/* ---------- coach tips + demo captions ---------- */
.coach { position: absolute; left: 50%; top: calc(var(--st) + 206px); transform: translate(-50%, -8px); width: min(340px, calc(100% - 36px)); padding: 12px 16px; border-radius: 16px; text-align: center; pointer-events: none; z-index: 5;
  background: rgba(22, 10, 44, .82); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
  font-weight: 600; font-size: 15px; line-height: 1.35; color: #fff7ea; opacity: 0; transition: opacity .3s, transform .3s; }
.coach.show { opacity: 1; transform: translate(-50%, 0); }
.coach.go { border-color: rgba(62, 224, 143, .6); box-shadow: 0 0 24px rgba(62, 224, 143, .3); }
.coach.heat { border-color: rgba(255, 150, 80, .6); box-shadow: 0 0 24px rgba(255, 90, 40, .3); }
.coach.bank { border-color: rgba(255, 207, 74, .7); box-shadow: 0 0 24px rgba(255, 190, 40, .35); }
.coach.bust { border-color: rgba(255, 75, 85, .6); box-shadow: 0 0 24px rgba(255, 40, 60, .3); }
.ctag { display: block; margin-bottom: 6px; font-size: 10px; letter-spacing: .18em; color: var(--pink); font-weight: 800; }
@media (min-height: 760px) { .coach { top: calc(var(--st) + 226px); } }
.bankbtn.nudge { animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(255, 170, 40, .35), 0 0 0 0 rgba(255, 207, 74, .6); } 50% { transform: scale(1.06); box-shadow: 0 10px 40px rgba(255, 170, 40, .55), 0 0 0 12px rgba(255, 207, 74, 0); } }

/* ---------- how to play extras ---------- */
.howmore { text-align: left; font-size: 13px; color: #dccff5; margin-top: 10px; line-height: 1.45; }
.howmore p { margin: 8px 2px; }
kbd { display: inline-block; padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); font: 700 12px/1.5 var(--body); }
@media (hover: none) { .howmore .keys { display: none; } }
details.perks { margin-top: 10px; text-align: left; border-radius: 16px; background: rgba(255, 255, 255, .05); padding: 4px 12px; }
details.perks summary { cursor: pointer; padding: 10px 2px; font-weight: 700; color: var(--gold); }
.pl { position: relative; display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.pl .pi { font-size: 22px; width: 34px; text-align: center; flex: none; }
.pl b { display: block; font-size: 14px; } .pl small { display: block; color: #cbbfe6; font-size: 12px; line-height: 1.35; padding-right: 44px; }
.pl em { position: absolute; right: 0; top: 10px; font-style: normal; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; color: var(--mute); }
.pl.rare em { color: var(--teal); } .pl.wild em { color: var(--pink); }
