/* Premium UI, layer 1 (calm depth): loaded after every feature sheet and before bold.css, so it can restyle
   shared components through tokens. One vocabulary everywhere: raised surfaces draw a hairline ring (--panel-line),
   a layered shadow and a 1px top light (--highlight); "selected" means a raised surface on a sunken
   track; presses scale to --press-scale. High contrast keeps its solid black edges. */

/* Panels: hairline ring instead of a hard border, a thinner famolu stripe. */
.catalog-launchpad,
.hub-heading {
  border-color: var(--panel-line);
  box-shadow: var(--shadow-md), var(--highlight);
}
.catalog-launchpad::before,
.hub-heading::before { height: 3px; }

/* Lab launchers: tonal tiles with an icon chip and a 1px mid-blue edge (3:1, tests/browser/lab-launchers.spec.js). */
.button.lab-launcher {
  gap: 12px;
  color: var(--brand-ink);
  background: var(--brand-tint);
  border: 1px solid var(--launcher-edge);
  box-shadow: var(--highlight);
}
html:not([data-input="touch"]) .button.lab-launcher:hover { background: var(--surface); box-shadow: var(--shadow-sm); }
.unit-labs .lab-launcher,
.lab-shelf .lab-launcher { padding: 7px 18px 7px 7px; }
.lab-launcher__icon {
  box-sizing: border-box;
  width: 38px;
  height: 38px;
  padding: 8px;
  color: var(--brand);
  background: var(--surface);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-xs), 0 0 0 1px var(--panel-line);
}
html[data-theme="dark"] .lab-launcher__icon { color: var(--brand-ink); background: var(--surface-3); }
.lab-shelf__scroll { background: var(--surface); border-color: var(--panel-line); box-shadow: var(--shadow-xs); }

/* Catalogue toolbar: no box around the box; the search field itself is the raised surface. */
.catalog-toolbar {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.search-field,
.select-field {
  background: var(--surface-raised);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm), var(--highlight);
  transition: box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.search-field:focus-within,
.select-field:focus-within { border-color: var(--brand); box-shadow: var(--shadow-sm), var(--ring-focus); }
/* The field has its own clear button; Chromium's built-in one would be a second ×. */
.search-field input::-webkit-search-cancel-button { display: none; -webkit-appearance: none; appearance: none; }

/* Side navigation: the current topic is a raised chip, not a tinted bar with a left rule. */
.catalogue-nav__link {
  margin: 2px 0;
  padding-left: 14px;
  border-left: 0;
  border-radius: var(--radius-sm);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.catalogue-nav__link[aria-current="location"] {
  color: var(--brand-ink);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--panel-line);
}
.catalogue-nav__link:hover:not([aria-current="location"]) { background: var(--surface-2); }

/* Game cards: ring + layered shadow, a 3px accent, a short lift on hover devices only. */
.game-card {
  border-color: var(--panel-line);
  box-shadow: var(--shadow-sm), var(--highlight);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.game-card::before { height: 3px; }
@media (hover: hover) and (pointer: fine) {
  .game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md), var(--highlight); }
}

/* Buttons: one press feel (scale, not a drop), a top light on raised buttons. */
.button {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs), var(--highlight);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out), background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.button:active:not(:disabled) { transform: scale(var(--press-scale)); }
.button--primary { box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, .22); }

/* Setup dialog ("Kim oynuyor?"). */
.overlay__backdrop { background: var(--scrim); backdrop-filter: blur(8px) saturate(1.1); }
.modal { border: 1px solid var(--panel-line); box-shadow: var(--shadow-lg); }
.setup-modal .modal__header { background: var(--surface); border-bottom: 1px solid var(--line); }
.setup-modal .modal__header h1 { letter-spacing: var(--tracking-display); }
#setupContent { background: var(--bg); }
.setup-panel {
  border-color: var(--panel-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm), var(--highlight);
}
.setup-panel__title { letter-spacing: var(--tracking-tight); }
.modal__actions { background: var(--surface); }
.setup-summary span { background: var(--surface-2); border-color: transparent; }

/* Choice groups: a sunken track; the chosen option is a lifted brand chip inside it. */
.segmented {
  gap: 4px;
  padding: 4px;
  background: var(--track);
  border-radius: calc(var(--radius-sm) + 4px);
  box-shadow: inset 0 1px 2px rgba(11, 27, 51, .07);
}
.segmented > button {
  min-height: 46px;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.segmented > button:active:not(:disabled) { transform: scale(var(--press-scale)); }
html:not([data-input="touch"]) .segmented > button:hover:not(:disabled):not(.is-selected) { color: var(--ink); background: var(--surface-2); }
.segmented > button.is-selected {
  color: var(--on-brand);
  background: var(--primary) linear-gradient(180deg, rgba(255, 255, 255, .12), transparent);
  box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, .18);
  font-weight: 800;
}
html[data-theme="dark"] .segmented { box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
/* Long lists (five or more options wrap onto several rows) read better as separate raised tiles than
   as one big track. */
.segmented:has(> button:nth-child(5)) { gap: 6px; padding: 0; background: transparent; box-shadow: none; }
.segmented:has(> button:nth-child(5)) > button:not(.is-selected) { color: var(--ink); background: var(--surface-raised); box-shadow: var(--shadow-xs), 0 0 0 1px var(--panel-line); }
html[data-theme="dark"] .segmented:has(> button:nth-child(5)) { box-shadow: none; }
html[data-theme="dark"] .segmented:has(> button:nth-child(5)) > button:not(.is-selected) { background: var(--surface-2); }

.time-stepper__button,
.time-stepper__value { border-color: var(--panel-line); box-shadow: var(--shadow-xs), var(--highlight); }

/* Game shell: glass bar with a hairline, not a hard rule. */
.game-shell__header { border-bottom: 1px solid var(--panel-line); box-shadow: var(--shadow-xs); }

/* Duel lanes: keep the identity colours, lighten the key-cap edges. The answer key-caps keep a 2 px edge: a
   1.5 px border paints 1 px at 1× and lane answer controls need a full 2 px outline (contest-visuals.spec.js). */
#arenaPlay[data-activity] .duel-side {
  border-width: 1.5px;
  box-shadow: inset 0 4px 0 var(--side-identity-border), 0 24px 48px -30px var(--side-identity-shadow), var(--shadow-sm);
}
#arenaPlay[data-activity] .duel-side header strong { border-width: 1.5px; box-shadow: var(--shadow-xs), var(--highlight); }
#arenaPlay[data-activity] .duel-options .button {
  background: var(--surface);
  border-width: 2px;
  border-radius: var(--radius-md);
  box-shadow: 0 3px 0 var(--side-identity-border), 0 10px 20px -14px var(--side-identity-shadow), var(--highlight);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background-color var(--dur-fast) ease;
}
html:not([data-input="touch"]) #arenaPlay[data-activity] .duel-options .button:hover:not(:disabled) {
  box-shadow: 0 3px 0 var(--side-identity-border), 0 14px 24px -14px var(--side-identity-shadow), var(--highlight);
}
#arenaPlay[data-activity] .duel-options .button:active:not(:disabled) { box-shadow: 0 1px 0 var(--side-identity-border); transform: translateY(2px) scale(.99); }

/* Teacher tools drawer: a quiet surface header and ringed sections. */
.teacher-drawer { transition: transform .38s var(--ease-drawer), visibility .38s; }
.teacher-drawer__header { background: var(--surface); border-bottom: 1px solid var(--line); }
.teacher-drawer__header p { color: var(--brand-ink); }
.tool-section { border-color: var(--panel-line); box-shadow: var(--shadow-sm), var(--highlight); }

/* High contrast: solid black edges again, no glass or tonal fills. */
body.high-contrast .button.lab-launcher,
body.high-contrast .search-field,
body.high-contrast .select-field,
body.high-contrast .game-card,
body.high-contrast .setup-panel { border: 2px solid #000; }
body.high-contrast .button.lab-launcher { color: #000; background: #fff; }
body.high-contrast .segmented { background: #fff; box-shadow: none; }
body.high-contrast .segmented > button { color: #000; border: 2px solid #000; }
body.high-contrast .segmented > button.is-selected { color: #fff; background: #0b3a8c; box-shadow: none; }

/* Reduced motion (the app's switch, which follows the OS until a choice is saved): no lift and no press
   movement; colour changes stay. */
@media (prefers-reduced-motion: reduce) {
  body:not(.motion-on) :is(.game-card:hover, .button:active:not(:disabled), .segmented > button:active:not(:disabled),
    #arenaPlay[data-activity] .duel-options .button:active:not(:disabled)) { transform: none; }
}
body.reduced-motion :is(.game-card:hover, .button:active:not(:disabled), .segmented > button:active:not(:disabled),
  #arenaPlay[data-activity] .duel-options .button:active:not(:disabled)) { transform: none; }
