/*
 * 202ch tool colours — explicit dark mode only.
 * Keep score bands, finish rules and dart labels distinct. The light palette,
 * board geometry, hit testing and the existing print rules are untouched.
 */
@media screen {
  html[data-theme="dark"] body.site-theme {
    --darts-s-background: #244d42;
    --darts-s-foreground: #c6ead8;
    --darts-s-border: #568d78;
    --darts-d-background: #244e69;
    --darts-d-foreground: #c2e8ff;
    --darts-d-border: #5796be;
    --darts-t-background: #693248;
    --darts-t-foreground: #ffd3e2;
    --darts-t-border: #b66c88;
    --darts-b-background: #63491f;
    --darts-b-foreground: #fce5ad;
    --darts-b-border: #b99755;
  }

  /* Shared meaning colours keep S / D / T / BULL readable on a dark surface. */
  html[data-theme="dark"] body.site-theme :is(.target-single, .quick-dart.dart-s) {
    background: #244d42;
    border-color: #568d78;
    color: #c6ead8;
  }

  html[data-theme="dark"] body.site-theme :is(.target-double, .quick-dart.dart-d) {
    background: #244e69;
    border-color: #5796be;
    color: #c2e8ff;
  }

  html[data-theme="dark"] body.site-theme :is(.target-triple, .quick-dart.dart-t) {
    background: #693248;
    border-color: #b66c88;
    color: #ffd3e2;
  }

  html[data-theme="dark"] body.site-theme .target-bull {
    background: #63491f;
    border-color: #b99755;
    color: #fce5ad;
  }

  html[data-theme="dark"] body.site-theme .quick-dart.dart-bull {
    background: #453667;
    color: #e0d0ff;
  }

  html[data-theme="dark"] body.site-theme .quick-dart.dart-empty {
    background: #203448;
    color: #b0c4db;
  }

  /* Five finish-rule palettes: aqua / mint / lavender / peach / rose. */
  html[data-theme="dark"] body.site-theme :is(.chart-sheet, .chart-tabs button, .quick-view) {
    --tone: #65c6d7;
    --tone-dark: #24687b;
    --tone-soft: #153a4b;
    --tone-pale: #142e42;
    --quick-accent: var(--tone);
    --quick-soft: var(--tone-soft);
  }

  html[data-theme="dark"] body.site-theme :is(.chart-sheet, .chart-tabs button, .quick-view)[data-tone="mint"] {
    --tone: #84d2b3;
    --tone-dark: #2f705f;
    --tone-soft: #193b36;
    --tone-pale: #183139;
  }

  html[data-theme="dark"] body.site-theme :is(.chart-sheet, .chart-tabs button, .quick-view)[data-tone="lavender"] {
    --tone: #b6a6ed;
    --tone-dark: #66549b;
    --tone-soft: #2c2d4b;
    --tone-pale: #232c42;
  }

  html[data-theme="dark"] body.site-theme :is(.chart-sheet, .chart-tabs button, .quick-view)[data-tone="peach"] {
    --tone: #efb995;
    --tone-dark: #925637;
    --tone-soft: #493323;
    --tone-pale: #352c2c;
  }

  html[data-theme="dark"] body.site-theme :is(.chart-sheet, .chart-tabs button, .quick-view)[data-tone="rose"] {
    --tone: #e9abc1;
    --tone-dark: #8d506d;
    --tone-soft: #422d42;
    --tone-pale: #322c3e;
  }

  html[data-theme="dark"] body.site-theme .chart-tabs button {
    border-color: #355576;
    background: #14283d;
    color: #d4e6f6;
  }

  html[data-theme="dark"] body.site-theme .chart-tabs button small {
    color: #b0c4db;
  }

  html[data-theme="dark"] body.site-theme .chart-tabs button.active {
    background: var(--tone-soft);
    border-color: var(--tone);
    box-shadow: inset 0 -3px var(--tone);
    color: var(--tone);
  }

  html[data-theme="dark"] body.site-theme .chart-tabs button.active small {
    color: inherit;
  }

  html[data-theme="dark"] body.site-theme .chart-sheet {
    border-color: color-mix(in srgb, var(--tone) 48%, #355576);
    background: #102338;
    box-shadow: 0 16px 40px #030b1738;
  }

  html[data-theme="dark"] body.site-theme .chart-title-row {
    background: linear-gradient(100deg, var(--tone-dark), color-mix(in srgb, var(--tone-dark) 85%, #14283d));
    color: #eef7ff;
  }

  html[data-theme="dark"] body.site-theme .chart-mark {
    background: #102b40;
    color: var(--tone);
  }

  html[data-theme="dark"] body.site-theme .chart-header > p {
    background: var(--tone-soft);
    color: var(--tone);
  }

  html[data-theme="dark"] body.site-theme .score-block :is(th, td) {
    border-color: #35506a;
  }

  html[data-theme="dark"] body.site-theme .score-block thead th {
    background: var(--tone-dark);
    color: #eef7ff;
  }

  html[data-theme="dark"] body.site-theme .score-block tbody th {
    background: var(--tone-soft);
    color: var(--tone);
  }

  html[data-theme="dark"] body.site-theme .score-block tbody td {
    background: #102338;
    color: #e7f0fb;
  }

  html[data-theme="dark"] body.site-theme .score-block tbody tr:nth-child(even) td {
    background: var(--tone-pale);
  }

  html[data-theme="dark"] body.site-theme .score-block tbody tr.unavailable :is(th, td) {
    background: #13283a;
    color: #98afc3;
  }

  html[data-theme="dark"] body.site-theme .setup-panel {
    background: linear-gradient(135deg, var(--tone-pale), #102338 75%);
    border-color: color-mix(in srgb, var(--tone) 55%, #355576);
  }

  html[data-theme="dark"] body.site-theme .setup-panel::after {
    color: color-mix(in srgb, var(--tone) 12%, #102338);
  }

  html[data-theme="dark"] body.site-theme :is(.setup-kicker, .setup-panel h2, .chart-footer span:last-child) {
    color: var(--tone);
  }

  html[data-theme="dark"] body.site-theme .setup-section-title {
    background: var(--tone-dark);
    color: #eef7ff;
  }

  html[data-theme="dark"] body.site-theme .setup-examples div {
    background: #183249;
    color: #e7f0fb;
    border-left-color: var(--tone);
  }

  html[data-theme="dark"] body.site-theme .setup-examples.two-darts div {
    background: var(--tone-soft);
    color: var(--tone);
  }

  html[data-theme="dark"] body.site-theme :is(.setup-lead, .setup-foot, .chart-footer) {
    color: #b0c4db;
  }

  html[data-theme="dark"] body.site-theme .quick-view {
    border-color: #355576;
    background: #14283d;
  }

  html[data-theme="dark"] body.site-theme .quick-view-header {
    background: var(--quick-soft);
    color: var(--quick-accent);
  }

  html[data-theme="dark"] body.site-theme :is(.quick-hint, .quick-bull-legend, .quick-legend, .quick-description span) {
    color: #b0c4db;
  }

  html[data-theme="dark"] body.site-theme .quick-list {
    border-color: #355576;
  }

  /* Repeat the same four score-band hues in both rows and shortcut buttons. */
  html[data-theme="dark"] body.site-theme :is(.quick-shortcuts button, .quick-row)[data-band-tone="yellow"] {
    --band-light: #383326;
    --band-dark: #433c29;
    --band-button: #433c29;
    --band-active: #635637;
    --band-line: #aa9160;
    --band-ink: #f2dda2;
  }

  html[data-theme="dark"] body.site-theme :is(.quick-shortcuts button, .quick-row)[data-band-tone="green"] {
    --band-light: #173a36;
    --band-dark: #20473d;
    --band-button: #20473d;
    --band-active: #315d4c;
    --band-line: #6ba58c;
    --band-ink: #c5ebd4;
  }

  html[data-theme="dark"] body.site-theme :is(.quick-shortcuts button, .quick-row)[data-band-tone="blue"] {
    --band-light: #18334c;
    --band-dark: #203e58;
    --band-button: #203e58;
    --band-active: #315a7c;
    --band-line: #669bc0;
    --band-ink: #c7e7ff;
  }

  html[data-theme="dark"] body.site-theme :is(.quick-shortcuts button, .quick-row)[data-band-tone="pink"] {
    --band-light: #352b40;
    --band-dark: #443046;
    --band-button: #443046;
    --band-active: #604058;
    --band-line: #b17e98;
    --band-ink: #f4d2e5;
  }

  html[data-theme="dark"] body.site-theme .quick-row {
    border-bottom-color: #405468;
    background: var(--band-light);
  }

  html[data-theme="dark"] body.site-theme .quick-row:nth-child(even) {
    background: var(--band-dark);
  }

  html[data-theme="dark"] body.site-theme .quick-row h3 {
    color: var(--band-ink);
  }

  html[data-theme="dark"] body.site-theme .quick-row.no-checkout h3 {
    color: #b0c4db;
  }

  html[data-theme="dark"] body.site-theme .quick-description {
    color: #e7f0fb;
  }

  html[data-theme="dark"] body.site-theme .quick-shortcuts button {
    background: var(--band-button);
    border-color: var(--band-line);
    color: var(--band-ink);
  }

  html[data-theme="dark"] body.site-theme .quick-shortcuts button.active {
    background: var(--band-active);
    border-color: var(--band-ink);
    color: var(--band-ink);
    box-shadow: inset 3px 0 var(--band-ink);
  }

  /* Practice / search boards: subdued navy singles and familiar red/green rings. */
  html[data-theme="dark"] body.site-theme .dartboard {
    filter: drop-shadow(0 12px 22px #030b1730);
  }

  html[data-theme="dark"] body.site-theme :is(.board-bezel, .dartboard-bezel) {
    fill: #1b374d;
    stroke: #537791;
  }

  html[data-theme="dark"] body.site-theme .board-number-ring {
    fill: #183248;
    stroke: #476b85;
  }

  html[data-theme="dark"] body.site-theme :is(.board-number, .dartboard-number) {
    fill: #d9edf9;
  }

  html[data-theme="dark"] body.site-theme :is(.board-segment, .mobile-score-ring, .dartboard-segment) {
    stroke: #7391a4;
  }

  html[data-theme="dark"] body.site-theme :is(.single-black, .dartboard-segment.tone-pale) {
    fill: #254256;
  }

  html[data-theme="dark"] body.site-theme :is(.single-cream, .dartboard-segment.tone-cream) {
    fill: #426378;
  }

  html[data-theme="dark"] body.site-theme :is(.ring-red, .inner-bull, .dartboard-segment.tone-red) {
    fill: #b96079;
  }

  html[data-theme="dark"] body.site-theme :is(.ring-green, .outer-bull, .dartboard-segment.tone-green) {
    fill: #4f9f95;
  }

  html[data-theme="dark"] body.site-theme .dartboard-segment.is-aim {
    stroke: #9bd5ff;
  }

  html[data-theme="dark"] body.site-theme .dartboard-input .darts-note-zone--blue-border {
    stroke: #10283e;
  }

  html[data-theme="dark"] body.site-theme .dartboard-input .darts-note-zone--blue {
    stroke: #87c8ef;
  }

  html[data-theme="dark"] body.site-theme .dartboard-input .darts-note-zone--aim {
    stroke: #dac2ff;
  }

  html[data-theme="dark"] body.site-theme .dartboard-input .darts-note-aim-dot {
    fill: #dac2ff;
    stroke: #172d45;
  }

  html[data-theme="dark"] body.site-theme .darts-note-board-caption__key--blue {
    border-top-color: #87c8ef;
  }

  html[data-theme="dark"] body.site-theme :is(.board-segment, .mobile-score-ring, .dartboard-segment):focus-visible {
    stroke: #ffe2a0;
    stroke-width: 4;
    outline: none;
  }

  html[data-theme="dark"] body.site-theme .board-disabled {
    background: rgb(20 45 64 / 92%);
    border-color: #5a7d98;
    color: #e7f0fb;
  }

  html[data-theme="dark"] body.site-theme .board-score-editing .board-disabled {
    background: #322c50;
    border-color: #a690df;
    color: #ece1ff;
  }

  html[data-theme="dark"] body.site-theme .board-disabled.board-round-complete {
    background: transparent;
  }

  html[data-theme="dark"] body.site-theme .board-next-round {
    background: rgb(29 72 63 / 92%);
    color: #d2f7e6;
    border-color: #7fc7ab;
    box-shadow: 0 6px 20px #030b1738, inset 0 0 0 3px #8cceb324;
  }

  html[data-theme="dark"] body.site-theme .board-next-round:hover {
    background: #28594a;
  }

  html[data-theme="dark"] body.site-theme .board-next-round.is-bust {
    background: rgb(85 43 59 / 94%);
    color: #ffd7e6;
    border-color: #da8da8;
    box-shadow: 0 6px 20px #030b1738, inset 0 0 0 3px #efafbf24;
  }

  html[data-theme="dark"] body.site-theme .board-next-round.is-bust:hover {
    background: #6a344a;
  }

  /* Scoreboard board input uses the same subdued red/green palette. */
  html[data-theme="dark"] body.site-theme .board-rim {
    fill: #1b374d;
  }

  html[data-theme="dark"] body.site-theme .board-dark {
    fill: #254256;
  }

  html[data-theme="dark"] body.site-theme .board-light {
    fill: #426378;
  }

  html[data-theme="dark"] body.site-theme :is(.board-green, .board-outer-bull) {
    fill: #4f9f95;
  }

  html[data-theme="dark"] body.site-theme :is(.board-pink, .board-inner-bull) {
    fill: #b96079;
  }

  html[data-theme="dark"] body.site-theme .board-target {
    stroke: #7391a4;
  }

  html[data-theme="dark"] body.site-theme .board-target:focus-visible {
    stroke: #ffe2a0;
    stroke-width: 4;
    outline: none;
  }

  html[data-theme="dark"] body.site-theme .input-mode-tabs button {
    background: #1b334c;
    border-color: #46698a;
    color: #e7f0fb;
  }

  html[data-theme="dark"] body.site-theme .input-mode-tabs button[aria-pressed="true"] {
    background: #1e4d73;
    border-color: #86ccff;
    color: #e7f0fb;
  }

  html[data-theme="dark"] body.site-theme .board-extra-actions button {
    background: #1b334c;
    border-color: #46698a;
    color: #e7f0fb;
  }

  html[data-theme="dark"] body.site-theme .board-centre-action {
    background: #1d483f;
    border-color: #7fc7ab;
    color: #d2f7e6;
    box-shadow: 0 3px 12px #030b1738;
  }

  html[data-theme="dark"] body.site-theme :is(.board-help, .board-status, .board-input-help) {
    color: #b0c4db;
  }

  /* Cricket: preserve pink triples / blue doubles / grey closed numbers. */
  html[data-theme="dark"] body.site-theme .boardwrap svg > circle:first-child {
    fill: #1b374d;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .segment {
    stroke: #7391a4;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .segment[data-m="1"] {
    fill: #254256;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .segment[fill="#f7fbff"] {
    fill: #426378;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .segment[data-m="2"] {
    fill: #4589a8;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .segment[data-m="3"] {
    fill: #b96079;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .segment[fill="#e4eaf0"] {
    fill: #213647;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .segment[fill="#f2f5f8"] {
    fill: #2c4558;
  }

  html[data-theme="dark"] body.site-theme .boardwrap circle.segment[data-m="1"] {
    fill: #4589a8;
  }

  html[data-theme="dark"] body.site-theme .boardwrap circle.segment[data-m="2"] {
    fill: #b96079;
  }

  html[data-theme="dark"] body.site-theme .boardwrap :is(path, circle).segment.closed-segment {
    fill: #2f4555;
    stroke: #607586;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .segment.aimed-segment {
    stroke: var(--accent, #86ccff);
    stroke-width: 3;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .segment.aimed-segment.closed-segment {
    fill: #2f4555;
    stroke-dasharray: 5 3;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .cricket-number {
    fill: #d9edf9;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .other-number {
    fill: #91a9bd;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .number-target.selected {
    fill: color-mix(in srgb, var(--accent, #86ccff) 25%, #12304a);
    stroke: var(--accent, #86ccff);
  }

  html[data-theme="dark"] body.site-theme .boardwrap text.aimed-number {
    fill: #f5fbff;
  }

  html[data-theme="dark"] body.site-theme .boardwrap [role="button"]:focus-visible {
    stroke: #ffe2a0;
    stroke-width: 4;
    outline: none;
  }

  html[data-theme="dark"] body.site-theme :is(.boardwrap .bull-target, .board-miss) {
    border-color: #46698a;
    background: #1b334c;
    color: #e7f0fb;
  }

  html[data-theme="dark"] body.site-theme .boardwrap .bull-target.selected {
    background: #1e4d73;
    border-color: #86ccff;
  }
}
