:root {
  color-scheme: light;
  --page: #f4f6f1;
  --ink: #20372b;
  --muted: #6d786f;
  --muted-strong: #4e6054;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-raised: #edf2e9;
  --surface-soft: #f7f9f5;
  --line: #e0e6dc;
  --line-strong: #cbd5c5;
  --accent: #2c6247;
  --accent-bright: #357454;
  --accent-dark: #204a35;
  --accent-soft: #edf4e8;
  --accent-fill: var(--accent);
  --accent-fill-hover: var(--accent-dark);
  --lime: #3c704c;
  --danger: #b54336;
  --board-light: #ebecd0;
  --board-dark: #739552;
  --shadow: 0 8px 28px rgba(38, 63, 41, 0.06);
  --radius: 14px;
  --board-column-width: min(650px, calc(100dvh - 280px));
  --panel-width: 420px;
  --workspace-gap: 36px;
  font-family: "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--page);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0d0c;
  --ink: #e7efe7;
  --muted: #abb8ad;
  --muted-strong: #c7d5c9;
  --surface: #171c19;
  --surface-solid: #171c19;
  --surface-raised: #2a352d;
  --surface-soft: #202823;
  --line: #35443a;
  --line-strong: #607565;
  --accent: #a3d4ae;
  --accent-bright: #c0e6c6;
  --accent-dark: #76b385;
  --accent-soft: #263c2d;
  --accent-fill: #3b704d;
  --accent-fill-hover: #447954;
  --lime: #b5d99d;
  --danger: #ffad9e;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
  scrollbar-color: #61715f #111713;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-height: 100dvh; margin: 0; background: var(--page); }
button, textarea, input, select { font: inherit; }
button { color: inherit; }
button, a, summary, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
a { color: var(--accent); }
button, a, input, textarea, summary, select { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible,
summary:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #759b59;
  outline-offset: 3px;
}
button svg, .engine-note svg, summary svg, .import-trigger svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
h1, h2, p { overflow-wrap: anywhere; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--accent-fill);
  color: #fff;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.ambient { display: none; }

/* A quiet header keeps both tools and the import action in the same place. */
.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px max(28px, calc((100vw - 1220px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.8px;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  width: 37px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-fill);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 28px;
  line-height: 1;
}
.brand-accent { color: var(--accent); }
.brand small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 450;
  letter-spacing: 0.1px;
}
.site-nav {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}
.site-nav a {
  padding: 9px 16px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: background 140ms, color 140ms;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] {
  background: var(--surface);
  box-shadow: 0 1px 5px rgba(27, 51, 34, 0.09);
  color: var(--accent);
}
.header-tools { display: flex; align-items: center; gap: 16px; }
.theme-toggle { display: inline-flex; width: 38px; min-width: 38px; height: 38px; min-height: 38px; flex: 0 0 auto; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--muted-strong); }
.theme-toggle:hover { background: var(--accent-soft); color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }
.engine-pill {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.status-dot { position: relative; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #949d91; }
.status-dot.is-ready { background: #67964e; box-shadow: 0 0 0 4px #edf4e7; }
.status-dot.is-error { background: var(--danger); }
.status-dot.is-loading { background: #ae8640; }
.status-dot.is-loading::after { position: absolute; inset: -4px; border: 1px solid #ae8640; border-radius: inherit; content: ""; animation: status-pulse 1.3s ease-out infinite; }
@keyframes status-pulse { from { opacity: 0.8; transform: scale(0.5); } to { opacity: 0; transform: scale(1.5); } }
.import-trigger {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.import-trigger:hover { background: var(--accent-soft); border-color: #a4b99c; }

/* The board scales with desktop height; the analysis panel can scroll independently. */
.app-shell {
  display: grid;
  width: min(calc(100% - 64px), calc(var(--board-column-width) + var(--panel-width) + var(--workspace-gap)));
  margin: 24px auto 16px;
  grid-template-columns: minmax(0, 1fr) var(--panel-width);
  gap: 24px var(--workspace-gap);
  align-items: start;
  outline: none;
}
.board-column { width: 100%; min-width: 0; }
.player-strip {
  display: grid;
  min-height: 46px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 6px 0 6px 30px;
}
.player-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe5d9;
}
.player-avatar.light { background: #fff; }
.avatar-piece { width: 100%; height: 100%; object-fit: contain; }
.player-name, .player-detail { margin: 0; }
.player-name { overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.player-detail { margin-top: 2px; color: var(--muted); font-size: 10px; }
.captured-pieces { display: flex; max-width: 180px; flex-wrap: wrap; justify-content: flex-end; }
.captured-piece { width: 21px; height: 21px; object-fit: contain; }
.captured-piece + .captured-piece { margin-left: -6px; }
.board-and-eval { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; }
.eval-track { position: relative; overflow: hidden; border: 1px solid #c8d0c1; border-radius: 5px; background: #fffef8; }
.eval-fill { position: absolute; top: 0; right: 0; left: 0; height: 50%; background: #28392c; transition: height 450ms ease; }
.eval-score { position: absolute; z-index: 1; right: 0; bottom: 8px; left: 0; color: #28392c; font-size: 9px; font-weight: 750; text-align: center; writing-mode: vertical-rl; transform: rotate(180deg); }
.eval-track.is-black-score .eval-score { top: 8px; bottom: auto; color: #fff; transform: none; }
.board-wrap { position: relative; overflow: hidden; width: 100%; border-radius: 5px; box-shadow: 0 4px 18px rgba(43, 62, 34, 0.09), 0 0 0 1px rgba(54, 78, 40, 0.09); isolation: isolate; }
.board-wrap::before { display: block; padding-top: 100%; content: ""; }
.board { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); background: var(--board-light) url("./assets/chesscom/board-green.png") center / 100% 100% no-repeat; user-select: none; touch-action: manipulation; }
.square { position: relative; display: grid; min-width: 0; min-height: 0; padding: 0; place-items: center; border: 0; border-radius: 0; cursor: default; }
.square.light, .square.dark { background: transparent; }
.square.has-own-piece { cursor: grab; }
.square.has-own-piece:active { cursor: grabbing; }
.square:focus-visible { outline: 3px solid #284a38; outline-offset: -4px; z-index: 5; }
.square.last-move::after, .square.best-from::after, .square.best-to::after, .square.selected::after { position: absolute; inset: 0; z-index: 0; content: ""; pointer-events: none; }
.square.last-move::after { background: rgba(247, 211, 75, 0.35); }
.square.best-from::after, .square.best-to::after { background: rgba(241, 187, 66, 0.31); }
.square.selected::after { box-shadow: inset 0 0 0 4px rgba(39, 81, 55, 0.8); }
.piece { position: absolute; inset: 0; z-index: 2; display: block; width: 100%; height: 100%; object-fit: contain; }
.piece.dragging { opacity: 0.3; }
.legal-dot, .capture-ring { position: absolute; z-index: 3; pointer-events: none; }
.legal-dot { width: 19%; aspect-ratio: 1; border-radius: 50%; background: rgba(27, 37, 30, 0.38); }
.capture-ring { inset: 7%; border: clamp(4px, 0.7vw, 8px) solid rgba(35, 47, 38, 0.35); border-radius: 50%; }
.coord { position: absolute; z-index: 4; font-size: clamp(8px, 1.15vw, 12px); font-weight: 750; line-height: 1; pointer-events: none; opacity: 0.9; }
.coord.rank { top: 5px; left: 5px; }
.coord.file { right: 5px; bottom: 4px; }
.square.light .coord { color: var(--board-dark); }
.square.dark .coord { color: var(--board-light); }
.move-arrow { position: absolute; z-index: 6; display: none; height: clamp(8px, 1.2vw, 13px); border: 1px solid rgba(255, 239, 190, 0.4); border-radius: 999px; background: #d99a30; box-shadow: 0 2px 5px rgba(76, 56, 14, 0.25); pointer-events: none; transform-origin: left center; }
.move-arrow::after { position: absolute; top: 50%; right: clamp(-15px, -1.45vw, -10px); width: 0; height: 0; border-top: clamp(10px, 1.3vw, 15px) solid transparent; border-bottom: clamp(10px, 1.3vw, 15px) solid transparent; border-left: clamp(17px, 2vw, 23px) solid #d99a30; content: ""; transform: translateY(-50%); }
.move-arrow.visible { display: block; }
.history-navigation { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px 0 0 30px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.history-navigation button { display: inline-flex; min-width: 38px; min-height: 36px; align-items: center; justify-content: center; gap: 5px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted-strong); font-size: 12px; font-weight: 600; line-height: 1; }
.history-navigation button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.history-navigation > span { min-width: 66px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; text-align: center; }
.history-navigation button:disabled { opacity: 0.32; }
.board-actions { display: flex; justify-content: center; gap: 10px; margin: 4px 0 0 30px; }
.icon-button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 550; }
.icon-button:hover:not(:disabled) { background: var(--surface); border-color: var(--line); color: var(--ink); }
.icon-button svg { width: 15px; height: 15px; }

/* One panel, two clear workspaces: analysis and the game being studied. */
.analysis-panel { min-width: 0; width: 100%; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); scrollbar-width: thin; scrollbar-color: #cbd5c4 transparent; scroll-margin-top: 20px; }
.panel-heading { margin-bottom: 18px; }
.panel-kicker { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 1.4px; line-height: 1.4; text-transform: uppercase; }
.panel-kicker .eyebrow { margin: 0; letter-spacing: 1px; font-size: 9px; }
h1 { margin: 8px 0 0; font-size: 26px; font-weight: 720; letter-spacing: -0.85px; line-height: 1.2; }
.intro { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.turn-badge { display: inline-flex; min-height: 24px; align-items: center; gap: 6px; padding: 0 7px; border-radius: 5px; background: var(--surface-soft); color: var(--muted-strong); font-size: 9px; font-weight: 600; white-space: nowrap; }
.turn-badge span { width: 7px; height: 7px; border: 1px solid #96a18f; border-radius: 50%; background: #fff; }
.turn-badge.black span { background: #29382b; border-color: #29382b; }
.workspace-tabs { display: flex; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.workspace-tabs [role="tab"] { display: inline-flex; min-width: 0; min-height: 34px; flex: 1; align-items: center; justify-content: center; gap: 7px; padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.workspace-tabs [aria-selected="true"] { background: var(--surface); box-shadow: 0 1px 5px rgba(35, 55, 31, 0.08); color: var(--accent); }
.workspace-tabs svg { width: 16px; height: 16px; }
.workspace-tabpanel { min-width: 0; padding-top: 16px; }
.analyze-button { display: grid; width: 100%; min-height: 58px; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 11px; margin: 0; padding: 10px 13px; border: 1px solid var(--accent-fill); border-radius: 10px; background: var(--accent-fill); color: #fff; text-align: left; transition: background 140ms, transform 140ms; }
.analyze-button:hover:not(:disabled) { background: var(--accent-fill-hover); transform: translateY(-1px); }
.analyze-button:active:not(:disabled) { transform: translateY(0); }
.analyze-button:disabled { opacity: 0.6; }
.analyze-icon { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; font-size: 23px; }
.analyze-icon svg { width: 19px; height: 19px; }
.analyze-button.is-analyzing .analyze-icon svg { animation: engine-spin 1.8s linear infinite; }
@keyframes engine-spin { to { transform: rotate(360deg); } }
.button-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.button-copy strong { font-size: 13px; font-weight: 650; }
.button-copy small { color: #d1e2d4; font-size: 10px; }
.button-shortcut { padding: 3px 5px; border: 1px solid rgba(255, 255, 255, 0.24); border-radius: 4px; color: #d6e7d9; font-size: 9px; }
.best-card { margin-top: 14px; padding: 15px; overflow: hidden; border: 1px solid #d3e2c8; border-radius: 12px; background: linear-gradient(135deg, #f1f7eb, #fafcf7); }
.best-card.is-empty { background: var(--surface-soft); border-color: var(--line); }
.best-card-top, .section-title-row, .analysis-stats, .setting-row, .fen-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.line-label { color: var(--muted-strong); font-size: 10px; font-weight: 650; letter-spacing: 0.8px; text-transform: uppercase; }
.line-label b { margin-left: 3px; color: var(--accent); }
.score-chip { display: inline-flex; min-width: 53px; min-height: 26px; align-items: center; justify-content: center; padding: 0 8px; border: 1px solid #d4e1c9; border-radius: 6px; background: #e6efda; color: #396039; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-chip.negative { border-color: #ead7ca; background: #f6ebe2; color: #9c5834; }
.best-main { display: flex; min-height: 74px; align-items: center; justify-content: space-between; gap: 10px; }
.best-move { margin: 2px 0 0; color: #284b32; font-size: 39px; font-weight: 700; letter-spacing: -1.8px; line-height: 1.1; }
.best-description { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.play-button { display: inline-flex; min-height: 36px; flex: 0 0 auto; align-items: center; justify-content: center; gap: 5px; padding: 0 10px; border: 1px solid #c7d8bc; border-radius: 7px; background: var(--surface); color: var(--accent); font-size: 11px; font-weight: 650; }
.play-button:hover:not(:disabled) { background: var(--accent-soft); border-color: #94b085; }
.play-button svg { width: 13px; height: 13px; }
.principal-variation { display: flex; min-height: 39px; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #c4d5b9 transparent; }
.pv-move { flex: 0 0 auto; padding: 4px 7px; border-radius: 5px; background: #e9eee3; color: #53604c; font-size: 10px; font-weight: 600; }
.pv-move:first-child { background: #dceacd; color: #36542c; }
.pv-placeholder { width: 64px; height: 22px; border-radius: 5px; background: var(--surface-raised); }
.pv-placeholder.short { width: 42px; }
.analysis-stats { min-height: 28px; justify-content: flex-start; flex-wrap: wrap; gap: 14px; margin-top: 3px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.analysis-stats b { color: var(--muted-strong); font-weight: 650; }
.alternatives-section { margin-top: 18px; }
.section-title-row h2 { margin: 0; color: var(--ink); font-size: 12px; font-weight: 650; letter-spacing: -0.1px; }
.section-title-row > span { color: var(--muted); font-size: 10px; }
.alternatives { display: grid; gap: 6px; margin-top: 9px; }
.alternative { display: grid; width: 100%; min-height: 44px; grid-template-columns: 22px 44px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-align: left; transition: background 140ms, border-color 140ms; }
.alternative:not(.empty):hover { border-color: #b4c8a7; background: var(--surface-soft); }
.alternative > span:first-child { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 5px; background: var(--surface-raised); color: var(--muted); font-size: 10px; font-weight: 650; }
.alternative .alt-move { color: var(--ink); font-size: 13px; font-weight: 700; }
.alternative .alt-line, .alternative.empty p { overflow: hidden; margin: 0; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.alternative .alt-score { color: var(--muted-strong); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.alternative.empty { grid-template-columns: 22px minmax(0, 1fr); cursor: default; }

/* Progressive disclosure keeps advanced controls close without filling the screen. */
.analysis-settings, .position-tools, .rating-breakdown { margin-top: 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.analysis-settings summary, .position-tools summary, .rating-breakdown summary { display: flex; min-height: 43px; align-items: center; gap: 8px; padding: 10px 12px; color: var(--muted-strong); font-size: 11px; font-weight: 600; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary svg { width: 14px; height: 14px; margin-left: auto; transition: transform 150ms; }
details[open] > summary svg { transform: rotate(180deg); }
.settings-summary { margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 450; }
.analysis-settings summary svg { margin-left: 0; }
.analysis-settings[open] > summary { border-bottom: 1px solid var(--line); }
.settings-card { padding: 14px 12px; }
.setting-row { flex-wrap: wrap; gap: 12px; }
.setting-label { display: block; color: var(--ink); font-size: 12px; font-weight: 600; }
.setting-row p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.time-options { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.time-options button { min-width: 38px; min-height: 32px; padding: 0 6px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; }
.time-options button.active { background: var(--accent-fill); color: #fff; box-shadow: 0 1px 4px rgba(34, 67, 43, 0.1); }
.time-options button:hover:not(.active) { background: var(--surface-raised); color: var(--ink); }
.setting-divider { height: 1px; margin: 14px 0; background: var(--line); }
.setting-row.compact { min-height: 30px; flex-wrap: nowrap; }
.toggle { position: relative; width: 37px; height: 22px; flex: 0 0 auto; cursor: pointer; }
.toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle span { position: absolute; inset: 0; border: 1px solid #b8c4b3; border-radius: 999px; background: #d7dfd1; transition: background 150ms; }
.toggle span::after { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0002; content: ""; transition: transform 150ms; }
.toggle input:checked + span { background: var(--accent-fill); border-color: var(--accent-fill); }
.toggle input:checked + span::after { transform: translateX(15px); }
.toggle input:focus-visible + span { outline: 3px solid #759b59; outline-offset: 3px; }
.auto-move-card { margin-top: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.auto-move-card:has(input:checked) { border-color: #b2c9a5; background: var(--accent-soft); }
.auto-move-heading, .auto-move-check, .auto-side-label { display: flex; align-items: center; gap: 7px; }
.auto-move-heading { justify-content: space-between; flex-wrap: wrap; gap: 9px; }
.auto-move-check { min-height: 30px; font-size: 12px; font-weight: 650; cursor: pointer; }
.auto-move-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent-fill); }
.auto-side-label { color: var(--muted); font-size: 10px; }
.auto-side-label select { min-height: 32px; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 11px; }
#autoMoveStatus { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.engine-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 15px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.engine-note svg { width: 13px; height: 13px; color: #7a8b71; }

/* Imports and move lists are real work areas, not a footer full of settings. */
.pgn-card { margin: 0; padding: 0; }
.pgn-card h2 { margin: 0; font-size: 13px; }
.pgn-card textarea, .fen-control textarea { display: block; width: 100%; margin-top: 10px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-soft); color: var(--ink); font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; line-height: 1.7; resize: vertical; }
.pgn-card textarea { min-height: 126px; }
textarea::placeholder { color: #85907e; opacity: 1; }
.pgn-card textarea[aria-invalid="true"] { border-color: var(--danger); background: #fff8f5; }
.pgn-hint, .pgn-status, .pgn-error { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.pgn-status { color: var(--accent); }
.pgn-error { padding: 8px 10px; border-radius: 6px; background: #fdf0e9; color: var(--danger); }
.pgn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.pgn-actions a { color: var(--accent); font-size: 11px; text-underline-offset: 3px; }
.small-button, .subtle-button, .fen-actions button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; border: 1px solid #c5d6bb; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 650; }
.small-button:hover:not(:disabled), .fen-actions button:hover:not(:disabled) { background: #e0ecd6; }
.subtle-button { min-height: 32px; border-color: var(--line); background: var(--surface); color: var(--muted-strong); font-weight: 550; }
.subtle-button:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-soft); }
.move-history-wrap { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.move-history { display: flex; min-height: 60px; max-height: 270px; flex-wrap: wrap; align-content: flex-start; align-items: center; gap: 5px; margin-top: 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #cbd5c4 transparent; }
.history-empty { margin: 4px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.move-number { flex: 0 0 auto; padding: 0 3px; color: var(--muted); font-size: 11px; font-weight: 550; }
.history-move { flex: 0 0 auto; min-height: 32px; padding: 5px 9px; border: 1px solid transparent; border-radius: 6px; background: var(--surface-soft); color: var(--muted-strong); font-size: 12px; font-weight: 600; }
.history-move:hover { border-color: var(--line-strong); }
.history-move.active { border-color: #bed2b1; background: var(--accent-soft); color: var(--accent); }
.history-move.is-future { color: #8a9484; }
.fen-control { padding: 0 12px 12px; }
.fen-control label { display: block; margin: 4px 0; color: var(--muted); font-size: 10px; font-weight: 600; }
.fen-control textarea { min-height: 80px; margin-top: 7px; font-size: 11px; }
.fen-actions { justify-content: flex-start; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.fen-actions button { min-height: 34px; padding: 0 9px; font-size: 10px; }
.fen-actions button.secondary { background: var(--surface); border-color: var(--line); color: var(--muted-strong); }

/* Game review: import first, then a readable summary and selected-move detail. */
.review-settings { margin: 20px 0 16px; padding: 14px 0 0; border-top: 1px solid var(--line); }
.review-settings .setting-row { align-items: flex-start; flex-direction: column; }
.review-settings .time-options { width: 100%; }
.review-settings .time-options button { flex: 1; }
.review-run-controls { display: flex; align-items: center; gap: 10px; }
.review-run-controls .analyze-button { flex: 1; }
.review-feedback { margin-top: 12px; }
.review-feedback:has(#reviewProgress[hidden]):has(#cancelReviewButton[hidden]) { display: none; }
.review-stop { display: flex; justify-content: flex-end; }
.review-progress { margin-top: 10px; }
.review-progress progress { width: 100%; height: 7px; border: 0; border-radius: 99px; accent-color: var(--accent); }
.review-progress progress::-webkit-progress-bar { border-radius: 99px; background: var(--surface-raised); }
.review-progress progress::-webkit-progress-value { border-radius: 99px; background: var(--accent); }
.review-progress p { margin: 7px 0 0; color: var(--muted-strong); font-size: 11px; }
.review-summary { padding: 0; }
.review-summary .section-title-row { align-items: baseline; }
.accuracy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.accuracy-grid > div { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.accuracy-grid > div:first-child { background: var(--accent-soft); border-color: #d4e1ca; }
.accuracy-grid span { display: block; overflow: hidden; color: var(--muted-strong); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.accuracy-grid strong { display: block; margin-top: 5px; color: var(--ink); font-size: 34px; font-weight: 650; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.rating-breakdown { border-right: 0; border-left: 0; border-radius: 0; }
.rating-breakdown summary { padding-right: 0; padding-left: 0; }
.rating-summary { width: 100%; margin: 0 0 12px; border-collapse: collapse; }
.rating-summary th, .rating-summary td { padding: 5px 0; font-size: 11px; text-align: right; }
.rating-summary thead th { padding-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 550; }
.rating-summary th:first-child { text-align: left; }
.rating-summary td { width: 46px; color: var(--muted-strong); font-variant-numeric: tabular-nums; }
.rating-label { display: inline-flex; min-height: 27px; align-items: center; gap: 7px; padding: 3px 0; border: 0; background: transparent; color: var(--rating-color); font-size: 11px; font-weight: 600; }
.rating-label:disabled { opacity: 0.65; }
.rating--brilliant { --rating-color: #007d68; }
.rating--great { --rating-color: #326c99; }
.rating--best, .rating--excellent { --rating-color: #477323; }
.rating--good { --rating-color: #557747; }
.rating--book { --rating-color: #855c35; }
.rating--forced { --rating-color: #566951; }
.rating--inaccuracy { --rating-color: #9a6b03; }
.rating--mistake { --rating-color: #b05416; }
.rating--miss { --rating-color: #b64c40; }
.rating--blunder { --rating-color: #be3629; }
.rating-icon { display: block; width: 18px; height: 19px; flex: 0 0 auto; object-fit: contain; }
.rating-badge { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 5px; padding: 5px 7px; border: 1px solid color-mix(in srgb, var(--rating-color, #7d8975) 25%, transparent); border-radius: 6px; background: color-mix(in srgb, var(--rating-color, #7d8975) 7%, #fff); color: var(--rating-color, #7d8975); font-size: 11px; font-weight: 600; white-space: nowrap; }
.square-rating { position: absolute; z-index: 5; top: 3px; right: 3px; width: clamp(22px, 3.2vw, 32px); aspect-ratio: 18 / 19; pointer-events: none; }
.square-rating .rating-icon { width: 100%; height: 100%; }
.review-detail { margin-top: 18px; }
.review-reason { margin: 13px 0; color: var(--muted-strong); font-size: 12px; line-height: 1.65; }
.review-evals { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.review-evals b { margin-left: 5px; color: var(--ink); }
.review-best { margin: 13px 0 0; color: var(--muted); font-size: 12px; }
.review-best strong { margin-left: 4px; color: var(--accent); }
.review-detail .small-button { margin: 10px 0 6px; }
.review-detail .analysis-stats { gap: 12px; }
.review-method > div { padding: 0 12px 12px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.review-method a { color: var(--accent); text-underline-offset: 3px; }
.review-board-caption { margin: 8px 0 0 30px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.review-timeline { width: 100%; min-width: 0; }
.evaluation-card, .review-moves-card { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.review-moves-card { margin-top: 16px; }
#evaluationChart { display: block; width: 100%; margin-top: 12px; overflow: visible; }
.chart-midline { stroke: var(--line-strong); stroke-dasharray: 4 4; }
.chart-area { fill: #edf4e7; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart-point { fill: #79956b; cursor: pointer; }
.chart-point.active { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-point:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart-hit { cursor: pointer; }
.chart-axis { fill: var(--muted); font-size: 10px; }
#chartHint { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.review-moves { display: grid; max-height: 320px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 12px; padding-right: 3px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #cbd5c4 transparent; }
.review-move { display: flex; min-width: 0; min-height: 41px; align-items: center; justify-content: space-between; gap: 5px; padding: 6px 8px; border: 1px solid transparent; border-radius: 7px; background: var(--surface-soft); color: var(--muted-strong); text-align: left; }
.review-move:hover, .review-move.active { border-color: #bad0ae; background: var(--accent-soft); }
.review-notation { font-size: 12px; font-weight: 650; }
.review-move .rating-badge { padding: 3px 5px; font-size: 10px; }
.review-move .rating-pending { border-color: transparent; background: transparent; color: var(--muted); font-size: 10px; }

/* Dialogs, feedback, and the mobile action bar. */
.promotion-dialog { width: min(370px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 90px #132c2240; }
.promotion-dialog::backdrop { background: rgba(24, 45, 31, 0.42); backdrop-filter: blur(3px); }
.promotion-dialog form { padding: 22px; }
.promotion-dialog p { margin: 0 0 16px; font-size: 17px; font-weight: 650; text-align: center; }
#promotionChoices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.promotion-choice { display: grid; min-width: 0; aspect-ratio: 1; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.promotion-choice:hover { border-color: #93ae7d; background: var(--accent-soft); }
.promotion-piece { width: 100%; height: auto; object-fit: contain; }
.promotion-cancel { display: block; min-height: 36px; margin: 14px auto 0; padding: 0 12px; border: 0; border-radius: 6px; background: var(--surface-soft); color: var(--muted-strong); font-size: 12px; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; max-width: min(370px, calc(100% - 40px)); padding: 13px 17px; border: 1px solid #395a43; border-radius: 10px; background: #244332; box-shadow: 0 8px 30px #20382b22; color: #fff; font-size: 12px; font-weight: 500; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity 180ms, transform 180ms; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #833e32; border-color: #a15141; }
.mobile-action-bar { display: none; }

/* Dark surfaces use a readable accent for text and a deeper green for filled controls. */
html[data-theme="dark"] .site-nav a[aria-current="page"],
html[data-theme="dark"] .workspace-tabs [aria-selected="true"] { box-shadow: 0 1px 5px rgba(0, 0, 0, 0.22); }
html[data-theme="dark"] .status-dot.is-ready { background: #94c779; box-shadow: 0 0 0 4px #243923; }
html[data-theme="dark"] .status-dot.is-loading { background: #d1a15b; }
html[data-theme="dark"] .status-dot.is-loading::after { border-color: #d1a15b; }
html[data-theme="dark"] .import-trigger:hover { border-color: #759870; }
html[data-theme="dark"] .player-avatar { background: #718167; }
html[data-theme="dark"] .player-avatar.light { background: #38473c; }
html[data-theme="dark"] .captured-pieces:not(:empty) { border-radius: 4px; background: #718167; }
html[data-theme="dark"] .turn-badge.black span { border-color: #96a88f; }
html[data-theme="dark"] .board-wrap { box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28), 0 0 0 1px #3c493d; }
html[data-theme="dark"] .analysis-panel,
html[data-theme="dark"] .principal-variation,
html[data-theme="dark"] .move-history,
html[data-theme="dark"] .review-moves { scrollbar-color: #61715f transparent; }
html[data-theme="dark"] .button-copy small,
html[data-theme="dark"] .button-shortcut { color: #f0f8f0; }
html[data-theme="dark"] .best-card { border-color: #456044; background: linear-gradient(135deg, #203225, #1c271f); }
html[data-theme="dark"] .best-card.is-empty { border-color: var(--line); background: var(--surface-soft); }
html[data-theme="dark"] .score-chip { border-color: #54734e; background: #2d4633; color: #c1e3ab; }
html[data-theme="dark"] .score-chip.negative { border-color: #8c5e44; background: #472e24; color: #fac391; }
html[data-theme="dark"] .best-move { color: #d0e8c2; }
html[data-theme="dark"] .play-button { border-color: #58764e; }
html[data-theme="dark"] .play-button:hover:not(:disabled) { border-color: #85ad73; }
html[data-theme="dark"] .pv-move { background: #2b382c; color: #c4d0b9; }
html[data-theme="dark"] .pv-move:first-child { background: #365034; color: #d6ebc3; }
html[data-theme="dark"] .alternative:not(.empty):hover { border-color: var(--line-strong); }
html[data-theme="dark"] .time-options button.active { box-shadow: inset 0 0 0 1px #679c73; }
html[data-theme="dark"] .toggle span { border-color: #697e6b; background: #36453a; }
html[data-theme="dark"] .toggle input:checked + span { border-color: #85b98e; background: var(--accent-fill); }
html[data-theme="dark"] .toggle span::after { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
html[data-theme="dark"] .auto-move-card:has(input:checked) { border-color: #57774f; }
html[data-theme="dark"] .engine-note svg { color: #a3b39a; }
html[data-theme="dark"] textarea::placeholder { color: #a0af9e; }
html[data-theme="dark"] .pgn-card textarea[aria-invalid="true"] { background: #35241f; }
html[data-theme="dark"] .pgn-error { background: #382420; }
html[data-theme="dark"] .small-button,
html[data-theme="dark"] .fen-actions button:not(.secondary) { border-color: #54764c; }
html[data-theme="dark"] .small-button:hover:not(:disabled),
html[data-theme="dark"] .fen-actions button:hover:not(:disabled) { background: #334d37; }
html[data-theme="dark"] .fen-actions button.secondary:hover:not(:disabled) { background: var(--surface-raised); }
html[data-theme="dark"] .history-move.active { border-color: #58794e; }
html[data-theme="dark"] .history-move.is-future { color: var(--muted); }
html[data-theme="dark"] .accuracy-grid > div:first-child { border-color: #486742; }
html[data-theme="dark"] .rating--brilliant { --rating-color: #6fd5bd; }
html[data-theme="dark"] .rating--great { --rating-color: #9ecbec; }
html[data-theme="dark"] .rating--best,
html[data-theme="dark"] .rating--excellent { --rating-color: #b4d78b; }
html[data-theme="dark"] .rating--good { --rating-color: #bed0a6; }
html[data-theme="dark"] .rating--book { --rating-color: #d7b490; }
html[data-theme="dark"] .rating--forced { --rating-color: #b1c2ad; }
html[data-theme="dark"] .rating--inaccuracy { --rating-color: #e9c570; }
html[data-theme="dark"] .rating--mistake { --rating-color: #f8b679; }
html[data-theme="dark"] .rating--miss { --rating-color: #f5a18e; }
html[data-theme="dark"] .rating--blunder { --rating-color: #ff9d94; }
html[data-theme="dark"] .rating-badge { border-color: color-mix(in srgb, var(--rating-color, var(--muted)) 35%, var(--line)); background: color-mix(in srgb, var(--rating-color, var(--muted)) 12%, var(--surface-soft)); color: var(--rating-color, var(--muted)); }
html[data-theme="dark"] .review-move .rating-pending { border-color: transparent; background: transparent; color: var(--muted); }
html[data-theme="dark"] .chart-area { fill: #263d2c; }
html[data-theme="dark"] .chart-point { fill: #8cb997; }
html[data-theme="dark"] .chart-point.active { fill: var(--accent); }
html[data-theme="dark"] .review-move:hover,
html[data-theme="dark"] .review-move.active { border-color: #58794e; }
html[data-theme="dark"] .promotion-dialog { box-shadow: 0 24px 90px rgba(0, 0, 0, 0.6); }
html[data-theme="dark"] .promotion-dialog::backdrop { background: rgba(0, 0, 0, 0.68); }
html[data-theme="dark"] .promotion-choice { border-color: #809077; background: #718167; }
html[data-theme="dark"] .promotion-choice:hover { border-color: #a8ca95; background: #829872; }
html[data-theme="dark"] .toast { border-color: #63856b; background: #294332; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3); color: #eff9ee; }
html[data-theme="dark"] .toast.error { border-color: #ab715c; background: #4e3029; color: #ffe4dc; }
html[data-theme="dark"] .mobile-action-bar { background: rgba(23, 28, 25, 0.96); box-shadow: 0 -5px 22px rgba(0, 0, 0, 0.24); }

@media (min-width: 861px) {
  .analysis-panel { position: sticky; top: 20px; max-height: calc(100dvh - 116px); overflow-y: auto; overscroll-behavior: contain; }
  .calculator-page .board-column { position: sticky; top: 20px; }
  .review-page .board-column { grid-column: 1; grid-row: 1; }
  .review-page .analysis-panel { grid-column: 2; grid-row: 1 / span 2; }
  .review-timeline { grid-column: 1; grid-row: 2; }
}
@media (max-width: 1120px) and (min-width: 861px) {
  :root { --panel-width: 365px; --workspace-gap: 26px; }
  .site-header { gap: 14px; padding-right: 24px; padding-left: 24px; }
  .header-tools { gap: 14px; }
  .engine-pill { max-width: 130px; }
  #engineStatus { overflow: hidden; text-overflow: ellipsis; }
  .site-nav a { padding: 9px 11px; }
  .analysis-panel { padding: 17px; }
  .panel-kicker { gap: 5px; }
  h1 { font-size: 24px; }
  .button-shortcut { display: none; }
}
@media (max-width: 860px) {
  .site-header { gap: 16px; padding: 14px 22px; }
  .brand small { display: none; }
  .header-tools { gap: 12px; }
  .engine-pill { width: 14px; }
  #engineStatus { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .app-shell { width: min(calc(100% - 36px), 610px); margin: 16px auto 110px; grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .board-column, .analysis-panel, .review-timeline { width: 100%; min-width: 0; max-width: none; }
  .analysis-panel { padding: 22px; scroll-margin-top: 18px; }
  .player-strip { min-height: 48px; }
  .history-navigation button { min-width: 40px; min-height: 40px; }
  .icon-button { min-height: 42px; padding: 0 12px; font-size: 12px; }
  .auto-move-check { min-height: 36px; }
  .auto-side-label select { min-height: 36px; }
  .time-options button { min-height: 38px; }
  .mobile-action-bar { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px max(18px, calc((100vw - 574px) / 2)) calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.96); box-shadow: 0 -5px 22px rgba(27, 50, 30, 0.05); backdrop-filter: blur(12px); }
  .mobile-action-bar button { display: inline-flex; min-width: 0; min-height: 44px; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; font-size: 13px; font-weight: 650; }
  .mobile-secondary { flex: 0 1 40%; padding: 0 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--accent); }
  .mobile-primary { flex: 1 1 60%; padding: 0 14px; border: 1px solid var(--accent-fill); background: var(--accent-fill); color: #fff; }
  .toast { right: 16px; bottom: calc(88px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px); }
}
@media (max-width: 650px) {
  .site-header { flex-wrap: wrap; gap: 12px; padding: 13px 18px 12px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 33px; height: 36px; font-size: 26px; }
  .header-tools { margin-left: auto; gap: 14px; }
  .import-trigger { min-height: 36px; padding: 0 9px; gap: 6px; font-size: 11px; }
  .import-trigger svg { width: 15px; height: 15px; }
  .site-nav { width: 100%; order: 3; }
  .site-nav a { flex: 1; padding: 9px 10px; text-align: center; font-size: 12px; }
  .app-shell { width: min(calc(100% - 28px), 520px); margin-top: 10px; gap: 22px; }
  .board-and-eval { grid-template-columns: 18px minmax(0, 1fr); gap: 6px; }
  .player-strip { padding-left: 24px; }
  .history-navigation, .board-actions, .review-board-caption { margin-left: 24px; }
  .history-navigation { gap: 3px; }
  .history-navigation button { padding: 0 7px; }
  .history-navigation > span { min-width: 55px; font-size: 10px; }
  .board-actions { gap: 4px; }
  .icon-button { padding: 0 8px; }
  .captured-pieces { max-width: 120px; }
  .analysis-panel { padding: 18px; border-radius: 14px; }
  .panel-heading { margin-bottom: 16px; }
  h1 { font-size: 25px; }
  .intro { font-size: 12px; }
  .workspace-tabs [role="tab"] { min-height: 38px; }
  .analyze-button { min-height: 60px; }
  .button-shortcut { display: none; }
  .best-card { padding: 14px; }
  .best-description { max-width: 180px; line-height: 1.5; }
  .best-main { min-height: 82px; }
  .play-button { min-height: 40px; }
  .analysis-stats { gap: 11px; }
  .alternative { min-height: 46px; grid-template-columns: 22px 39px minmax(0, 1fr) auto; gap: 7px; }
  .alternative.empty { grid-template-columns: 22px minmax(0, 1fr); }
  .setting-row { align-items: flex-start; flex-direction: column; }
  .setting-row.compact { flex-direction: row; align-items: center; }
  .time-options { width: 100%; }
  .time-options button { flex: 1; }
  .pgn-card textarea { font-size: 13px; }
  .small-button, .subtle-button { min-height: 38px; }
  .fen-actions button { min-height: 38px; }
  .review-moves { grid-template-columns: minmax(0, 1fr); max-height: 310px; }
  .review-move { min-height: 45px; }
  .square-rating { top: 1px; right: 1px; width: 20px; }
  .evaluation-card, .review-moves-card { padding: 15px; }
}
@media (max-width: 360px) {
  .site-header { padding-right: 14px; padding-left: 14px; }
  .brand { gap: 7px; font-size: 18px; }
  .header-tools { gap: 11px; }
  .import-trigger { font-size: 10px; }
  .import-trigger svg { display: none; }
  .app-shell { width: calc(100% - 20px); }
  .analysis-panel { padding: 15px; }
  .history-navigation button { min-width: 33px; padding: 0 5px; }
  .history-navigation button span { font-size: 11px; }
  .panel-kicker .eyebrow { font-size: 8px; }
  .turn-badge { padding: 0 5px; font-size: 8px; }
  .auto-move-heading { gap: 5px; }
  .auto-side-label { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (pointer: coarse) {
  .theme-toggle { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
}
@media (max-width: 420px) {
  .header-tools { gap: 8px; }
}
@media (max-width: 360px) {
  .site-header { column-gap: 8px; }
}

