:root {
  --bg: #07110f;
  --surface: #0e1c19;
  --surface-2: #132520;
  --surface-3: #19302a;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f4f7f5;
  --muted: #95aaa3;
  --gold: #d9b65e;
  --gold-light: #f0d98c;
  --green: #3ddc97;
  --red: #f07178;
  --blue: #63a7ff;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(34, 121, 91, 0.19), transparent 32rem),
    radial-gradient(circle at 90% 20%, rgba(217, 182, 94, 0.09), transparent 28rem),
    var(--bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell { width: min(1400px, calc(100% - 40px)); margin: 0 auto; }

.topbar {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 182, 94, 0.42);
  border-radius: 12px;
  color: var(--gold-light);
  background: linear-gradient(145deg, rgba(217,182,94,.16), rgba(217,182,94,.03));
  font-weight: 800;
  letter-spacing: -0.05em;
}
.brand > span:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: .7rem; }

.demo-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: .78rem;
}
.demo-badge span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 30px;
  padding: 60px 0 42px;
}
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(2.5rem, 5.5vw, 5rem); line-height: .98; letter-spacing: -.065em; }
.hero h1 span { color: var(--gold-light); }
.hero-copy { max-width: 660px; margin: 22px 0 0; color: var(--muted); font-size: 1rem; }
.rules-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--gold-light);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 700;
}
.rules-link span { transition: transform .16s ease; }
.rules-link:hover span { transform: translateY(3px); }
.balance-card {
  min-width: 245px;
  padding: 22px 24px;
  border: 1px solid rgba(217, 182, 94, .25);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(217, 182, 94, .12), rgba(14,28,25,.85));
  box-shadow: var(--shadow);
}
.balance-card span, .balance-card small { display: block; color: var(--muted); font-size: .75rem; }
.balance-card strong { display: block; margin: 2px 0; color: var(--gold-light); font-size: 2rem; letter-spacing: -.04em; }

.message { margin-bottom: 18px; padding: 13px 16px; border-radius: 12px; border: 1px solid transparent; font-size: .88rem; }
.message.info { color: #b9d8ff; background: rgba(99,167,255,.1); border-color: rgba(99,167,255,.25); }
.message.error { color: #ffc2c5; background: rgba(240,113,120,.1); border-color: rgba(240,113,120,.28); }
.message.success { color: #a8f0d0; background: rgba(61,220,151,.1); border-color: rgba(61,220,151,.25); }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 22px; align-items: start; }
.card { border: 1px solid var(--border); border-radius: var(--radius); background: rgba(14, 28, 25, .9); box-shadow: var(--shadow); }
.board-card { padding: 26px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading h2, .bet-card h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.025em; }
.selection-count { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .82rem; white-space: nowrap; }
.selection-count strong { color: var(--text); }
.remaining-count { padding: 3px 7px; border: 1px solid rgba(217,182,94,.2); border-radius: 7px; color: var(--gold-light); background: rgba(217,182,94,.07); font-size: .67rem; font-weight: 700; }

.legend { display: flex; gap: 18px; margin: 18px 0; color: var(--muted); font-size: .72rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); }
.legend-dot.selected { background: var(--gold); }
.legend-dot.drawn { background: var(--blue); }
.legend-dot.hit { background: var(--green); }

.number-board { display: grid; grid-template-columns: repeat(10, minmax(42px, 1fr)); gap: 8px; }
.number-cell {
  aspect-ratio: 1;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: #b8c8c3;
  cursor: pointer;
  font-size: .86rem;
  font-weight: 600;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.number-cell:hover { transform: translateY(-2px); border-color: rgba(217,182,94,.42); color: var(--text); }
.number-cell:focus-visible, .button:focus-visible, input:focus-visible { outline: 3px solid rgba(217,182,94,.3); outline-offset: 2px; }
.number-cell.is-selected { color: #171208; border-color: var(--gold); background: linear-gradient(145deg, var(--gold-light), var(--gold)); box-shadow: 0 5px 18px rgba(217,182,94,.18); }
.number-cell.is-drawn { color: #d9eaff; border-color: rgba(99,167,255,.7); background: rgba(99,167,255,.18); }
.number-cell.is-hit { color: #062519; border-color: var(--green); background: linear-gradient(145deg, #6defb7, var(--green)); box-shadow: 0 0 0 3px rgba(61,220,151,.14), 0 8px 20px rgba(61,220,151,.2); }

.board-actions { display: flex; gap: 10px; margin-top: 20px; }
.button { min-height: 43px; padding: 0 17px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-weight: 700; font-size: .82rem; transition: transform .16s ease, filter .16s ease, border-color .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button:active { transform: translateY(0); }
.button-primary { color: #171208; background: linear-gradient(135deg, var(--gold-light), var(--gold)); }
.button-secondary { color: var(--text); border-color: rgba(217,182,94,.25); background: rgba(217,182,94,.11); }
.button-ghost { color: var(--muted); border-color: var(--border); background: transparent; }
.button-danger-ghost { color: #f2a6aa; border-color: rgba(240,113,120,.2); background: rgba(240,113,120,.06); }
.button-full { width: 100%; margin-top: 18px; }
.button-small { min-height: 32px; padding: 0 10px; font-size: .7rem; }

.sidebar { display: grid; gap: 22px; }
.bet-card, .result-card { padding: 24px; }
.bet-card label { display: block; margin: 22px 0 7px; color: var(--muted); font-size: .78rem; }
.input-wrap { position: relative; }
.input-wrap input { width: 100%; height: 54px; padding: 0 58px 0 15px; color: var(--text); border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); font-weight: 700; }
.input-wrap span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--gold); font-size: .72rem; font-weight: 800; }
.field-note { margin: 7px 0 0; color: var(--muted); font-size: .7rem; }
.pdf-availability { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--muted); font-size: .66rem; line-height: 1.45; }
.pdf-availability span { padding: 2px 5px; border: 1px solid rgba(217,182,94,.2); border-radius: 5px; color: var(--gold-light); background: rgba(217,182,94,.07); font-size: .54rem; font-weight: 800; letter-spacing: .04em; }

.result-card { min-height: 235px; }
.empty-result { min-height: 185px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-result h2 { margin: 13px 0 4px; font-size: 1rem; }
.empty-result p { max-width: 240px; margin: 0; color: var(--muted); font-size: .78rem; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; color: var(--muted); border: 1px dashed rgba(255,255,255,.18); border-radius: 50%; font-size: .75rem; font-weight: 800; }
.result-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding-bottom: 17px; border-bottom: 1px solid var(--border); }
.result-status { margin: 0; font-size: 1.2rem; letter-spacing: -.03em; }
.result-status.win { color: var(--green); }
.result-status.loss { color: #ffc2c5; }
.result-code { margin: 4px 0 0; color: var(--muted); font-size: .67rem; word-break: break-all; }
.hits-badge { min-width: 54px; padding: 7px 8px; text-align: center; border-radius: 10px; color: var(--gold-light); background: rgba(217,182,94,.1); font-size: .7rem; }
.hits-badge strong { display: block; font-size: 1.05rem; }
.result-numbers { margin: 16px 0; }
.result-numbers p { margin: 9px 0; color: var(--muted); font-size: .7rem; }
.result-numbers strong { display: block; margin-top: 2px; color: var(--text); font-size: .73rem; line-height: 1.7; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.result-stat { padding: 10px; border-radius: 10px; background: var(--surface-2); }
.result-stat span { display: block; color: var(--muted); font-size: .64rem; }
.result-stat strong { font-size: .82rem; }
.prize-callout { margin: 13px 0; padding: 13px; border: 1px solid rgba(61,220,151,.2); border-radius: 11px; background: rgba(61,220,151,.08); }
.prize-callout span { color: var(--muted); font-size: .68rem; }
.prize-callout strong { display: block; color: var(--green); font-size: 1.3rem; }

.history-card { margin: 22px 0; padding: 26px; }
.history-heading { align-items: center; margin-bottom: 18px; }
.history-container { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.history-table th { padding: 11px 10px; color: var(--muted); border-bottom: 1px solid var(--border); text-align: left; font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; }
.history-table td { padding: 13px 10px; border-bottom: 1px solid rgba(255,255,255,.05); font-size: .76rem; }
.history-table tr:last-child td { border-bottom: 0; }
.history-table .code-cell { color: var(--gold-light); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .68rem; }
.status-pill { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: .65rem; font-weight: 700; }
.status-pill.win { color: #9aebc5; background: rgba(61,220,151,.1); }
.status-pill.loss { color: #f3a4a8; background: rgba(240,113,120,.09); }
.history-empty { padding: 38px 20px; text-align: center; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: .82rem; }

.rules-section { padding: 68px 0 18px; scroll-margin-top: 24px; }
.rules-intro { max-width: 660px; margin-bottom: 24px; }
.rules-intro h2 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.045em; }
.rules-intro > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: .88rem; }
.rules-layout { display: grid; grid-template-columns: 1.05fr .95fr; gap: 22px; }
.how-card, .payouts-card { padding: 26px; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.card-title-row h3 { margin: 0; font-size: 1.18rem; letter-spacing: -.025em; }
.card-number { color: rgba(217,182,94,.2); font-size: 2.2rem; font-weight: 800; line-height: 1; letter-spacing: -.08em; }
.steps-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.steps-list li { position: relative; display: grid; grid-template-columns: 36px 1fr; gap: 13px; padding: 17px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.steps-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.steps-list li > span { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid rgba(217,182,94,.28); border-radius: 9px; color: var(--gold-light); background: rgba(217,182,94,.08); font-size: .72rem; font-weight: 800; }
.steps-list strong { display: block; margin: 1px 0 3px; font-size: .82rem; }
.steps-list p { margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.payout-table { margin-top: 12px; }
.payout-row { display: grid; grid-template-columns: 1fr 1fr; align-items: center; min-height: 41px; padding: 0 12px; border-bottom: 1px solid rgba(255,255,255,.05); color: var(--muted); font-size: .76rem; }
.payout-row span:last-child, .payout-row strong { justify-self: end; }
.payout-row strong { color: var(--text); }
.payout-head { min-height: 34px; color: var(--muted); font-size: .62rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.payout-row.is-winning strong { color: var(--green); }
.payout-row.jackpot { margin-top: 5px; border: 1px solid rgba(217,182,94,.3); border-radius: 10px; color: var(--gold-light); background: linear-gradient(90deg, rgba(217,182,94,.12), rgba(217,182,94,.035)); }
.payout-row.jackpot strong { color: var(--gold-light); font-size: .88rem; }
.payout-note { display: grid; grid-template-columns: 21px 1fr; gap: 8px; margin: 17px 0 0; padding: 11px; border-radius: 10px; color: var(--muted); background: var(--surface-2); font-size: .66rem; line-height: 1.5; }
.payout-note span { width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; color: var(--gold); font-size: .62rem; font-weight: 800; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 26px 0 36px; color: var(--muted); border-top: 1px solid var(--border); font-size: .7rem; }
footer p { margin: 0; }

@media (max-width: 1050px) {
  .game-layout { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: 1fr 1fr; }
  .rules-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 24px, 1400px); }
  .topbar { height: 72px; }
  .demo-badge { font-size: 0; padding: 9px; }
  .hero { grid-template-columns: 1fr; padding: 42px 0 30px; }
  .hero h1 { font-size: clamp(2.35rem, 13vw, 4rem); }
  .balance-card { min-width: 0; }
  .board-card, .history-card { padding: 17px; }
  .number-board { grid-template-columns: repeat(8, 1fr); gap: 6px; }
  .number-cell { min-height: 36px; border-radius: 8px; font-size: .76rem; }
  .sidebar { grid-template-columns: 1fr; }
  .rules-section { padding-top: 48px; }
  .how-card, .payouts-card { padding: 19px; }
  .section-heading { flex-direction: column; gap: 12px; }
  .history-heading { align-items: stretch; }
  .legend { gap: 10px; flex-wrap: wrap; }
  footer { flex-direction: column; }
}

@media (max-width: 430px) {
  .number-board { grid-template-columns: repeat(5, 1fr); }
  .board-actions { flex-direction: column; }
  .board-actions .button { width: 100%; }
}

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