:root {
  color-scheme: dark;
  --ink: #f6f3ea;
  --subtle: #bfb9ae;
  --paper: #141513;
  --line: #454139;
  --surface: #20211f;
  --raised: #2a2a26;
  --control-line: #7c7362;
  --gold: #d4b038;
  --gold-light: #edce72;
  --gold-wash: #393021;
  --button-ink: #131009;
  --success: #96deb3;
  --success-wash: #233b2d;
  --danger: #f7a7a4;
  --danger-wash: #382423;
  --dark: #0f100e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 100%;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 275px; }
a { color: inherit; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 4px; }
.site-width { width: min(1176px, calc(100% - 72px)); margin-inline: auto; }
.topbar { background: var(--dark); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 78px; display: flex; gap: 24px; justify-content: space-between; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .98rem; letter-spacing: .015em; font-weight: 850; }
.brand small { margin-top: 2px; color: var(--gold-light); font-size: .69rem; letter-spacing: .12em; font-weight: 760; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--gold-wash); color: var(--gold-light); border: 1px solid var(--control-line); border-radius: 9px; }
.brand-mark i { display: grid; place-items: center; width: 23px; height: 23px; border: 1.5px solid currentColor; border-radius: 50%; }
.brand-mark i::before { content: ""; width: 11px; height: 11px; border: 1px solid currentColor; border-radius: 50%; background: radial-gradient(circle, currentColor 2px, transparent 2.5px); }
nav { height: 78px; display: flex; align-items: stretch; gap: clamp(12px, 3vw, 32px); }
nav a { display: grid; align-items: center; border-bottom: 2px solid transparent; padding-top: 2px; font-size: .94rem; font-weight: 680; color: var(--subtle); text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--gold-light); }
nav a[aria-current="page"] { border-color: var(--gold); }
main { min-height: calc(100vh - 168px); }
.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 408px; margin-top: 27px; border: 1px solid var(--line); border-radius: 22px; background: var(--dark); color: var(--ink); }
.hero::before { content: ""; position: absolute; z-index: -2; inset: 0; background: linear-gradient(90deg, var(--dark) 14%, rgba(15,16,14,.82) 44%, rgba(23,16,10,.3) 78%), url("./tdf-texture.jpg") right 49% / 66% auto no-repeat; opacity: .62; }
.hero::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, var(--dark) 26%, rgba(15,16,14,.75) 40%, transparent 65%); pointer-events: none; }
#board { position: absolute; z-index: -1; right: 2%; top: 50%; transform: translateY(-50%) rotate(-12deg); width: min(62%, 630px); height: auto; filter: drop-shadow(0 15px 28px rgba(0,0,0,.7)); }
.hero-copy { padding: 44px 52px 46px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 15px; color: var(--gold-light); font-size: .79rem; font-weight: 800; letter-spacing: .14em; }
.eyebrow span { height: 4px; width: 4px; border-radius: 50%; background: currentColor; }
h1, h2, h3, p { margin-top: 0; }
.hero h1 { margin: 0 0 15px; font-size: clamp(4rem, 8vw, 7rem); letter-spacing: -.09em; line-height: .85; font-weight: 880; }
.hero h1 em { color: var(--gold-light); font-style: normal; }
.hero-lead { color: var(--ink); max-width: 355px; margin: 23px 0 24px; font-size: 1.07rem; line-height: 1.48; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 46px; padding: 9px 15px; border-radius: 9px; border: 1px solid var(--control-line); background: var(--dark); color: var(--ink); font-weight: 740; text-decoration: none; }
.button:hover:enabled, a.button:hover { border-color: var(--gold); background: var(--gold-wash); }
.button.primary { background: var(--gold); border-color: var(--gold); color: var(--button-ink); }
.button.primary:hover:enabled, a.button.primary:hover { background: var(--gold-light); border-color: var(--gold-light); }
.button.dark { color: var(--gold-light); }
.hero .button span { border-left: 1px solid #76601e; padding-left: 12px; font-size: .86rem; font-weight: 650; }
[data-mark="miss"] { color: var(--danger); }
[data-mark="miss"]:hover:enabled { background: var(--danger-wash); border-color: var(--danger); }
.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) 263px; gap: 24px; margin: 33px 0 40px; align-items: start; }
.section-heading { margin-bottom: 17px; }
.section-heading h2, .overview h2 { font-size: 1.52rem; letter-spacing: -.048em; margin-bottom: 5px; line-height: 1.15; }
.section-heading p, .overview p { margin: 0; line-height: 1.48; color: var(--subtle); }
.training-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.training-card, .overview, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
.training-card { padding: 16px; display: flex; flex-direction: column; align-items: flex-start; }
.card-icon { display: grid; place-items: center; width: 39px; height: 39px; margin-bottom: 17px; border-radius: 9px; background: var(--gold-wash); color: var(--gold-light); }
.card-icon i { display: block; position: relative; }
.card-icon.bingo i { width: 20px; height: 20px; border: 1.5px solid; border-radius: 3px; background: linear-gradient(currentColor,currentColor) center / 1px 100% no-repeat, linear-gradient(currentColor,currentColor) center / 100% 1px no-repeat; }
.card-icon.rescue i { width: 18px; height: 18px; border: 1.5px solid; border-left-color: transparent; border-radius: 50%; }
.card-icon.rescue i::before { content: ""; position: absolute; left: -1px; top: -1px; width: 6px; height: 6px; border-left: 1.5px solid; border-bottom: 1.5px solid; }
.card-icon.sprint i { width: 12px; height: 20px; background: currentColor; clip-path: polygon(57% 0, 100% 0, 69% 40%, 100% 40%, 25% 100%, 39% 54%, 0 54%); }
.training-card h3 { margin-bottom: 6px; font-size: 1.14rem; letter-spacing: -.035em; line-height: 1.2; }
.training-card p { color: var(--subtle); margin-bottom: 14px; line-height: 1.4; font-size: .94rem; }
.training-card .meta { margin-top: auto; margin-bottom: 11px; color: var(--ink); font-weight: 650; font-size: .88rem; }
.training-card .button { width: 100%; min-height: 42px; font-size: .94rem; }
.overview { padding: 18px; }
.overview h2 { font-size: 1.25rem; margin-bottom: 14px; }
.stat { border-top: 1px solid var(--line); padding: 11px 0; }
.stat:first-child { padding-top: 2px; border-top: 0; }
.stat small { display: block; color: var(--subtle); font-size: .86rem; margin-bottom: 3px; }
.stat strong { display: block; color: var(--gold-light); font-size: 1.15rem; letter-spacing: -.025em; }
.text-link, .back-link { display: inline-block; text-underline-offset: 3px; font-weight: 680; }
.text-link { margin-top: 5px; color: var(--gold-light); font-size: .95rem; }
.footer { padding-block: 19px 25px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--subtle); font-size: .9rem; }
.inner-view { max-width: 780px; margin: 26px auto 45px; }
.inner-view h1 { font-size: clamp(2.25rem, 6vw, 4rem); line-height: .98; letter-spacing: -.068em; margin: 15px 0 9px; }
.back-link { font-size: .93rem; color: var(--subtle); }
.panel { margin-top: 15px; padding: clamp(17px, 4vw, 28px); }
.panel > :last-child { margin-bottom: 0; }
.panel p { line-height: 1.5; }
.panel h2 { font-size: 1.35rem; letter-spacing: -.035em; margin-bottom: 8px; }
.level-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.level-picker label { position: relative; }
.level-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.level-picker span { display: block; height: 100%; border: 1px solid var(--control-line); border-radius: 9px; padding: 11px; line-height: 1.4; cursor: pointer; }
.level-picker span small { display: block; margin-top: 4px; color: var(--subtle); font-size: .86rem; }
.level-picker input:checked + span { background: var(--gold-wash); color: var(--gold-light); border-color: var(--gold); }
.level-picker input:focus-visible + span { outline: 3px solid var(--gold-light); outline-offset: 3px; }
.play-meter { display: flex; justify-content: space-between; gap: 12px; font-size: .94rem; font-weight: 680; }
progress { width: 100%; height: 10px; margin: 9px 0 10px; appearance: none; border: 0; border-radius: 20px; overflow: hidden; background: var(--line); accent-color: var(--gold); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--gold); }
progress::-moz-progress-bar { background: var(--gold); }
.target { margin: 13px 0 4px; color: var(--gold-light); font-size: clamp(3.2rem, 12vw, 5.2rem); font-weight: 850; letter-spacing: -.075em; line-height: .97; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.button-row .button { flex: 1; }
.score-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.score-buttons .button { min-height: 56px; touch-action: manipulation; }
.checkout-buttons { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.checkout-buttons .button { padding-inline: 6px; }
.visit-controls { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.visit-controls p, .entry-toggle .hint { margin: 0; color: var(--subtle); }
.visit-controls .score-buttons { margin-top: 8px; }
.entry-toggle { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 10px 0 0; }
.last-entry { margin: 13px 0 0; min-height: 1.5em; color: var(--subtle); font-size: .92rem; }
.route-hint p { margin: 6px 0 0; color: var(--gold-light); }
.dart-slots { list-style: none; padding: 0; display: flex; gap: 6px; margin: 13px 0; }
.dart-slots li { display: grid; gap: 2px; padding: 8px 12px; background: var(--raised); border-radius: 7px; min-width: 72px; }
.dart-slots small { color: var(--subtle); font-size: .78rem; }
.dart-slots strong { color: var(--gold-light); }
.score-picker { max-width: 450px; margin-top: 12px; }
.number-grid, .multiplier-row { display: grid; gap: 6px; margin-top: 6px; }
.number-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.multiplier-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.score-picker .button { min-height: 44px; padding: 4px; touch-action: manipulation; }
.score-picker [aria-pressed="true"] { color: var(--button-ink); background: var(--gold); border-color: var(--gold); }
.score-picker [aria-pressed="true"]:hover:enabled { background: var(--gold-light); }
#data-notice { margin-top: 16px; padding: 10px 14px; color: var(--gold-light); background: var(--gold-wash); border-radius: 8px; }
.session-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.quiet { border: 0; padding: 4px 0; background: transparent; color: var(--subtle); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.target-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0; }
.target-chip { min-width: 47px; min-height: 43px; padding: 8px; display: inline-grid; place-items: center; color: var(--ink); background: var(--raised); border: 1px solid var(--control-line); border-radius: 8px; font-weight: 730; }
button.target-chip[aria-pressed="true"] { color: var(--button-ink); background: var(--gold); border-color: var(--gold); }
.target-chip.done { color: var(--success); background: var(--success-wash); }
.hint { color: var(--subtle); margin-bottom: 8px; }
.result-number { color: var(--gold-light); font-size: 3rem; margin: 7px 0; font-weight: 870; letter-spacing: -.05em; }
.result-breakdown { list-style: none; padding: 0; margin: 13px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.result-breakdown li { background: var(--raised); border-radius: 7px; padding: 9px; display: flex; justify-content: space-between; gap: 5px; }
.history-list { list-style: none; padding: 0; margin: 0; }
.history-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 12px 0; }
.history-list li:first-child { border-top: 0; }
.history-list span { display: block; color: var(--subtle); font-size: .9rem; margin-top: 3px; }
.history-list .item-score { color: var(--ink); font-weight: 760; text-align: right; }
.history-filters { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 15px 0; }
.history-filters label { display: grid; gap: 4px; color: var(--subtle); font-size: .9rem; }
.history-filters select { min-height: 43px; border: 1px solid var(--control-line); border-radius: 7px; padding: 4px 9px; color: var(--ink); background: var(--dark); }
.history-statistics details { margin-bottom: 10px; }
.history-statistics summary, .route-hint summary { cursor: pointer; }
.score-details { margin: 14px 0; }
.score-details p { margin: 4px 0 8px; }
.score-details strong { color: var(--gold-light); }
.stats-table { overflow-x: auto; margin: 10px 0; }
.stats-table table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); }
.stats-table thead { color: var(--subtle); font-size: .9rem; }
.stats-table td { white-space: nowrap; }
.field-stack { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.field-stack .button { flex: none; }
.skip-link { position: fixed; z-index: 3; left: 12px; top: 9px; transform: translateY(-200%); padding: 10px; background: var(--surface); }
.skip-link:focus { transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 960px) {
  .dashboard { grid-template-columns: minmax(0, 1fr); }
  .overview { max-width: none; }
  #overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  #overview .stat { border-top: 0; padding-top: 0; }
}
@media (max-width: 650px) {
  .site-width { width: calc(100% - 30px); }
  .header-inner, nav { min-height: 66px; height: 66px; }
  .brand { gap: 7px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand strong { font-size: .85rem; }
  .brand small { font-size: .61rem; }
  nav a { font-size: .83rem; }
  .hero { min-height: 0; margin-top: 14px; border-radius: 16px; }
  .hero-copy { padding: 27px 20px 28px; }
  .hero h1 { font-size: clamp(3.25rem, 13.5vw, 5.4rem); }
  .hero-lead { max-width: 235px; font-size: .98rem; margin: 18px 0; }
  #board { right: -26%; width: 89%; }
  .hero::after { background: linear-gradient(90deg, var(--dark) 12%, rgba(15,16,14,.8) 49%, transparent 91%); }
  .dashboard { margin-top: 24px; gap: 17px; }
  .training-cards { grid-template-columns: 1fr; gap: 8px; }
  .training-card { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; padding: 12px; }
  .card-icon { grid-row: 1 / 4; margin-bottom: 0; }
  .training-card h3, .training-card p, .training-card .meta, .training-card .button { grid-column: 2; }
  .training-card h3, .training-card p { margin-bottom: 3px; }
  .training-card .meta { margin-block: 3px 8px; }
  .training-card .button { width: auto; justify-self: start; }
  .overview { padding: 13px; }
  .level-picker { gap: 6px; }
  .level-picker span { padding: 8px; }
}
@media (max-width: 365px) {
  .header-inner { gap: 7px; }
  nav { gap: 8px; }
  .brand strong, nav a { font-size: .76rem; }
  .brand-mark { width: 29px; height: 29px; }
  #overview { grid-template-columns: 1fr; gap: 3px; }
  .checkout-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.account-panel { max-width: 32rem; margin: clamp(2rem,7vw,6rem) auto; padding: clamp(1.2rem,4vw,2.5rem); background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 1rem }
.account-panel h1 { font-size: clamp(1.8rem,5vw,2.6rem); margin: 0 0 .7rem }
.account-panel p { line-height: 1.5; color: var(--subtle) }
.account-panel form, #local-import { display: grid; gap: 1rem }
.account-panel label { display: grid; gap: .4rem }
.account-panel input { padding: .8rem; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--control-line); border-radius: .5rem; width: 100% }
.account-panel .text-link { background: transparent; border: 0; padding: .6rem; font: inherit; color: var(--gold-light) }
#auth-status:empty { display: none }
