/* Alternative event palettes. Dark deliberately keeps the existing styles unchanged. */
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f3f6f3;
  --panel: #ffffff;
  --line: #ccd8d0;
  --text: #18342a;
  --muted: #5b6d63;
  --lime: #246746;
  --warning: #805416;
  --danger: #ad3331;
  --theme-soft: #eaf0eb;
  --theme-input: #ffffff;
  --theme-hover: #e4ece5;
  --theme-active: #dceadd;
  --theme-accent-border: #80a68b;
  --theme-accent-hover: #185334;
  --theme-positive: #275e36;
  --theme-positive-bg: #e6f1e3;
  --theme-warning-bg: #fff2d8;
  --theme-warning-border: #cfac68;
  --theme-danger-bg: #fbeae6;
  --theme-danger-border: #d8a19c;
  --theme-shadow: #18342a1f;
  --theme-backdrop: #13281d80;
  --theme-call-bg: #f3f6f3fa;
  --theme-logo-plate: #1a2d27;
  --theme-award-bg: linear-gradient(105deg, #fff0be, #fffaf0);
  --theme-award-ink: #785211;
  --theme-award-border: #b18b37;
  --theme-silver: #536375;
  --theme-bronze: #8e4f27;
  --theme-reveal-glow: #377b4e30;
}

:root[data-theme='coffee'] {
  color-scheme: light;
  --bg: #f5eee4;
  --panel: #fffaf2;
  --line: #dacaba;
  --text: #422c22;
  --muted: #7a6555;
  --lime: #8d4d2d;
  --warning: #805014;
  --danger: #a92f2f;
  --theme-soft: #eee1d1;
  --theme-input: #fffdf8;
  --theme-hover: #ecddcb;
  --theme-active: #eddbc5;
  --theme-accent-border: #bd906d;
  --theme-accent-hover: #703b22;
  --theme-positive: #41602e;
  --theme-positive-bg: #edf0dd;
  --theme-warning-bg: #fff0d5;
  --theme-warning-border: #c9a169;
  --theme-danger-bg: #f9e6df;
  --theme-danger-border: #d09b91;
  --theme-shadow: #57351f24;
  --theme-backdrop: #34201480;
  --theme-call-bg: #f5eee4fa;
  --theme-logo-plate: #38271e;
  --theme-award-bg: linear-gradient(105deg, #f5dfac, #fff6e4);
  --theme-award-ink: #775013;
  --theme-award-border: #ae8135;
  --theme-silver: #5d6670;
  --theme-bronze: #96502b;
  --theme-reveal-glow: #aa663c30;
}

/* Common public surfaces, including the mobile navigation. */
:root:is([data-theme='light'], [data-theme='coffee']) .test-notice {
  background: var(--theme-positive-bg);
  color: var(--theme-positive);
}
:root:is([data-theme='light'], [data-theme='coffee']) .main-nav a.active,
:root:is([data-theme='light'], [data-theme='coffee']) .event-state {
  background: var(--theme-soft);
}
:root:is([data-theme='light'], [data-theme='coffee']) .screen-button {
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .event-state.live {
  background: var(--theme-active);
  color: var(--lime);
}
:root:is([data-theme='light'], [data-theme='coffee']) .athlete-card.revealed {
  background: var(--theme-active);
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .revealed .status-tag {
  color: var(--lime);
}
:root:is([data-theme='light'], [data-theme='coffee']) #connectionStatus.stale {
  color: var(--warning);
}
:root:is([data-theme='light'], [data-theme='coffee']) .table-head {
  background: var(--theme-soft);
}
:root:is([data-theme='light'], [data-theme='coffee']) .heat-row.current {
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .heat-row p {
  color: var(--text);
}
:root:is([data-theme='light'], [data-theme='coffee']) .toast {
  color: #ffffff;
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(input, select) {
  background: var(--theme-input);
  border-color: var(--line);
}
:root:is([data-theme='light'], [data-theme='coffee']) input::placeholder {
  color: var(--muted);
  opacity: 1;
}
/* These two supplied logos use white artwork. Keep the original pixels on a dark plate. */
:root:is([data-theme='light'], [data-theme='coffee']) :is(.logo-submarine, .logo-pir) {
  background: var(--theme-logo-plate);
  border-radius: 5px;
  padding: 6px;
  box-sizing: border-box;
}
@media (max-width: 1050px) {
  :root:is([data-theme='light'], [data-theme='coffee']) :is(.main-nav, .screen-mode .main-nav) {
    background: var(--panel);
  }
}
@media (max-width: 600px) {
  :root:is([data-theme='light'], [data-theme='coffee']) :is(.logo-submarine, .logo-pir) {
    padding: 4px;
  }
}
@media (min-width: 1051px) and (max-width: 1350px) {
  :root:is([data-theme='light'], [data-theme='coffee']) .main-nav {
    flex-wrap: wrap;
    max-width: 100%;
  }
  :root:is([data-theme='light'], [data-theme='coffee']) .main-nav a {
    font-size: 12px;
    line-height: 1.25;
    padding: 7px 10px;
  }
}

/* Tournament board: selected paths and their cards follow the chosen palette. */
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-format .bracket-format-arrow {
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.bracket-search-input, .bracket-reset) {
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-search-results {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: 0 14px 40px var(--theme-shadow);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.bracket-search-option:hover, .bracket-search-option.is-active) {
  background: var(--theme-active);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-selected {
  background: linear-gradient(110deg, var(--theme-active), var(--panel));
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-selected-eyebrow {
  color: var(--lime);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.bracket-selected-meta, .bracket-step-title, .bracket-step-meta) {
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-step {
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.bracket-viewport, .bracket-column-body) {
  scrollbar-color: var(--theme-accent-border) var(--theme-soft);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-column {
  background: var(--theme-soft);
  border-color: var(--line);
  box-shadow: 0 2px 0 var(--theme-shadow);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-stage-heading {
  background: var(--panel);
  border-color: var(--line);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.bracket-stage-overline, .bracket-stage-status, .bracket-stage-rule) {
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-stage-status.is-complete {
  color: var(--theme-positive);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-stage-count {
  color: var(--lime);
  background: var(--theme-active);
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-person {
  background: var(--panel);
  border-color: var(--line);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-person:hover {
  background: var(--theme-hover);
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.bracket-person-rank, .bracket-person-score strong, .bracket-person-time) {
  color: var(--text);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.bracket-person-number, .bracket-person-score, .bracket-person-score small, .bracket-person-bottom) {
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.bracket-person-marker, .bracket-person-advanced .bracket-person-state) {
  color: var(--theme-positive);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-person-winner {
  background: var(--theme-active);
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.bracket-person-winner .bracket-person-rank, .bracket-person-winner .bracket-person-score strong, .bracket-person-winner .bracket-person-state) {
  color: var(--lime);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-person.is-selected {
  background: var(--theme-active);
  border-color: var(--lime);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-person.is-selected :is(.bracket-person-rank, .bracket-person-score strong) {
  color: var(--lime);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-person.is-selected .bracket-person-name {
  color: var(--text);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-person.is-selected :is(.bracket-person-number, .bracket-person-time, .bracket-person-bottom) {
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-stage-footer {
  background: var(--panel);
  border-color: var(--line);
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.bracket-unassigned, .bracket-unassigned-symbol, .bracket-unassigned p) {
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) .bracket-connections .bracket-path {
  filter: none;
}

/* LIVE cards, result effects, broadcast call and awards. */
:root:is([data-theme='light'], [data-theme='coffee']) .live-root {
  --live-accent: var(--lime);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.live-meta, .live-qr, .live-qr-label > strong) {
  color: var(--text);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.live-meta-divider, .live-qr-label) {
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-meta > span:not(.live-mode):not(.live-meta-divider)::after {
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-mode {
  background: var(--theme-active);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-badge {
  color: #ffffff;
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-disconnected .live-badge {
  background: var(--theme-warning-bg);
  color: var(--warning);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-disconnected .live-signal-text {
  color: var(--warning);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.live-person, .live-ranking) {
  background: var(--panel);
  border-color: var(--line);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-person-published {
  background: var(--theme-active);
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-person-published .live-person-status {
  color: var(--lime);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-rank-head {
  background: var(--theme-soft);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-rank-row {
  border-color: var(--line);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-final-ranking .live-rank-leader {
  background: var(--theme-active);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-dot {
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-dot:hover {
  color: var(--text);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-dot-active {
  color: var(--lime);
  background: var(--theme-active);
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-control {
  color: var(--muted);
  border-color: var(--line);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-control:hover {
  color: var(--text);
  border-color: var(--lime);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-progress {
  background: var(--line);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-paused .live-progress-fill {
  background: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-call {
  background: var(--theme-call-bg);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-call-kicker {
  color: var(--muted);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-call-stage {
  color: var(--text);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-person-reveal {
  animation-name: theme-result-reveal;
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-person-reveal .live-person-status {
  color: var(--lime);
}
/* The existing award rule is important, so its narrowly scoped counterpart is too. */
:root:is([data-theme='light'], [data-theme='coffee']) .live-award-winner {
  background: var(--theme-award-bg) !important;
  box-shadow: inset 4px 0 0 var(--theme-award-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-award-winner :is(.live-rank-place, .live-rank-score strong, .live-rank-status) {
  color: var(--theme-award-ink);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-award-winner .live-rank-name {
  color: var(--text);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-award-silver .live-rank-place {
  color: var(--theme-silver);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-award-bronze .live-rank-place {
  color: var(--theme-bronze);
}
@keyframes theme-result-reveal {
  0% { border-color: var(--lime); box-shadow: inset 0 0 0 2px var(--lime), 0 0 24px var(--theme-reveal-glow); transform: translateY(-3px); }
  25% { box-shadow: inset 0 0 0 1px var(--lime), 0 0 16px var(--theme-reveal-glow); }
  100% { border-color: var(--theme-accent-border); box-shadow: inset 0 0 0 0 transparent, 0 0 0 transparent; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  :root:is([data-theme='light'], [data-theme='coffee']) .live-person-reveal {
    border-color: var(--lime);
    box-shadow: inset 0 0 0 1px var(--lime);
  }
}

/* Organizer cabinet, native dialogs, validation, import and floating LIVE desk. */
:root:is([data-theme='light'], [data-theme='coffee']) .primary {
  color: #ffffff;
}
:root:is([data-theme='light'], [data-theme='coffee']) .primary:hover:enabled {
  background: var(--theme-accent-hover);
}
:root:is([data-theme='light'], [data-theme='coffee']) .secondary {
  background: var(--theme-soft);
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .quiet:hover:enabled {
  background: var(--theme-hover);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(label, .time-fields legend, .replacement-modes legend) {
  color: var(--text);
}
:root:is([data-theme='light'], [data-theme='coffee']) .step-number {
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .workflow-steps .is-current .step-number {
  background: var(--theme-active);
}
:root:is([data-theme='light'], [data-theme='coffee']) .workflow-steps .is-done .step-number {
  color: var(--theme-positive);
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .badge.published {
  color: var(--theme-positive);
  background: var(--theme-positive-bg);
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .badge.draft {
  background: var(--theme-warning-bg);
  border-color: var(--theme-warning-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .station-card.is-published {
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.station-card.is-empty, .circle-stations > .is-empty) {
  background: var(--theme-soft);
}
:root:is([data-theme='light'], [data-theme='coffee']) .score-fields input[aria-invalid=true] {
  border-color: var(--danger);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.advancement-item, .replacement-current, .circle-stations > li, .import-circle) {
  background: var(--theme-input);
}
:root:is([data-theme='light'], [data-theme='coffee']) .advancement-item.ready {
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.advancement-item.tie, .tie-people button) {
  border-color: var(--theme-warning-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .notice {
  background: var(--theme-positive-bg);
  border-color: var(--theme-accent-border);
  color: var(--theme-positive);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.notice.warning, .circle-plan-message, .rename-conflict) {
  background: var(--theme-warning-bg);
  border-color: var(--theme-warning-border);
  color: var(--warning);
}
:root:is([data-theme='light'], [data-theme='coffee']) .notice.error {
  background: var(--theme-danger-bg);
  border-color: var(--theme-danger-border);
  color: var(--danger);
}
:root:is([data-theme='light'], [data-theme='coffee']) .replacement-history li span {
  color: var(--text);
}
:root:is([data-theme='light'], [data-theme='coffee']) dialog {
  border-color: var(--theme-accent-border);
  box-shadow: 0 25px 90px var(--theme-shadow);
}
:root:is([data-theme='light'], [data-theme='coffee']) dialog::backdrop {
  background: var(--theme-backdrop);
}
:root:is([data-theme='light'], [data-theme='coffee']) :is(.replacement-review, .circle-pending-change) {
  background: var(--theme-active);
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .circle-plan-card.is-fixed {
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .import-station {
  border-color: var(--line);
}
:root:is([data-theme='light'], [data-theme='coffee']) .heat-time-table thead th {
  background: var(--theme-soft);
  color: var(--text);
}
:root:is([data-theme='light'], [data-theme='coffee']) .scene-controls .live-screen-link {
  border-color: var(--theme-accent-border);
}
:root:is([data-theme='light'], [data-theme='coffee']) .scene-controls .live-screen-link:hover {
  background: var(--theme-active);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-host-reopen {
  background: var(--theme-active);
  border-color: var(--theme-accent-border);
  box-shadow: 0 5px 25px var(--theme-shadow);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-host-panel {
  background: var(--panel);
  border-color: var(--theme-accent-border);
  box-shadow: 0 12px 55px var(--theme-shadow);
}
:root:is([data-theme='light'], [data-theme='coffee']) .live-host-heading h3 > span {
  color: var(--lime);
}
