/* TikTato — game UI. Mobile first. Palette: night navy, gold, Haiti red, blue, teal. No purple. */
:root {
  --bg: #070d1c;
  --bg2: #0d1730;
  --card: rgba(255, 255, 255, .06);
  --card2: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .12);
  --text: #f4f7ff;
  --muted: #9fb0cc;
  --gold: #F5C518;
  --gold2: #ffa800;
  --red: #D21034;
  --red2: #ff3b57;
  --blue: #1E6BFF;
  --teal: #14B8A6;
  --cyan: #22d3ee;
  --green: #22c55e;
  --x: #ff4d5e;
  --o: #22d3ee;
  --r: 18px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .45);
  --display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font: 700 16px/1.45 var(--font);
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(30, 107, 255, .32), transparent 60%),
    radial-gradient(700px 500px at 100% 105%, rgba(210, 16, 52, .22), transparent 60%),
    radial-gradient(600px 400px at -10% 100%, rgba(20, 184, 166, .2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--gold); }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
svg { display: block; }

/* ---------- shared bits ---------- */
.logo { width: 34px; height: 34px; flex: none; }
.logo-lg { width: 76px; height: 76px; filter: drop-shadow(0 10px 24px rgba(245, 197, 24, .35)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border: 0; border-radius: 16px;
  font: 400 19px/1 var(--display); letter-spacing: .4px; text-transform: uppercase;
  transition: transform .12s ease, filter .2s ease, opacity .2s;
}
.btn:active { transform: translateY(2px) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-cta {
  color: #fff;
  background: linear-gradient(180deg, #ff4a64 0%, var(--red) 55%, #a50b28 100%);
  box-shadow: 0 6px 0 #7a0a1f, 0 14px 30px rgba(210, 16, 52, .45), inset 0 2px 0 rgba(255, 255, 255, .35);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.btn-cta:active { box-shadow: 0 3px 0 #7a0a1f, 0 8px 18px rgba(210, 16, 52, .4), inset 0 2px 0 rgba(255, 255, 255, .35); }
.btn-ghost { background: var(--card); border: 1.5px solid var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--card2); }
.btn-gold {
  color: #2a1d00;
  background: linear-gradient(180deg, #ffe066, var(--gold) 55%, #d49b00);
  box-shadow: 0 5px 0 #8a6400, 0 12px 26px rgba(245, 197, 24, .35), inset 0 2px 0 rgba(255, 255, 255, .6);
}

.coin {
  display: inline-block; width: 22px; height: 22px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c2 0 12%, #ffd84a 30%, #f0a800 72%, #b97800 100%);
  box-shadow: inset 0 0 0 2px rgba(150, 95, 0, .55), 0 2px 6px rgba(245, 197, 24, .45);
  position: relative;
}
.coin::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  border: 2px solid rgba(150, 95, 0, .45);
}
.coin.sm { width: 16px; height: 16px; }
.coin.sm::after { inset: 3.5px; border-width: 1.5px; }
.coin.lg { width: 36px; height: 36px; }
.coin.lg::after { inset: 8px; border-width: 3px; }

.avatar {
  --s: 44px;
  width: var(--s); height: var(--s); flex: none;
  display: grid; place-items: center; border-radius: 50%;
  font-size: calc(var(--s) * .55); line-height: 1;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), 0 0 0 3px rgba(255, 255, 255, .14);
  position: relative;
}
.avatar.sm { --s: 36px; }
.avatar.md { --s: 64px; }
.avatar.lg { --s: 60px; }
.avatar.xl { --s: 104px; }
.av-c0 { background: linear-gradient(160deg, #ffe066, #e0a800); }
.av-c1 { background: linear-gradient(160deg, #ff5a73, #b00c2c); }
.av-c2 { background: linear-gradient(160deg, #5d97ff, #0f4fd6); }
.av-c3 { background: linear-gradient(160deg, #3fe0cc, #0d8f80); }
.av-c4 { background: linear-gradient(160deg, #5fe38a, #179a46); }
.av-c5 { background: linear-gradient(160deg, #ffa25a, #e05e00); }

.field { display: block; margin: 0 0 14px; }
.field-label { display: block; margin: 0 0 7px; font-size: 13px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.field-label small { text-transform: none; letter-spacing: 0; font-weight: 700; opacity: .8; }
.field-box {
  display: flex; align-items: center; gap: 10px;
  min-height: 54px; padding: 0 14px; border-radius: 14px;
  background: rgba(3, 8, 20, .55); border: 1.5px solid var(--line);
  transition: border-color .2s, box-shadow .2s;
}
.field-box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(245, 197, 24, .16); }
.field-box svg { width: 20px; height: 20px; fill: var(--muted); flex: none; }
.field-box input {
  flex: 1; min-width: 0; height: 50px; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 17px; font-weight: 700;
}
.peek { border: 0; background: transparent; color: var(--gold); font-size: 13px; font-weight: 800; padding: 6px; }

.flash { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; font-size: 15px; border: 1.5px solid var(--line); background: var(--card); }
.flash-error { border-color: rgba(255, 77, 94, .55); background: rgba(210, 16, 52, .14); }
.flash-success { border-color: rgba(34, 197, 94, .5); background: rgba(34, 197, 94, .12); }
.flash-info { border-color: rgba(34, 211, 238, .45); background: rgba(34, 211, 238, .1); }
.note { color: var(--muted); font-size: 14px; margin: 10px 0; }
.center { text-align: center; }

/* ---------- auth ---------- */
body.auth { overflow-x: hidden; }
.glyphs { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.glyphs .g {
  position: absolute; font: 400 64px/1 var(--display); opacity: .09;
  animation: floaty 14s ease-in-out infinite;
}
.glyphs .g:nth-child(odd) { color: var(--x); }
.glyphs .g:nth-child(even) { color: var(--o); }
.g0 { left: 4%; top: 8%; } .g1 { left: 78%; top: 6%; animation-delay: -2s; }
.g2 { left: 60%; top: 30%; font-size: 90px !important; animation-delay: -4s; }
.g3 { left: 10%; top: 40%; animation-delay: -6s; } .g4 { left: 85%; top: 52%; animation-delay: -1s; }
.g5 { left: 30%; top: 70%; font-size: 100px !important; animation-delay: -3s; }
.g6 { left: 70%; top: 82%; animation-delay: -5s; } .g7 { left: 4%; top: 86%; animation-delay: -7s; }
.g8 { left: 45%; top: 4%; animation-delay: -8s; } .g9 { left: 92%; top: 30%; animation-delay: -9s; }
.g10 { left: 20%; top: 18%; font-size: 40px !important; animation-delay: -10s; }
.g11 { left: 52%; top: 58%; font-size: 40px !important; animation-delay: -11s; }
.g12 { left: 88%; top: 92%; animation-delay: -12s; } .g13 { left: 35%; top: 92%; font-size: 44px !important; animation-delay: -13s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-26px) rotate(8deg); }
}

.auth-wrap {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 16px calc(28px + env(safe-area-inset-bottom));
}
.auth-card {
  width: 100%; max-width: 420px; padding: 26px 20px 22px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(20, 34, 66, .92), rgba(10, 18, 38, .94));
  border: 1.5px solid rgba(245, 197, 24, .28);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .08);
  animation: pop-in .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 18px; }
.auth-brand-sm { flex-direction: row; gap: 12px; justify-content: center; }
.brand-title { margin: 10px 0 0; font: 400 40px/1 var(--display); letter-spacing: .5px; }
.auth-brand-sm .brand-title { margin: 0; font-size: 28px; }
.brand-title span { color: var(--gold); text-shadow: 0 0 24px rgba(245, 197, 24, .45); }
.brand-tag { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.auth-switch { margin: 18px 0 0; text-align: center; color: var(--muted); }
.auth-switch a { font-weight: 900; text-decoration: none; }
.auth-foot { margin: 18px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.auth-form .btn-cta { margin-top: 6px; }

.avatar-pick { border: 0; margin: 0 0 16px; padding: 0; text-align: center; }
.avatar-pick legend { width: 100%; text-align: center; }
.avatar-preview { margin: 4px auto 14px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-opt input, .color-opt input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-opt span {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 14px;
  font-size: 26px; background: var(--card); border: 2px solid transparent; transition: transform .12s, border-color .2s;
}
.avatar-opt input:checked + span { border-color: var(--gold); background: rgba(245, 197, 24, .14); transform: scale(1.06); }
.avatar-opt input:focus-visible + span, .color-opt input:focus-visible + span { outline: 3px solid var(--cyan); outline-offset: 2px; }
.color-grid { display: flex; justify-content: center; gap: 12px; margin-top: 12px; }
.color-opt span { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 2px rgba(255, 255, 255, .15); }
.color-opt input:checked + span { border-color: #fff; transform: scale(1.12); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; font-size: 13.5px; color: var(--muted); }
.check input { width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--gold); }

/* ---------- app shell ---------- */
body.app { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(180deg, rgba(7, 13, 28, .96), rgba(7, 13, 28, .82));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-word { font: 400 24px/1 var(--display); letter-spacing: .4px; }
.brand-word span { color: var(--gold); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.coin-chip {
  display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 6px 0 9px;
  border-radius: 999px; border: 1.5px solid rgba(245, 197, 24, .45);
  background: linear-gradient(180deg, rgba(245, 197, 24, .16), rgba(245, 197, 24, .05));
  font-size: 16px; font-weight: 900;
}
.coin-chip b { min-width: 1ch; font-variant-numeric: tabular-nums; }
.chip-plus {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold); color: #2a1d00; font-weight: 900; font-size: 18px; line-height: 1;
}
.coin-chip.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.14); box-shadow: 0 0 24px rgba(245, 197, 24, .6); } }
.icon-btn {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; border: 1.5px solid var(--line); background: var(--card);
}
.icon-btn svg { width: 21px; height: 21px; fill: var(--gold); }
.icon-btn.ring svg { animation: ring 1s ease; }
@keyframes ring { 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } 50% { transform: none; } }
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 900;
  box-shadow: 0 0 0 2px var(--bg);
}

.flash-host { max-width: 560px; margin: 12px auto 0; padding: 0 16px; }
.app-main { max-width: 560px; margin: 0 auto; padding: 14px 16px 24px; }
.screen { animation: screen-in .28s ease both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } }
.screen-title { margin: 6px 0 6px; font: 400 30px/1.1 var(--display); letter-spacing: .3px; }
.screen-sub { margin: 0 0 18px; color: var(--muted); }
.back { border: 0; background: none; color: var(--gold); font-weight: 900; padding: 6px 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(7, 13, 28, .94); border-top: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tab {
  flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 900; border-radius: 12px;
}
.tab svg { width: 24px; height: 24px; fill: currentColor; }
.tab.on { color: var(--gold); background: rgba(245, 197, 24, .1); }
body.in-game .tabbar { display: none; }

/* ---------- arena ---------- */
.hero-card {
  position: relative; overflow: hidden; padding: 18px; border-radius: 24px;
  background: linear-gradient(150deg, rgba(30, 107, 255, .28), rgba(13, 23, 48, .9) 55%, rgba(210, 16, 52, .2));
  border: 1.5px solid rgba(255, 255, 255, .12);
  box-shadow: var(--shadow);
}
.hero-top { display: flex; align-items: center; gap: 12px; }
.hero-hello { margin: 0; font-size: 18px; }
.hero-hello b { color: var(--gold); }
.hero-stats { display: flex; gap: 12px; margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.hero-stats.center { justify-content: center; }
.hero-stats b { color: var(--text); }
.online-pill {
  margin-left: auto; align-self: flex-start; display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: rgba(34, 197, 94, .14); color: #8ef0b0; font-size: 12px; white-space: nowrap;
}
.online-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.play-btn {
  position: relative; display: block; width: 100%; margin-top: 18px; height: 86px; border: 0; border-radius: 22px;
  font: 400 44px/1 var(--display); letter-spacing: 3px; color: #2a1d00;
  background: linear-gradient(180deg, #fff09a 0%, var(--gold) 45%, #e09a00 100%);
  box-shadow: 0 8px 0 #8a6400, 0 18px 40px rgba(245, 197, 24, .45), inset 0 3px 0 rgba(255, 255, 255, .7);
  overflow: hidden; animation: pulse 2.2s ease-in-out infinite;
}
.play-btn span { position: relative; z-index: 1; text-shadow: 0 2px 0 rgba(255, 255, 255, .5); }
.play-btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .65), transparent);
  transform: skewX(-20deg); animation: shine 2.8s ease-in-out infinite;
}
.play-btn:active { transform: translateY(4px); box-shadow: 0 4px 0 #8a6400, 0 10px 24px rgba(245, 197, 24, .4), inset 0 3px 0 rgba(255, 255, 255, .7); }
@keyframes pulse { 50% { transform: scale(1.02); } }
@keyframes shine { 0% { left: -40%; } 60%, 100% { left: 130%; } }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 10px; }
.section-head h2 { margin: 0; font: 400 22px/1 var(--display); letter-spacing: .3px; }
.live-dot { font-size: 11px; font-weight: 900; letter-spacing: 1px; color: #fff; background: var(--red); padding: 3px 8px; border-radius: 6px; animation: blink 1.4s infinite; }
.mode-pill { font-size: 11px; font-weight: 900; letter-spacing: 1px; color: #2a1d00; background: var(--gold); padding: 3px 8px; border-radius: 6px; }

.challenge-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.challenge {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px;
  background: var(--card); border: 1.5px solid var(--line);
}
.challenge.fresh { animation: fresh 1.2s ease; }
@keyframes fresh { 0% { transform: translateX(-16px); opacity: 0; border-color: var(--gold); } 40% { opacity: 1; } 100% { border-color: var(--line); } }
.ch-info { flex: 1; min-width: 0; }
.ch-name { margin: 0; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-meta { margin: 1px 0 0; color: var(--muted); font-size: 13px; }
.ch-stake { display: flex; align-items: center; gap: 5px; font-weight: 900; color: var(--gold); font-size: 17px; }
.ch-accept { min-height: 42px; padding: 0 14px; font-size: 16px; border-radius: 12px; }
.empty { text-align: center; color: var(--muted); padding: 22px 12px; border: 1.5px dashed var(--line); border-radius: 18px; }
.empty-icon { font-size: 34px; margin: 0; }

/* ---------- bet ---------- */
.bet-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.bet-chip {
  display: flex; align-items: center; justify-content: center; gap: 5px; height: 50px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-weight: 900; font-size: 16px;
}
.bet-chip.on { border-color: var(--gold); background: rgba(245, 197, 24, .16); color: var(--gold); transform: translateY(-2px); }
.bet-chip:disabled { opacity: .35; }
.payout-card {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 18px; padding: 14px;
  border-radius: 18px; background: rgba(3, 8, 20, .5); border: 1.5px solid var(--line);
}
.payout-card div { padding: 8px 10px; border-radius: 12px; background: var(--card); }
.payout-card small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.payout-card b { font-size: 18px; }
.payout-card .win b { color: var(--green); }
.payout-card .lose b { color: var(--x); }

/* ---------- waiting ---------- */
.radar { position: relative; width: 240px; height: 240px; margin: 18px auto 8px; display: grid; place-items: center; }
.radar-ring { position: absolute; border-radius: 50%; border: 2px solid rgba(20, 184, 166, .35); }
.r1 { inset: 0; } .r2 { inset: 40px; } .r3 { inset: 80px; }
.radar-ring { animation: ripple 2.4s ease-out infinite; }
.r2 { animation-delay: .8s; } .r3 { animation-delay: 1.6s; }
@keyframes ripple { 0% { transform: scale(.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.15); opacity: 0; } }
.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(20, 184, 166, .45), transparent 25%);
  animation: spin 2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.radar .avatar { z-index: 1; animation: bob 2.4s ease-in-out infinite; }
.wait-stake { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0; font-size: 20px; }
.wait-stake b { color: var(--gold); font-size: 26px; }
.dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ---------- game ---------- */
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: 4px; }
.pcard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 18px; border: 1.5px solid transparent; transition: background .3s, border-color .3s; }
.pcard.active { background: var(--card); border-color: rgba(245, 197, 24, .4); }
.pname { margin: 0; max-width: 120px; font-weight: 900; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname .you { color: var(--gold); font-size: 11px; display: block; text-align: center; letter-spacing: 1px; }
.pmark { font: 400 22px/1 var(--display); }
.mark-x { color: var(--x); } .mark-o { color: var(--o); }
.avatar.ring { overflow: visible; }
.avatar .av-face { position: relative; z-index: 1; }
.avatar .timer {
  --p: 0;
  position: absolute; inset: -7px; border-radius: 50%; opacity: 0; transition: opacity .3s;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(255, 255, 255, .1) 0);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 59%);
  mask: radial-gradient(circle, transparent 58%, #000 59%);
}
.pcard.active .timer { opacity: 1; }
.pcard.low .timer { background: conic-gradient(var(--red2) calc(var(--p) * 1%), rgba(255, 255, 255, .1) 0); }
.pot { display: flex; flex-direction: column; align-items: center; padding: 8px 12px; border-radius: 16px; background: rgba(245, 197, 24, .1); border: 1.5px solid rgba(245, 197, 24, .35); }
.pot-label { font-size: 11px; letter-spacing: 2px; color: var(--gold); font-weight: 900; }
.pot-val { display: flex; align-items: center; gap: 5px; font: 400 24px/1.1 var(--display); }
.pot-sub { font-size: 11px; color: var(--muted); white-space: nowrap; }
.turn-line { text-align: center; margin: 14px 0 12px; font: 400 22px/1.2 var(--display); letter-spacing: .4px; min-height: 27px; }
.turn-line.mine { color: var(--gold); animation: pulse 1.4s ease-in-out infinite; }

.board {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  width: min(100%, 380px); aspect-ratio: 1; margin: 0 auto; padding: 10px; border-radius: 26px;
  background: linear-gradient(160deg, #16264b, #0b1430);
  border: 2px solid rgba(255, 255, 255, .1);
  box-shadow: var(--shadow), inset 0 2px 0 rgba(255, 255, 255, .06);
}
.cell {
  position: relative; border: 0; border-radius: 18px; padding: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03));
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25);
  transition: background .2s, transform .1s;
}
.board.can-play .cell:empty:hover { background: rgba(245, 197, 24, .12); }
.board.can-play .cell:empty:active { transform: scale(.96); }
.cell svg { position: absolute; inset: 16%; width: 68%; height: 68%; overflow: visible; }
.cell .mx line { stroke: var(--x); stroke-width: 14; stroke-linecap: round; filter: drop-shadow(0 0 8px rgba(255, 77, 94, .6)); }
.cell .mo circle { stroke: var(--o); stroke-width: 13; fill: none; filter: drop-shadow(0 0 8px rgba(34, 211, 238, .6)); }
.cell.new .mx line { stroke-dasharray: 120; stroke-dashoffset: 120; animation: draw .22s ease-out forwards; }
.cell.new .mx line + line { animation-delay: .16s; }
.cell.new .mo circle { stroke-dasharray: 230; stroke-dashoffset: 230; animation: draw .4s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.cell.win { background: rgba(245, 197, 24, .22); animation: winpulse .8s ease-in-out 3; }
@keyframes winpulse { 50% { transform: scale(1.06); } }
.strike { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); pointer-events: none; }
.strike line { stroke: var(--gold); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 500; stroke-dashoffset: 500; filter: drop-shadow(0 0 10px rgba(245, 197, 24, .8)); }
.strike.on line { animation: draw .5s ease-out forwards; }
.game-actions { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.game-actions .btn { flex: 1; max-width: 200px; }

/* ---------- wallet ---------- */
.balance-card {
  text-align: center; padding: 22px 16px; border-radius: 24px;
  background: radial-gradient(400px 200px at 50% 0%, rgba(245, 197, 24, .25), transparent 70%), linear-gradient(180deg, #14254a, #0b1430);
  border: 1.5px solid rgba(245, 197, 24, .35); box-shadow: var(--shadow);
}
.balance-label { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-size: 13px; }
.balance-val { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 2px; font: 400 46px/1 var(--display); color: var(--gold); }
.balance-usd { margin: 0; color: var(--muted); }
.packs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pack {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; text-align: left;
  border-radius: 18px; border: 1.5px solid var(--line); background: var(--card);
}
.pack:hover { border-color: rgba(245, 197, 24, .5); }
.pack.best { border-color: var(--gold); background: rgba(245, 197, 24, .1); }
.pack-price { font: 400 26px/1 var(--display); }
.pack-coins { display: flex; align-items: center; gap: 6px; color: var(--gold); font-weight: 900; }
.pack-fee { color: var(--muted); font-size: 12px; }
.pack-pay {
  margin-top: 6px; width: 100%; padding: 8px 0; border-radius: 10px; text-align: center;
  background: #ffc439; color: #111; font-weight: 900; font-size: 14px;
}
.pack:disabled { opacity: .55; }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.lg-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--card); font-size: 18px; flex: none; }
.lg-main { flex: 1; min-width: 0; }
.lg-main p { margin: 0; }
.lg-main small { color: var(--muted); }
.lg-amt { font-weight: 900; text-align: right; }
.lg-amt.plus { color: var(--green); }
.lg-amt.minus { color: var(--x); }
.lg-amt small { display: block; color: var(--muted); font-weight: 700; font-size: 12px; }

/* ---------- profile ---------- */
.profile-card { display: flex; flex-direction: column; align-items: center; padding: 20px; border-radius: 24px; background: var(--card); border: 1.5px solid var(--line); }
.rules { margin: 18px 0; padding: 16px 18px; border-radius: 20px; background: rgba(3, 8, 20, .5); border: 1.5px solid var(--line); }
.rules h2 { margin: 0 0 8px; font: 400 21px/1.2 var(--display); }
.rules ul { margin: 0; padding-left: 18px; color: #d3dcef; }
.rules li { margin: 6px 0; }
.rules b { color: var(--gold); }

/* ---------- sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(2, 5, 14, .7); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet-body {
  position: relative; width: 100%; max-width: 560px; padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0; background: linear-gradient(180deg, #14254a, #0b1430);
  border: 1.5px solid var(--line); border-bottom: 0; box-shadow: var(--shadow);
  animation: sheet-up .32s cubic-bezier(.2, 1.2, .4, 1);
}
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet-grip { display: block; width: 44px; height: 5px; margin: 0 auto 12px; border-radius: 5px; background: rgba(255, 255, 255, .25); }
.sheet-title { margin: 0 0 14px; font: 400 26px/1.1 var(--display); text-align: center; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
.mode-card {
  display: flex; align-items: center; gap: 14px; width: 100%; margin-bottom: 12px; padding: 16px;
  border-radius: 20px; text-align: left; border: 2px solid var(--line);
  transition: transform .12s, border-color .2s;
}
.mode-card:active { transform: scale(.98); }
.mode-card b { display: block; font: 400 24px/1.1 var(--display); }
.mode-card small { color: var(--muted); font-size: 14px; }
.mode-icon { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 16px; font-size: 32px; flex: none; }
.mode-ai { background: linear-gradient(120deg, rgba(20, 184, 166, .25), rgba(20, 184, 166, .05)); border-color: rgba(20, 184, 166, .5); }
.mode-ai .mode-icon { background: rgba(20, 184, 166, .3); }
.mode-human { background: linear-gradient(120deg, rgba(210, 16, 52, .3), rgba(245, 197, 24, .08)); border-color: rgba(245, 197, 24, .5); }
.mode-human .mode-icon { background: rgba(210, 16, 52, .35); }
.seg { display: flex; gap: 6px; padding: 5px; margin-bottom: 16px; border-radius: 14px; background: rgba(3, 8, 20, .5); }
.seg button { flex: 1; height: 44px; border: 0; border-radius: 10px; background: none; font-weight: 900; color: var(--muted); }
.seg button.on { background: var(--gold); color: #2a1d00; }
.confirm-lines { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.confirm-lines li { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: var(--card); }
.confirm-lines .win { color: var(--green); } .confirm-lines .lose { color: var(--x); }
.confirm-who { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 12px; font-weight: 900; }

/* ---------- toasts ---------- */
.toast-host {
  position: fixed; left: 0; right: 0; top: calc(70px + env(safe-area-inset-top)); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 12px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 440px;
  padding: 10px 12px; border-radius: 16px; background: #13234a; border: 1.5px solid rgba(245, 197, 24, .45);
  box-shadow: var(--shadow); animation: toast-in .35s cubic-bezier(.2, 1.3, .4, 1);
}
.toast.out { animation: toast-out .3s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-20px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-14px); } }
.toast-main { flex: 1; min-width: 0; }
.toast-main p { margin: 0; font-size: 14px; }
.toast-main b { display: block; font-size: 15px; }
.toast .btn { min-height: 38px; padding: 0 12px; font-size: 15px; border-radius: 10px; }
.toast-icon { font-size: 22px; }

/* ---------- money + celebration ---------- */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.fly-coin { position: fixed; left: 0; top: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; }
.money-pop {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%);
  font: 400 44px/1 var(--display); color: var(--gold); white-space: nowrap;
  text-shadow: 0 0 24px rgba(245, 197, 24, .7), 0 4px 0 #8a6400;
  animation: money-pop 1.8s ease forwards;
}
.money-pop small { display: block; text-align: center; font-size: 16px; color: #fff; letter-spacing: 2px; text-shadow: none; }
@keyframes money-pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  70% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(.9); }
}

.win-overlay {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 50% 40%, rgba(20, 34, 66, .9), rgba(2, 5, 14, .96));
  animation: fade .3s ease;
}
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.win-card { position: relative; width: 100%; max-width: 400px; text-align: center; padding: 26px 18px 20px; }
.rays {
  position: absolute; left: 50%; top: 160px; width: 560px; height: 560px; margin: -280px 0 0 -280px; z-index: -1;
  background: repeating-conic-gradient(from 0deg, rgba(245, 197, 24, .2) 0 10deg, transparent 10deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%);
  mask: radial-gradient(circle, #000 20%, transparent 68%);
  animation: spin 18s linear infinite;
}
.win-kicker { margin: 0; font: 400 22px/1 var(--display); letter-spacing: 6px; text-transform: uppercase; color: #fff; animation: drop-in .5s .1s cubic-bezier(.2, 1.4, .4, 1) both; }
.win-title {
  margin: 4px 0 14px; font: 400 64px/1 var(--display); letter-spacing: 2px; text-transform: uppercase;
  background: linear-gradient(180deg, #fff6c2 0%, var(--gold) 45%, #e08a00 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #7a5200) drop-shadow(0 0 26px rgba(245, 197, 24, .55));
  animation: slam .6s .25s cubic-bezier(.2, 1.6, .4, 1) both;
}
.win-overlay.draw .win-title { font-size: 54px; }
@keyframes drop-in { from { opacity: 0; transform: translateY(-30px); } }
@keyframes slam { from { opacity: 0; transform: scale(2.4); } }
.win-avatars { display: flex; justify-content: center; gap: 18px; margin-top: 40px; }
.win-overlay.draw .win-avatars { margin-top: 8px; }
.win-av { position: relative; animation: rise .6s .55s cubic-bezier(.2, 1.4, .4, 1) both; }
.win-av .avatar { --s: 128px; box-shadow: 0 0 0 5px var(--gold), 0 0 0 11px rgba(245, 197, 24, .25), 0 0 60px rgba(245, 197, 24, .55); }
.win-overlay.draw .win-av .avatar { --s: 96px; box-shadow: 0 0 0 4px rgba(255, 255, 255, .5), 0 0 30px rgba(34, 211, 238, .4); }
.crown { position: absolute; left: 50%; top: -40px; transform: translateX(-50%) rotate(-8deg); font-size: 48px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); animation: crown 1.6s 1s ease-in-out infinite; }
@keyframes crown { 50% { transform: translateX(-50%) translateY(-6px) rotate(8deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(40px) scale(.6); } }
.win-name { margin: 16px 0 6px; font: 400 30px/1.1 var(--display); animation: drop-in .5s .8s both; }
.win-amount {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px; border-radius: 999px;
  background: rgba(245, 197, 24, .14); border: 1.5px solid rgba(245, 197, 24, .5);
  font: 400 34px/1 var(--display); color: var(--gold); animation: drop-in .5s 1s both;
}
.win-amount.loss { color: var(--x); background: rgba(210, 16, 52, .14); border-color: rgba(255, 77, 94, .5); }
.win-sub { margin: 12px 0 18px; color: #d3dcef; animation: drop-in .5s 1.1s both; }
.win-actions { display: flex; gap: 10px; animation: drop-in .5s 1.2s both; }
.win-actions .btn { flex: 1; }

@media (min-width: 720px) {
  .app-main { padding-top: 24px; }
  .bet-chips { grid-template-columns: repeat(7, 1fr); }
  .packs { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- sandbox strip ---------- */
.demo-strip {
  padding: 6px 16px; text-align: center; font-size: 12px; font-weight: 800; letter-spacing: .3px;
  color: #2a1d00; background: linear-gradient(90deg, #ffd84a, var(--gold));
}

/* ---------- limit card ---------- */
.limit-card { margin: 16px 0 4px; padding: 14px; border-radius: 18px; background: rgba(3, 8, 20, .5); border: 1.5px solid var(--line); }
.limit-card:empty { display: none; }
.limit-card p { margin: 4px 0 8px; color: var(--muted); font-size: 14px; }
.limit-card small { display: block; margin-bottom: 8px; color: var(--gold); }
.limit-card .btn { min-height: 42px; font-size: 15px; }
.limit-bar { height: 8px; margin-bottom: 10px; border-radius: 8px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.limit-bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--teal), var(--gold)); }

/* ---------- Tato, the AI wallet agent ---------- */
.tato-face {
  position: relative; display: inline-block; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c2 0 10%, #ffd84a 32%, #f0a800 75%, #b97800 100%);
  box-shadow: inset 0 0 0 2px rgba(150, 95, 0, .5);
}
.tato-face i { position: absolute; top: 38%; width: 5px; height: 8px; border-radius: 3px; background: #2a1d00; animation: tato-blink 4s infinite; }
.tato-face i:first-child { left: 32%; } .tato-face i:last-child { right: 32%; }
.tato-face::after { content: ""; position: absolute; left: 34%; right: 34%; bottom: 24%; height: 5px; border: 2.5px solid #2a1d00; border-top: 0; border-radius: 0 0 8px 8px; }
.tato-face.lg { width: 44px; height: 44px; }
@keyframes tato-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.tato-fab {
  position: fixed; right: 14px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 7px; border-radius: 999px;
  border: 1.5px solid rgba(245, 197, 24, .55); background: rgba(13, 23, 48, .95); font-weight: 900;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5), 0 0 22px rgba(245, 197, 24, .25);
  animation: pop-in .5s .4s cubic-bezier(.2, 1.4, .4, 1) both;
}
.tato-fab:active { transform: scale(.96); }
body.in-game .tato-fab { display: none; }
.tato-body { display: flex; flex-direction: column; max-height: 88vh; max-height: 88dvh; padding-top: 14px; }
.tato-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.tato-head h2 { margin: 0; font: 400 24px/1 var(--display); }
.tato-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.tato-head .icon-btn:first-of-type { margin-left: auto; }
.icon-btn.sm { width: 34px; height: 34px; font-size: 15px; color: var(--muted); }
.tato-log { flex: 1; min-height: 160px; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.tato-msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; animation: toast-in .25s ease; }
.tato-msg.bot { align-self: flex-start; background: var(--card2); border-bottom-left-radius: 5px; }
.tato-msg.me { align-self: flex-end; background: linear-gradient(180deg, #1f5ad8, #1747b0); border-bottom-right-radius: 5px; }
.tato-msg.error { background: rgba(210, 16, 52, .18); border: 1px solid rgba(255, 77, 94, .5); }
.dots-anim::after { content: "Tato is thinking"; color: var(--muted); }
.tato-msg.typing .dots-anim::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--gold); animation: blink 1s infinite; }
.tato-card { align-self: stretch; padding: 12px; border-radius: 16px; background: rgba(3, 8, 20, .55); border: 1.5px solid rgba(245, 197, 24, .4); animation: toast-in .3s ease; }
.tato-card > b { display: block; margin-bottom: 8px; }
.tato-card small { display: block; margin-top: 8px; color: var(--muted); }
.tato-card .sheet-actions { margin-top: 10px; }
.tato-card .sheet-actions .btn { min-height: 44px; font-size: 16px; }
.tato-card.done { border-color: var(--line); opacity: .85; }
.tato-pay { display: block; margin-top: 10px; padding: 12px 0; text-decoration: none; font-size: 16px; }
.tato-chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.tato-chips button { flex: none; padding: 8px 12px; border-radius: 999px; border: 1.5px solid rgba(245, 197, 24, .4); background: rgba(245, 197, 24, .08); color: var(--text); font-size: 13px; font-weight: 800; }
.tato-form { display: flex; gap: 8px; }
.tato-form input { flex: 1; min-width: 0; height: 50px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line); background: rgba(3, 8, 20, .55); color: var(--text); outline: 0; font-weight: 700; }
.tato-form input:focus { border-color: var(--gold); }
.tato-form .btn { min-height: 50px; width: 56px; padding: 0; font-size: 20px; }
.tato-note { margin: 8px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
