/* Laskerchess — Editorial Ivory
   Quality chess-magazine / FT-app restraint.
   Overrides palette/typography. Layout/IA unchanged. Loads last. */

:root {
  --ink: #1a1a1a;
  --muted: #6b6560;
  --paper: #f7f4ef;
  --line: #e4ddd3;
  --green: #5c2a33;          /* deep burgundy as semantic "accent" stand-in */
  --lime: #3a4a6b;           /* ink-blue hairline accent (replaces flashy lime) */
  --dark: #2a2e38;           /* neutral dark slate for engine */
  --warm: #f0ebe3;

  --focus: #5c2a33;
  --shadow-soft: 0 10px 28px rgba(26, 26, 26, 0.06);

  --ed-ivory: #f7f4ef;
  --ed-paper: #fbf9f5;
  --ed-card: #f0ebe3;
  --ed-ink: #1a1a1a;
  --ed-ink-soft: rgba(26, 26, 26, 0.78);
  --ed-charcoal: #2c3038;
  --ed-burgundy: #5c2a33;
  --ed-burgundy-deep: #452028;
  --ed-inkblue: #3a4a6b;
  --ed-slate: #2a2e38;
  --ed-slate-deep: #1e222a;
  --ed-ui: #fbf9f5;
  --ed-panel-text: #e8e4dc;
  --ed-panel-muted: rgba(232, 228, 220, 0.7);

  --desk-light-square: #f3e4cf;
  --desk-dark-square: #7d4e3b;
  --desk-search: #fbf9f5;
  --desk-search-ink: #1a1a1a;
  --desk-search-muted: #6b6560;
  --desk-search-line: #e4ddd3;
  --desk-field: #ffffff;
}

html {
  scroll-padding-top: 76px;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: Manrope, system-ui, sans-serif;
}

h1, h2, .intro h1, .brand {
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif;
}

h1 {
  letter-spacing: -0.02em;
  font-weight: 500;
}

.topbar {
  z-index: 50;
  background: rgba(251, 249, 245, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.brand-mark {
  background: var(--ed-ink);
  color: var(--ed-ivory);
  font-family: Georgia, serif;
}

nav a:hover {
  color: var(--ed-burgundy);
}

.ghost:hover,
.filter:hover {
  border-color: var(--ed-inkblue);
  color: var(--ed-ink);
}

.eyebrow {
  color: var(--ed-burgundy);
  letter-spacing: 0.14em;
}

h1 em {
  color: var(--ed-inkblue);
  font-style: italic;
}

.research {
  background: var(--ed-charcoal);
  border-radius: 6px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(42, 46, 56, 0.4);
}

.search-label {
  color: rgba(232, 228, 220, 0.85);
  font-family: "Libre Baskerville", Georgia, serif;
  font-weight: 500;
}

.research input,
.searchbar input {
  color: #f7f4ef;
  border-bottom-color: rgba(232, 228, 220, 0.35);
}

.research input::placeholder,
.searchbar input::placeholder {
  color: rgba(247, 244, 239, 0.5);
}

.primary {
  background: var(--ed-burgundy);
  color: #fbf9f5;
}

.primary span {
  color: rgba(251, 249, 245, 0.8);
}

.primary:hover {
  background: var(--ed-burgundy-deep);
}

.filter {
  border-color: rgba(232, 228, 220, 0.28);
  color: #e8e4dc;
}

.filter.active {
  background: var(--ed-inkblue);
  border-color: var(--ed-inkblue);
  color: #fbf9f5;
}

.search-filters {
  border-top-color: rgba(232, 228, 220, 0.2);
}

.search-filters > summary {
  color: #f0ebe3;
}

.search-filters > summary span {
  color: rgba(240, 235, 227, 0.6);
}

@media (min-width: 1101px) {
  .search-filters {
    z-index: 1;
  }
  .search-filters[open] .filter-grid,
  .search-filters[open] .filters {
    z-index: 5;
    background: var(--ed-charcoal);
  }
  .search-filters > summary {
    background: var(--ed-charcoal);
  }
}

@media (max-width: 1100px) {
  .search-filters[open] .filter-grid,
  .search-filters[open] .filters {
    background: var(--ed-charcoal);
  }
}

@media (max-height: 800px) and (min-width: 1101px) {
  html { scroll-padding-top: 52px; }
}

.filter-grid label {
  color: #e8e4dc;
}

.filter-grid input,
.filter-grid select {
  background: #1e222a;
  border-color: rgba(232, 228, 220, 0.28);
  color: #f7f4ef;
}

.workbench {
  background: var(--ed-paper);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
  border-radius: 4px;
  overflow: hidden;
}

.game:hover,
.game.selected {
  background: var(--ed-card);
}

.game-tag,
.detail-top,
.text-button,
.stat-number,
.source-link,
.read-badge {
  color: var(--ed-burgundy);
}

.board {
  box-shadow: 0 8px 24px rgba(26, 26, 26, 0.1);
  border-radius: 2px;
}

.square.light,
button.square.light {
  background: #e8d9c0 !important;
  background-color: #e8d9c0 !important;
}
.square.dark,
button.square.dark {
  background: #6b7054 !important; /* muted olive-walnut */
  background-color: #6b7054 !important;
}

#board:empty,
.board:empty {
  aspect-ratio: 1;
  display: block;
  background-color: #e8d9c0;
  background-image: repeating-conic-gradient(#6b7054 0% 25%, #e8d9c0 0% 50%);
  background-size: 25% 25%;
  background-position: 0 0;
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(26, 26, 26, 0.1);
}

.board[data-preview-static="1"] {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
}
.board-grid-row { display: contents; }

.library-pane {
  background: var(--ed-ivory);
}

.library-tile:hover {
  border-color: var(--ed-inkblue);
}

.engine-box {
  box-shadow: 0 8px 22px rgba(26, 26, 26, 0.08);
}

.notation-box .moves:focus-within,
.engine-pv:focus-within,
.engine-pv li:focus-visible {
  outline-color: var(--ed-burgundy);
}

.material-table th {
  color: var(--ed-burgundy);
  background: var(--ed-card);
}

.data-status {
  color: var(--ed-inkblue);
}

.data-status::before {
  background: var(--ed-burgundy);
  box-shadow: 0 0 0 3px rgba(92, 42, 51, 0.22);
}

.stats { border-color: var(--line); }
.stats div { border-color: var(--line); }

footer {
  border-top-color: var(--line);
  color: var(--muted);
}

.info-tooltip {
  background: var(--ed-charcoal);
  box-shadow: 0 4px 16px rgba(26, 26, 26, 0.28);
}

dialog,
.tool-dialog,
.account-shell {
  background: var(--ed-paper);
}

.tool-dialog .pane-head {
  background: var(--ed-paper);
}

.tool-dialog :is(input, select, textarea):focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(92, 42, 51, 0.18);
}

.notation-box .moves:focus-within,
.engine-pv:focus-within {
  outline: 2px solid var(--ed-burgundy);
}

button.primary,
.detail-actions .primary {
  background: var(--ed-burgundy);
  color: #fbf9f5;
}

.engine-arrow { stroke: var(--ed-burgundy-deep) !important; }
.engine-arrowhead { fill: var(--ed-burgundy-deep) !important; }
#board.is-engine-preview {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--ed-burgundy) 55%, transparent);
}
.square.last-from {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--ed-burgundy) 65%, transparent);
}
.square.last-to {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--ed-inkblue) 70%, transparent);
}

.preview-empty-banner {
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--ed-card);
  color: var(--ed-ink);
  font: 700 0.72rem Manrope, sans-serif;
  letter-spacing: 0.02em;
}
.preview-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 2px;
  background: var(--ed-card);
  color: var(--ed-burgundy);
  font: 700 0.65rem 'DM Mono', monospace;
  vertical-align: middle;
  border: 1px solid var(--line);
}
#game-list .game[disabled],
#game-list .game[data-preview-static="1"] {
  cursor: default;
  opacity: 1;
  width: 100%;
  text-align: left;
}
#game-list .game[data-preview-static="1"].selected {
  background: var(--ed-card);
  box-shadow: inset 3px 0 0 var(--ed-burgundy);
}

/* Engine — neutral dark slate, not green */
.engine-box {
  background: var(--ed-slate) !important;
  color: #e8e4dc !important;
  box-shadow: 0 8px 22px rgba(26, 26, 26, 0.12) !important;
  scrollbar-gutter: stable;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 228, 220, 0.35) transparent;
}

.engine-box.is-collapsed .engine-head,
.engine-head {
  background: var(--ed-slate-deep) !important;
  color: #e8e4dc;
}

.engine-eval {
  color: #c9a86a !important; /* quiet gold for eval only */
}

.engine-name,
.engine-depth-label,
.engine-foot,
.engine-setting-note,
.engine-run-note,
.engine-more summary {
  color: rgba(232, 228, 220, 0.75) !important;
}

.engine-box .ghost {
  color: var(--ed-ink) !important;
  background: #e8e4dc !important;
  border-color: rgba(232, 228, 220, 0.5) !important;
}
.engine-box .ghost:hover {
  color: var(--ed-ink) !important;
  background: #f7f4ef !important;
  border-color: var(--ed-burgundy) !important;
}
.engine-box .ghost:disabled {
  opacity: 0.45;
  color: var(--ed-ink) !important;
  background: #9a948c !important;
  border-color: #9a948c !important;
}
.engine-box .primary {
  background: var(--ed-burgundy) !important;
  color: #fbf9f5 !important;
}
.engine-box .primary:hover {
  background: var(--ed-burgundy-deep) !important;
}

.engine-run-controls label { color: #e8e4dc !important; }
.engine-run-controls input,
.engine-more select,
.engine-more input {
  background: var(--ed-slate-deep);
  border: 1px solid rgba(232, 228, 220, 0.3);
  color: #f7f4ef;
  border-radius: 2px;
}
.engine-run-controls input:focus {
  outline: 3px solid color-mix(in srgb, var(--ed-burgundy) 50%, transparent) !important;
}

.engine-pv li.is-previewing {
  background: #363b48 !important;
  box-shadow: inset 3px 0 0 var(--ed-burgundy) !important;
}
.engine-pv strong { color: #c9a86a !important; }
.engine-pv li:focus-visible,
.engine-pv:focus-within {
  outline-color: var(--ed-burgundy) !important;
}

.notation-box .moves,
.engine-pv {
  scrollbar-color: rgba(107, 101, 96, 0.5) transparent;
  scrollbar-width: thin;
}

.eval-bar { background: #3a4a6b !important; }
.eval-bar-fill { background: #e8d9c0 !important; }

@media (min-width: 1024px) {
  .workspace-scroll-pane { scrollbar-gutter: stable; }
  .workspace-scroll-pane-detail {
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(107, 101, 96, 0.4) transparent;
  }
  .game-list,
  .workspace-scroll-pane-games,
  .library,
  .workspace-scroll-pane-library,
  .library-explorer {
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(107, 101, 96, 0.4) transparent;
  }
}

.workbench { overflow: hidden; }

.notation-box {
  background: var(--ed-paper);
  border-color: var(--line);
  overflow: hidden;
}
.notation-box .moves {
  overflow: auto;
  scrollbar-gutter: stable;
}

.square.legal::after {
  background: color-mix(in srgb, var(--ed-burgundy) 50%, transparent) !important;
}

/* Generous editorial whitespace on intro */
.intro {
  padding-bottom: 1.25rem;
}
.lede {
  max-width: 38rem;
  line-height: 1.65;
}


/* === Shared professional shell polish (visual hierarchy / chrome) === */
.topbar {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand {
  letter-spacing: -0.01em;
  font-weight: 700;
}
.brand-mark {
  border-radius: 4px;
  width: 1.55rem;
  height: 1.55rem;
  display: inline-grid;
  place-items: center;
  font-size: 0.85rem;
  margin-right: 0.45rem;
}
nav a {
  font-weight: 600;
  font-size: 0.84rem;
  opacity: 0.82;
}
nav a:hover { opacity: 1; }

.intro {
  margin-bottom: 0.65rem !important;
}
@media (min-width: 901px) {
  .intro { margin-bottom: 0.4rem !important; }
}
.intro .lede {
  opacity: 0.88;
}
.data-status {
  font-weight: 600;
}

/* Calmer search chrome */
.research {
  overflow: visible;
}
.searchbar {
  align-items: end;
}
.primary {
  border: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.ghost {
  border-radius: 6px;
  font-weight: 600;
}

/* Workbench framing — clearer product shell */
.workbench {
  border-width: 1px;
  border-style: solid;
}

/* Game list density */
.game {
  border-radius: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}
.game-players {
  font-weight: 650;
}
.preview-empty-banner {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Board framing */
.board-shell {
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 70%, #fff);
}
.board {
  outline: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}
.board-ranks,
.board-files {
  opacity: 0.55;
  font-weight: 600;
  font-size: 0.68rem;
}

/* Notation / engine — reduce nested scroll noise */
.notation-box,
.engine-box {
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
}
.notation-box .pane-head,
.engine-head {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  min-height: 40px;
}
.notation-box .tree-actions .ghost,
.notation-box .nag-row .ghost {
  font-size: 0.68rem !important;
  opacity: 0.92;
}
.notation-box .nag-row .ghost[aria-pressed="true"] {
  background: color-mix(in srgb, var(--lime) 18%, transparent) !important;
  color: var(--ink) !important;
  box-shadow: inset 0 0 0 1px var(--lime) !important;
}

/* Kill leftover forest / lime from base */
.engine-box .ghost,
.engine-box .primary {
  /* theme files set concrete colors */
}
#board.is-engine-preview {
  outline: none;
}


/* === Scrollbar restore (pre-POLISH preference) ===
   Stable gutters + visible thin scrollbars on notation / engine / library /
   game-list columns — not the over-cleaned "auto gutter / nearly invisible" look. */
.workspace-scroll-pane,
.workspace-scroll-pane-detail,
.workspace-scroll-pane-games,
.workspace-scroll-pane-library,
.game-list,
.engine-box,
.notation-box .moves,
.library,
.library-explorer {
  scrollbar-gutter: stable !important;
  scrollbar-width: thin;
  overflow-x: hidden;
  overflow-y: auto;
}
.engine-box {
  scrollbar-color: rgba(232, 228, 220, 0.55) rgba(30, 34, 42, 0.55) !important;
}
.notation-box .moves,
.game-list,
.library,
.library-explorer,
.workspace-scroll-pane,
.workspace-scroll-pane-detail,
.workspace-scroll-pane-games,
.workspace-scroll-pane-library {
  scrollbar-color: rgba(107, 101, 96, 0.65) rgba(232, 228, 220, 0.35) !important;
}
.workspace-scroll-pane::-webkit-scrollbar,
.workspace-scroll-pane-detail::-webkit-scrollbar,
.workspace-scroll-pane-games::-webkit-scrollbar,
.workspace-scroll-pane-library::-webkit-scrollbar,
.game-list::-webkit-scrollbar,
.engine-box::-webkit-scrollbar,
.notation-box .moves::-webkit-scrollbar,
.library::-webkit-scrollbar,
.library-explorer::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.workspace-scroll-pane::-webkit-scrollbar-thumb,
.workspace-scroll-pane-detail::-webkit-scrollbar-thumb,
.workspace-scroll-pane-games::-webkit-scrollbar-thumb,
.workspace-scroll-pane-library::-webkit-scrollbar-thumb,
.game-list::-webkit-scrollbar-thumb,
.notation-box .moves::-webkit-scrollbar-thumb,
.library::-webkit-scrollbar-thumb,
.library-explorer::-webkit-scrollbar-thumb {
  background: rgba(107, 101, 96, 0.55);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.engine-box::-webkit-scrollbar-thumb {
  background: rgba(232, 228, 220, 0.45);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.workspace-scroll-pane::-webkit-scrollbar-track,
.workspace-scroll-pane-detail::-webkit-scrollbar-track,
.workspace-scroll-pane-games::-webkit-scrollbar-track,
.workspace-scroll-pane-library::-webkit-scrollbar-track,
.game-list::-webkit-scrollbar-track,
.engine-box::-webkit-scrollbar-track,
.notation-box .moves::-webkit-scrollbar-track,
.library::-webkit-scrollbar-track,
.library-explorer::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.06);
}
.engine-box::after {
  flex-basis: 12px !important;
  min-height: 12px !important;
}


/* Column resizers — visible + interactive in static preview */
.workspace-column-resizer {
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 40 !important;
}
.workspace-column-resizer::before {
  background: color-mix(in srgb, var(--ed-burgundy, #5c2a33) 55%, var(--line)) !important;
  opacity: 0.85 !important;
}
.workspace-column-resizer:hover::before,
.workspace-column-resizer.is-resizing::before,
.workspace-column-resizer:focus-visible::before,
.workspace-column-resizer:focus::before {
  background: var(--ed-burgundy, #5c2a33) !important;
  opacity: 1 !important;
  inset-inline: 3px !important;
}

/* Floating theme switcher */
.theme-switcher {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, #fff);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  backdrop-filter: blur(8px);
}
.theme-switcher a {
  display: inline-block;
  padding: 7px 10px;
  border-radius: 7px;
  font: 700 0.68rem Manrope, system-ui, sans-serif;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
  opacity: 0.75;
}
.theme-switcher a:hover { opacity: 1; background: color-mix(in srgb, var(--line) 55%, transparent); }
.theme-switcher a.is-active {
  opacity: 1;
  background: var(--ink);
  color: var(--paper);
}
.theme-switcher .hub {
  border-left: 1px solid var(--line);
  margin-left: 2px;
  padding-left: 10px;
  opacity: 0.9;
}

footer {
  font-size: 0.78rem;
  opacity: 0.85;
}

/* Editorial-specific hierarchy */
body { letter-spacing: 0.005em; }
.topbar { height: 64px; }
.brand { font-family: "Libre Baskerville", Georgia, "Times New Roman", serif; font-weight: 500; }
.intro h1 { font-weight: 500; line-height: 1.15; }
.research { border-radius: 4px !important; }
.workbench { border-radius: 3px !important; }
.board-shell {
  background: #fbf9f5;
  border-color: #e4ddd3;
  border-radius: 3px;
  padding: 8px;
}
.ghost, .filter, .primary { border-radius: 3px !important; }
.theme-switcher { border-radius: 4px; }
.theme-switcher a { border-radius: 2px; }

/* === Light (Editorial) sharpen pass — product-grade chrome === */
:root {
  --radius-ui: 4px;
  --radius-panel: 6px;
  --radius-shell: 8px;
}
.topbar {
  height: 60px;
  padding-inline: max(20px, calc((100vw - 1240px) / 2));
  background: rgba(251, 249, 245, 0.97);
  border-bottom: 1px solid #ddd5c8;
}
.brand {
  font-size: 1.08rem;
  letter-spacing: -0.015em;
}
.brand-mark {
  border-radius: 3px !important;
  width: 1.4rem;
  height: 1.4rem;
  font-size: 0.78rem;
}
nav a {
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  opacity: 0.78;
}
.topbar-actions .ghost {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: var(--radius-ui) !important;
  font-size: 0.78rem;
}
.intro .eyebrow {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  margin-bottom: 8px;
}
.intro h1 {
  font-size: clamp(1.85rem, 3.2vw, 2.55rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}
.intro .lede {
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 44ch;
  color: #5c574f;
}
.research {
  border-radius: var(--radius-panel) !important;
  padding: 18px 18px 16px;
  border: 1px solid #1e222a;
  box-shadow: 0 12px 32px rgba(26, 26, 26, 0.1);
}
.search-label {
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.searchbar input {
  font-size: 0.95rem;
  padding: 10px 4px 11px;
}
.primary {
  border-radius: var(--radius-ui) !important;
  min-height: 40px;
  padding: 10px 16px;
  letter-spacing: 0.02em;
}
.filter {
  border-radius: 999px !important;
  font-size: 0.72rem;
  padding: 6px 11px;
}
.workbench {
  border-radius: var(--radius-panel) !important;
  border-color: #ddd5c8;
  box-shadow: 0 10px 28px rgba(26, 26, 26, 0.06);
}
.board-shell {
  padding: 10px !important;
  border-radius: var(--radius-shell) !important;
  border: 1px solid #d8d0c4 !important;
  background: #fbf9f5 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}
.board {
  border-radius: 3px;
  outline: 1px solid rgba(26, 26, 26, 0.12) !important;
  box-shadow: 0 6px 18px rgba(26, 26, 26, 0.1);
}
.board-ranks,
.board-files {
  opacity: 0.72;
  font-weight: 650;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  color: #5c574f;
}
.notation-box {
  border-radius: var(--radius-panel) !important;
  background: #fbf9f5 !important;
  border: 1px solid #ddd5c8 !important;
}
.notation-box .pane-head {
  min-height: 42px;
  padding: 8px 10px;
  background: #f3eee6;
  border-bottom: 1px solid #ddd5c8;
}
.engine-box {
  border-radius: var(--radius-panel) !important;
  border: 1px solid #1e222a !important;
}
.engine-head {
  min-height: 42px;
  padding: 8px 10px;
}
.engine-eval {
  font-weight: 750;
  letter-spacing: -0.02em;
}
.theme-switcher {
  border-radius: var(--radius-panel);
  padding: 5px;
  gap: 3px;
  border-color: #ddd5c8;
  box-shadow: 0 10px 28px rgba(26, 26, 26, 0.14);
}
.theme-switcher a {
  border-radius: var(--radius-ui);
  padding: 8px 12px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.theme-switcher a.is-active {
  background: var(--ed-ink);
  color: var(--ed-ivory);
}

/* === Board/notation column resizer (preview) ===
   phase2.css late @media blocks lock .board-stage to a fixed --board-size and
   ignore --board-panel-width that preview-resize.js updates — so the grip looked
   present but dragging changed nothing. Re-bind layout to --board-panel-width
   at the same 1024px gate as the outer workbench splitters. */
@media (min-width: 1024px) {
  .board-stage,
  .board-stage.is-notation-collapsed,
  .board-stage.is-engine-collapsed,
  .board-stage.is-notation-collapsed.is-engine-collapsed {
    --board-panel-width: 400px;
    --board-size: var(--board-panel-width);
    position: relative;
    height: var(--board-panel-width) !important;
    min-height: 300px !important;
    max-height: none !important;
    flex: 0 0 var(--board-panel-width) !important;
    flex-basis: var(--board-panel-width) !important;
    overflow: hidden;
    grid-template-columns: 16px minmax(0, var(--board-panel-width)) minmax(200px, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }
  .board-shell {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    aspect-ratio: auto;
    justify-self: stretch;
    align-self: stretch;
    box-sizing: border-box;
  }
  .workspace-column-resizer-board-detail {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    /* Fallback; preview-resize.js snaps left to board-shell.getBoundingClientRect(). */
    left: calc(16px + var(--board-panel-width)) !important;
    z-index: 50 !important;
    pointer-events: auto !important;
    opacity: 1 !important;
  }
  .game-detail:has(#panel-explorer[open]) .workspace-column-resizer-board-detail {
    display: none !important;
  }
}

/* Short desktop: still allow user-sized board panel (do not re-freeze to 340px). */
@media (min-width: 1101px) and (max-height: 800px) {
  .board-stage,
  .board-stage.is-notation-collapsed,
  .board-stage.is-engine-collapsed,
  .board-stage.is-notation-collapsed.is-engine-collapsed {
    --board-size: var(--board-panel-width);
    height: var(--board-panel-width) !important;
    min-height: 280px !important;
    max-height: none !important;
    flex: 0 0 var(--board-panel-width) !important;
    flex-basis: var(--board-panel-width) !important;
    grid-template-columns: 14px minmax(0, var(--board-panel-width)) minmax(180px, 1fr) !important;
  }
}


/* Theme switcher — buttons (production, no Hub) */
.theme-switcher {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, #fff);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  backdrop-filter: blur(8px);
}
.theme-switcher button {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: 700 0.72rem Manrope, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  opacity: 0.85;
}
.theme-switcher button:hover { opacity: 1; background: color-mix(in srgb, var(--line) 55%, transparent); }
.theme-switcher button.is-active {
  opacity: 1;
  color: var(--ink);
  background: color-mix(in srgb, var(--lime, #c9e765) 55%, var(--paper));
}

/* Professional topbar — Lasker */
.topbar {
  height: 64px !important;
  padding: 0 max(20px, calc((100vw - 1240px) / 2)) !important;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 85%, transparent) !important;
  background: color-mix(in srgb, var(--paper) 88%, transparent) !important;
  backdrop-filter: blur(14px) saturate(1.2) !important;
  z-index: 50 !important;
}
.brand {
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif !important;
  font-weight: 500 !important;
  font-size: 1.28rem !important;
  letter-spacing: -0.03em !important;
  gap: 10px !important;
}
.brand-mark {
  width: 28px !important;
  height: 28px !important;
  border-radius: 7px !important;
  font: 600 0.9rem "DM Mono", monospace !important;
  letter-spacing: 0 !important;
}
.topbar > nav[aria-label="Primary navigation"] {
  gap: 22px !important;
  margin-right: 20px !important;
}
.topbar > nav[aria-label="Primary navigation"] a {
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em !important;
  color: var(--muted) !important;
  padding: 6px 0 !important;
  border-bottom: 2px solid transparent;
}
.topbar > nav[aria-label="Primary navigation"] a:hover {
  color: var(--ink) !important;
  border-bottom-color: color-mix(in srgb, var(--green) 55%, transparent);
}
.topbar-actions {
  gap: 8px !important;
}
.topbar-actions .ghost {
  padding: 8px 12px !important;
  border-radius: 6px !important;
  font-size: 0.78rem !important;
}
