:root {
  --ink: #17201b;
  --muted: #607067;
  --paper: #f5f1e8;
  --panel: #fffdf8;
  --green: #0d5c3b;
  --green-dark: #073d28;
  --gold: #c99a34;
  --gold-soft: #f4e4b7;
  --gold-pale: #fbf4df;
  --red: #a33832;
  --line: #d8d2c4;
  --shadow: 0 14px 42px rgba(28, 44, 34, .10);
}
* { box-sizing: border-box; }
html, body { width: 100%; max-width: 100%; overflow-x: clip; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; }
body.auth-pending { overflow: hidden; }
body.auth-pending > header, body.auth-pending > nav, body.auth-pending > main { visibility: hidden; }
.auth-gate { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; overflow-y: auto; overscroll-behavior: contain; padding: 22px; background: radial-gradient(circle at 80% 18%, #1b704d, #062b1d 64%); }
.auth-card { width: min(470px, 100%); max-height: calc(100vh - 44px); max-height: calc(100dvh - 44px); overflow-y: auto; -webkit-overflow-scrolling: touch; padding: clamp(28px, 5vw, 48px); text-align: center; border: 1px solid rgba(255,255,255,.2); border-radius: 26px; color: white; background: rgba(4,33,22,.88); box-shadow: 0 28px 90px rgba(0,0,0,.42); }
.auth-logo-button { display: inline-flex; margin-bottom: 14px; padding: 0; border: 0; border-radius: 50%; background: transparent; appearance: none; }
.auth-logo-button:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 5px; }
.auth-logo { display: block; width: 124px; height: 124px; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(0,0,0,.35)); }
.auth-card h1 { margin-bottom: 10px; }
.event-title { margin: -2px 0 10px; color: var(--gold-soft); font-size: clamp(16px, 2.2vw, 22px); font-weight: 900; letter-spacing: .04em; }
.auth-intro, .auth-note { color: #dce9df; line-height: 1.5; }
.admin-password-modal { position: fixed; inset: 0; z-index: 2010; display: grid; place-items: center; overflow-y: auto; overscroll-behavior: contain; padding: 22px; background: rgba(2,19,12,.72); backdrop-filter: blur(5px); }
.admin-password-card { width: min(430px, 100%); max-height: calc(100vh - 44px); max-height: calc(100dvh - 44px); overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 30px; text-align: left; border: 1px solid rgba(255,255,255,.24); border-radius: 22px; color: white; background: #082f20; box-shadow: 0 26px 80px rgba(0,0,0,.48); }
.admin-password-card h2 { margin-bottom: 9px; }
.admin-password-card label { display: block; margin: 20px 0 7px; color: var(--gold-soft); font-size: 13px; font-weight: 850; }
.admin-password-card input, .admin-password-card select { width: 100%; border-color: rgba(255,255,255,.45); }
.auth-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.auth-buttons .button { min-height: 48px; }
.auth-buttons .button.secondary { border-color: var(--gold); background: rgba(201,154,52,.14); }
.auth-error { min-height: 22px; margin: 14px 0 0; color: #ffd3cd; font-weight: 800; }
.auth-note { margin: 6px 0 0; font-size: 13px; }
body.viewer-mode .edit-only { display: none !important; }
body.player-mode .admin-only, body.player-mode .player-hide { display: none !important; }
body.player-mode .betting-layout { grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr); }
body.viewer-mode main input:disabled, body.viewer-mode main textarea:disabled, body.viewer-mode main select:disabled { color: var(--ink); opacity: .72; background: #f3f0e8; }
body.player-mode main .view:not(#view-individual-bets) input:disabled, body.player-mode main .view:not(#view-individual-bets) textarea:disabled, body.player-mode main .view:not(#view-individual-bets) select:disabled { color: var(--ink); opacity: .72; background: #f3f0e8; }
.text-button { width: 100%; margin-top: 8px; padding: 7px; color: var(--gold-soft); background: transparent; border: 0; text-decoration: underline; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { padding: 28px clamp(20px, 4vw, 56px); color: white; background: linear-gradient(120deg, #073d28, #0d5c3b 62%, #816018); display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.brand-lockup { display: flex; align-items: center; gap: clamp(14px, 2vw, 22px); min-width: 0; }
.brand-logo { width: clamp(66px, 7vw, 88px); height: clamp(66px, 7vw, 88px); flex: 0 0 auto; object-fit: contain; filter: drop-shadow(0 5px 12px rgba(0,0,0,.28)); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(28px, 4vw, 44px); letter-spacing: -.03em; }
h2 { font-size: clamp(24px, 3vw, 34px); margin-bottom: 0; }
h3 { margin-bottom: 0; font-size: 20px; }
.subhead { margin-bottom: 0; color: #dce9df; }
.eyebrow { margin-bottom: 6px; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; font-size: 12px; color: var(--gold); }
.top-actions, .button-row { display: flex; align-items: center; gap: 10px; }
.sync-status { white-space: nowrap; border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 850; border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.18); }
.sync-status.online { color: #effff4; background: rgba(10,80,44,.72); }
.sync-status.saving { color: #fff2c8; background: rgba(95,67,8,.72); }
.sync-status.offline { color: #ffe4e1; background: rgba(126,37,31,.82); }
.button-row.wrap { flex-wrap: wrap; }
.button { border: 1px solid transparent; border-radius: 999px; padding: 10px 16px; background: var(--green); color: #fff; font-weight: 750; transition: transform .15s, box-shadow .15s; }
.button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.14); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.button.secondary { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); }
main .button.secondary { color: var(--green); background: white; border-color: var(--green); }
.button.danger { background: #7d2b28; }
.button.primary { background: var(--green); }
.button.small { padding: 7px 12px; font-size: 13px; }
.file-button input { display: none; }
.tabs { display: flex; overflow-x: auto; gap: 10px; padding: 0 clamp(16px, 4vw, 56px); background: var(--green-dark); }
.tab-group { display: flex; flex: 0 0 auto; align-items: stretch; }
.tab-group-label { display: flex; align-items: center; max-width: 116px; padding: 8px 11px; color: var(--gold-soft); background: rgba(255,255,255,.08); border-right: 1px solid rgba(255,255,255,.16); font-size: 10px; font-weight: 900; letter-spacing: .08em; line-height: 1.2; text-transform: uppercase; }
.trophy-tab-group { border-left: 2px solid var(--gold); }
.trophy-tab-group .tab-group-label { max-width: 132px; color: #fff4c9; background: rgba(201,154,52,.2); }
.tab { white-space: nowrap; border: 0; color: #cbd9d0; background: transparent; padding: 16px 18px; font-weight: 750; border-bottom: 3px solid transparent; }
.tab.active { color: white; border-bottom-color: var(--gold); }
.mobile-tabs { position: -webkit-sticky; position: sticky; top: 0; z-index: 700; display: grid; grid-template-columns: minmax(170px, 230px) minmax(240px, 310px); justify-content: center; gap: 12px; padding: 10px clamp(12px, 4vw, 56px); background: var(--green-dark); box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.mobile-menu { position: relative; min-width: 0; }
.mobile-menu summary { position: relative; padding: 12px 38px 12px 15px; list-style: none; cursor: pointer; user-select: none; border: 1px solid rgba(255,255,255,.26); border-radius: 12px; color: white; background: rgba(255,255,255,.09); font-weight: 850; }
.mobile-menu summary [data-menu-label] { display: block; line-height: 1.2; }
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu summary::after { content: "⌄"; position: absolute; right: 14px; top: 9px; color: var(--gold-soft); font-size: 20px; transition: transform .18s; }
.mobile-menu[open] summary { border-color: var(--gold); background: rgba(201,154,52,.16); }
.mobile-menu[open] summary::after { transform: rotate(180deg); }
.mobile-menu-options { position: absolute; top: calc(100% + 7px); left: 0; z-index: 710; width: min(285px, calc(100vw - 24px)); overflow: hidden; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 18px 44px rgba(0,0,0,.28); }
.mobile-menu:last-child .mobile-menu-options { right: 0; left: auto; }
.mobile-menu .tab { display: block; width: 100%; margin: 0; padding: 12px 13px; border: 0; border-radius: 9px; color: var(--green-dark); background: transparent; text-align: left; white-space: normal; }
.mobile-menu .tab.active { color: white; background: var(--green); }
.mobile-menu .tab + .tab { margin-top: 2px; }
main { max-width: 1500px; margin: auto; padding: 30px clamp(16px, 4vw, 56px) 64px; }
.view { display: none; }
.view.active { display: block; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.section-heading-actions { display: flex; max-width: 620px; flex-direction: column; align-items: flex-end; gap: 10px; }
.section-heading-actions .button { display: inline-flex; align-items: center; text-decoration: none; }
.status-note { max-width: 620px; margin-bottom: 3px; color: var(--muted); line-height: 1.45; }
.two-column { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 22px; }
.panel { min-width: 0; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); margin-bottom: 22px; }
.panel.compact { margin-top: 20px; }
.late-sales-settings { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(260px, 1.2fr); gap: 16px; align-items: end; margin: 14px 0; padding: 14px; border-radius: 12px; background: #edf4ef; }
.late-sales-settings label span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 800; color: var(--green-dark); }
.late-sales-warning { padding: 10px 12px; border-left: 3px solid var(--gold); background: #fff8e6; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.player-guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.player-guide-card { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-content: start; }
.player-guide-card h3 { margin: 4px 0 12px; color: var(--green-dark); }
.player-guide-card ol, .player-guide-card ul { margin: 0 0 14px; padding-left: 21px; line-height: 1.55; }
.player-guide-card li + li { margin-top: 8px; }
.player-guide-number { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 20px; font-weight: 900; }
.player-guide-table td:first-child { color: var(--green-dark); font-weight: 850; }
.player-guide-footer { margin: 18px 0 0; padding: 13px 15px; border-radius: 12px; background: var(--gold-pale); line-height: 1.5; }
.hint, .source { color: var(--muted); font-size: 14px; line-height: 1.5; }
.source { margin: 14px 0 0; font-style: italic; }
.table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
th, td { border-bottom: 1px solid #e6e0d4; padding: 10px 8px; }
input[type="text"], input[type="number"], input[type="datetime-local"], textarea, select { width: 100%; border: 1px solid #bfc8c1; border-radius: 10px; padding: 9px 10px; background: white; color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(201,154,52,.28); border-color: var(--gold); }
.qty { width: 76px !important; }
.summary-strip { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: #edf4ef; font-weight: 750; line-height: 1.5; }
.horse-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.horse-row { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 8px; }
.horse-number { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-weight: 850; }
.pill { display: inline-block; border-radius: 999px; padding: 5px 10px; background: var(--gold-soft); color: #694c0f; font-size: 12px; font-weight: 800; }
.segmented { display: inline-flex; padding: 4px; margin-bottom: 16px; border-radius: 999px; background: #ded8ca; }
.segmented button { border: 0; border-radius: 999px; background: transparent; padding: 10px 18px; font-weight: 800; }
.segmented button.active { color: white; background: var(--green); }
.tv-stage { min-height: 520px; padding: clamp(22px, 4vw, 48px); color: white; background: radial-gradient(circle at 80% 20%, #196f4c, #062b1d 62%); border-radius: 24px; box-shadow: 0 22px 60px rgba(5,46,30,.28); }
.reveal-stage { min-height: 620px; display: flex; flex-direction: column; }
.stage-top { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.shuffle-board { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px; }
.shuffle-telemetry { grid-column: 1 / -1; display: grid; grid-template-columns: auto auto auto auto minmax(140px, 1fr); align-items: center; gap: 16px; padding: 10px 14px; border: 1px solid rgba(244,228,183,.32); border-radius: 10px; color: #dce9df; background: rgba(0,0,0,.24); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; letter-spacing: .08em; }
.shuffle-telemetry b { color: var(--gold-soft); }
.telemetry-progress { height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.12); }
.telemetry-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #aa7d20, #ffe5a0); box-shadow: 0 0 12px rgba(255,229,160,.55); transition: width .08s linear; }
.shuffle-column { position: relative; overflow: hidden; padding: 16px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: 16px; }
.shuffle-board.processing .shuffle-column::after { content: ""; position: absolute; z-index: 2; inset: -30% 0 auto; height: 36%; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(244,228,183,.10), transparent); animation: matrix-scan 1.05s linear infinite; }
.shuffle-column h4 { margin: 0 0 12px; color: var(--gold-soft); }
.shuffle-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-height: 330px; overflow: hidden; }
.shuffle-chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 8px; border-radius: 8px; background: rgba(255,255,255,.10); font-size: 13px; transition: color .07s, background .07s, transform .07s, box-shadow .07s; }
.shuffle-chip.hot { color: #1d1608; background: #f4d98d; transform: translateY(-1px); box-shadow: 0 0 16px rgba(244,217,141,.5); }
@keyframes matrix-scan { from { transform: translateY(0); } to { transform: translateY(460%); } }
.reveal-card { max-width: 840px; margin: 54px auto 28px; padding: 36px; text-align: center; border: 2px solid var(--gold); border-radius: 22px; background: rgba(0,0,0,.22); }
.reveal-stage .reveal-card { width: min(900px, 100%); margin-top: auto; margin-bottom: auto; padding: clamp(42px, 7vw, 84px) 36px; }
.reveal-card .horse { font-size: clamp(30px, 5vw, 58px); font-weight: 900; }
.reveal-card .owner { margin-top: 8px; color: var(--gold-soft); font-size: clamp(24px, 4vw, 42px); font-weight: 850; }
.sealed-card { min-height: 330px; margin-top: 24px; display: grid; place-items: center; text-align: center; padding: 36px; border: 1px solid rgba(255,255,255,.18); border-radius: 20px; background: rgba(0,0,0,.18); }
.sealed-card .seal { width: 92px; height: 92px; margin: 0 auto 18px; display: grid; place-items: center; border: 3px solid var(--gold); border-radius: 50%; color: var(--gold-soft); font-size: 38px; font-weight: 900; }
.sealed-card h4 { margin: 0 0 8px; font-size: clamp(26px, 4vw, 42px); }
.sealed-card p { max-width: 680px; margin: 0 auto; color: #dce9df; line-height: 1.5; }
.revealed-history { margin-top: 20px; padding: 14px 16px; border-radius: 12px; background: rgba(255,255,255,.08); }
.revealed-history summary { cursor: pointer; color: var(--gold-soft); font-weight: 800; }
.revealed-history .revealed-grid { margin-top: 14px; }
.hidden { display: none !important; }
.revealed-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.revealed-item { padding: 10px; border-radius: 10px; background: rgba(255,255,255,.09); font-size: 13px; }
.allocation-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
.allocation-panel { min-width: 0; }
.allocation-table { width: 100%; }
.allocation-table th, .allocation-table td { vertical-align: top; }
.allocation-table th:first-child { width: 48%; }
.allocation-scratched { color: var(--red); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.allocation-progress { margin: 14px 0 0; }
.scratch-list { display: grid; gap: 12px; }
.scratch-heading-actions { display: grid; justify-items: end; gap: 8px; max-width: 620px; }
.scratch-heading-actions .status-note { margin: 0; }
.scratch-row { display: grid; grid-template-columns: minmax(230px, 1fr) auto auto; align-items: center; gap: 14px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.scratch-row.scratched { border-color: #cd766f; background: #fff2ef; }
.sweep-decisions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.results-entry label { display: block; margin-bottom: 8px; font-weight: 800; }
.results-entry textarea { margin-bottom: 12px; font-size: 17px; }
.payout-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.money { font-variant-numeric: tabular-nums; font-weight: 850; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; gap: 12px; align-items: end; }
.settings-grid label, .bet-form-grid label, fieldset label { display: grid; gap: 6px; color: var(--green-dark); font-size: 13px; font-weight: 800; }
.betting-roster-add { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 12px; align-items: end; margin: 18px 0; }
.betting-roster-add label, .ledger-selector-panel label { display: grid; gap: 6px; color: var(--green-dark); font-size: 13px; font-weight: 800; }
.ledger-selector-panel > div { width: min(440px, 100%); }
.ledger-selector-panel .hint { margin: 8px 0 0; }
.betting-layout { display: grid; grid-template-columns: minmax(320px, .72fr) minmax(0, 1.28fr); gap: 22px; align-items: start; }
.betting-layout.ledger-only { grid-template-columns: minmax(0, 1fr); }
.betting-layout.ledger-only .participant-ledger { grid-column: 1 / -1; }
body.viewer-mode .betting-layout { grid-template-columns: 1fr; }
body.viewer-mode .participant-ledger { grid-column: 1 / -1; }
.bet-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.balance-callout { margin: 4px 0 0; color: var(--green); font-size: 22px; font-weight: 900; }
.bet-row-actions { display: flex; gap: 6px; }
.status-won { color: var(--green); font-weight: 800; }
.status-lost { color: var(--red); font-weight: 800; }
.status-pending { color: #7c651f; font-weight: 800; }
@media (min-width: 901px) {
  .betting-layout.ledger-only #participant-bets { overflow-x: visible; }
  .betting-layout.ledger-only #participant-bets table { table-layout: fixed; }
  .betting-layout.ledger-only #participant-bets th,
  .betting-layout.ledger-only #participant-bets td { overflow-wrap: anywhere; }
  .betting-layout.ledger-only #participant-bets th:nth-child(1) { width: 12%; }
  .betting-layout.ledger-only #participant-bets th:nth-child(2) { width: 13%; }
  .betting-layout.ledger-only #participant-bets th:nth-child(3) { width: 20%; }
  .betting-layout.ledger-only #participant-bets th:nth-child(4) { width: 10%; }
  .betting-layout.ledger-only #participant-bets th:nth-child(5) { width: 12%; }
  .betting-layout.ledger-only #participant-bets th:nth-child(6) { width: 11%; }
  .betting-layout.ledger-only #participant-bets th:nth-child(7) { width: 10%; }
  .betting-layout.ledger-only #participant-bets th:nth-child(8) { width: 12%; }
}
.payout-status { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.payout-status.paid { color: #fff; background: var(--green); }
.payout-status.unpaid { color: #fff; background: var(--red); }
.payout-status.waiting { color: #6a5310; background: #fff1bf; }
.payout-status.none { color: var(--muted); background: #ece9e1; }
.activation-code-sheet { margin-top: 18px; padding: 18px; border: 2px solid var(--gold); border-radius: 18px; background: #fffaf0; }
.activation-code-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.activation-code-card { display: grid; gap: 5px; padding: 13px; border: 1px dashed #a17a24; border-radius: 12px; background: white; }
.activation-code-card span { color: var(--muted); font-weight: 750; }
.activation-code-card strong { color: var(--green-dark); font-size: 25px; letter-spacing: .15em; font-variant-numeric: tabular-nums; }
.activation-print-root { display: none; }
.activation-print-page { min-height: 250mm; padding: 16mm; color: #17201b; border: 2px solid #c99a34; border-radius: 8mm; background: white; break-after: page; page-break-after: always; }
.activation-print-page:last-child { break-after: auto; page-break-after: auto; }
.activation-print-brand { display: flex; align-items: center; gap: 8mm; margin-bottom: 9mm; }
.activation-print-brand img { width: 30mm; height: 30mm; object-fit: contain; }
.activation-print-page h1 { color: #073d28; font-size: 25pt; }
.activation-print-page .event-title { margin: -1mm 0 1.5mm; color: #9b7018; font-size: 14pt; }
.activation-print-code { margin: 8mm 0; padding: 6mm; text-align: center; border: 2px dashed #c99a34; border-radius: 5mm; }
.activation-print-code strong { display: block; margin-top: 3mm; color: #073d28; font-size: 34pt; letter-spacing: .18em; }
.activation-print-qr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7mm; margin: 7mm 0 5mm; }
.activation-print-qr-row figure { display: flex; align-items: center; gap: 4mm; margin: 0; padding: 3mm; border: 1px solid #d9c89f; border-radius: 4mm; background: #fffdf7; break-inside: avoid; }
.activation-print-qr-row img { width: 34mm; height: 34mm; flex: 0 0 34mm; object-fit: contain; }
.activation-print-qr-row figcaption { display: grid; gap: 1.5mm; min-width: 0; color: #073d28; }
.activation-print-qr-row figcaption strong { font-size: 12pt; }
.activation-print-qr-row figcaption span { overflow-wrap: anywhere; font-size: 9pt; }
.activation-print-page ol { padding-left: 7mm; font-size: 11pt; line-height: 1.45; }
.activation-print-url { overflow-wrap: anywhere; font-weight: 850; color: #0d5c3b; }
.race-selector { display: flex; max-width: 100%; overflow-x: auto; }
.race-selector button { display: grid; min-width: 76px; gap: 1px; line-height: 1.05; text-align: center; }
.race-selector button span { font-size: 0.68rem; letter-spacing: 0.06em; }
.race-selector button strong { font-size: 0.92rem; }
.dividend-groups { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 14px; }
fieldset { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #faf7f0; }
legend { padding: 0 7px; color: var(--green-dark); font-weight: 900; }
fieldset label + label { margin-top: 10px; }
.place-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.place-grid label + label { margin-top: 0; }
.duet-fieldset { grid-column: span 3; }
.three-input-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.leaderboard-summary { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.leader-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.leader-card:first-child { color: white; border-color: var(--gold); background: linear-gradient(135deg, var(--green-dark), var(--green)); }
.leader-card .rank { color: var(--gold); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.leader-card .name { margin: 5px 0; font-size: 24px; font-weight: 900; }
.leader-card .balance { font-size: 22px; font-weight: 900; }
.betting-chart-panel { overflow: hidden; }
.betting-balance-chart { margin-top: 8px; }
.chart-scroll { max-width: 100%; overflow-x: auto; padding-bottom: 4px; }
.betting-balance-svg { display: block; width: 100%; min-width: 780px; height: auto; }
.chart-plot-background { fill: #fbfaf6; stroke: #dfd7c8; }
.chart-grid-line { stroke: #d9d2c6; stroke-width: 1; stroke-dasharray: 5 5; }
.chart-grid-line.vertical { stroke-opacity: .58; }
.chart-axis-label { fill: #55645c; font-family: Inter, system-ui, sans-serif; font-size: 14px; font-weight: 700; }
.chart-axis-title { fill: var(--green-dark); font-family: Inter, system-ui, sans-serif; font-size: 16px; font-weight: 900; }
.chart-series-line { filter: drop-shadow(0 1px 1px rgba(7, 46, 31, .12)); }
.chart-point { stroke: white; stroke-width: 2; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; padding: 12px 8px 2px; }
.chart-legend-item { display: inline-flex; align-items: center; gap: 7px; color: var(--green-dark); font-size: 13px; font-weight: 800; }
.chart-legend-swatch { display: inline-block; flex: 0 0 20px; width: 20px; height: 4px; border-radius: 99px; box-shadow: 0 0 0 1px rgba(0,0,0,.05); }
.chart-legend-swatch.series-0 { background: #0b6b50; }
.chart-legend-swatch.series-1 { background: #c08b18; }
.chart-legend-swatch.series-2 { background: #a64b44; }
.chart-legend-swatch.series-3 { background: #315c8c; }
.chart-legend-swatch.series-4 { background: #7b4d9b; }
.chart-legend-swatch.series-5 { background: #d16b2f; }
.chart-legend-swatch.series-6 { background: #2f7f8f; }
.chart-legend-swatch.series-7 { background: #8d6e35; }
.chart-legend-swatch.series-8 { background: #4f6f52; }
.chart-legend-swatch.series-9 { background: #a23b72; }
.chart-hidden-zone rect { fill: rgba(250,247,239,.92); stroke: rgba(201,154,52,.45); stroke-width: 2; stroke-dasharray: 8 8; }
.chart-hidden-zone text { fill: var(--green-dark); font-family: Georgia, "Times New Roman", serif; font-size: 58px; font-weight: 900; }
.leaderboard-future { color: var(--green-dark); background: rgba(201,154,52,.13); font-weight: 900; text-align: center; }
.trophy-stage { min-height: 650px; display: flex; flex-direction: column; }
.trophy-podium { width: min(1050px, 100%); margin: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: end; }
.podium-place { min-height: 230px; display: grid; align-content: center; padding: 24px; text-align: center; border: 1px solid rgba(255,255,255,.2); border-radius: 20px 20px 8px 8px; background: rgba(255,255,255,.08); opacity: .2; filter: blur(5px); transition: .5s; }
.podium-place.revealed { opacity: 1; filter: none; }
.podium-place.first { min-height: 340px; border: 2px solid var(--gold); background: rgba(201,154,52,.16); }
.podium-place.second { min-height: 285px; }
.podium-place .place-number { color: var(--gold-soft); font-size: 16px; font-weight: 900; letter-spacing: .12em; }
.podium-place .podium-name { margin: 12px 0 8px; font-size: clamp(24px, 4vw, 44px); font-weight: 900; }
.podium-place .podium-name.crowded { font-size: clamp(17px, 2.3vw, 27px); line-height: 1.25; }
.podium-place .podium-balance { color: var(--gold-soft); font-size: 24px; font-weight: 850; }
.winner-card { display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #e6e0d4; }
.winner-card:last-child { border-bottom: 0; }
.audit-log { max-height: 560px; overflow: auto; }
.reset-controls { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto; gap: 10px; align-items: center; }
.audit-entry { display: grid; grid-template-columns: 52px 170px 160px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid #e6e0d4; font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 430px; padding: 13px 16px; border-radius: 12px; color: white; background: var(--green-dark); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(4, 25, 16, .72); }
.modal-card { width: min(540px, 100%); padding: 28px; border-radius: 20px; background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.modal-card h2 { margin-bottom: 8px; }
.modal-card label { display: block; margin: 18px 0 7px; font-weight: 800; }
.modal-actions { justify-content: flex-end; margin-top: 20px; }
.modal-card .button.secondary { color: var(--green); background: white; border-color: var(--green); }
.reset-options-card { width: min(680px, 100%); max-height: calc(100vh - 40px); overflow: auto; }
.reset-choice-list { display: grid; gap: 12px; margin-top: 18px; }
.reset-choice { display: grid; gap: 5px; width: 100%; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--green-dark); background: white; text-align: left; cursor: pointer; }
.reset-choice:hover, .reset-choice:focus-visible { border-color: var(--gold); background: var(--gold-pale); outline: none; }
.reset-choice strong { font-size: 16px; }
.reset-choice span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.reset-choice.danger-choice { border-color: rgba(167, 43, 43, .42); }
.reset-choice.danger-choice strong { color: var(--red); }
@media (max-width: 900px) { .topbar, .section-heading, .stage-top { align-items: stretch; flex-direction: column; } .section-heading-actions { align-items: flex-start; } .two-column, .payout-panels, .late-sales-settings, .betting-layout, .settings-grid, .player-guide-grid, .allocation-groups { grid-template-columns: 1fr; } .shuffle-board { grid-template-columns: 1fr; } .shuffle-telemetry { grid-template-columns: 1fr 1fr; gap: 8px 14px; } .telemetry-progress { grid-column: 1 / -1; } .revealed-grid { grid-template-columns: repeat(2, 1fr); } .audit-entry { grid-template-columns: 44px 1fr; } .audit-entry > :nth-child(3), .audit-entry > :nth-child(4) { grid-column: 2; } .reset-controls { grid-template-columns: 1fr; } .dividend-groups { grid-template-columns: 1fr 1fr; } .duet-fieldset { grid-column: span 2; } }
@media (max-width: 900px) {
  body.player-mode .betting-layout { grid-template-columns: minmax(0, 1fr); }
  body.player-mode .bet-entry-panel { grid-column: 1; order: 1; width: 100%; }
  body.player-mode .participant-ledger { grid-column: 1; order: 2; width: 100%; }
}
@media (max-width: 1100px) { .two-column { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .brand-lockup { align-items: flex-start; } .brand-logo { width: 58px; height: 58px; } .horse-grid, .bet-form-grid, .dividend-groups, .place-grid, .three-input-grid, .leaderboard-summary, .trophy-podium, .betting-roster-add { grid-template-columns: 1fr; } .duet-fieldset { grid-column: auto; } .scratch-row { grid-template-columns: 1fr; } .scratch-heading-actions { justify-items: start; } .shuffle-list { grid-template-columns: repeat(2, 1fr); } .top-actions { flex-wrap: wrap; } .podium-place, .podium-place.first, .podium-place.second { min-height: 190px; } }
@media (max-width: 560px) {
  .auth-gate, .admin-password-modal { padding: 12px; }
  .auth-card, .admin-password-card { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .auth-card { padding: 24px 20px; }
  .admin-password-card { padding: 22px 18px; }
  .admin-password-card label { margin-top: 14px; }
}
@media (max-width: 720px) { .auth-buttons { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .mobile-tabs { grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 12px; }
  .mobile-menu-options { width: min(285px, calc(200vw - 34px)); }
  main { padding-top: 22px; }
}
@page { size: A4 portrait; margin: 10mm; }
@media print {
  .topbar, .tabs, .mobile-tabs, .button, .file-button, #view-setup, #view-draw, #view-reveal, #view-scratches, #view-audit, .results-entry, #view-individual-bets, #view-dividends, #view-trophy { display: none !important; }
  html, body { width: 100%; margin: 0; background: white; }
  body { color: #111; font-size: 9pt; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  main { width: 100%; max-width: none; margin: 0; padding: 0; }
  .view { display: none !important; }
  #view-results.active, #view-leaderboard.active { display: block !important; }
  #view-leaderboard .section-heading { margin-bottom: 4mm; }
  #view-leaderboard h2 { font-size: 18pt; }
  #view-leaderboard h3 { font-size: 13pt; }
  #view-leaderboard .panel { width: 100%; margin: 0 0 5mm; padding: 4mm; border-radius: 0; }
  .panel, .leader-card { box-shadow: none; break-inside: avoid; }
  .leaderboard-summary { grid-template-columns: repeat(3, 1fr); gap: 3mm; margin-bottom: 5mm; }
  .leader-card { padding: 3mm; border-radius: 2mm; }
  .leader-card .name { font-size: 14pt; }
  .leader-card .balance { font-size: 12pt; }
  .betting-balance-svg { width: 100%; min-width: 0; }
  .chart-scroll, .table-wrap { width: 100%; overflow: visible; }
  #view-leaderboard table { width: 100%; table-layout: fixed; }
  #view-leaderboard th { white-space: normal; overflow-wrap: anywhere; line-height: 1.1; letter-spacing: 0; }
  #view-leaderboard td { white-space: nowrap; }
  #view-leaderboard th, #view-leaderboard td { padding: 1.2mm .7mm; }
  #betting-leaderboard table { font-size: 6.8pt; }
  #betting-leaderboard th { font-size: 6.1pt; }
  #betting-leaderboard th:first-child { font-size: 0; }
  #betting-leaderboard th:first-child::after { content: "Pos."; font-size: 6.1pt; }
  #betting-leaderboard th:nth-child(1) { width: 8%; }
  #betting-leaderboard th:nth-child(2) { width: 15%; }
  #betting-leaderboard th:nth-child(3) { width: 10%; }
  #betting-leaderboard th:nth-child(4) { width: 10%; }
  #betting-leaderboard th:nth-child(5) { width: 11%; }
  #betting-leaderboard th:nth-child(6) { width: 6%; }
  #betting-leaderboard th:nth-child(7) { width: 6%; }
  #betting-leaderboard th:nth-child(8) { width: 8%; }
  #betting-leaderboard th:nth-child(9) { width: 11%; }
  #betting-leaderboard th:nth-child(10) { width: 15%; }
  #race-balance-table table { font-size: 6.8pt; }
  #race-balance-table th { font-size: 6.2pt; }
  #race-balance-table th:first-child { width: 18%; }
  body.print-activation-codes > * { display: none !important; }
  body.print-activation-codes #activation-print-root { display: block !important; }
  body.print-activation-codes { font-size: 12pt; }
}
