:root {
  color-scheme: dark;
  --bg: #0c0f14;
  --panel: #171c24;
  --panel-2: #1e2530;
  --panel-3: #12171e;
  --text: #f3f4f6;
  --muted: #99a2af;
  --border: #2b3441;
  --border-soft: #232b36;
  --accent: #c3a96f;
  --accent-hover: #d1b87d;
  --danger: #b85c62;
  --light-square: #d9d0bc;
  --dark-square: #756451;
  --light-square-highlight: #c7b672;
  --dark-square-highlight: #9b8447;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.27);
  --brilliant: #4fa9a1;
  --great: #7d89ae;
  --best: #9f9a70;
  --excellent: #849483;
  --good: #7d8793;
  --inaccuracy: #b89a5d;
  --mistake: #b47552;
  --blunder: #aa5962;
  --book: #8e76aa;
  --mate: #c6cbd2;
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

body {
  margin: 0;
  min-width: 320px;
  overflow-y: scroll;
  background:
    radial-gradient(circle at top right, rgba(195, 169, 111, 0.08), transparent 31rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, textarea, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.4rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  background: rgba(12, 15, 20, 0.93);
  backdrop-filter: blur(14px);
}

.brand-row { display: flex; align-items: center; gap: 0.75rem; }
.brand-icon { font-size: 2rem; color: var(--accent); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0.15rem; font-size: clamp(1.35rem, 3vw, 1.9rem); }
h2 { margin-bottom: 0.35rem; font-size: 1.12rem; }
.topbar p, .section-heading p, .moves-heading p, .board-toolbar p { margin-bottom: 0; color: var(--muted); }


main { width: min(1480px, 100%); margin: 0 auto; padding: clamp(1rem, 3vw, 2rem); }
.panel {
  background: rgba(23, 28, 36, 0.97);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  box-shadow: var(--shadow);
}

.input-panel { max-width: 980px; margin: 2rem auto; }
.section-heading, .moves-heading, .board-toolbar, .progress-header, .settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  flex: 0 0 auto;
}

label { display: block; margin: 1.2rem 0 0.45rem; font-weight: 650; }
textarea {
  width: 100%;
  min-height: 250px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #10151c;
  color: var(--text);
  padding: 1rem;
  line-height: 1.55;
}
textarea:focus, select:focus, button:focus-visible {
  outline: 3px solid rgba(195, 169, 111, 0.30);
  outline-offset: 2px;
}


.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.pgn-import-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  padding: 0.82rem 0.9rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: #121820;
}
.pgn-import-row > div { min-width: 0; }
.pgn-import-row strong { display: block; margin-bottom: 0.18rem; font-size: 0.9rem; }
.pgn-import-row span { color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.file-button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.48rem; }
.file-button > span { color: var(--accent); font-size: 1rem; font-weight: 900; }

.pgn-help {
  margin-top: 1rem;
  overflow: hidden;
  border: 1px solid rgba(195, 169, 111, 0.28);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(27, 32, 40, 0.98), rgba(17, 22, 29, 0.98));
}
.pgn-help summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.72rem;
  min-height: 66px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.pgn-help summary::-webkit-details-marker { display: none; }
.pgn-help summary:focus-visible { outline: 3px solid rgba(195, 169, 111, 0.3); outline-offset: -3px; }
.pgn-help summary strong { display: block; color: var(--text); font-size: 0.95rem; }
.pgn-help summary small { display: block; margin-top: 0.18rem; color: var(--muted); font-size: 0.76rem; }
.help-summary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.9rem;
  font-weight: 400;
  line-height: 1;
  text-align: center;
}
.help-chevron { color: var(--muted); font-size: 1.2rem; transition: transform 150ms ease; }
.pgn-help[open] .help-chevron { transform: rotate(180deg); }
.pgn-help-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0 1rem 0.85rem;
  border-top: 1px solid var(--border-soft);
}
.pgn-guide-card {
  min-width: 0;
  margin-top: 0.85rem;
  padding: 0.85rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(14, 19, 25, 0.72);
}
.guide-title-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; }
.guide-device {
  flex: 0 0 2.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1;
  text-align: center;
}
.guide-title-row > div > strong { display: block; font-size: 0.9rem; }
.guide-title-row > div > span { display: block; margin-top: 0.12rem; color: var(--muted); font-size: 0.74rem; }
.pgn-guide-card ol { display: grid; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.pgn-guide-card li { display: grid; grid-template-columns: 1.45rem minmax(0, 1fr); align-items: start; gap: 0.5rem; }
.pgn-guide-card li > span {
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border: 1px solid rgba(195, 169, 111, 0.3);
  border-radius: 50%;
  background: rgba(195, 169, 111, 0.08);
  color: #dbc89c;
  font-size: 0.7rem;
  font-weight: 900;
}
.pgn-guide-card li p { margin: 0; color: #c8ced6; font-size: 0.8rem; line-height: 1.4; }
.pgn-guide-card li p strong { color: var(--text); }
.fair-play-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0 1rem 0.75rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid rgba(180, 117, 82, 0.32);
  border-radius: 11px;
  background: rgba(180, 117, 82, 0.08);
}
.notice-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: rgba(180, 117, 82, 0.18);
  color: #e2b08f;
  font-size: 0.75rem;
  font-weight: 900;
}
.fair-play-notice p { margin: 0; color: #d6c2b6; font-size: 0.79rem; line-height: 1.4; }
.automatic-import-note {
  margin: 0;
  padding: 0 1rem 0.9rem;
  color: #818b98;
  font-size: 0.74rem;
  line-height: 1.4;
}

.select-label { margin: 0; min-width: 170px; }
select {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #10151c;
  color: var(--text);
}
.settings-row { margin-top: 1rem; align-items: end; }
.actions { display: flex; gap: 0.7rem; flex-wrap: wrap; justify-content: flex-end; }

.button, .icon-button {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0.72rem 1rem;
  font-weight: 750;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.button:hover, .icon-button:hover { transform: translateY(-1px); }
.button.primary { background: var(--accent); color: #18140b; }
.button.primary:hover { background: var(--accent-hover); }
.button.secondary { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.button.danger { background: rgba(184, 92, 98, 0.14); color: #f0b2b6; border-color: rgba(184, 92, 98, 0.42); }
.icon-button { padding: 0.55rem 0.8rem; background: var(--panel-2); color: var(--text); border-color: var(--border); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.error-message { color: #ee9797; margin: 0.8rem 0 0; min-height: 1.25rem; }
.hidden { display: none !important; }

#progressPanel { max-width: 980px; margin: 2rem auto; }
.progress-percent { font-size: 1.35rem; font-weight: 800; }
.progress-track { height: 12px; border-radius: 999px; overflow: hidden; background: #0c1015; margin-top: 1rem; border: 1px solid var(--border); }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 180ms ease; }

/* Partieübersicht */
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(320px, 1.18fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.accuracy-card,
.highlights-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(29, 36, 47, 0.98), rgba(20, 25, 33, 0.98));
  box-shadow: var(--shadow);
}

.accuracy-card { padding: 1rem; }
.accuracy-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.84rem;
}
.accuracy-player { display: flex; align-items: center; gap: 0.5rem; color: var(--text); font-size: 0.94rem; }
.accuracy-body { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; gap: 1rem; padding-top: 1rem; }
.accuracy-ring {
  --accuracy: 0;
  --ring-color: #e4dfd5;
  width: 104px;
  aspect-ratio: 1;
  padding: 8px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--accuracy) * 1%), #303844 0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: background 260ms ease;
}
.black-accuracy-card .accuracy-ring { --ring-color: #858e9b; }
.accuracy-ring-center {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 50%;
  background: #151a22;
  border: 1px solid #303846;
}
.accuracy-ring-center strong { font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.accuracy-ring-center span { margin-top: 0.25rem; color: var(--muted); font-size: 0.7rem; }
.accuracy-copy { min-width: 0; }
.accuracy-copy strong { display: block; margin-bottom: 0.35rem; font-size: 1.02rem; }
.accuracy-copy p { margin-bottom: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.4; }

.highlights-card { padding: 1rem; }
.highlights-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.highlights-heading h2 { margin-bottom: 0; }
.eyebrow { display: block; margin-bottom: 0.2rem; color: var(--accent); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.highlight-mark { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border: 1px solid rgba(195, 169, 111, 0.35); border-radius: 10px; background: rgba(195, 169, 111, 0.08); color: #dcc99f; }
.highlight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
.highlight-stat {
  --move-tone: var(--good);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.68rem;
  border: 1px solid color-mix(in srgb, var(--move-tone) 25%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--move-tone) 7%, var(--panel-3));
}
.highlight-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--move-tone) 48%, var(--border));
  background: color-mix(in srgb, var(--move-tone) 18%, #11161d);
  color: color-mix(in srgb, var(--move-tone) 78%, #fff);
  font-size: 0.82rem;
  font-weight: 900;
}
.highlight-stat div { min-width: 0; }
.highlight-stat strong { display: block; font-size: 1.25rem; line-height: 1; font-variant-numeric: tabular-nums; }
.highlight-stat div span { display: block; margin-top: 0.24rem; color: var(--muted); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.analysis-layout {
  display: grid;
  grid-template-columns: minmax(470px, 680px) minmax(500px, 1fr);
  gap: 1rem;
  align-items: start;
  justify-content: center;
}

.board-panel {
  position: sticky;
  top: 1rem;
  align-self: start;
  padding: 0;
  overflow: hidden;
  min-width: 0;
}

.board-toolbar {
  min-height: 78px;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(18, 23, 30, 0.76);
}
.game-heading { min-width: 0; }
.game-heading h2, .game-heading p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.position-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 118px;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.72rem;
  background: #1a2029;
  color: #d6dbe2;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}
.status-disc { width: 0.62rem; height: 0.62rem; border-radius: 50%; background: #89919d; box-shadow: 0 0 0 3px rgba(137, 145, 157, 0.12); }
.position-status.white { background: #e8e4db; border-color: #faf7ef; color: #14171c; }
.position-status.white .status-disc { background: #fff; border: 1px solid #9ca3ad; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18); }
.position-status.black { background: #0d1015; border-color: #58616d; color: #f1f3f5; }
.position-status.black .status-disc { background: #15181d; border: 1px solid #7a838f; box-shadow: 0 0 0 3px rgba(8, 10, 13, 0.35); }

.board-content { padding: 1rem 1.2rem 1.2rem; }
.board-stage {
  width: min(100%, 636px);
  margin: 0 auto 0.95rem;
  border: 1px solid #303846;
  border-radius: 15px;
  overflow: hidden;
  background: #10151c;
  box-shadow: 0 13px 30px rgba(0, 0, 0, 0.25);
}

.player-strip {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.66rem 0.8rem;
  background: #161c24;
  color: var(--text);
}
.player-strip-top { border-bottom: 1px solid #303846; }
.player-strip-bottom { border-top: 1px solid #303846; }
.player-identity { min-width: 0; display: flex; align-items: center; gap: 0.55rem; }
.player-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.player-side { color: var(--muted); font-size: 0.76rem; letter-spacing: 0.05em; text-transform: uppercase; }
.player-disc { flex: 0 0 auto; width: 1rem; height: 1rem; border-radius: 50%; border: 1px solid #050608; }
.black-disc { background: #24272c; box-shadow: inset 0 0 0 2px #454a52; }
.white-disc { background: #f1eee7; box-shadow: inset 0 0 0 2px #d1cbc0; }

/* Die Leiste besitzt eine eigene Spalte. Das Brett bleibt dadurch immer exakt 8 × 8. */
.board-shell {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 8px;
  background: #0e1218;
}
.evaluation-column { min-width: 0; }
.evaluation-bar {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid #59616b;
  border-radius: 7px;
  background: #111318;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.evaluation-white-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50%;
  background: #ebe7de;
  transition: height 220ms ease;
}
.evaluation-marker {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: 50%;
  height: 0;
  border-top: 2px solid #9da5af;
  transition: bottom 220ms ease;
}
.evaluation-marker span {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  min-width: 31px;
  padding: 0.18rem 0.24rem;
  border: 1px solid #767f8a;
  border-radius: 6px;
  background: #444c58;
  color: #fff;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.25);
}
.evaluation-marker.white-leading span { background: #f2eee5; border-color: #fff; color: #11151a; }
.evaluation-marker.black-leading span { background: #111318; border-color: #9aa2ad; color: #f5f6f7; }
.evaluation-side-symbol {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.84rem;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.evaluation-black-symbol { top: 7px; color: #e8eaf0; }
.evaluation-white-symbol { bottom: 7px; color: #171a20; }

.board-frame {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid #4c4237;
  border-radius: 4px;
  background: var(--dark-square);
  contain: layout paint;
}
.board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  overflow: hidden;
}
.square {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  user-select: none;
}
.square.light { background: var(--light-square); }
.square.dark { background: var(--dark-square); }
.square.last-move.light { background: var(--light-square-highlight); }
.square.last-move.dark { background: var(--dark-square-highlight); }
.square.best-target::before {
  content: "";
  position: absolute;
  width: 24%;
  height: 24%;
  border-radius: 50%;
  background: rgba(52, 77, 62, 0.72);
  box-shadow: 0 0 0 4px rgba(52, 77, 62, 0.14);
  z-index: 1;
}
.piece {
  position: relative;
  z-index: 2;
  display: block;
  width: 86%;
  height: 86%;
  object-fit: contain;
  pointer-events: none;
  transform: translateY(-0.5%);
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.28));
}
.coordinate {
  position: absolute;
  z-index: 5;
  display: inline-grid;
  place-items: center;
  min-width: 0.9rem;
  height: 0.9rem;
  padding: 0 0.16rem;
  border-radius: 4px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(0.56rem, 0.9vw, 0.68rem);
  font-weight: 900;
  line-height: 1;
  opacity: 0.94;
  text-shadow: none;
}
.coordinate.file { right: 3px; bottom: 3px; }
.coordinate.rank { left: 3px; top: 3px; }
.square.light .coordinate { background: rgba(102, 85, 66, 0.14); color: #5e4d3d; }
.square.dark .coordinate { background: rgba(236, 226, 206, 0.14); color: #eee3cf; }

.navigation-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  gap: 0.5rem;
  align-items: center;
}
#movePositionLabel {
  text-align: center;
  font-weight: 750;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.move-details {
  min-height: 172px;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 13px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.move-details p:last-child { margin-bottom: 0; }
.detail-title { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; margin-bottom: 0.55rem; }
.detail-title strong { font-size: 1.05rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 1rem; color: var(--muted); }
.detail-grid b { color: var(--text); }

.moves-panel { min-width: 0; }
.legend { display: flex; gap: 0.65rem 0.95rem; flex-wrap: wrap; margin: 1rem 0; color: var(--muted); font-size: 0.86rem; }
.legend span { display: flex; align-items: center; gap: 0.35rem; }
.dot { width: 0.58rem; height: 0.58rem; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 3px rgba(255,255,255,0.025); }
.dot.brilliant { background: var(--brilliant); }
.dot.best { background: var(--best); }
.dot.inaccuracy { background: var(--inaccuracy); }
.dot.mistake { background: var(--mistake); }
.dot.blunder { background: var(--blunder); }

.move-list {
  display: grid;
  gap: 0.42rem;
  height: min(760px, calc(100vh - 285px));
  min-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 0.15rem 0.35rem 0.15rem 0;
}
.move-list::-webkit-scrollbar { width: 10px; }
.move-list::-webkit-scrollbar-track { background: transparent; }
.move-list::-webkit-scrollbar-thumb { background: #303947; border: 3px solid transparent; border-radius: 999px; background-clip: padding-box; }
.move-row { display: grid; grid-template-columns: 3rem minmax(0, 1fr) minmax(0, 1fr); gap: 0.42rem; align-items: stretch; }
.move-number { color: #7f8997; display: grid; place-items: center; font-variant-numeric: tabular-nums; }

.category-brilliant { --move-tone: var(--brilliant); }
.category-great { --move-tone: var(--great); }
.category-best { --move-tone: var(--best); }
.category-excellent { --move-tone: var(--excellent); }
.category-good { --move-tone: var(--good); }
.category-inaccuracy { --move-tone: var(--inaccuracy); }
.category-mistake { --move-tone: var(--mistake); }
.category-blunder { --move-tone: var(--blunder); }
.category-book { --move-tone: var(--book); }
.category-mate { --move-tone: var(--mate); }

.move-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 48px;
  position: relative;
  border: 1px solid color-mix(in srgb, var(--move-tone, var(--border)) 24%, var(--border));
  border-radius: 11px;
  padding: 0.56rem 0.65rem 0.56rem 0.78rem;
  background: color-mix(in srgb, var(--move-tone, var(--panel-2)) 6%, var(--panel-2));
  color: var(--text);
  text-align: left;
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--move-tone, var(--border)) 72%, transparent);
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.move-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--move-tone, #697586) 46%, #697586);
  background: color-mix(in srgb, var(--move-tone, var(--panel-2)) 10%, var(--panel-2));
}
.move-button.active {
  border-color: color-mix(in srgb, var(--move-tone, var(--accent)) 64%, #c8d0da);
  background: color-mix(in srgb, var(--move-tone, var(--panel-2)) 14%, var(--panel-2));
  box-shadow:
    inset 3px 0 0 var(--move-tone, var(--accent)),
    0 0 0 2px color-mix(in srgb, var(--move-tone, var(--accent)) 24%, transparent);
}
.move-san { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 780; letter-spacing: 0.01em; }
.move-classification { display: inline-flex; align-items: center; gap: 0.38rem; font-size: 0.76rem; color: #a5aebb; white-space: nowrap; }
.classification-icon {
  display: inline-grid;
  place-items: center;
  width: 1.48rem;
  height: 1.48rem;
  border-radius: 7px;
  border: 1px solid color-mix(in srgb, var(--move-tone, var(--border)) 50%, #ffffff 7%);
  background: color-mix(in srgb, var(--move-tone, var(--panel-3)) 19%, var(--panel-3));
  color: color-mix(in srgb, var(--move-tone, var(--text)) 76%, #ffffff);
  font-weight: 900;
  font-size: 0.74rem;
  line-height: 1;
}

.method-note { color: var(--muted); font-size: 0.9rem; margin: 1rem 0 0; text-align: center; }

@media (max-width: 1220px) {
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .highlights-card { grid-column: 1 / -1; }
  .analysis-layout { grid-template-columns: minmax(430px, 620px) minmax(450px, 1fr); }
  .move-classification > span:first-child { display: none; }
}

@media (max-width: 1000px) {
  .analysis-layout { grid-template-columns: minmax(0, 1fr); }
  .board-panel { position: static; }
  .move-list { height: auto; min-height: 0; max-height: none; overflow: visible; padding-right: 0; }
  .move-classification > span:first-child { display: inline; }
}

@media (max-width: 700px) {
  .topbar, .section-heading, .moves-heading, .settings-row { align-items: stretch; flex-direction: column; }
  .pgn-import-row { align-items: stretch; flex-direction: column; }
  .file-button { justify-content: center; }
  .pgn-help-content { grid-template-columns: minmax(0, 1fr); }
  .board-toolbar { align-items: center; flex-direction: row; }
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .highlights-card { grid-column: auto; }
  .actions { justify-content: stretch; }
  .actions .button { flex: 1; }
  .heading-actions { width: 100%; justify-content: stretch; }
  .heading-actions .button { flex: 1; }
  .move-row { grid-template-columns: 2rem minmax(0, 1fr); }
  .move-row .move-button.black-move { grid-column: 2; }
  .board-content { padding: 0.8rem; }
  .board-toolbar { min-height: 70px; padding: 0.85rem; }
  .position-status { min-width: auto; padding-inline: 0.58rem; }
  .player-side { display: none; }
  .board-shell { grid-template-columns: 31px minmax(0, 1fr); gap: 6px; padding: 6px; }
  .evaluation-marker span { min-width: 27px; font-size: 0.6rem; }
  .move-details { min-height: 190px; }
  .detail-grid { grid-template-columns: 1fr; }
  .move-classification > span:first-child { display: none; }
}

@media (max-width: 470px) {
  .accuracy-body { grid-template-columns: 88px minmax(0, 1fr); gap: 0.8rem; }
  .accuracy-ring { width: 88px; }
  .accuracy-ring-center strong { font-size: 1.25rem; }
  .highlight-grid { grid-template-columns: minmax(0, 1fr); }
  .game-heading p { display: none; }
  .position-status { font-size: 0.74rem; }
}

@media (max-width: 430px) {
  .navigation-row { grid-template-columns: repeat(4, 1fr); }
  #movePositionLabel { grid-column: 1 / -1; grid-row: 1; min-height: 1.5rem; }
  .navigation-row .icon-button { grid-row: 2; }
}


/* Rechtliche Hinweise */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.25rem 0 0;
  padding: 1rem 0.15rem 0;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.78rem;
}
.app-footer p { margin: 0; }
.app-footer nav { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.app-footer a, .legal-page a { color: #dbc89c; text-decoration: none; }
.app-footer a:hover, .legal-page a:hover { text-decoration: underline; }

.legal-page { max-width: 860px; margin: 2rem auto; }
.legal-page .legal-back { display: inline-flex; margin-bottom: 1rem; }
.legal-page h1 { margin-bottom: 0.45rem; }
.legal-page h2 { margin-top: 1.65rem; }
.legal-page p, .legal-page li { color: #c8ced6; line-height: 1.65; }
.legal-page code { color: #ead8ae; }
.legal-page .legal-meta { color: var(--muted); font-size: 0.86rem; }
.legal-page .legal-callout {
  margin: 1.2rem 0;
  padding: 1rem;
  border: 1px solid rgba(195, 169, 111, 0.3);
  border-radius: 12px;
  background: rgba(195, 169, 111, 0.07);
}
@media (max-width: 720px) {
  .app-footer { align-items: flex-start; flex-direction: column; }
}
