:root {
  --bg: #0b0d1c;
  --bg-2: #11142a;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-strong: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #eef0ff;
  --muted: #9ba1c9;
  --faint: #6b7199;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --gold: #ffd166;
  --danger: #ff5c7a;
  --ok: #34e3a0;
  --red: #ff4d6d;
  --green: #22e39a;
  --yellow: #ffc93c;
  --blue: #4f8cff;
  --radius: 18px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
  --font: 'Outfit', system-ui, -apple-system, Segoe UI, sans-serif;
  --display: 'Lilita One', 'Outfit', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 800px at 80% -10%, #1d1846 0%, transparent 60%),
    radial-gradient(900px 700px at -10% 110%, #0f2a46 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); }

/* ---------- Ambient background ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(90px); opacity: 0.16; animation: drift 26s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { background: var(--red); top: -18vmax; left: -12vmax; }
.aurora span:nth-child(2) { background: var(--green); top: -16vmax; right: -14vmax; animation-delay: -6s; }
.aurora span:nth-child(3) { background: var(--yellow); bottom: -20vmax; right: -10vmax; animation-delay: -12s; opacity: 0.1; }
.aurora span:nth-child(4) { background: var(--blue); bottom: -18vmax; left: -14vmax; animation-delay: -18s; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.15); } }

/* ---------- Primitives ---------- */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.035));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border-strong); background: var(--panel-strong);
  padding: 10px 18px; border-radius: 12px; font-weight: 600; letter-spacing: 0.01em;
  transition: transform 0.15s ease, background 0.2s, box-shadow 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,0.14); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  border: 0; color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #6366f1 55%, #22d3ee);
  box-shadow: 0 10px 30px -10px rgba(139, 92, 246, 0.8), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-primary:hover { background: linear-gradient(135deg, #9b6dff, #7476ff 55%, #3ee0f5); box-shadow: 0 14px 34px -10px rgba(139, 92, 246, 0.95); }
.btn-gold {
  border: 0; color: #2a1c00;
  background: linear-gradient(135deg, #ffe08a, #ffc93c 50%, #ff9f43);
  box-shadow: 0 10px 30px -12px rgba(255, 201, 60, 0.9), inset 0 1px 0 rgba(255,255,255,0.5);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--panel); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 26px; font-size: 17px; border-radius: 14px; }
.btn-block { width: 100%; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border); font-size: 12px; color: var(--muted); font-weight: 500;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52,227,160,0.6); animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(52,227,160,0.55); } 80%, 100% { box-shadow: 0 0 0 8px rgba(52,227,160,0); } }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.28); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(139,92,246,0.22); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.display { font-family: var(--display); letter-spacing: 0.02em; font-weight: 400; }
.hidden { display: none !important; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 22px; letter-spacing: 0.03em; }
.logo-mark { width: 32px; height: 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 9px; background: #070814; box-shadow: 0 0 0 1px var(--border); }
.logo-mark i { border-radius: 4px; }
.logo-mark i:nth-child(1) { background: var(--red); }
.logo-mark i:nth-child(2) { background: var(--green); }
.logo-mark i:nth-child(3) { background: var(--blue); }
.logo-mark i:nth-child(4) { background: var(--yellow); }
.logo b { background: linear-gradient(90deg, #fff, #c9b8ff); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 400; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 40px; padding: 40px clamp(16px, 5vw, 80px); max-width: 1280px; margin: 0 auto; }
.auth-hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(44px, 6.4vw, 84px); line-height: 0.98; margin: 18px 0 16px; }
.auth-hero h1 .grad { background: linear-gradient(90deg, var(--red), var(--yellow) 35%, var(--green) 65%, var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p { color: var(--muted); font-size: 18px; max-width: 520px; }
.auth-feats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.auth-feats .chip { padding: 8px 14px; font-size: 13px; color: var(--text); }
.auth-preview { margin-top: 30px; width: min(380px, 80vw); aspect-ratio: 1; filter: drop-shadow(0 30px 60px rgba(0,0,0,0.55)); transform: perspective(900px) rotateX(18deg) rotateZ(-8deg); animation: float 7s ease-in-out infinite; }
@keyframes float { 50% { transform: perspective(900px) rotateX(18deg) rotateZ(-8deg) translateY(-12px); } }
.auth-card { padding: 30px; max-width: 420px; width: 100%; justify-self: center; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0,0,0,0.3); border-radius: 12px; padding: 4px; margin-bottom: 22px; }
.tabs button { border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 600; color: var(--muted); transition: all 0.2s; }
.tabs button.active { background: var(--panel-strong); color: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.auth-card form { display: grid; gap: 16px; }
.auth-note { font-size: 12.5px; color: var(--faint); text-align: center; margin-top: 4px; }

/* ---------- Lobby ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px); background: rgba(11,13,28,0.72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar .spacer { flex: 1; }
.wallet-chip { display: flex; align-items: center; gap: 4px; padding: 5px 5px 5px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); }
.wallet-chip .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.wallet-chip .bonus { color: var(--gold); font-size: 12.5px; margin: 0 10px 0 6px; font-weight: 600; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; flex: none; text-transform: uppercase;
}
.lobby { max-width: 1240px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 60px; }
.hero-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.hero-card { position: relative; overflow: hidden; padding: 28px; min-height: 220px; display: flex; flex-direction: column; justify-content: space-between; }
.hero-card h2 { font-family: var(--display); font-weight: 400; font-size: 34px; margin: 6px 0 6px; line-height: 1.05; }
.hero-card p { margin: 0; color: var(--muted); max-width: 440px; }
.hero-practice { background: linear-gradient(120deg, rgba(139,92,246,0.35), rgba(34,211,238,0.18) 60%, rgba(255,255,255,0.03)); }
.hero-practice .art { position: absolute; right: -40px; top: -30px; width: 280px; opacity: 0.9; transform: rotate(14deg); filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5)); pointer-events: none; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; position: relative; }
.hero-fair { background: linear-gradient(160deg, rgba(52,227,160,0.16), rgba(255,255,255,0.03)); }
.hero-fair .shield { font-size: 34px; }
.stats-row { display: flex; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.stat b { display: block; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin: 36px 0 14px; gap: 12px; }
.section-head h3 { margin: 0; font-size: 22px; font-weight: 700; }
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.table-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; transition: transform 0.2s, border-color 0.2s; }
.table-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.table-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--tc, var(--accent)); box-shadow: 0 0 22px var(--tc, var(--accent)); }
.table-card .tname { font-weight: 700; font-size: 16px; }
.table-card .prize { font-family: var(--display); font-size: 38px; line-height: 1; color: var(--gold); text-shadow: 0 0 24px rgba(255,209,102,0.35); }
.table-card .prize small { font-family: var(--font); font-size: 12px; color: var(--muted); display: block; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; font-weight: 600; text-shadow: none; }
.table-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.waiting { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.history { display: grid; gap: 8px; }
.history-row { display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 14px; padding: 12px 16px; }
.place-badge { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--panel-strong); }
.place-1 { background: linear-gradient(135deg, #ffe08a, #ffb627); color: #3a2600; }
.place-2 { background: linear-gradient(135deg, #e9eefc, #a9b4d6); color: #1f2640; }
.place-3 { background: linear-gradient(135deg, #f3b98b, #c9773f); color: #2d1405; }
.pos { color: var(--ok); font-weight: 700; }
.neg { color: var(--muted); }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* ---------- Overlays / modals ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(5,6,16,0.66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 26px; animation: pop 0.32s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { from { transform: scale(0.9) translateY(10px); opacity: 0; } }
.modal h2 { margin: 0 0 4px; font-family: var(--display); font-weight: 400; font-size: 30px; }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 18px; }
.close-x { border: 0; background: var(--panel); width: 34px; height: 34px; border-radius: 10px; font-size: 18px; color: var(--muted); }
.balances { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.balance-card { padding: 16px; border-radius: 14px; background: rgba(0,0,0,0.25); border: 1px solid var(--border); }
.balance-card span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.balance-card b { display: block; font-size: 26px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.balance-card small { color: var(--faint); font-size: 12px; }
.amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 14px; }
.amounts .btn { padding: 12px 6px; }
.amounts .btn.sel { border-color: var(--accent); background: rgba(139,92,246,0.22); }
.demo-banner { font-size: 12.5px; padding: 10px 12px; border-radius: 10px; background: rgba(255,209,102,0.1); border: 1px solid rgba(255,209,102,0.25); color: #ffe3a3; margin-bottom: 14px; }
.ledger { display: grid; gap: 2px; margin-top: 10px; max-height: 240px; overflow: auto; }
.ledger-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 4px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13.5px; }
.ledger-row .k { text-transform: capitalize; }
.seg { display: inline-flex; background: rgba(0,0,0,0.3); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.seg button.active { background: var(--panel-strong); color: var(--text); }

.matchmaking { text-align: center; padding: 34px 28px; width: min(420px, 100%); }
.radar { width: 150px; height: 150px; margin: 6px auto 22px; position: relative; }
.radar::before, .radar::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(139,92,246,0.5); animation: radar 2s ease-out infinite; }
.radar::after { animation-delay: 1s; }
@keyframes radar { from { transform: scale(0.35); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
.radar .orbit { position: absolute; inset: 18px; border-radius: 50%; animation: spin 2.4s linear infinite; }
.radar .orbit i { position: absolute; width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 18px currentColor; }
.radar .orbit i:nth-child(1) { background: var(--red); color: var(--red); top: -9px; left: calc(50% - 9px); }
.radar .orbit i:nth-child(2) { background: var(--green); color: var(--green); right: -9px; top: calc(50% - 9px); }
.radar .orbit i:nth-child(3) { background: var(--yellow); color: var(--yellow); bottom: -9px; left: calc(50% - 9px); }
.radar .orbit i:nth-child(4) { background: var(--blue); color: var(--blue); left: -9px; top: calc(50% - 9px); }
@keyframes spin { to { transform: rotate(360deg); } }
.matchmaking .elapsed { font-variant-numeric: tabular-nums; color: var(--muted); margin: 6px 0 20px; }
.tip { font-size: 12.5px; color: var(--faint); margin-top: 18px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; z-index: 80; left: 50%; top: 18px; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 14px; background: rgba(22,25,50,0.92); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-weight: 500; animation: toast-in 0.35s cubic-bezier(0.2, 1.3, 0.4, 1); backdrop-filter: blur(10px); }
.toast.error { border-color: rgba(255,92,122,0.5); }
.toast.success { border-color: rgba(52,227,160,0.5); }
.toast.out { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in { from { transform: translateY(-14px) scale(0.96); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-10px); opacity: 0; } }

/* ---------- Game ---------- */
.game { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.game-bar { display: flex; align-items: center; gap: 10px; padding: 12px clamp(12px, 3vw, 28px); }
.game-bar .title { flex: 1; text-align: center; min-width: 0; }
.game-bar .title b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-bar .title span { font-size: 12.5px; color: var(--gold); font-weight: 600; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); display: grid; place-items: center; font-size: 17px; flex: none; transition: background 0.2s; }
.icon-btn:hover { background: var(--panel-strong); }
.arena {
  --board: min(calc(100dvh - 250px), calc(100vw - 24px), 760px);
  display: grid; justify-content: center; align-content: center; gap: 10px;
  grid-template-columns: calc(var(--board) / 2) calc(var(--board) / 2);
  grid-template-areas: 'tl tr' 'board board' 'bl br';
  padding: 0 12px; min-height: 0;
}
.seat-tl { grid-area: tl; } .seat-tr { grid-area: tr; justify-self: end; } .seat-bl { grid-area: bl; } .seat-br { grid-area: br; justify-self: end; }
.board-wrap { grid-area: board; width: var(--board); height: var(--board); position: relative; }
@media (min-width: 1000px) and (min-aspect-ratio: 4/3) {
  .arena { --board: min(calc(100dvh - 190px), calc(100vw - 560px), 780px); grid-template-columns: 230px var(--board) 230px; grid-template-rows: 1fr 1fr; grid-template-areas: 'tl board tr' 'bl board br'; gap: 22px; }
  .seat-tl, .seat-tr { align-self: start; } .seat-bl, .seat-br { align-self: end; }
  .seat-tr, .seat-br { justify-self: start; }
  .seat-tl, .seat-bl { justify-self: end; }
}
/* The board must stack above its decorative frame, or the frame swallows token clicks. */
#board { position: relative; z-index: 1; width: 100%; height: 100%; display: block; overflow: visible; }
.board-frame { position: absolute; z-index: 0; pointer-events: none; inset: -10px; border-radius: 28px; background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.02)); border: 1px solid var(--border); box-shadow: 0 40px 90px -30px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.12); }

.seat { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 16px; min-width: 0; max-width: 100%; transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s, opacity 0.3s; }
.seat.empty-seat { visibility: hidden; }
.seat.active { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc), 0 0 34px -6px var(--pc), var(--shadow); transform: scale(1.03); }
.seat.out { opacity: 0.45; filter: grayscale(0.7); }
.seat-avatar { position: relative; width: 50px; height: 50px; flex: none; }
.seat-avatar .ring { position: absolute; inset: -4px; border-radius: 50%; background: conic-gradient(var(--pc) calc(var(--t, 0) * 1turn), rgba(255,255,255,0.08) 0); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
.seat-avatar .face { position: absolute; inset: 3px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--pc) 70%, #fff), var(--pc) 55%, color-mix(in srgb, var(--pc) 55%, #000)); text-shadow: 0 1px 2px rgba(0,0,0,0.35); }
.seat-info { min-width: 0; }
.seat-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; display: flex; align-items: center; gap: 6px; }
.seat-name .you { font-size: 10px; padding: 1px 6px; border-radius: 6px; background: var(--pc); color: #10122a; font-weight: 800; }
.seat-name .bot { font-size: 10px; padding: 1px 6px; border-radius: 6px; background: var(--panel-strong); color: var(--muted); font-weight: 700; }
.seat-sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-top: 3px; }
.pips { display: flex; gap: 3px; }
.pips i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.12); }
.pips i.on { background: var(--pc); box-shadow: 0 0 8px var(--pc); }
.mini-die { width: 22px; height: 22px; border-radius: 6px; background: #fff; color: #161a33; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.emote-bubble { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); font-size: 26px; padding: 4px 10px; border-radius: 14px; background: rgba(22,25,50,0.95); border: 1px solid var(--border-strong); animation: bubble 2.2s ease forwards; white-space: nowrap; pointer-events: none; z-index: 5; }
.emote-bubble.txt { font-size: 15px; font-weight: 700; }
@keyframes bubble { 0% { transform: translate(-50%, 10px) scale(0.6); opacity: 0; } 12% { transform: translate(-50%, -6px) scale(1.08); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -26px); opacity: 0; } }
.seat-avatar { overflow: visible; }

.controls { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 12px 16px 18px; flex-wrap: wrap; }
.dice-zone { display: flex; align-items: center; gap: 16px; padding: 10px 22px 10px 12px; border-radius: 20px; min-width: 260px; }
.dice-zone.mine { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc), 0 0 40px -8px var(--pc), var(--shadow); }
.dice-label b { display: block; font-size: 16px; }
.dice-label span { font-size: 12.5px; color: var(--muted); }
.emotes { display: flex; gap: 6px; }
.emotes button { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); font-size: 17px; transition: transform 0.15s; }
.emotes button:hover { transform: translateY(-2px) scale(1.08); }
.emotes button.txt { width: auto; padding: 0 10px; font-size: 12px; font-weight: 700; }

/* ---------- 3D dice ---------- */
.die-wrap { width: 64px; height: 64px; perspective: 400px; flex: none; border: 0; background: none; padding: 0; position: relative; }
.die-wrap:disabled { cursor: default; }
.die-wrap.can-roll::after { content: ''; position: absolute; inset: -10px; border-radius: 20px; border: 2px solid var(--pc, #fff); animation: halo 1.2s ease-in-out infinite; }
@keyframes halo { 50% { transform: scale(1.12); opacity: 0.25; } }
.die { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transform: rotateX(-20deg) rotateY(25deg); }
.die.tumble { animation: tumble 550ms linear infinite; }
.die-wrap:has(.die.tumble) { animation: shake 0.18s ease-in-out infinite alternate; }
@keyframes tumble { from { transform: rotateX(0) rotateY(0) rotateZ(0); } to { transform: rotateX(360deg) rotateY(720deg) rotateZ(180deg); } }
@keyframes shake { from { transform: translate(-2px, 1px) rotate(-4deg); } to { transform: translate(2px, -2px) rotate(4deg); } }
.face { position: absolute; inset: 0; border-radius: 14px; background: linear-gradient(145deg, #ffffff, #dfe3f5); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06), inset 0 -6px 12px rgba(0,0,0,0.12); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 9px; backface-visibility: hidden; }
.face .p { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4a4f73, #12152b); align-self: center; justify-self: center; }
.face.f1 .p { background: radial-gradient(circle at 35% 30%, #ff8aa0, #e1173f); width: 15px; height: 15px; }
.f1 { transform: translateZ(32px); }
.f6 { transform: rotateY(180deg) translateZ(32px); }
.f2 { transform: rotateY(90deg) translateZ(32px); }
.f5 { transform: rotateY(-90deg) translateZ(32px); }
.f3 { transform: rotateX(90deg) translateZ(32px); }
.f4 { transform: rotateX(-90deg) translateZ(32px); }

/* ---------- Board SVG ---------- */
.token { cursor: default; transition: transform 0.28s cubic-bezier(0.3, 1.3, 0.5, 1); }
.token.legal { cursor: pointer; }
.token .halo { opacity: 0; }
.token.legal .halo { opacity: 1; animation: legal 1s ease-in-out infinite; transform-origin: 0 0; }
@keyframes legal { 0%, 100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(1.35); opacity: 0.25; } }
.token.legal:hover .body { filter: brightness(1.2); }
.token.ghost { opacity: 0.35; }
.cell-hint { pointer-events: none; animation: hint 1s ease-in-out infinite; }
@keyframes hint { 50% { opacity: 0.35; } }
.spark { pointer-events: none; }

/* ---------- Results ---------- */
.results { text-align: center; width: min(460px, 100%); padding: 30px 26px; }
.results .trophy { font-size: 64px; line-height: 1; filter: drop-shadow(0 10px 24px rgba(255,201,60,0.5)); animation: bounce 1.6s ease-in-out infinite; }
@keyframes bounce { 50% { transform: translateY(-8px) rotate(-4deg); } }
.results h2 { font-size: 40px; margin: 10px 0 4px; }
.results .won { font-family: var(--display); font-size: 46px; color: var(--gold); text-shadow: 0 0 30px rgba(255,209,102,0.45); margin: 6px 0; }
.standings { display: grid; gap: 8px; margin: 20px 0; text-align: left; }
.standing { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(0,0,0,0.25); border: 1px solid var(--border); }
.standing .sw { width: 14px; height: 14px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 10px var(--pc); }
.standing .nm { flex: 1; font-weight: 600; }
.results-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fair-box { text-align: left; display: grid; gap: 10px; margin-top: 10px; }
.fair-box .kv { padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,0.3); border: 1px solid var(--border); }
.fair-box .kv span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.verified { display: inline-flex; gap: 8px; align-items: center; color: var(--ok); font-weight: 700; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; padding-top: 28px; gap: 26px; }
  .auth-preview { display: none; }
  .hero-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
  .topbar .live { display: none; }
  .wallet-chip .bonus { display: none; }
  .hero-card h2 { font-size: 28px; }
  .hero-practice .art { width: 180px; right: -50px; opacity: 0.45; }
  .seat { padding: 6px 10px 6px 6px; gap: 8px; }
  .seat-avatar { width: 38px; height: 38px; }
  .seat-name { max-width: 90px; font-size: 13px; }
  .arena { --board: min(calc(100dvh - 300px), calc(100vw - 16px)); padding: 0 8px; }
  .dice-zone { min-width: 0; padding-right: 16px; }
  .history-row { grid-template-columns: 40px 1fr auto; }
  .history-row .when { display: none; }
  .amounts { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
