/* Screen chrome for the live app. Board geometry, exports, embeds and event artwork
   belong to their respective renderers. Keep these selectors off game pieces. */
:root {
  --ct-pine: #143e39;
  --ct-fern: #205d4e;
  --ct-sea: #175e83;
  --ct-gilt: #e5b45d;
  --ct-ink: #203733;
  --ct-muted: #526962;
  --ct-rule: #cbd8d1;
  --ct-paper: #fafbf7;
  --ct-wash: #eff4ee;
  --ct-face: Georgia, Cambria, "Times New Roman", serif;
  --ct-ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --ct-hex: polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
  --ct-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m4 10 4 4 8-9' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --ct-dot: radial-gradient(circle,white 0 24%,transparent 26%);
}
body.tournament-page, body.generator-page:not(.generator-embedded):not(.tournament-generator-embedded),
body:has(> :is(.mod-navbar,.practice-header,.scan-header,.trust-header,.site-header,.organizer-topbar,.ct-account-header)) {
  --ui-ink: var(--ct-ink);
  --ui-muted: var(--ct-muted);
  --ui-ocean: var(--ct-sea);
  --ui-ocean-dark: #174c63;
  --ui-line: var(--ct-rule);
  --ui-radius: 6px;
  --paper: var(--ct-paper);
  color: var(--ct-ink);
  background: var(--ct-paper);
  font-family: var(--ct-ui);
}
/* Existing headers retain their collapse, localization and account-menu behavior. */
.generator-app > .panel-topline:has(> .generator-header-actions),
body .tournament-navbar, body .mod-navbar, .practice-header, .scan-header, .trust-header,
.site-header.page-width, .organizer-topbar, .kiosk-app-bar, .ct-account-header {
  background: var(--ct-pine) !important;
  border: 0;
  border-bottom: 3px solid var(--ct-gilt);
  box-shadow: none;
  color: #f8faf4;
}
.practice-header, .scan-header, .trust-header, .site-header.page-width, .ct-account-header {
  box-sizing: border-box; width: 100%; max-width: none; margin: 0;
  min-height: 62px; height: auto; padding: 8px max(18px,calc((100% - 1240px) / 2));
}
.ct-account-header { display: flex; align-items: center }
:is(.panel-topline,.navbar,.practice-header,.scan-header,.trust-header,.site-header,.organizer-topbar,.ct-account-header,.kiosk-app-bar) .ct-brand {
  color: white; background: transparent; text-decoration: none;
}
.ct-brand .ct-brand-mark { background-color: #f6d694; clip-path: var(--ct-hex); padding: 2px; box-sizing: border-box }
.ct-brand .ct-brand-name { font: 700 1.35rem/1.1 var(--ct-face); letter-spacing: 0; color: inherit }
.ct-brand .ct-brand-light { font-weight: 400 }
:is(.panel-topline,.navbar,.kiosk-app-bar) .ct-brand .ct-brand-subtitle, .practice-header .header-label { color: #d3e2d7 }
.generator-suite-nav > a, .tournament-navbar .nav-tool-link, .mod-navbar .navbar-nav .nav-link,
.practice-header .back-link, .scan-header > a:not(.ct-brand), .trust-header nav > a, .site-header nav > a, .organizer-topbar nav > a {
  color: #f5f8f2; background: transparent; border-color: transparent;
  border-radius: 4px; text-decoration: none; font-weight: 600; letter-spacing: 0;
}
:is(.tournament-navbar,.mod-navbar) :is(.nav-tool-link,.nav-link):is(:hover,:focus-visible,.active,[aria-current="page"]),
.tournament-navbar details[open] > .nav-tool-link, .generator-suite-nav > a:is(:hover,:focus-visible),
:is(.trust-header,.site-header,.organizer-topbar) nav > a:is(:hover,:focus-visible,[aria-current="page"]) {
  color: white; background: #28564d; text-decoration: underline; text-decoration-color: var(--ct-gilt); text-underline-offset: 5px;
}
.mod-navbar .navbar-collapse:is(.show,.collapsing) { background: var(--ct-pine) }
body :is(.mod-navbar,.tournament-navbar) .navbar-toggler {
  background-color: #f5f6ed; border: 1px solid #c4d1bd; border-radius: 5px; padding: 5px 8px;
}
:is(.mod-navbar,.tournament-navbar,.panel-topline,.practice-header,.scan-header,.trust-header,.site-header,.kiosk-app-bar,.ct-account-header) :focus-visible {
  outline: 3px solid var(--ct-gilt); outline-offset: 2px;
}
/* Page titles use the same family as the wordmark; dense data keeps the UI face. */
body.tournament-page .tournament-shell h1, .generator-page .title-block h1,
body:has(> .mod-navbar) h1, .organizer-hero h1, .practice-heading h1, .page-heading h1,
.trust-main h1, .site-header ~ main h1, .ct-account-page h1, .kiosk-heading h1, .map-picker-heading h1 {
  font-family: var(--ct-face); font-weight: 700; line-height: 1.1; letter-spacing: 0; text-wrap: balance;
}
.generator-page .title-block h1 { color: var(--ct-pine); font-size: 2rem }
body.tournament-page .tournament-shell :is(h2,h3,h4,h5), .sf-heading h1, .map-title { letter-spacing: 0 }
.tournament-shell :is(.directory-section-heading,.result-page-header), .sf-heading, .practice-heading {
  border-bottom: 1px solid var(--ct-rule); padding-bottom: 16px;
}
.tournament-page .tournament-shell :is(.card,.event-action,.event-progress,.event-link-panel,.tournament-dashboard-card,.participant-status,.round-card,.result-player-card),
#practice :is(.board-panel,.coach-panel), #photo-scan :is(.photo-panel,.controls) {
  border-radius: 6px; box-shadow: none;
}
.tournament-shell :is(.public-tournament-card,.tournament-dashboard-card,.public-filter-card) {
  box-shadow: inset 0 0 0 1px var(--ct-rule) !important;
}
.tournament-shell .public-filter-card { background: var(--ct-wash) }
.tournament-shell .public-tournament-meta { gap: 8px 16px }
.tournament-shell .public-tournament-meta > div {
  padding: 7px 0 0; border: 0; border-top: 1px solid var(--ct-rule); border-radius: 0; background: none;
}
.tournament-shell .public-tournament-meta dt { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: .8rem }
.tournament-shell .public-tournament-meta dd { white-space: normal; overflow: visible; overflow-wrap: anywhere; font-weight: 650 }
.tournament-page .tournament-event-nav {
  background: transparent; border: 0; border-bottom: 1px solid var(--ct-rule); border-radius: 0; padding: 0 0 5px;
}
.tournament-event-nav a { border-radius: 4px }
.tournament-page .tournament-event-nav a[aria-current] {
  color: var(--ct-pine); background: #e5eee6; box-shadow: inset 0 -3px var(--ct-fern);
}
.tournament-page :is(.table,.event-progress-stats,.public-tournament-meta), .kiosk-shell { font-variant-numeric: tabular-nums }
.tournament-page .table { --bs-table-bg: white; --bs-table-border-color: var(--ct-rule); --bs-table-striped-bg: #f5f8f3 }
.tournament-page .table thead th { --bs-table-bg: var(--ct-wash); color: var(--ct-pine); vertical-align: middle }
.tournament-page .btn, .generator-page .mobile-board-actions > .mobile-board-action, .map-picker button { border-radius: 5px }
.tournament-page .btn-primary, .generator-page .mobile-board-actions > .is-primary,
.ct-account-page .primary, .map-picker .map-picker-use {
  background: var(--ct-fern); border-color: var(--ct-fern); color: white; box-shadow: none;
}
.tournament-page .btn-primary:not(:disabled):hover, .generator-page .mobile-board-actions > .is-primary:hover,
.ct-account-page .primary:hover { background: var(--ct-pine); color: white }
.tournament-navbar .btn.tournament-primary-action { background: #f1ce86; color: #27392f; border-color: #f1ce86 }
.tournament-navbar .btn.tournament-primary-action:hover { background: #ffe0a1; color: #23392f }
.tournament-page :is(.btn-outline-primary,.btn-outline-secondary) { background: white; color: var(--ct-fern); border-color: #9db7ab; box-shadow: none }
.tournament-page :is(.btn-outline-primary,.btn-outline-secondary):not(:disabled):is(:hover,.active,[aria-current]) { background: var(--ct-wash); color: var(--ct-pine) }
.tournament-page :is(.form-control,.form-select), .generator-page #hashInput, .sf-shell :is(select,input:not([type=checkbox])),
.ct-account-page input:not([type=checkbox],[type=hidden]) {
  border: 1px solid #a5b8af; border-radius: 5px; background-color: white; color: var(--ct-ink);
}
.tournament-page :is(.form-control,.form-select):disabled { background-color: #edf0ec; color: #54655e }
.tournament-page :is(.form-control,.form-select):is(.is-invalid,[aria-invalid=true]) { border-color: #a42c34 }
.tournament-page :is(.form-control,.form-select):focus, .generator-page #hashInput:focus {
  border-color: var(--ct-sea); box-shadow: 0 0 0 3px #d2e8ef;
}
.tournament-page .form-label, .tournament-page .ct-radio-group legend { color: var(--ct-ink); font-weight: 650 }
.ct-account-page { padding: 0 }
.ct-account-page main { padding: 32px 18px; width: min(100%, 460px) }
.ct-account-page h1 { font-size: 2.1rem }

/* Map reports and scenario setup share the same reading hierarchy as events. */
.page-map-show .map-hero,.page-analyzer-landing .analyzer-hero {
  background: transparent; border: 0; border-bottom: 1px solid var(--ct-rule);
  border-radius: 0; padding: 0 0 24px; box-shadow: none;
}
.page-map-show .map-hero::after { content: none }
.page-map-show .map-card,.page-map-analytics .analytics-card,.page-analyzer-landing .analyzer-card,
body:has(.mod-navbar) :is(.mod-card,.mod-hero-card) { border-color: var(--ct-rule); border-radius: 6px; box-shadow: none }
.page-analyzer-landing .analyzer-hero h1 { font-size: 2.6rem }
.page-analyzer-landing .analyzer-cta,.sf-shell .sf-button,.map-actions .btn { border-radius: 5px; box-shadow: none }
.page-analyzer-landing .analyzer-cta:not(.is-secondary),.sf-shell .sf-button-primary,.map-actions .btn-primary {
  background: var(--ct-fern); border-color: var(--ct-fern); color: white;
}
.page-analyzer-landing .analyzer-cta.is-secondary { border: 1px solid #9db7ab; color: var(--ct-fern); background: white }
.map-picker .map-picker-header { background: var(--ct-paper); border-bottom: 2px solid var(--ct-gilt) }

/* An ocean drafting surface outside the canvas: not part of downloaded board images. */
.generator-page:not(.generator-embedded,.tournament-generator-embedded) .generator-app {
  background-color: #ecf4f2;
  background-image: linear-gradient(#32636c0c 1px,transparent 1px),linear-gradient(90deg,#32636c0c 1px,transparent 1px);
  background-size: 32px 32px;
}
.generator-page .control-panel { background: var(--ct-paper) }
.generator-page:not(.generator-embedded,.tournament-generator-embedded) .generator-utilities { background: var(--ct-paper) }
.generator-page #map-select .selected-map-button { background: var(--ct-pine); border-color: var(--ct-pine); color: white }
.generator-page #map-select .selected-map-button small { color: #d5e6dc }
.generator-page #map-select .available-map-button { background: white; color: var(--ct-pine); border-color: var(--ct-rule) }

/* Unwrapped inputs in the existing views keep their labels, IDs and event listeners.
   Do not replace switches, hidden button inputs, or the native forced-colors UI. */
.ct-radio-group { min-width: 0; margin: 0; padding: 0; border: 0 }
.ct-radio-group legend.form-label { float: none; width: auto; padding: 0; margin-bottom: 4px; font-size: inherit }
.ct-choice-row { display: flex; flex-wrap: wrap; gap: 2px 16px }
.ct-choice { display: inline-flex; position: relative; align-items: center; gap: 8px; min-height: 44px; cursor: pointer }
.ct-choice .hex-option__text { overflow-wrap: anywhere }
.ct-choice input { position: absolute; clip-path: inset(50%); pointer-events: none }
.ct-choice .hex-option__frame,.ct-choice .hex-option__tile { clip-path: var(--ct-hex); display: grid; place-items: center }
.ct-choice .hex-option__frame { width: 25px; height: 29px; background: #e6ccb2; flex: none }
.ct-choice .hex-option__tile { width: 84%; height: 84%; background: #d4a373 }
.ct-choice .hex-option__dot { width: 9px; height: 9px; border-radius: 50%; background: white }
.ct-choice .hex-option__checkmark { width: 76%; height: 76%; background: var(--ct-tick) center / contain no-repeat }
.ct-choice :is(.hex-option__checkmark,.hex-option__dot) { opacity: 0; transform: scale(.7) }
.ct-choice input:checked + .hex-option__frame { background: #ffb703 }
.ct-choice input:checked + .hex-option__frame .hex-option__tile { background: #52b788 }
.ct-choice input:checked + .hex-option__frame :is(.hex-option__checkmark,.hex-option__dot) { opacity: 1; transform: scale(1) }
.ct-choice:has(input:focus-visible) { outline: 3px solid var(--ct-sea); outline-offset: 2px; border-radius: 3px }
.ct-choice:has(input:disabled) { opacity: .55; cursor: not-allowed }
@media not (forced-colors: active) {
  :is(.tournament-page,.generator-page #popmenu,.sf-shell,.ct-account-page) input:is([type=checkbox],[type=radio]):not(:where(.ct-choice input,.btn-check,.visually-hidden,.form-switch input,[role=switch],[hidden])) {
    appearance: none; display: inline-grid; place-items: center; position: relative; vertical-align: middle;
    width: 22px; height: 26px; flex: 0 0 22px; padding: 0; border: 0; border-radius: 0;
    background: transparent; box-shadow: none; cursor: pointer;
  }
  :is(.tournament-page,.generator-page #popmenu,.sf-shell,.ct-account-page) input:is([type=checkbox],[type=radio]):not(:where(.ct-choice input,.btn-check,.visually-hidden,.form-switch input,[role=switch],[hidden]))::before,
  :is(.tournament-page,.generator-page #popmenu,.sf-shell,.ct-account-page) input:is([type=checkbox],[type=radio]):not(:where(.ct-choice input,.btn-check,.visually-hidden,.form-switch input,[role=switch],[hidden]))::after {
    content: ''; position: absolute; inset: 0; clip-path: var(--ct-hex); background: #e6ccb2;
  }
  :is(.tournament-page,.generator-page #popmenu,.sf-shell,.ct-account-page) input:is([type=checkbox],[type=radio]):not(:where(.ct-choice input,.btn-check,.visually-hidden,.form-switch input,[role=switch],[hidden]))::after {
    inset: 2px; background: #d4a373 center / 85% no-repeat;
  }
  :is(.tournament-page,.generator-page #popmenu,.sf-shell,.ct-account-page) input:is([type=checkbox],[type=radio]):checked::before { background-color: #ffb703 }
  :is(.tournament-page,.generator-page #popmenu,.sf-shell,.ct-account-page) input:is([type=checkbox],[type=radio]):checked::after { background-color: #52b788; background-image: var(--ct-tick) }
  :is(.tournament-page,.generator-page #popmenu,.sf-shell,.ct-account-page) input[type=radio]:checked::after { background-image: var(--ct-dot); background-size: 100% }
  :is(.tournament-page,.generator-page #popmenu,.sf-shell,.ct-account-page) input:is([type=checkbox],[type=radio]):disabled { opacity: .55; cursor: not-allowed }
  :is(.tournament-page,.generator-page #popmenu,.sf-shell,.ct-account-page) input:is([type=checkbox],[type=radio]):focus-visible { outline: 3px solid var(--ct-sea); outline-offset: 2px }
}
@media (forced-colors: active) {
  .ct-choice input { position: static; clip-path: none; pointer-events: auto }
  .ct-choice .hex-option__frame { display: none }
}
@media (prefers-reduced-motion: no-preference) {
  .ct-choice .hex-option__frame,.ct-choice :is(.hex-option__dot,.hex-option__checkmark) { transition: transform .15s,opacity .15s }
  @media (hover: hover) { .ct-choice:hover input:enabled + .hex-option__frame { transform: translateY(-1px) } }
}
@media (max-width: 900px) {
  .ct-menu-button { display: inline-grid; place-items: center; flex: none; margin-left: auto;
    width: 44px; height: 44px; padding: 0; border-radius: 5px; border: 1px solid #76968a;
    background: transparent; color: white; cursor: pointer }
  .ct-menu-button::before { content: ''; width: 21px; height: 16px; box-sizing: border-box; border-block: 2px solid;
    background: linear-gradient(currentColor,currentColor) center / 100% 2px no-repeat }
  .ct-menu-button[aria-expanded=true] { background: #28564d; color: #ffe0a1 }
  body nav[data-ct-nav][data-ct-open=false],body.generator-page .generator-app > .panel-topline .generator-suite-nav[data-ct-open=false] { display: none }
  body nav[data-ct-nav][data-ct-open=true],body.generator-page .generator-app > .panel-topline .generator-suite-nav[data-ct-open=true] {
    display: flex; flex-wrap: wrap; width: 100%; align-items: center; justify-content: flex-start;
    gap: 2px 8px; padding: 6px 0; border-top: 1px solid #507068;
  }
  nav[data-ct-open=true] > a { display: inline-flex; align-items: center; min-height: 44px }
  .organizer-topbar .organizer-container, .site-header.page-width,.trust-header { flex-wrap: wrap }
  .organizer-topbar [data-ct-open=true] .desktop-link { display: inline-flex }
  .generator-page .generator-header-actions { gap: 4px }
  .generator-page .title-block h1 { font-size: 1.55rem }
  /* The expansion's sea frame extends 4.5% past each side of its board. */
  .generator-page.generator-expansion:not(.generator-embedded,.tournament-generator-embedded) .board-stage { --board-size: min(90vw,640px) }
  .generator-page .generator-app .control-panel { background: var(--ct-paper) }
}
@media (min-width: 900.01px) { .ct-menu-button { display: none } }
@media (max-width: 600px) {
  .page-analyzer-landing .analyzer-hero h1 { font-size: 1.9rem }
  body .ct-account :is(.ct-account__login,.ct-account__summary) { position: relative; width: 44px; height: 44px; padding: 0; justify-content: center }
  body .ct-account :is(.ct-account__login,.ct-account__summary) > span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  body .ct-account .ct-account__summary > .ct-account__chevron { display: none }
  body .ct-brand .ct-brand-name { font-size: 1.15rem }
  body .ct-brand { column-gap: 7px }
  .trust-header,.site-header.page-width,.scan-header,.practice-header { flex-wrap: wrap; gap: 4px 10px; padding: 6px 12px }
  .trust-header nav,.site-header.page-width nav { gap: 4px 12px }
  .tournament-navbar .container { column-gap: 6px }
}
@media (max-width: 400px) {
  .generator-page .site-language-switcher > summary .language-flag { display: none }
  .generator-page .generator-header-actions .site-language-switcher > summary { min-width: 44px; padding-inline: 5px }
}
