:root {
  color-scheme: dark;
  --bg: #090c18;
  --surface: #12182a;
  --surface-2: #192139;
  --text: #f7f8ff;
  --muted: #a5aec4;
  --line: rgba(255,255,255,.09);
  --primary: #ff4d7d;
  --primary-2: #ff805d;
  --green: #34d399;
  --blue: #6c7cff;
  --radius: 22px;
  --shadow: 0 22px 64px rgba(0,0,0,.34);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% -10%, #20294b 0, var(--bg) 43%); color: var(--text); overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(108,124,255,.65); outline-offset: 3px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ambient { position: fixed; width: 240px; height: 240px; border-radius: 50%; filter: blur(90px); opacity: .16; pointer-events: none; }
.ambient-one { background: #ff4d7d; top: 8%; right: -100px; }
.ambient-two { background: #556dff; bottom: 15%; left: -120px; }
.app { position: relative; width: min(100%, 720px); min-height: 100vh; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 5px; color: #ff789e; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(22px, 6vw, 30px); line-height: 1.15; letter-spacing: -.03em; }
h2 { margin-bottom: 0; font-size: 22px; letter-spacing: -.025em; }
.icon-button, .sheet-close { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.06); cursor: pointer; transition: background .18s ease, opacity .18s ease; }
.icon-button svg { transform: translate(-1px, 1px); fill: currentColor; stroke: none; }
.icon-button:active, .sheet-close:active, .nav-item:active, .game-card:active { opacity: .7; }

.balance-card { position: relative; overflow: hidden; padding: 22px; border: 1px solid rgba(255,255,255,.12); border-radius: 28px; background: linear-gradient(135deg, rgba(41,50,88,.95), rgba(18,24,42,.98)); box-shadow: var(--shadow); }
.balance-card::after { content: ""; position: absolute; width: 170px; height: 170px; border-radius: 50%; right: -55px; top: -80px; background: linear-gradient(145deg, rgba(255,77,125,.45), rgba(108,124,255,.15)); filter: blur(8px); }
.balance-topline { position: relative; z-index: 1; display: flex; justify-content: space-between; color: #c3c9d9; font-size: 13px; font-weight: 600; }
.live-pill { display: inline-flex; gap: 7px; align-items: center; font-size: 10px; letter-spacing: .08em; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }
.balance-value { position: relative; z-index: 1; margin: 12px 0 22px; font-size: clamp(40px, 12vw, 58px); font-weight: 800; letter-spacing: -.055em; }
.balance-actions { position: relative; z-index: 1; display: grid; grid-template-columns: 1.2fr 1fr; gap: 10px; }
.button { min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; border: 0; border-radius: 16px; font-weight: 750; cursor: pointer; transition: filter .18s ease, opacity .18s ease, background .18s ease; }
.button svg { width: 20px; height: 20px; }
.button-primary { color: white; background: linear-gradient(115deg, var(--primary), var(--primary-2)); box-shadow: 0 12px 28px rgba(255,77,125,.22); }
.button-ghost { border: 1px solid var(--line); background: rgba(255,255,255,.065); }
.button:active { filter: brightness(.88); }
.button:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; }
.full { width: 100%; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 30px 2px 15px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.muted-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.game-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.game-card { position: relative; min-height: 90px; display: grid; grid-template-columns: 58px 1fr 20px; align-items: center; gap: 13px; width: 100%; padding: 15px; text-align: left; border: 1px solid var(--line); border-radius: 21px; background: rgba(18,24,42,.82); box-shadow: 0 10px 28px rgba(0,0,0,.12); cursor: pointer; transition: border-color .18s ease, background .18s ease, opacity .18s ease; }
.game-card:hover { border-color: rgba(255,255,255,.18); background: var(--surface-2); }
.game-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px; }
.game-icon svg { width: 35px; height: 35px; }
.dice .game-icon { color: #c3caff; background: rgba(108,124,255,.18); }
.darts .game-icon { color: #ff91ae; background: rgba(255,77,125,.18); }
.football .game-icon { color: #74edbd; background: rgba(52,211,153,.16); }
.basketball .game-icon { color: #ff9a6e; background: rgba(255,128,93,.16); }
.game-card strong { display: block; font-size: 17px; }
.game-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.arrow { color: var(--muted); font-size: 30px; font-weight: 300; }
.responsible { margin: 20px 12px 0; color: #7f899f; font-size: 11px; text-align: center; line-height: 1.5; }

.bottom-nav { position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 720px); min-height: calc(75px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px 12px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(9,12,24,.91); backdrop-filter: blur(18px); }
.nav-item { min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 14px; color: #7f899f; background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.nav-item svg { width: 21px; height: 21px; }
.nav-item.active { color: #ff6f97; background: rgba(255,77,125,.08); }

.screen { animation: screen-in .24s ease both; }
.page-heading { margin-top: 2px; }
.history-list { display: grid; gap: 10px; margin-top: 18px; }
.history-item { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(18,24,42,.78); }
.history-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: #aeb7ff; background: rgba(108,124,255,.14); }
.history-icon svg { width: 22px; height: 22px; }
.history-main strong { display: block; font-size: 14px; }
.history-main small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.history-amount { text-align: right; font-weight: 800; white-space: nowrap; }
.history-amount.positive { color: var(--green); }
.empty-state { padding: 40px 18px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 20px; }

.profile-card { display: flex; align-items: center; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(135deg, rgba(41,50,88,.92), rgba(18,24,42,.95)); }
.avatar { width: 64px; height: 64px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 20px; background: linear-gradient(135deg, var(--primary), #8059ff); font-size: 25px; font-weight: 900; }
.profile-id { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 18px 0; }
.stats-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: rgba(18,24,42,.82); }
.stats-grid span { display: block; color: var(--muted); font-size: 12px; }
.stats-grid strong { display: block; margin-top: 8px; font-size: 21px; }

.sheet-backdrop { position: fixed; z-index: 30; inset: 0; background: rgba(1,3,10,.68); backdrop-filter: blur(4px); }
.bet-sheet { position: fixed; z-index: 31; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 720px); max-height: 88vh; overflow-y: auto; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-bottom: 0; border-radius: 28px 28px 0 0; background: #111728; box-shadow: 0 -24px 70px rgba(0,0,0,.48); animation: sheet-in .25s cubic-bezier(.2,.75,.3,1) both; }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 20px; border-radius: 9px; background: #3a4358; }
.sheet-close { position: absolute; right: 16px; top: 24px; width: 44px; height: 44px; border-radius: 14px; }
.outcome-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.outcome-button { min-height: 72px; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-2); text-align: left; cursor: pointer; }
.outcome-button strong, .outcome-button small { display: block; }
.outcome-button small { margin-top: 6px; color: #ff91ae; }
.outcome-button.selected { border-color: var(--primary); background: rgba(255,77,125,.12); }
.stake-panel { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.stake-panel label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.stake-field { display: flex; align-items: center; height: 62px; padding: 0 17px; border: 1px solid var(--line); border-radius: 18px; background: #090e1c; }
.stake-field span { color: var(--muted); font-size: 25px; }
.stake-field input { width: 100%; height: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 30px; font-weight: 800; }
.stake-panel > p { margin: 7px 2px 14px; color: var(--muted); font-size: 11px; }
.stake-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.preset { min-height: 44px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.055); font-size: 13px; font-weight: 750; cursor: pointer; }

.result-dialog { position: fixed; z-index: 40; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(calc(100% - 36px), 410px); padding: 28px; border: 1px solid var(--line); border-radius: 28px; background: #141b2e; box-shadow: 0 35px 90px rgba(0,0,0,.58); text-align: center; animation: pop-in .26s ease both; }
.result-dialog::before { content: ""; position: absolute; z-index: -1; inset: 0; border-radius: inherit; box-shadow: 0 0 80px rgba(255,77,125,.13); }
.result-orb { width: 86px; height: 86px; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 50%; background: linear-gradient(135deg, #ff4d7d, #ff805d); color: white; font-size: 34px; font-weight: 900; box-shadow: 0 15px 40px rgba(255,77,125,.28); }
.result-dialog.win .result-orb { background: linear-gradient(135deg, #1eb980, #54e6aa); box-shadow: 0 15px 40px rgba(52,211,153,.25); }
.result-value { margin: 10px 0 5px; color: var(--muted); }
.result-credit { margin-bottom: 22px; font-size: 24px; font-weight: 900; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 36px), 500px); padding: 14px 16px; border: 1px solid var(--line); border-radius: 15px; background: #222a40; box-shadow: var(--shadow); text-align: center; font-size: 13px; }

.loading-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; }
.brand-mark { width: 78px; height: 78px; display: grid; place-items: center; border-radius: 24px; background: linear-gradient(135deg, var(--primary), #7f5cff); box-shadow: 0 18px 48px rgba(255,77,125,.24); font-size: 25px; font-weight: 900; }
.loader { width: 28px; height: 28px; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.loading-screen p { color: var(--muted); font-size: 13px; }

@media (min-width: 540px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); }
  .game-card { min-height: 112px; grid-template-columns: 58px 1fr; }
  .game-card .arrow { display: none; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .app { padding-top: 12px; }
  .topbar { margin-bottom: 14px; }
  .balance-card { padding: 17px; }
  .balance-value { margin: 7px 0 13px; font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes sheet-in { from { opacity: .5; transform: translate(-50%, 35px); } }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%,-47%) scale(.96); } }
