:root {
  --bg: #07060d;
  --bg-2: #0d0b18;
  --card: #13111f;
  --card-2: #1a1729;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --fg: #f3f1fa;
  --muted: #9a95b0;
  --pink: #ff2bd6;
  --cyan: #22e4ff;
  --lime: #b6ff3b;
  --amber: #ffb547;
  --red: #ff5470;
  --grad: linear-gradient(100deg, #ff2bd6 0%, #8b5cf6 50%, #22e4ff 100%);
  --r: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.glow { position: fixed; inset: -20vh -10vw auto; height: 70vh; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 50% at 20% 30%, rgba(255, 43, 214, 0.16), transparent 70%), radial-gradient(40% 50% at 80% 20%, rgba(34, 228, 255, 0.12), transparent 70%); }

/* header */
.top { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: rgba(7, 6, 13, 0.78); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; gap: 28px; max-width: 1200px; height: 64px; margin: 0 auto; padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: 0.06em; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark { width: 30px; height: 30px; filter: drop-shadow(0 0 8px rgba(255, 43, 214, 0.5)); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; transition: color .15s, background .15s; }
.nav a:hover { color: var(--fg); }
.nav a.on { color: var(--fg); background: var(--card-2); }
.account { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.balance { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.balance .amt { transition: color .3s, text-shadow .3s; }
.balance .amt.flash { color: var(--lime); text-shadow: 0 0 14px rgba(182, 255, 59, 0.7); }
.pending-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 181, 71, 0.14); color: var(--amber); font-size: 12px; font-weight: 600; }
.pending-pill::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card-2); font-weight: 700; cursor: pointer; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 46px; width: 240px; padding: 8px; border-radius: 14px; background: var(--card); border: 1px solid var(--line-2); box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.menu-pop[hidden] { display: none; }
.menu-pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 13px; }
.menu-pop .who b { display: block; font-size: 14px; }
.menu-pop .who span { color: var(--muted); }
.menu-pop button, .menu-pop a { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; text-align: left; font-size: 14px; cursor: pointer; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--card-2); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card-2); font-weight: 700; font-size: 14px; cursor: pointer; transition: transform .12s, box-shadow .2s, opacity .2s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.neon { border: 0; background: var(--grad); color: #fff; box-shadow: 0 6px 24px -6px rgba(255, 43, 214, 0.65); }
.btn.neon:hover { box-shadow: 0 8px 30px -4px rgba(139, 92, 246, 0.8); }
.btn.ghost { background: transparent; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.loading, .btn.loading:disabled { position: relative; color: transparent !important; pointer-events: none; opacity: 1; }
.btn.loading::after { content: ""; position: absolute; inset: 0; width: 18px; height: 18px; margin: auto; border-radius: 99px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn.sm.loading::after { width: 14px; height: 14px; }
a[data-deposit].loading { opacity: .6; pointer-events: none; cursor: progress; }
.balance .btn { height: 30px; }

.view { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; }
.foot { border-top: 1px solid var(--line); padding: 22px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.foot p { margin: 0; } .foot b { color: #a78bfa; }

/* setup banner */
.setup { max-width: 1200px; margin: 18px auto 0; padding: 0 20px; }
.setup-card { display: flex; gap: 14px; padding: 16px 18px; border-radius: var(--r); background: rgba(255, 181, 71, 0.07); border: 1px solid rgba(255, 181, 71, 0.3); font-size: 14px; }
.setup-card .ico { color: var(--amber); flex-shrink: 0; margin-top: 2px; }
.setup-card b { display: block; margin-bottom: 2px; }
.setup-card code { font: 12.5px var(--mono); padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.07); }
.setup-card p { margin: 0; color: var(--muted); }

/* hero */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 24px; min-height: 340px; padding: 44px; border-radius: 28px;
  background: radial-gradient(70% 120% at 100% 0%, rgba(34, 228, 255, 0.22), transparent 60%), radial-gradient(60% 100% at 0% 100%, rgba(255, 43, 214, 0.25), transparent 60%), var(--bg-2);
  border: 1px solid var(--line-2); }
.hero h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); line-height: 1.02; letter-spacing: -0.03em; font-weight: 850; }
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { max-width: 460px; margin: 16px 0 26px; color: var(--muted); font-size: 16px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .coins { display: flex; gap: 8px; margin-top: 22px; color: var(--muted); font-size: 12.5px; align-items: center; flex-wrap: wrap; }
.chip-coin { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 99px; color: #fff; font-size: 8.5px; font-weight: 800; }
.hero-art { position: relative; height: 260px; }
.die { position: absolute; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); place-items: center; padding: 18px; width: 150px; height: 150px; border-radius: 30px;
  background: linear-gradient(145deg, #2a1f4d, #120d24); border: 1px solid rgba(255,255,255,.18); box-shadow: 0 30px 60px -20px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.2), 0 0 50px -10px rgba(255, 43, 214, 0.5); }
.die i { width: 22px; height: 22px; border-radius: 99px; background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.die.b i { width: 18px; height: 18px; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.die.a { left: 12%; top: 18%; transform: rotate(-14deg); animation: float 6s ease-in-out infinite; }
.die.b { right: 6%; top: 32%; width: 120px; height: 120px; border-radius: 24px; transform: rotate(18deg); animation: float 7s ease-in-out -2s infinite; }

/* lobby */
.section-head { display: flex; align-items: end; justify-content: space-between; margin: 40px 0 16px; }
.section-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.on { color: var(--fg); background: var(--card-2); }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.game { position: relative; display: flex; flex-direction: column; justify-content: flex-end; aspect-ratio: 3 / 4; padding: 14px; overflow: hidden; border-radius: 18px; border: 1px solid var(--line); cursor: pointer; isolation: isolate; transition: transform .18s, border-color .18s, box-shadow .18s; text-align: left; }
.game:hover { transform: translateY(-4px); border-color: var(--line-2); box-shadow: 0 18px 40px -16px var(--tint, rgba(255,43,214,.6)); }
.game .art { position: absolute; inset: 0; z-index: -1; }
.game .glyph { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); width: 56%; opacity: .95; filter: drop-shadow(0 0 18px var(--tint)); }
.game::after { content: ""; position: absolute; inset: 40% 0 0; z-index: -1; background: linear-gradient(transparent, rgba(5, 4, 10, 0.92)); }
.game .name { font-weight: 800; font-size: 15px; letter-spacing: 0.01em; }
.game .by { color: rgba(255,255,255,.6); font-size: 11.5px; }
.game .tag { position: absolute; top: 12px; left: 12px; padding: 3px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); }
.game .tag.live { color: var(--lime); }
.game .play { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; background: rgba(5, 4, 10, 0.55); transition: opacity .18s; font-weight: 800; }
.game:hover .play { opacity: 1; }
.game .play span { padding: 9px 18px; border-radius: 999px; background: var(--grad); }
.game .play span.soon { background: rgba(255,255,255,.12); font-size: 13px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.feature { padding: 20px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.feature b { display: block; margin: 10px 0 4px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.feature .ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: rgba(139, 92, 246, .16); color: #c4b5fd; }

/* auth */
.auth { max-width: 420px; margin: 30px auto; padding: 32px; border-radius: 24px; background: var(--card); border: 1px solid var(--line-2); }
.auth h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.02em; }
.auth > p { margin: 0 0 22px; color: var(--muted); }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input.in { width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
input.in:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, .25); }
.form-error { min-height: 20px; margin: 4px 0 10px; color: var(--red); font-size: 13.5px; }
.auth .alt { margin-top: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.auth .alt a { color: #c4b5fd; font-weight: 600; }

/* dice */
.dice-wrap { display: grid; grid-template-columns: 340px 1fr; gap: 20px; }
.panel { padding: 22px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); }
.panel h2 { margin: 0 0 16px; font-size: 18px; }
.bet-row { display: flex; gap: 8px; }
.bet-row .in { flex: 1; font-variant-numeric: tabular-nums; font-weight: 700; }
.bet-row .btn { height: 46px; border-radius: 12px; padding: 0 14px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.stat { padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.stage { display: flex; flex-direction: column; justify-content: center; min-height: 420px; padding: 34px; border-radius: 22px; background: radial-gradient(80% 80% at 50% 0%, rgba(139, 92, 246, .16), transparent 70%), var(--card); border: 1px solid var(--line); }
.roll-num { text-align: center; font-size: clamp(64px, 10vw, 110px); font-weight: 850; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.roll-num.win { color: var(--lime); text-shadow: 0 0 40px rgba(182, 255, 59, 0.5); }
.roll-num.lose { color: var(--red); text-shadow: 0 0 40px rgba(255, 84, 112, 0.35); }
.roll-note { margin: 10px 0 30px; text-align: center; color: var(--muted); min-height: 24px; }
.track { position: relative; height: 14px; border-radius: 99px; background: linear-gradient(90deg, var(--lime) 0 var(--chance), var(--red) var(--chance) 100%); box-shadow: inset 0 0 0 1px rgba(0,0,0,.3); }
.track .marker { position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 6px; background: #fff; box-shadow: 0 0 18px rgba(255,255,255,.6); transform: translate(-50%, -50%) rotate(45deg); transition: left .45s cubic-bezier(.2,.9,.3,1.2); }
.track .marker[hidden] { display: none; }
.scale { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; margin: 22px 0 6px; accent-color: #8b5cf6; }
.history { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 26px; min-height: 28px; }
.history span { padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; background: rgba(255, 84, 112, .14); color: var(--red); }
.history span.w { background: rgba(182, 255, 59, .14); color: var(--lime); }
.empty-cta { margin-top: 12px; padding: 14px; border-radius: 12px; background: rgba(139, 92, 246, .1); border: 1px solid rgba(139, 92, 246, .3); font-size: 13.5px; }

/* wallet */
.wallet-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 28px; border-radius: 24px; background: radial-gradient(60% 140% at 100% 0%, rgba(34, 228, 255, .16), transparent 60%), var(--card); border: 1px solid var(--line-2); }
.wallet-top .label { color: var(--muted); font-weight: 600; font-size: 13px; }
.wallet-top .big { font-size: 44px; font-weight: 850; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.wallet-top .pid { margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.wallet-top .pid code { font: 12px var(--mono); color: var(--fg); }
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; margin-top: 20px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; padding: 0 10px 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
table.list td { padding: 12px 10px; border-top: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.list td.r, table.list th.r { text-align: right; }
.st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.st.detected { background: rgba(255, 181, 71, .14); color: var(--amber); }
.st.confirmed { background: rgba(182, 255, 59, .12); color: var(--lime); }
.st.failed { background: rgba(255, 84, 112, .14); color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.empty { padding: 26px 10px; text-align: center; color: var(--muted); font-size: 14px; }
.how ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.how li { margin-bottom: 8px; } .how li b { color: var(--fg); }
.coin-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 99px; color: #fff; font-size: 7.5px; font-weight: 800; vertical-align: middle; }

/* toasts and dialog */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line-2); box-shadow: 0 20px 50px rgba(0,0,0,.5); font-size: 14px; animation: toast-in .25s cubic-bezier(.2,.8,.2,1); }
.toast b { display: block; }
.toast p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.toast .ico { flex-shrink: 0; width: 10px; height: 10px; margin-top: 6px; border-radius: 99px; background: var(--amber); }
.toast.ok .ico { background: var(--lime); box-shadow: 0 0 12px var(--lime); }
.toast.bad .ico { background: var(--red); }
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }
.dialog-back { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(4, 4, 10, 0.72); backdrop-filter: blur(6px); }
.dialog { width: 100%; max-width: 460px; padding: 26px; border-radius: 22px; background: var(--card); border: 1px solid var(--line-2); }
.dialog h2 { margin: 0 0 8px; font-size: 20px; }
.dialog ol { padding-left: 20px; color: var(--muted); font-size: 14px; }
.dialog code { font: 12.5px var(--mono); padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.07); color: var(--fg); }
.dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { translate: 0 -12px; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 30px 24px; }
  .hero-art { display: none; }
  .dice-wrap, .grid-2 { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top-inner { gap: 12px; padding: 0 16px; }
  .brand span { display: none; }
  .nav a { padding: 6px 10px; }
  .view { padding: 20px 16px 48px; }
  .balance .lbl { display: none; }
  .games { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .wallet-top .big { font-size: 36px; }
  table.list .hide-sm { display: none; }
}
@media (max-width: 420px) {
  .nav a[data-nav="/wallet"] { display: none; }
}
