:root {
  color-scheme: dark;
  --navy-950: #0b1421;
  --navy-900: #101b2b;
  --navy-850: #152337;
  --navy-800: #1a2a40;
  --navy-700: #293d55;
  --ink: #f4f0e6;
  --muted: #9aa9b8;
  --muted-2: #71849a;
  --gold: #d7b66d;
  --gold-light: #f0d99f;
  --line: rgba(215, 182, 109, .18);
  --panel: rgba(20, 34, 52, .88);
  --green: #7ac9a7;
  font-family: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% -12%, rgba(67, 93, 116, .3), transparent 48rem),
    radial-gradient(circle at 8% 38%, rgba(122, 201, 167, .045), transparent 22rem),
    var(--navy-950);
}
button { font: inherit; }
.page-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--gold); border-radius: 50%;
  color: var(--gold-light); font: 24px "Marcellus", Georgia, serif;
  box-shadow: inset 0 0 0 4px rgba(215,182,109,.08);
}
.brand-copy { display: grid; gap: 2px; letter-spacing: .13em; }
.brand-copy strong { font-size: 11px; }
.brand-copy small { color: var(--muted); font-size: 8px; letter-spacing: .2em; }
.edition, .footer { color: var(--muted-2); font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.intro { text-align: center; padding: 43px 0 30px; }
.eyebrow { margin: 0 0 9px; color: var(--gold); font-size: 9px; font-weight: 700; letter-spacing: .2em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 9px; font: 42px/1.1 "Marcellus", Georgia, serif; letter-spacing: -.025em; }
h1 em { color: var(--gold-light); font-style: normal; }
.intro-copy { margin: 0; color: var(--muted); font-size: 13px; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .85fr); gap: 16px; align-items: stretch; }
.panel {
  background: linear-gradient(145deg, rgba(25, 42, 63, .96), rgba(17, 29, 45, .97));
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.025);
}
.draw-panel { padding: 22px 25px 19px; text-align: center; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; text-align: left; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.panel-heading h2 { margin: 0; font: 20px "Marcellus", Georgia, serif; }
.live-indicator {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 3px;
  padding: 6px 9px; border: 1px solid rgba(122,201,167,.2); border-radius: 20px;
  color: var(--green); font-size: 8px; font-weight: 700; letter-spacing: .12em; white-space: nowrap;
}
.live-indicator span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ball-stage { min-height: 266px; display: grid; place-items: center; padding: 14px 0 8px; }
.ball-placeholder { display: grid; justify-items: center; gap: 8px; color: var(--muted); }
.placeholder-star { color: var(--gold); font-size: 30px; }
.ball-placeholder strong { color: var(--gold-light); font-size: 11px; letter-spacing: .24em; }
.ball-placeholder small { font-size: 11px; }
.drawn-ball {
  --ball-color: #d7b66d;
  position: relative; width: 214px; height: 214px; border-radius: 50%;
  display: grid; align-content: center; justify-items: center; gap: 1px;
  border: 2px solid rgba(255,255,255,.48);
  background:
    radial-gradient(circle at 33% 25%, rgba(255,255,255,.5), transparent 8%),
    radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--ball-color), white 22%), var(--ball-color) 43%, color-mix(in srgb, var(--ball-color), black 34%) 100%);
  color: #172235;
  box-shadow: 0 0 0 8px rgba(215,182,109,.07), 0 18px 42px rgba(0,0,0,.42), inset -9px -13px 22px rgba(0,0,0,.2), inset 8px 8px 16px rgba(255,255,255,.23);
}
.drawn-ball::after {
  content: ""; position: absolute; inset: 12px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.36); pointer-events: none;
}
.ball-letter { font: 34px "Marcellus", Georgia, serif; line-height: 1; }
.ball-number { font: 66px/.98 "Marcellus", Georgia, serif; letter-spacing: -.04em; }
.ball-subtitle { margin-top: 5px; color: rgba(20,32,48,.75); font-size: 8px; font-weight: 700; letter-spacing: .19em; }
.ball-b { --ball-color: #70b5e5; }
.ball-i { --ball-color: #e78683; }
.ball-n { --ball-color: #e8c46d; }
.ball-g { --ball-color: #78c59a; }
.ball-o { --ball-color: #ad9be2; }
.draw-counter { display: flex; justify-content: center; align-items: center; gap: 34px; margin: 0 0 16px; }
.draw-counter div:not(.counter-divider) { display: grid; gap: 2px; }
.draw-counter strong { font: 25px "Marcellus", Georgia, serif; }
.draw-counter span { color: var(--muted-2); font-size: 8px; font-weight: 700; letter-spacing: .16em; }
.counter-divider { width: 1px; height: 30px; background: var(--line); }
.progress-track { height: 3px; overflow: hidden; background: rgba(255,255,255,.08); border-radius: 4px; }
.progress-track div { height: 100%; width: 0; background: linear-gradient(90deg, #9a7b43, var(--gold-light)); transition: width .2s ease; }
.primary-actions { display: flex; gap: 9px; margin-top: 19px; }
.button {
  min-height: 43px; border-radius: 8px; padding: 0 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; cursor: pointer; font-size: 11px; font-weight: 700;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.button:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 3px; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .4; cursor: not-allowed; }
.button-primary { flex: 1; color: #182335; background: linear-gradient(135deg, #efd89e, #cba85c); box-shadow: 0 7px 18px rgba(196,158,82,.15); }
.button-primary:hover:not(:disabled) { background: linear-gradient(135deg, #f7e5b6, #d9b76c); }
.button-icon { font-size: 13px; }
.button-secondary { color: var(--gold-light); border-color: rgba(215,182,109,.32); background: rgba(215,182,109,.06); }
.button-secondary:hover:not(:disabled) { background: rgba(215,182,109,.13); }
.action-note { margin: 10px 0 0; color: var(--muted-2); font-size: 10px; }
.notice { margin-top: 12px; padding: 9px 11px; border-radius: 7px; background: rgba(122,201,167,.08); color: var(--green); font-size: 11px; }
.stats-panel { padding: 22px 20px 17px; }
.compact-heading { margin-bottom: 20px; }
.next-probability { padding: 14px 13px; border: 1px solid rgba(215,182,109,.16); border-radius: 9px; background: rgba(215,182,109,.045); display: grid; gap: 5px; }
.probability-label { color: var(--muted); font-size: 9px; line-height: 1.4; }
.next-probability strong { color: var(--gold-light); font: 25px "Marcellus", Georgia, serif; }
.next-probability small { color: var(--muted-2); font-size: 10px; }
.column-list { display: grid; gap: 13px; margin-top: 21px; }
.column-row { display: grid; grid-template-columns: 29px minmax(0,1fr) 65px; align-items: center; gap: 9px; }
.column-letter { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; font: 15px "Marcellus", Georgia, serif; }
.letter-b { color: #a9d8f6; background: rgba(112,181,229,.16); }
.letter-i { color: #ffc1bd; background: rgba(231,134,131,.16); }
.letter-n { color: #f5d88e; background: rgba(232,196,109,.16); }
.letter-g { color: #b5ebc8; background: rgba(120,197,154,.16); }
.letter-o { color: #d0c4ff; background: rgba(173,155,226,.16); }
.column-info { display: grid; gap: 2px; }
.column-info strong { font-size: 10px; font-weight: 600; }
.column-info small { color: var(--muted-2); font-size: 9px; }
.column-bar { height: 4px; display: block; overflow: hidden; border-radius: 5px; background: rgba(255,255,255,.07); }
.column-bar i { display: block; height: 100%; border-radius: inherit; background: var(--gold); }
.stats-footnote { margin: 17px 0 0; color: var(--muted-2); font-size: 9px; line-height: 1.5; }
.history-panel { margin-top: 16px; padding: 20px 22px 13px; }
.history-heading { align-items: center; margin-bottom: 16px; }
.history-total { padding: 6px 9px; border: 1px solid var(--line); border-radius: 20px; color: var(--gold-light); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.history-table-wrap { max-height: 320px; overflow: auto; border: 1px solid rgba(255,255,255,.06); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
thead { position: sticky; top: 0; z-index: 1; background: #1b2b41; }
th { padding: 10px 13px; color: var(--muted-2); font-size: 8px; font-weight: 700; letter-spacing: .13em; }
td { padding: 8px 13px; border-top: 1px solid rgba(255,255,255,.045); color: #c7d0d9; font-size: 10px; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: rgba(255,255,255,.025); }
td.ball-cell { color: var(--gold-light); font-weight: 700; letter-spacing: .04em; }
.empty-row td { padding: 22px; color: var(--muted-2); text-align: center; }
.history-caption { margin: 10px 0 0; color: var(--muted-2); font-size: 9px; }
.bottom-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 2px 25px; }
.bottom-actions p { margin: 0; color: var(--muted-2); font-size: 10px; }
.button-quiet { min-height: 35px; padding: 0 12px; color: var(--muted); border-color: rgba(255,255,255,.12); background: transparent; }
.button-quiet:hover { color: var(--gold-light); border-color: var(--line); }
.error-panel { margin: 20px 0; padding: 22px; border-color: rgba(231,134,131,.4); }
.error-panel h2 { margin-bottom: 10px; font: 21px "Marcellus", Georgia, serif; }
.error-panel p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.5; }
.footer { display: flex; justify-content: space-between; padding: 17px 0 24px; border-top: 1px solid rgba(255,255,255,.07); font-size: 8px; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 26px, 560px); }
  .topbar { min-height: 65px; }
  .edition { font-size: 8px; letter-spacing: .1em; }
  .intro { padding: 34px 0 23px; }
  h1 { font-size: 35px; }
  .game-layout { grid-template-columns: 1fr; gap: 12px; }
  .draw-panel { padding: 19px 17px 16px; }
  .ball-stage { min-height: 244px; }
  .drawn-ball { width: 194px; height: 194px; }
  .ball-number { font-size: 60px; }
  .stats-panel { padding: 19px 17px; }
  .column-list { grid-template-columns: 1fr 1fr; column-gap: 14px; }
  .history-panel { margin-top: 12px; padding: 18px 13px 12px; }
  .history-heading { align-items: flex-end; }
  th, td { padding-left: 10px; padding-right: 10px; }
  .bottom-actions { align-items: flex-start; padding-bottom: 21px; }
}
@media (max-width: 420px) {
  .edition { max-width: 110px; text-align: right; line-height: 1.5; }
  .panel-heading h2 { font-size: 18px; }
  .live-indicator { font-size: 7px; padding: 5px 7px; }
  .primary-actions { flex-direction: column; }
  .button { min-height: 44px; }
  .column-list { grid-template-columns: 1fr; }
  .bottom-actions { flex-direction: column; align-items: stretch; }
  .footer { gap: 15px; line-height: 1.5; }
  .footer span:last-child { text-align: right; }
}