/* House Always Wins — maximalist Vegas, mobile first. */
:root {
  --bg: #12020a;
  --velvet: #3d0614;
  --velvet-2: #5c0b20;
  --gold: #f7c948;
  --gold-2: #ffe58a;
  --gold-deep: #a8740f;
  --pink: #ff2d95;
  --cyan: #29e7ff;
  --felt: #0e7d45;
  --felt-dark: #04401f;
  --cream: #fff5dc;
  --ink: #1d0b05;
  --red: #e3263c;
  --green: #3ee07a;
  --muted: #d9b9a0;
  --font-logo: 'Monoton', 'Arial Black', sans-serif;
  --font-head: 'Limelight', Georgia, serif;
  --font-body: 'Outfit', system-ui, -apple-system, sans-serif;
  --tabbar-h: 64px;
  --card-w: clamp(46px, 13vw, 72px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  color: var(--cream);
  font-family: var(--font-body);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(255, 45, 149, .28), transparent 55%),
    radial-gradient(ellipse at 50% 115%, rgba(41, 231, 255, .14), transparent 55%),
    repeating-linear-gradient(45deg, rgba(247, 201, 72, .07) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(-45deg, rgba(247, 201, 72, .07) 0 1px, transparent 1px 24px),
    linear-gradient(var(--velvet-2), var(--velvet) 40%, var(--bg));
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .9rem; }
.center { text-align: center; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}

/* ---------- Header / marquee ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  margin: 0 -16px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  background: linear-gradient(#1f040f, var(--bg));
  box-shadow: 0 1px 0 rgba(247, 201, 72, .25), 0 10px 20px rgba(0, 0, 0, .45);
}
.marquee {
  position: relative;
  border-radius: 16px;
  padding: 12px 14px;
  background: radial-gradient(ellipse at center, #4a0a1c, #1c030b);
  box-shadow: 0 0 0 2px var(--gold-deep), 0 0 24px rgba(255, 45, 149, .35), inset 0 0 22px rgba(0, 0, 0, .6);
  text-align: center;
}
.marquee::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 16px;
  padding: 6px;
  background: radial-gradient(circle, #fff6c2 0 2.4px, #c48a1c 2.9px, transparent 3.4px) 0 0 / 14px 14px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: chase .5s steps(2) infinite;
  pointer-events: none;
}
@keyframes chase { to { background-position: 7px 7px; } }
.logo {
  margin: 0;
  font-family: var(--font-logo);
  font-weight: 400;
  font-size: clamp(1.25rem, 6.4vw, 2rem);
  letter-spacing: .04em;
  line-height: 1.15;
  color: #ffd1ea;
  text-shadow: 0 0 4px #fff, 0 0 10px var(--pink), 0 0 22px var(--pink), 0 0 42px rgba(255, 45, 149, .7);
}
.logo .flicker {
  color: #d6fbff;
  text-shadow: 0 0 4px #fff, 0 0 10px var(--cyan), 0 0 22px var(--cyan), 0 0 42px rgba(41, 231, 255, .7);
  animation: flicker 6s infinite;
}
@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: .35; }
}

.hud {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 8px;
  font-weight: 800;
}
.hud-chips {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: linear-gradient(#2a0510, #14020a);
  box-shadow: inset 0 0 0 1.5px var(--gold-deep), 0 0 12px rgba(247, 201, 72, .25);
  font-size: 1.15rem; color: var(--gold-2);
  font-variant-numeric: tabular-nums;
}
.chip-icon {
  width: 26px; height: 26px; border-radius: 50%;
  background:
    radial-gradient(circle, var(--gold) 0 42%, transparent 43%),
    repeating-conic-gradient(#fff 0 20deg, var(--red) 20deg 45deg);
  box-shadow: 0 0 0 2px #7a0d1c;
}
.hud-level { flex: 1; max-width: 160px; font-size: .8rem; color: var(--cyan); letter-spacing: .08em; }
.xpbar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .12); overflow: hidden; margin-top: 3px; }
#hud-xp {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  transform-origin: left; transition: transform .5s ease;
}
.hud-streak { font-size: 1.05rem; color: #ffb347; }
.refill-line { font-size: .75rem; color: var(--muted); text-align: center; margin-top: 4px; min-height: 1em; }

/* ---------- Screens ---------- */
.screen { display: none; padding-top: 6px; }
.screen.active { display: block; animation: screenIn .3s ease; }
@keyframes screenIn { from { transform: translateY(8px); } to { transform: none; } }
.screen-title {
  font-family: var(--font-head); font-weight: 400;
  text-align: center; font-size: 1.9rem; margin: 6px 0 4px;
  color: var(--gold-2);
  text-shadow: 0 2px 0 var(--gold-deep), 0 0 18px rgba(247, 201, 72, .45);
}
h3 { font-family: var(--font-head); font-weight: 400; color: var(--gold); margin: 22px 0 8px; font-size: 1.25rem; }

.panel {
  background: linear-gradient(160deg, rgba(60, 8, 22, .92), rgba(22, 3, 10, .92));
  border-radius: 16px;
  padding: 14px;
  box-shadow: inset 0 0 0 1.5px rgba(247, 201, 72, .45), 0 8px 24px rgba(0, 0, 0, .4);
}

/* ---------- Buttons ---------- */
.btn {
  border: 0; border-radius: 12px;
  padding: 12px 16px;
  font-weight: 800; letter-spacing: .02em;
  transition: transform .12s ease, filter .12s ease;
}
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .35; filter: grayscale(.6); }
.btn.sm { padding: 7px 12px; font-size: .85rem; }
.btn.big { width: 100%; padding: 16px; font-size: 1.2rem; text-transform: uppercase; letter-spacing: .12em; }
.btn.wide { width: 100%; margin-top: 18px; }
.btn-gold {
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 45%, var(--gold-deep));
  box-shadow: 0 4px 0 #6b4a07, 0 0 18px rgba(247, 201, 72, .4), inset 0 1px 0 rgba(255, 255, 255, .7);
}
.btn-ghost {
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1.5px rgba(247, 201, 72, .5);
  color: var(--gold-2);
}
.btn-ghost.danger { margin-top: 26px; width: 100%; color: #ff8a95; box-shadow: inset 0 0 0 1.5px rgba(227, 38, 60, .6); }

/* ---------- Lobby ---------- */
.tagline { text-align: center; color: var(--muted); margin: 10px 0 16px; line-height: 1.45; }
.tiles { display: grid; gap: 14px; margin-bottom: 18px; }
.tile {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto;
  column-gap: 14px; align-items: center; text-align: left;
  border: 0; border-radius: 20px; padding: 18px;
  box-shadow: 0 0 0 2px var(--gold-deep), 0 10px 28px rgba(0, 0, 0, .5), inset 0 0 30px rgba(0, 0, 0, .35);
  transition: transform .15s ease;
}
.tile:active { transform: scale(.98); }
.tile::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .18) 45%, transparent 60%);
  transform: translateX(-100%);
  animation: sheen 5s ease-in-out infinite;
}
@keyframes sheen { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.tile-icon { grid-row: span 2; font-size: 2.6rem; text-align: center; filter: drop-shadow(0 0 10px rgba(255, 255, 255, .4)); }
.tile-name { font-family: var(--font-head); font-size: 1.6rem; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .5); }
.tile-sub { font-size: .85rem; color: rgba(255, 245, 220, .8); }
.tile-bj { background: radial-gradient(circle at 20% 30%, #19a35c, var(--felt-dark) 70%); }
.tile-learn { background: radial-gradient(circle at 20% 30%, #3f2fb0, #160c45 70%); }
.tile-roulette { background: radial-gradient(circle at 20% 30%, #b0182f, #3a0510 70%); }
.tile.soon { opacity: .75; }
.status-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: .92rem; }
.status-row + .status-row { border-top: 1px dashed rgba(247, 201, 72, .2); }
.status-row b { color: var(--gold-2); text-align: right; }

/* ---------- Blackjack ---------- */
.bj-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tier-pills { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.pill {
  flex: none; border: 0; border-radius: 999px; padding: 7px 12px;
  font-size: .82rem; font-weight: 800;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 0 0 1.5px rgba(41, 231, 255, .35);
  color: #bfefff;
}
.pill.on { background: var(--cyan); color: #032a33; box-shadow: 0 0 14px rgba(41, 231, 255, .7); }
.pill.locked { opacity: .5; }

.table {
  position: relative;
  min-height: 290px;
  border-radius: 24px 24px 120px 120px / 24px 24px 60px 60px;
  padding: 12px 12px 18px;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 255, 255, .12), transparent 60%),
    repeating-radial-gradient(circle at 50% 50%, rgba(0, 0, 0, .03) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at 50% 40%, #13a057, var(--felt) 45%, var(--felt-dark));
  box-shadow:
    0 0 0 6px #4a2408,
    0 0 0 9px var(--gold-deep),
    0 0 0 11px #2b1404,
    0 0 40px rgba(255, 45, 149, .25),
    0 18px 40px rgba(0, 0, 0, .6),
    inset 0 0 50px rgba(0, 0, 0, .55);
  display: flex; flex-direction: column; justify-content: space-between;
  margin: 4px 4px 0;
}
.seat-label {
  text-align: center; font-size: .78rem; text-transform: uppercase; letter-spacing: .2em;
  color: rgba(255, 245, 220, .75); margin-bottom: 6px;
}
.total {
  display: inline-block; min-width: 28px; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, .45); color: #fff; letter-spacing: 0; font-weight: 800; font-size: .85rem;
}
.total:empty { display: none; }
.cards { display: flex; justify-content: center; min-height: calc(var(--card-w) * 1.4); }
.card + .card { margin-left: calc(var(--card-w) * -0.42); }

.felt-print { text-align: center; margin: 6px 0; pointer-events: none; }
.felt-print .arc {
  font-family: var(--font-head); font-size: clamp(1rem, 4.6vw, 1.3rem);
  color: rgba(255, 229, 138, .85); letter-spacing: .06em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .4);
}
.felt-print .sub { font-size: .7rem; color: rgba(255, 245, 220, .6); margin-top: 2px; letter-spacing: .04em; }

.hands { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.hands.multi { --card-w: clamp(40px, 10.5vw, 56px); }
.hand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; border-radius: 14px; transition: transform .2s ease; }
.hand.active { box-shadow: 0 0 0 2px var(--cyan), 0 0 18px rgba(41, 231, 255, .6); transform: translateY(-4px); }
.hand.empty .cards { min-height: calc(var(--card-w) * 1.4); }
.hand-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.hand-meta .total { margin: 0; }
.bet-chip {
  display: inline-grid; place-items: center;
  min-width: 34px; height: 34px; padding: 0 4px; border-radius: 50%;
  font-size: .7rem; font-weight: 800; color: #fff;
  background: radial-gradient(circle, #8a1325 0 52%, transparent 53%), repeating-conic-gradient(#fff 0 18deg, #8a1325 18deg 45deg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .5);
}
.tag { font-size: .7rem; font-weight: 800; letter-spacing: .1em; padding: 3px 8px; border-radius: 6px; background: rgba(0, 0, 0, .5); }
.res-win .tag, .res-bj .tag { background: var(--green); color: #032a12; }
.res-lose .tag, .res-bust .tag, .res-surrender .tag { background: var(--red); color: #fff; }
.res-push .tag { background: #ddd; color: #222; }
.res-lose .cards, .res-bust .cards { filter: brightness(.7); }

.shoe-info { position: absolute; right: 14px; top: 12px; font-size: .65rem; color: rgba(255, 245, 220, .5); }

/* Cards */
.card {
  position: relative; flex: none;
  width: var(--card-w); height: calc(var(--card-w) * 1.4);
  border-radius: calc(var(--card-w) * .1);
  background: linear-gradient(160deg, #fffdf6, #f1e6cc);
  color: #161616;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .12);
  font-weight: 800;
}
.card.red { color: #c8102e; }
.card .corner { position: absolute; top: 4px; left: 5px; font-size: calc(var(--card-w) * .24); line-height: .95; text-align: center; }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--card-w) * .55); padding-top: 12%; }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(247, 201, 72, .55) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(-45deg, rgba(247, 201, 72, .55) 0 2px, transparent 2px 9px),
    linear-gradient(#b3122d, #6d0716);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45), inset 0 0 0 3px #fff4d4, inset 0 0 0 5px #6d0716;
}
.deal-in { animation: dealIn .38s cubic-bezier(.2, .8, .3, 1.1) both; }
@keyframes dealIn {
  from { transform: translate(110px, -170px) rotate(-30deg) scale(.6); }
  to { transform: none; }
}
.flip-in { animation: flipIn .35s ease both; }
@keyframes flipIn { from { transform: rotateY(90deg); } to { transform: none; } }

/* Result banner — sits in the felt's middle strip, never over the cards */
.mid { position: relative; min-height: 58px; display: grid; place-items: center; }
.mid:has(.banner:not(.hidden)) .felt-print { visibility: hidden; }
.banner {
  position: absolute; left: 50%; top: 50%; z-index: 3;
  transform: translate(-50%, -50%);
  display: flex; align-items: baseline; gap: 12px; white-space: nowrap;
  padding: 8px 18px; border-radius: 14px; text-align: center;
  background: rgba(15, 2, 7, .85);
  animation: pop .45s cubic-bezier(.2, 1.4, .4, 1) both;
  pointer-events: none;
}
.banner .big { font-family: var(--font-head); font-size: 1.45rem; }
.banner .sub { font-weight: 800; font-size: 1.1rem; }
.banner.win { box-shadow: 0 0 0 2px var(--gold), 0 0 30px rgba(247, 201, 72, .6); }
.banner.win .big { color: var(--gold-2); text-shadow: 0 0 14px rgba(247, 201, 72, .8); }
.banner.win .sub { color: var(--green); }
.banner.lose { box-shadow: 0 0 0 2px var(--red), 0 0 24px rgba(227, 38, 60, .5); }
.banner.lose .big { color: #ff9aa5; }
.banner.lose .sub { color: #ff6b7a; }
.banner.push { box-shadow: 0 0 0 2px #ccc; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.4); } to { transform: translate(-50%, -50%) scale(1); } }

/* Coach */
.coach {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 14px;
  background: rgba(10, 2, 6, .75);
  box-shadow: inset 0 0 0 1.5px rgba(41, 231, 255, .35);
  font-size: .92rem; line-height: 1.45;
}
.coach p { margin: 0; }
.coach p + p { margin-top: 8px; }
.coach .ok { color: #9ff5bf; }
.coach .bad { color: #ffb0b8; }
.coach .hint { color: #bff4ff; }
.coach .info { color: var(--muted); }
.coach b { color: #fff; }

/* Controls */
.controls { margin-top: 12px; }
.bet-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
button:focus:not(:focus-visible) { outline: none; }
.bet-display { flex: 1; font-size: 1.05rem; }
.bet-display strong { font-size: 1.5rem; color: var(--gold-2); margin-left: 6px; font-variant-numeric: tabular-nums; }
.chip-rack { display: flex; justify-content: space-around; gap: 8px; margin-bottom: 12px; }
.chip {
  --c: #c8102e;
  width: 60px; height: 60px; flex: none; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(circle, var(--c) 0 46%, #fff 47% 49%, var(--c) 50% 60%, transparent 61%),
    repeating-conic-gradient(#fff 0 15deg, var(--c) 15deg 45deg);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .55), 0 6px 14px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(0, 0, 0, .25);
  transition: transform .12s ease;
}
.chip span { font-weight: 800; font-size: 1rem; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.chip:active:not(:disabled) { transform: translateY(3px) scale(.95); }
.chip:disabled { opacity: .3; }
.chip.c5 { --c: #c8102e; }
.chip.c25 { --c: #11873f; }
.chip.c100 { --c: #1b1b1b; }
.chip.c500 { --c: #6b2bb8; }

.actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.act { padding: 14px 2px; font-size: .82rem; color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .5); }
.act-H { background: linear-gradient(#2fd27a, #108a47); }
.act-S { background: linear-gradient(#ff5468, #b0142a); }
.act-D { background: linear-gradient(#ffd75e, #c48a10); color: var(--ink); }
.act-P { background: linear-gradient(#5aa8ff, #1d5fc4); }
.act-R { background: linear-gradient(#b9a3d6, #6c4f92); }
.act.rec { animation: recPulse 1.2s ease-in-out infinite; }
@keyframes recPulse {
  0%, 100% { box-shadow: 0 4px 0 rgba(0, 0, 0, .5), 0 0 0 2px #fff, 0 0 10px var(--cyan); }
  50% { box-shadow: 0 4px 0 rgba(0, 0, 0, .5), 0 0 0 3px #fff, 0 0 26px var(--cyan); }
}
.waiting { text-align: center; padding: 18px; color: var(--muted); font-style: italic; }

.broke { text-align: center; padding: 18px; border-radius: 16px; background: rgba(10, 2, 6, .8); box-shadow: inset 0 0 0 1.5px var(--red); }
.broke-title { font-family: var(--font-logo); font-size: 1.6rem; color: #ffc2c9; text-shadow: 0 0 8px var(--red), 0 0 20px var(--red); }
.broke p { color: var(--muted); }
.broke-timer { font-weight: 800; color: var(--gold-2); margin: 10px 0 14px; font-variant-numeric: tabular-nums; }

/* ---------- Learn ---------- */
.drill-felt {
  margin: 14px 0; padding: 14px; border-radius: 18px;
  background: radial-gradient(ellipse at 50% 30%, #13a057, var(--felt) 50%, var(--felt-dark));
  box-shadow: 0 0 0 4px #4a2408, 0 0 0 6px var(--gold-deep), inset 0 0 30px rgba(0, 0, 0, .5);
  display: grid; gap: 12px;
}
.drill-row { display: grid; gap: 6px; justify-items: center; }
.drill-row .lbl { font-size: .78rem; text-transform: uppercase; letter-spacing: .15em; color: rgba(255, 245, 220, .8); }
.act.right { opacity: 1; filter: none; box-shadow: 0 0 0 3px #fff, 0 0 18px var(--green); }
.act.wrong { opacity: 1; filter: none; box-shadow: 0 0 0 3px var(--red); }
.drill-feedback { margin-top: 12px; padding: 14px; border-radius: 14px; background: rgba(10, 2, 6, .8); }
.drill-feedback.ok { box-shadow: inset 0 0 0 1.5px var(--green); }
.drill-feedback.bad { box-shadow: inset 0 0 0 1.5px var(--red); }
.drill-feedback .verdict { font-weight: 800; font-size: 1.1rem; }
.drill-feedback.ok .verdict { color: #9ff5bf; }
.drill-feedback.bad .verdict { color: #ffb0b8; }
.drill-feedback p { margin: 8px 0 12px; line-height: 1.45; }
.paid { color: var(--gold-2); margin-left: 8px; }
.drill-meter { text-align: center; font-size: .8rem; color: var(--muted); margin-top: 12px; }

.chart-wrap { overflow-x: auto; border-radius: 12px; }
.chart { width: 100%; border-collapse: collapse; font-size: .78rem; font-weight: 800; text-align: center; }
.chart th { padding: 4px 2px; color: var(--gold-2); background: rgba(0, 0, 0, .35); }
.chart td { padding: 5px 0; border: 1px solid rgba(0, 0, 0, .35); color: #fff; }
.chart .sec th { text-align: left; padding: 8px 6px 4px; font-family: var(--font-head); font-weight: 400; font-size: .95rem; background: transparent; }
.c-H { background: #108a47; }
.c-S { background: #b0142a; }
.c-D { background: #c48a10; color: var(--ink) !important; }
.c-P { background: #1d5fc4; }
.c-R { background: #6c4f92; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: .75rem; font-weight: 800; }
.legend span { padding: 4px 8px; border-radius: 6px; }

/* ---------- Strategy School: tabs, lessons, drills ---------- */
.learn-tabs { justify-content: center; margin: 4px 0 14px; }
.drill-modes { margin-bottom: 10px; padding-bottom: 2px; }
.mastery { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-bottom: 12px; }
.m-row {
  display: grid; grid-template-columns: 62px 1fr 38px; align-items: center; gap: 6px;
  border: 0; background: none; padding: 2px 0; font-size: .76rem; color: var(--muted); text-align: left;
}
.m-row b { color: var(--gold-2); text-align: right; }
.m-bar { height: 7px; border-radius: 6px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.m-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--gold)); transform-origin: left; transition: transform .4s ease; }

.drill-tag { display: inline-block; font-size: .78rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; margin-bottom: 2px; }
.drill-tag.weak { background: rgba(227, 38, 60, .2); color: #ffb0b8; box-shadow: inset 0 0 0 1px rgba(227, 38, 60, .6); }
.drill-tag.new { background: rgba(41, 231, 255, .14); color: #bff4ff; box-shadow: inset 0 0 0 1px rgba(41, 231, 255, .5); }
.drill-tag.review { background: rgba(247, 201, 72, .12); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(247, 201, 72, .45); }
.empty-weak { padding: 22px; }
.empty-weak h3 { margin-top: 6px; }
.big-emoji { font-size: 2.6rem; }

.lesson-list { display: grid; gap: 8px; }
.lesson-item {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  padding: 12px 14px; border: 0; border-radius: 14px; text-align: left;
  background: linear-gradient(160deg, rgba(60, 8, 22, .92), rgba(22, 3, 10, .92));
  box-shadow: inset 0 0 0 1.5px rgba(247, 201, 72, .35);
  transition: transform .12s ease;
}
.lesson-item:active { transform: scale(.98); }
.li-icon { font-size: 1.5rem; text-align: center; }
.li-title { font-weight: 600; }
.li-state { font-size: .72rem; font-weight: 800; color: var(--cyan); }
.lesson-item.done { box-shadow: inset 0 0 0 1.5px rgba(62, 224, 122, .5); }
.lesson-item.done .li-state { color: var(--green); font-size: 1rem; }
h3 small { font-family: var(--font-body); font-size: .8rem; }

.lesson-head { display: flex; align-items: center; gap: 12px; }
.lesson-head .li-icon { font-size: 2.2rem; }
.lesson-head h2 { margin: 0; font-family: var(--font-head); font-weight: 400; color: var(--gold-2); font-size: 1.45rem; }
.kicker { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--cyan); }
.lesson-dots { display: flex; gap: 6px; margin: 12px 0; }
.lesson-dots i { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); }
.lesson-dots i.past { background: var(--gold-deep); }
.lesson-dots i.now { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.lesson-card {
  padding: 16px; border-radius: 18px; line-height: 1.5;
  background: linear-gradient(160deg, rgba(60, 8, 22, .95), rgba(22, 3, 10, .95));
  box-shadow: inset 0 0 0 1.5px rgba(247, 201, 72, .45), 0 10px 26px rgba(0, 0, 0, .45);
  animation: screenIn .25s ease;
}
.lesson-card h3 { margin: 0 0 8px; }
.lesson-card p { margin: 0 0 10px; }
.lesson-card p:last-child { margin-bottom: 0; }
.lesson-card b { color: #fff; }
.lesson-card.finish { text-align: center; padding: 26px 16px; }
.finish-icon { font-size: 3rem; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.lesson-nav .btn { flex: 1; }
.rule-list { list-style: none; margin: 8px 0 12px; padding: 0; }
.rule-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: .9rem; }
.rule-list li + li { border-top: 1px dashed rgba(247, 201, 72, .22); }
.rule-list span { color: var(--muted); }
.rule-list b { text-align: right; color: var(--gold-2) !important; }
.formula { text-align: center; font-weight: 800; color: var(--gold-2); padding: 10px; border-radius: 10px; background: rgba(0, 0, 0, .3); }
.lbars { display: grid; gap: 5px; margin: 8px 0 10px; }
.lbar { display: grid; grid-template-columns: 22px 1fr 40px; align-items: center; gap: 8px; font-size: .82rem; }
.lbar span { font-weight: 800; text-align: center; }
.lbar div { height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.lbar i { display: block; height: 100%; transform-origin: left; background: #6b7f99; }
.lbar.lb-warm i { background: #f0a23a; }
.lbar.lb-hot i { background: linear-gradient(90deg, #f0a23a, var(--red)); }
.lbar b { text-align: right; color: var(--cream) !important; }

.quiz h3 { font-family: var(--font-body); font-weight: 800; color: #fff; font-size: 1.1rem; line-height: 1.35; }
.quiz-opts { display: grid; gap: 8px; margin-top: 12px; }
.quiz-opt {
  padding: 13px 14px; border: 0; border-radius: 12px; text-align: left; font-weight: 600;
  background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1.5px rgba(41, 231, 255, .35);
  transition: transform .12s ease;
}
.quiz-opt:active:not(:disabled) { transform: scale(.98); }
.quiz-opt.right { background: rgba(62, 224, 122, .2); box-shadow: inset 0 0 0 2px var(--green); color: #c9ffdc; }
.quiz-opt.wrong { background: rgba(227, 38, 60, .2); box-shadow: inset 0 0 0 2px var(--red); color: #ffc2c9; }
.quiz-opt.dim { opacity: .45; }
.quiz .drill-feedback { margin-top: 12px; }
.rl-q { margin-top: 8px; }

.focus-card {
  display: grid; gap: 3px; width: 100%; text-align: left; margin-bottom: 14px;
  padding: 14px 16px; border: 0; border-radius: 18px;
  background: linear-gradient(120deg, rgba(41, 231, 255, .16), rgba(255, 45, 149, .16)), #1d040e;
  box-shadow: inset 0 0 0 1.5px rgba(41, 231, 255, .55), 0 0 22px rgba(41, 231, 255, .18);
}
.fc-kicker { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); font-weight: 800; }
.fc-title { font-family: var(--font-head); font-size: 1.35rem; color: #fff; }
.fc-sub { font-size: .82rem; color: var(--muted); }
.chart td.weak { box-shadow: inset 0 0 0 2px var(--gold-2); }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat {
  padding: 14px 10px; border-radius: 14px; text-align: center;
  background: linear-gradient(160deg, rgba(60, 8, 22, .92), rgba(22, 3, 10, .92));
  box-shadow: inset 0 0 0 1.5px rgba(247, 201, 72, .4);
}
.stat .v { font-size: 1.5rem; font-weight: 800; color: var(--gold-2); }
.stat .k { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.kv > div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: .92rem; }
.kv > div + div { border-top: 1px dashed rgba(247, 201, 72, .2); }
.pos { color: var(--green); }
.neg { color: #ff7a88; }
.spark { width: 100%; height: 110px; display: block; }
.spark-range { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.weak { list-style: none; margin: 0; padding: 0; }
.weak li { display: flex; justify-content: space-between; padding: 7px 0; }
.weak li + li { border-top: 1px dashed rgba(247, 201, 72, .2); }
.weak b { color: #ff9aa5; }

/* ---------- Roulette ---------- */
.rl-top { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-bottom: 10px; }
.rl-top .tier-pills { flex: none; }
.pill small { opacity: .75; font-weight: 600; margin-left: 2px; }

.rl-history {
  display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none;
  padding: 6px 2px 8px; min-height: 40px;
}
.rl-history .lbl { flex: none; font-size: .72rem; color: var(--muted); margin-right: 4px; }
.ball-disc {
  flex: none; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: .72rem; font-weight: 800; color: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35);
}
.ball-disc.red { background: #c8102e; }
.ball-disc.black { background: #1b1b1b; }
.ball-disc.green { background: #0e8a4a; }
.ball-disc.newest { width: 32px; height: 32px; font-size: .85rem; box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(247, 201, 72, .7); }
#rl-coach { margin: 0 0 12px; }

.rl-board {
  display: grid;
  grid-template-columns: 38px 38px repeat(3, 1fr);
  grid-template-rows: repeat(13, 32px) 34px;
  padding: 8px;
  border-radius: 16px;
  background: radial-gradient(ellipse at 50% 30%, #13a057, var(--felt) 50%, var(--felt-dark));
  box-shadow: 0 0 0 5px #4a2408, 0 0 0 7px var(--gold-deep), inset 0 0 30px rgba(0, 0, 0, .45), 0 14px 30px rgba(0, 0, 0, .5);
  margin: 0 4px;
  user-select: none; -webkit-user-select: none;
}
.rl-cell, .rl-out {
  position: relative; margin: 0; padding: 0;
  border: 1px solid rgba(255, 245, 220, .7);
  color: #fff; font-weight: 800; font-size: .95rem;
  display: grid; place-items: center;
  touch-action: manipulation;
}
.rl-cell.red { background: linear-gradient(#d0172f, #9a0c20); }
.rl-cell.black { background: linear-gradient(#262626, #0b0b0b); }
.rl-cell.green { background: linear-gradient(#18a85b, #0a6b37); }
.rl-out { background: rgba(0, 0, 0, .12); font-size: .78rem; letter-spacing: .04em; color: var(--cream); }
.rl-out.vert span { writing-mode: vertical-rl; transform: rotate(180deg); }
.dia { display: block; width: 16px; height: 16px; transform: rotate(45deg); border: 1.5px solid #fff; }
.dia.red { background: #c8102e; }
.dia.black { background: #111; }
.rl-zero { display: flex; }
.rl-zero .rl-cell { flex: 1; border-radius: 40% 40% 0 0 / 60% 60% 0 0; }
.rl-corner { display: grid; place-items: center; align-content: center; color: var(--gold-2); line-height: 1.1; text-align: center; }
.rl-corner b { font-size: .8rem; }
.rl-corner small { font-size: .62rem; color: var(--muted); }
.rl-cell.hit { z-index: 1; animation: hitGlow 1s ease-in-out 3; box-shadow: 0 0 0 3px var(--gold), 0 0 22px var(--gold); }
@keyframes hitGlow { 50% { box-shadow: 0 0 0 4px #fff, 0 0 30px var(--gold-2); } }
.rl-out.won, .rl-cell.won { box-shadow: inset 0 0 0 3px var(--green), 0 0 14px rgba(62, 224, 122, .7); z-index: 1; }

.rl-hot { grid-column: 3 / 6; grid-row: 1 / 14; position: relative; pointer-events: none; z-index: 2; }
.hot {
  position: absolute; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 229, 138, .55) 0 2.5px, transparent 3px);
  pointer-events: auto; touch-action: manipulation;
}
.hot.edge { width: 18px; }
.hot.hot.won { box-shadow: 0 0 0 3px var(--green), 0 0 12px var(--green); }
.token {
  position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%);
  display: grid; place-items: center;
  width: 23px; height: 23px; border-radius: 50%;
  font-size: .58rem; font-weight: 800; color: #fff; letter-spacing: -.02em;
  --c: #c8102e;
  background: radial-gradient(circle, var(--c) 0 54%, transparent 55%), repeating-conic-gradient(#fff 0 18deg, var(--c) 18deg 45deg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .6);
  pointer-events: none;
  animation: tokenIn .2s ease-out;
}
.token[data-tier="g"] { --c: #11873f; }
.token[data-tier="k"] { --c: #1b1b1b; }
.token[data-tier="p"] { --c: #6b2bb8; }
@keyframes tokenIn { from { transform: translate(-50%, -50%) scale(1.6); } }

.rl-bar {
  position: sticky; z-index: 10;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 4px);
  margin: 14px -6px 0; padding: 10px 10px 12px; border-radius: 16px;
  background: linear-gradient(rgba(40, 6, 16, .97), rgba(16, 2, 8, .98));
  box-shadow: 0 0 0 1.5px rgba(247, 201, 72, .55), 0 -8px 24px rgba(0, 0, 0, .55);
}
.rl-betinfo { font-size: .8rem; line-height: 1.35; color: var(--muted); min-height: 2.7em; margin-bottom: 8px; }
.rl-betinfo b { color: #fff; }
.rl-betinfo .bad { color: #ffb0b8; }
.rl-betinfo a { color: var(--cyan); }
.rl-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rl-chips { display: flex; gap: 6px; }
.chip.mini { width: 44px; height: 44px; box-shadow: 0 3px 0 rgba(0, 0, 0, .55), inset 0 0 0 2px rgba(0, 0, 0, .25); }
.chip.mini span { font-size: .8rem; }
.chip.mini.sel { transform: translateY(-4px); box-shadow: 0 0 0 3px #fff, 0 0 16px var(--gold), 0 4px 0 rgba(0, 0, 0, .55); }
.rl-total { flex: 1; text-align: right; display: grid; line-height: 1.2; }
.rl-total b { font-size: 1.3rem; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.rl-total small { font-size: .68rem; color: var(--muted); }
.rl-actions { display: grid; grid-template-columns: 1fr 1fr 1fr 1.6fr; gap: 6px; }
.rl-actions .spin { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .12em; }

.rl-overlay {
  position: fixed; inset: 0; z-index: 55;
  display: grid; place-items: center; align-content: center; gap: 16px; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(60, 6, 22, .97), rgba(5, 0, 3, .99));
}
.rl-wheel-wrap {
  width: min(88vw, 380px); aspect-ratio: 1; border-radius: 50%;
  box-shadow: 0 0 0 4px var(--gold-deep), 0 0 50px rgba(255, 45, 149, .45), 0 0 120px rgba(247, 201, 72, .2);
}
.rl-wheel-svg { width: 100%; height: 100%; display: block; }
.rl-wheel-svg .rot { transform-box: fill-box; transform-origin: center; }
.rl-result { text-align: center; min-height: 170px; display: grid; justify-items: center; align-content: start; gap: 6px; }
.rl-nomore { font-family: var(--font-head); font-size: 1.5rem; color: var(--gold-2); text-shadow: 0 0 14px rgba(247, 201, 72, .7); margin-top: 20px; }
.rl-num {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  font-size: 2rem; font-weight: 800; color: #fff;
  box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(247, 201, 72, .7);
  animation: pop2 .4s cubic-bezier(.2, 1.4, .4, 1) both;
}
.rl-num.red { background: #c8102e; }
.rl-num.black { background: #151515; }
.rl-num.green { background: #0e8a4a; }
.rl-desc { color: var(--muted); font-size: .9rem; }
.rl-net { font-family: var(--font-head); font-size: 1.8rem; color: var(--cream); }
.rl-net.pos { color: var(--green); text-shadow: 0 0 14px rgba(62, 224, 122, .6); }
.rl-net.neg { color: #ff7a88; }

.lab-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 12px; }
.lab-form label { display: grid; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.lab-form .full { grid-column: 1 / -1; }
.lab-form select {
  font: inherit; font-size: .95rem; color: var(--cream); background: #2a0510;
  border: 1.5px solid var(--gold-deep); border-radius: 10px; padding: 9px 10px;
}
.lab-desc { margin: 0; font-size: .9rem; line-height: 1.45; color: var(--cream); }
.lab-form p.muted { margin: 0; font-size: .78rem; }
.lab-chart { width: 100%; height: 170px; display: block; }
.lab-chart polyline { fill: none; stroke-width: 1.2; vector-effect: non-scaling-stroke; opacity: .45; }
.lab-chart polyline.up { stroke: var(--green); }
.lab-chart polyline.down { stroke: #ff5468; }
.lab-chart polyline.lead { stroke-width: 2.6; opacity: 1; stroke: var(--gold-2); }
.lab-chart .start { stroke: rgba(255, 245, 220, .6); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.lab-axis { display: flex; justify-content: space-between; gap: 6px; font-size: .68rem; color: var(--muted); margin-top: 4px; }
.lab-verdict { margin-top: 14px; }
.stat .v.neg { color: #ff7a88; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(18, 2, 10, .85), #12020a);
  box-shadow: 0 -1px 0 rgba(247, 201, 72, .4), 0 -10px 30px rgba(0, 0, 0, .6);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.tabbar button {
  flex: 1; max-width: 110px; border: 0; background: none;
  display: grid; justify-items: center; gap: 2px; padding: 4px 0;
  font-size: .68rem; font-weight: 600; color: rgba(255, 245, 220, .6);
  border-radius: 12px;
}
.tabbar button span { font-size: 1.35rem; transition: transform .2s ease; }
.tabbar button.on { color: var(--gold-2); }
.tabbar button.on span { transform: translateY(-2px) scale(1.12); filter: drop-shadow(0 0 8px rgba(247, 201, 72, .8)); }

/* ---------- Toasts & modal ---------- */
#toast-stack {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px); z-index: 60;
  transform: translateX(-50%);
  display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none;
}
.toast {
  padding: 11px 14px; border-radius: 12px; font-weight: 600; font-size: .9rem;
  background: rgba(20, 3, 10, .95); box-shadow: 0 0 0 1.5px rgba(41, 231, 255, .5), 0 10px 24px rgba(0, 0, 0, .5);
  animation: toastIn .3s ease both; transition: transform .35s ease, opacity .35s ease;
}
.toast.gold { box-shadow: 0 0 0 1.5px var(--gold), 0 0 20px rgba(247, 201, 72, .5); color: var(--gold-2); }
.toast.out { transform: translateY(-20px); opacity: 0; }
@keyframes toastIn { from { transform: translateY(-20px); } to { transform: none; } }

.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 16px;
  background: rgba(5, 0, 3, .75);
}
.modal-card {
  width: min(100%, 420px); max-height: 90dvh; overflow-y: auto;
  padding: 20px; border-radius: 20px;
  background: linear-gradient(160deg, #4a0a1c, #1a030b);
  box-shadow: 0 0 0 2px var(--gold), 0 0 40px rgba(255, 45, 149, .35), 0 20px 50px rgba(0, 0, 0, .7);
  animation: pop2 .35s cubic-bezier(.2, 1.3, .4, 1) both;
}
@keyframes pop2 { from { transform: scale(.85); } to { transform: none; } }
.modal-card h2 { font-family: var(--font-head); font-weight: 400; color: var(--gold-2); margin: 0 0 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.rules-form { display: grid; gap: 10px; }
.rules-form label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; }
.rules-form label.check { justify-content: flex-start; }
.rules-form select {
  font: inherit; color: var(--cream); background: #2a0510;
  border: 1.5px solid var(--gold-deep); border-radius: 10px; padding: 8px 10px;
}
.rules-form input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--gold); }
.edge-readout { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .35); }
.edge-readout b { color: var(--gold-2); }
.note { font-size: .82rem; color: var(--muted); line-height: 1.45; }

.daily { text-align: center; }
.daily-kicker { font-family: var(--font-head); color: var(--cyan); font-size: 1.2rem; text-shadow: 0 0 10px rgba(41, 231, 255, .6); }
.daily-amount {
  font-family: var(--font-logo); font-size: 3.4rem; margin: 8px 0;
  color: var(--gold-2); text-shadow: 0 0 6px #fff, 0 0 18px var(--gold), 0 0 40px var(--gold-deep);
}
.daily p { color: var(--muted); line-height: 1.45; }

/* Wider screens: a little more room for the table */
@media (min-width: 700px) {
  :root { --card-w: 78px; }
  .table { min-height: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
