/* Scandinavian Crown colours are scoped to screen; print keeps the light banner and results. */
.sc-page .sc-hero-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}
.sc-page .sc-hero-image--dark { display: none; }

@media screen {
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] {
    color-scheme: dark;
    --sc-primary: #275c8e;
    --sc-primary-dark: #1d4d78;
    --sc-bg: var(--theme-bg);
    --sc-card: var(--theme-surface);
    --sc-text: var(--theme-text);
    --sc-muted: var(--theme-muted);
    --sc-border: var(--theme-line);
    --sc-success: var(--theme-green);
    --sc-success-bg: var(--theme-green-bg);
    --sc-mobile-navy: #275c8e;
    --sc-mobile-navy-2: #1d4d78;
    --sc-mobile-blue: #275c8e;
    --sc-mobile-gold: var(--theme-gold);
    --sc-mobile-text: var(--theme-text);
    --sc-mobile-muted: var(--theme-muted);
    --sc-mobile-line: var(--theme-line);
    --sc-mobile-bg: var(--theme-bg);
    --sc-mobile-surface: var(--theme-surface);
    --sc-mobile-soft: var(--theme-raised);
    --sc-mobile-shadow: 0 10px 30px #00000040;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-hero-image--light {
    display: none;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-hero-image--dark {
    display: block;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-hero {
    background: var(--theme-bg);
    border: 1px solid var(--theme-line);
    box-shadow: 0 14px 34px #00000040;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-toolbar, .sc-card, .sc-tabs, .sc-player-item, .sc-empty, .sc-schedule-stage-empty) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-line) !important;
    box-shadow: 0 8px 24px #00000030;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-tab-button {
    background: transparent;
    color: var(--theme-muted) !important;
    box-shadow: none;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-tab-button:hover {
    background: var(--theme-hover) !important;
    color: var(--theme-text) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-tab-button.active {
    background: linear-gradient(145deg, #1d4d78, #275c8e) !important;
    color: #ffffff !important;
    box-shadow: inset 0 -2px 0 var(--theme-gold), 0 4px 12px #00000030;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-select-group > span, .sc-admin-form label > span, .sc-search-label, .sc-ranking-stage-filter > span, .sc-schedule-stage-filter > span, .sc-schedule-day-filter > span, .sc-pdf-stage-control > span, .sc-manual-field > span) {
    color: var(--theme-muted) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-meta, .sc-empty, .sc-schedule-stage-empty, .sc-player-item small, .sc-schedule-country-name, .sc-admin-import p, .sc-admin-schedule p, .sc-import-status, .sc-ranking-tiebreak-note, .sc-pdf-stage-help, .sc-pdf-download-empty) {
    color: var(--theme-muted) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-kicker {
    color: var(--theme-gold) !important;
  }
  /* The registration card's styles are injected after the page stylesheets. */
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #sc2027RegistrationCta {
    background: radial-gradient(circle at top right, #f5d18418, transparent 36%), linear-gradient(145deg, var(--theme-raised), var(--theme-surface) 60%, var(--theme-bg));
    border-color: var(--theme-gold);
    color: var(--theme-text);
    box-shadow: 0 18px 44px #00000040, 0 3px 10px #00000025;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #sc2027RegistrationCta h2 {
    color: var(--theme-text);
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #sc2027RegistrationCta p {
    color: var(--theme-muted);
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #sc2027RegistrationCta .sc-2027-cta-badge {
    background: var(--theme-gold-bg);
    color: var(--theme-gold);
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-select-group select, .sc-ranking-stage-filter select, .sc-schedule-stage-filter select, .sc-schedule-day-filter select, .sc-pdf-stage-control select, .sc-admin-form input, #scPlayerSearch) {
    box-shadow: none;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-page :is(button, a, input, select):focus-visible {
    outline: 3px solid var(--theme-gold) !important;
    outline-offset: 3px;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scPlayerSearch:focus {
    border-color: var(--theme-gold) !important;
    box-shadow: 0 0 0 3px #f5d18422;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-tiebreak-note {
    background: var(--theme-raised) !important;
    border-color: var(--theme-line);
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-player-item a, .sc-ranking-table td a, .sc-schedule-table td a) {
    color: var(--theme-link) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-ranking-table, .sc-schedule-table) :is(th, td) {
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-ranking-table, .sc-schedule-table) th {
    background: #1d4d78 !important;
    color: #ffffff !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-table tbody td {
    color: var(--theme-text) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-ranking-table, .sc-schedule-table) tbody td::before {
    color: var(--theme-muted) !important;
  }

  /* Alternating starts keep their distinction without white rows or date badges. */
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block:nth-child(odd) {
    --sc-start-bg: #152232;
    --sc-start-head-bg: #1c2d40;
    --sc-start-border: #365069;
    --sc-start-row-bg: #152232;
    --sc-start-player-bg: #1c2d40;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block:nth-child(even) {
    --sc-start-bg: #142b40;
    --sc-start-head-bg: #1d3b57;
    --sc-start-border: #41607b;
    --sc-start-row-bg: #142b40;
    --sc-start-player-bg: #1b344b;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block {
    background: var(--sc-start-bg) !important;
    border-color: var(--sc-start-border) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block:nth-child(even) {
    box-shadow: inset 4px 0 0 #6b9ecb;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block .sc-start-head {
    background: var(--sc-start-head-bg) !important;
    border-color: var(--sc-start-border) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-start-head strong {
    color: var(--theme-text) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-head span {
    color: var(--theme-text) !important;
    box-shadow: none;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block .sc-schedule-table tbody tr {
    background: var(--sc-start-row-bg) !important;
    border-color: var(--sc-start-border) !important;
    box-shadow: 0 4px 14px #00000025;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block .sc-schedule-table tbody td {
    background: var(--sc-start-row-bg) !important;
    color: var(--theme-text);
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block .sc-schedule-table tbody td:nth-child(2) {
    background: var(--sc-start-player-bg) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer .sc-schedule-total {
    background: var(--theme-raised) !important;
    color: var(--theme-muted) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer .sc-schedule-total.has-result {
    background: var(--theme-green-bg) !important;
    color: var(--theme-green) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(#scScheduleContainer .sc-row-button, #scScheduleAdmin .sc-secondary-button, .sc-manual-cancel) {
    background: var(--theme-raised) !important;
    border-color: var(--theme-line) !important;
    color: var(--theme-link) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(#scScheduleContainer .sc-row-button, #scScheduleAdmin .sc-secondary-button, .sc-manual-cancel):hover {
    background: var(--theme-hover) !important;
    color: var(--theme-text) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer .sc-row-button.danger {
    color: var(--theme-red) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer .sc-row-button.danger:hover {
    background: var(--theme-red-bg) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-page .sc-pdf-download-link {
    background: var(--theme-raised) !important;
    border-color: var(--theme-line) !important;
    color: var(--theme-link) !important;
    box-shadow: none;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-page .sc-pdf-download-link:hover {
    background: var(--theme-hover) !important;
    border-color: var(--theme-link) !important;
  }

  /* Player flags remain visible behind an overlay with readable light names. */
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-page .sc-player-flag-name {
    --sc-dark-flag-overlay: linear-gradient(90deg, #152232 0%, rgba(21, 34, 50, .94) 45%, rgba(21, 34, 50, .78) 100%);
    background-color: var(--theme-raised) !important;
    background-image: none !important;
    border-color: var(--theme-line) !important;
    color: var(--theme-text) !important;
    text-shadow: none !important;
    box-shadow: 0 3px 10px #00000025;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-player-flag-name[data-has-flag="true"] {
    background-image: var(--sc-dark-flag-overlay), var(--sc-player-flag) !important;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-player-flag-name[data-flag-code="se"] {
    background-image: var(--sc-dark-flag-overlay),
      linear-gradient(to right, transparent 31%, #fecc00 31%, #fecc00 39%, transparent 39%),
      linear-gradient(to bottom, transparent 42%, #fecc00 42%, #fecc00 58%, transparent 58%) !important;
    background-color: #006aa7 !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-player-flag-name[data-flag-code="no"] {
    background-image: var(--sc-dark-flag-overlay),
      linear-gradient(to right, transparent 33%, #00205b 33%, #00205b 39%, transparent 39%),
      linear-gradient(to bottom, transparent 44%, #00205b 44%, #00205b 56%, transparent 56%),
      linear-gradient(to right, transparent 29%, #ffffff 29%, #ffffff 43%, transparent 43%),
      linear-gradient(to bottom, transparent 37%, #ffffff 37%, #ffffff 63%, transparent 63%) !important;
    background-color: #ba0c2f !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-player-flag-name[data-flag-code="ee"] {
    background-image: var(--sc-dark-flag-overlay),
      linear-gradient(to bottom, #0072ce 33.333%, #000000 33.333%, #000000 66.666%, #ffffff 66.666%) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-player-flag-name[data-flag-code="de"] {
    background-image: var(--sc-dark-flag-overlay),
      linear-gradient(to bottom, #000000 33.333%, #dd0000 33.333%, #dd0000 66.666%, #ffce00 66.666%) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-player-flag-name[data-flag-code="hu"] {
    background-image: var(--sc-dark-flag-overlay),
      linear-gradient(to bottom, #ce2939 33.333%, #ffffff 33.333%, #ffffff 66.666%, #477050 66.666%) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] a.sc-player-flag-name:hover {
    border-color: var(--theme-link) !important;
    box-shadow: 0 6px 16px #00000040;
  }

  /* Winners, podium colours and administrative PDF dialogs also use the dark palette. */
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-winners-celebration {
    background: radial-gradient(circle at 50% -20%, #f5d18418, transparent 45%), linear-gradient(145deg, #1c2d40, #152232 60%, #0c1521) !important;
    border-color: #8c7540 !important;
    box-shadow: 0 18px 50px #00000040 !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-winner-card {
    background-color: var(--theme-surface) !important;
    background-image: none !important;
    border-color: #8c7540 !important;
    box-shadow: 0 8px 24px #00000030 !important;
    text-shadow: none !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-winner-card[data-has-flag="true"] {
    background-image: linear-gradient(90deg, #152232 0%, rgba(21, 34, 50, .98) 40%, rgba(21, 34, 50, .88) 68%, rgba(21, 34, 50, .78) 100%), var(--sc-winner-flag) !important;
    background-position: center, right center;
    background-repeat: no-repeat;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-winner-card:hover {
    border-color: var(--theme-gold) !important;
    box-shadow: 0 12px 30px #00000050 !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-winners-kicker, .sc-winner-label) {
    color: var(--theme-gold) !important;
    text-shadow: none !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-winner-card::after {
    background: #45371ecc;
    color: var(--theme-gold) !important;
    text-shadow: none !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-winner-name, .sc-winner-stat strong, .sc-pdf-bulk-file, .sc-pdf-bulk-copy strong, .sc-final-count strong) {
    color: var(--theme-text) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-winners-heading p, .sc-winner-stat, .sc-pdf-bulk-copy span, .sc-pdf-bulk-state, .sc-final-copy, .sc-final-count span, .sc-final-count small, .sc-final-actions small, .sc-manual-head span, .sc-manual-summary) {
    color: var(--theme-muted) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-winner-stat, .sc-final-count) {
    background: var(--theme-raised) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-pdf-bulk, .sc-pdf-bulk-row, .sc-final-builder, .sc-manual-modal, .sc-manual-actions) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-line) !important;
    color: var(--theme-text) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-manual-modal {
    box-shadow: 0 28px 80px #00000080;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-manual-notice, .sc-final-ready-badge[data-state="waiting"]) {
    background: var(--theme-gold-bg) !important;
    color: var(--theme-gold) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-final-ready-badge {
    background: var(--theme-raised) !important;
    color: var(--theme-muted) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-final-ready-badge[data-state="ready"] {
    background: var(--theme-green-bg) !important;
    color: var(--theme-green) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-pdf-bulk-row[data-state="success"] .sc-pdf-bulk-state {
    color: var(--theme-green) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-pdf-bulk-row:is([data-state="error"], [data-state="skipped"]) .sc-pdf-bulk-state,
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-pdf-stage-required {
    color: var(--theme-red) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-pdf-bulk-button, .sc-manual-save, #scCreateFinalBtn) {
    background: #275c8e !important;
    color: #ffffff !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] :is(.sc-pdf-bulk-button, .sc-manual-save, #scCreateFinalBtn):hover:not(:disabled) {
    background: #1d4d78 !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-table tbody tr.sc-place-1 td {
    background: var(--theme-gold-bg) !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-table tbody tr.sc-place-2 td {
    background: #334152 !important;
  }
  html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-table tbody tr.sc-place-3 td {
    background: #463329 !important;
  }

  @media (max-width: 700px) {
    html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block[data-start-tone="white"] {
      --sc-start-bg: #152232;
      --sc-start-head-bg: #1c2d40;
      --sc-start-border: #365069;
      --sc-start-row-bg: #152232;
      --sc-start-player-bg: #1c2d40;
    }
    html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block[data-start-tone="blue"] {
      --sc-start-bg: #142b40;
      --sc-start-head-bg: #1d3b57;
      --sc-start-border: #41607b;
      --sc-start-row-bg: #142b40;
      --sc-start-player-bg: #1b344b;
    }
    html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-head span {
      background: var(--theme-raised) !important;
      border-color: var(--theme-line) !important;
    }
    html[data-theme="dark"] body[data-site-page="scandinavian-crown"] #scScheduleContainer.sc-schedule-container .sc-start-block:nth-child(even) {
      box-shadow: none;
    }
    html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-table tbody tr {
      background: var(--theme-surface) !important;
      border-color: var(--theme-line);
      box-shadow: 0 4px 14px #00000025;
    }
    html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-table tbody td:nth-child(2) {
      background: var(--theme-raised) !important;
    }
    html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-table tbody tr.sc-place-1 {
      background: var(--theme-gold-bg) !important;
      border-color: #8c7540;
    }
    html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-table tbody tr.sc-place-2 {
      background: #334152 !important;
      border-color: #718298;
    }
    html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-table tbody tr.sc-place-3 {
      background: #463329 !important;
      border-color: #9f7254;
    }
    html[data-theme="dark"] body[data-site-page="scandinavian-crown"] .sc-ranking-table tbody tr td[data-sc-pdf-download-col] {
      background: transparent !important;
    }
  }
}

