@import url("/assets/world/foundation/pixel-art-foundation.css");

:root {
  color-scheme: light;
  --bg: #f4f1ec;
  --text: #171717;
  --muted: #66605a;
  --light-square: #ecd9b8;
  --dark-square: #8d6240;
  --selected: #f7c948;
  --target: rgba(24, 24, 24, 0.28);
  --panel: #fffaf2;
  --border: #d5c6b4;
  --surface: #fffdf8;
  --soft-surface: rgba(255, 252, 247, 0.74);
  --soft-hover: rgba(238, 231, 220, 0.72);
  --board-border: #3a2a1f;
  --kids-accent: #5c9a43;
  --kids-accent-2: #60758a;
  --kids-accent-soft: #edf6e8;
  --kids-piece-glow: rgba(255, 255, 255, 0);
}

.experience-boundary-screen {
  min-height: calc(100vh - 72px);
  padding: clamp(20px, 5vw, 72px);
  background: var(--bg);
}

.experience-boundary-panel {
  display: grid;
  gap: 16px;
  width: min(680px, 100%);
  margin: 8vh auto 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: clamp(24px, 5vw, 48px);
  box-shadow: 0 24px 70px rgba(58, 42, 31, 0.12);
}

.experience-boundary-panel h1,
.experience-boundary-panel p {
  margin: 0;
}

.experience-boundary-panel > p:last-of-type {
  color: var(--muted);
  line-height: 1.6;
}

.experience-boundary-panel button {
  width: fit-content;
  min-height: 44px;
  margin-top: 8px;
}

.character-creator-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  width: 100vw;
  height: 100vh;
  min-height: 0;
  place-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 22%, #17201d 0, #080b0a 46%, #020303 100%);
  padding: 8px;
  box-sizing: border-box;
  color: #f4e4bb;
}

.character-creator-screen[hidden] {
  display: none;
}

.character-creator-shell {
  --character-creator-width: min(1800px, calc(100vw - 16px), calc(177.777vh - 30px));
  position: relative;
  width: var(--character-creator-width);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 4px solid #080b0a;
  outline: 2px solid #a8742f;
  background: #0c1314;
  box-shadow:
    0 0 0 4px #2c2118,
    0 18px 54px rgba(0, 0, 0, 0.7);
  font-family: "Courier New", Courier, monospace;
  image-rendering: pixelated;
}

.character-creator-titlebar {
  position: absolute;
  z-index: 12;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 3px solid #090d0d;
  background: linear-gradient(rgba(23, 33, 38, 0.98), rgba(16, 23, 27, 0.96));
  padding: 7px 12px;
}

.character-creator-wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff1cf;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-shadow: 2px 2px 0 #000;
  text-transform: uppercase;
}

.character-creator-crown {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid #b27d32;
  background: #293b2c;
  color: #e1b55c;
  font-family: Georgia, "Times New Roman", serif;
}

.character-creator-step {
  border: 2px solid #070a0a;
  outline: 1px solid #8f6731;
  background: #192125;
  color: #d9c59a;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.character-creator-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(3, 7, 7, 0.28), rgba(3, 7, 7, 0.5)),
    url("/assets/pixel-club/clubhouse.png?v=landscape-20260718") center / cover no-repeat;
  isolation: isolate;
}

.character-creator-scene::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 48px 0 82px;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(211, 167, 75, 0.16), transparent 34%),
    linear-gradient(90deg, rgba(3, 6, 6, 0.42), transparent 22% 78%, rgba(3, 6, 6, 0.42));
  pointer-events: none;
}

.character-creator-heading {
  position: absolute;
  z-index: 4;
  top: 10%;
  right: 12%;
  left: 12%;
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  text-shadow: 2px 2px 0 #000;
}

.character-creator-heading h1,
.character-creator-heading p,
.character-preview-card h2,
.character-creator-status {
  margin: 0;
}

.character-creator-heading h1 {
  color: #fff1cf;
  font-size: clamp(30px, 3.4vw, 54px);
  font-weight: 900;
  letter-spacing: 0.035em;
  line-height: 1;
  text-transform: uppercase;
}

.character-creator-heading .eyebrow {
  color: #e1b55c;
  font-size: clamp(10px, 1vw, 14px);
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.character-creator-heading > p:last-child {
  color: #e2d0a8;
  font-size: clamp(12px, 1.1vw, 16px);
  font-weight: 700;
}

.character-creator-form {
  position: absolute;
  z-index: 3;
  inset: 0;
}

.character-player-options {
  position: absolute;
  top: 25%;
  bottom: 15%;
  left: 50%;
  width: min(780px, 66%);
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
  transform: translateX(-50%);
}

.character-player-options legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.character-player-options-grid {
  display: grid;
  height: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 3vw, 44px);
}

.character-player-choice {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 260px;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  gap: 8px;
  overflow: hidden;
  border: 4px solid #070a0a;
  border-radius: 0;
  outline: 2px solid #8f6731;
  outline-offset: -7px;
  background:
    radial-gradient(ellipse at 50% 58%, rgba(78, 102, 61, 0.78), rgba(14, 24, 22, 0.96) 58%),
    rgba(13, 21, 21, 0.96);
  color: #f4e4bb;
  padding: clamp(14px, 2vw, 24px) 16px 14px;
  box-shadow:
    7px 9px 0 rgba(0, 0, 0, 0.5),
    inset 0 0 42px rgba(0, 0, 0, 0.5);
  font: 900 clamp(15px, 1.45vw, 22px)/1 "Courier New", Courier, monospace;
  text-shadow: 2px 2px 0 #000;
  text-transform: uppercase;
  cursor: pointer;
}

.character-player-choice::after {
  content: "";
  position: absolute;
  z-index: 0;
  right: 14%;
  bottom: 49px;
  left: 14%;
  height: 13%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.46);
  filter: blur(1px);
}

.character-player-choice img {
  position: relative;
  z-index: 1;
  width: clamp(128px, 11vw, 210px);
  height: auto;
  max-height: 88%;
  align-self: end;
  object-fit: contain;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  filter: drop-shadow(7px 9px 0 rgba(0, 0, 0, 0.45));
  transition: transform 120ms steps(2, end);
  user-select: none;
}

.character-player-choice strong {
  position: relative;
  z-index: 2;
  display: block;
  width: calc(100% - 8px);
  border: 2px solid #070a0a;
  outline: 1px solid #8f6731;
  background: rgba(20, 29, 33, 0.98);
  padding: 9px 8px;
  text-align: center;
}

.character-player-choice:hover {
  outline-color: #d2a650;
  background:
    radial-gradient(ellipse at 50% 58%, rgba(93, 121, 68, 0.84), rgba(16, 30, 25, 0.97) 58%),
    rgba(13, 21, 21, 0.96);
}

.character-player-choice:hover img {
  transform: translateY(-4px);
}

.character-player-choice.selected {
  outline: 4px solid #efd38b;
  outline-offset: -9px;
  background:
    radial-gradient(ellipse at 50% 58%, rgba(113, 136, 74, 0.92), rgba(25, 49, 34, 0.98) 60%),
    #1b3224;
  box-shadow:
    7px 9px 0 rgba(0, 0, 0, 0.5),
    inset 0 0 0 3px #29391e,
    inset 0 0 42px rgba(0, 0, 0, 0.38);
}

.character-player-choice.selected::before {
  content: "✓";
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 3px solid #080b0a;
  outline: 2px solid #c08b3e;
  background: #fff0cd;
  color: #36513a;
  font: 900 23px/1 Georgia, serif;
  text-shadow: none;
}

.character-registration-bar {
  position: absolute;
  z-index: 8;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  min-height: 82px;
  grid-template-columns: minmax(250px, 0.85fr) minmax(160px, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-top: 3px solid #070a0a;
  background: rgba(16, 24, 29, 0.98);
  padding: 10px 14px;
}

.character-name-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #d5a84d;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.character-name-field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 2px solid #070a0a;
  border-radius: 0;
  outline: 1px solid #8f6731;
  background: #11191e;
  color: #fff1cf;
  padding: 9px 11px;
  box-sizing: border-box;
  font: 900 16px/1 "Courier New", Courier, monospace;
  text-transform: none;
}

.character-creator-status {
  min-height: 18px;
  overflow: hidden;
  color: #d9c59a;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-creator-status[data-tone="error"] {
  color: #ef9c8f;
}

.character-creator-status[data-tone="success"] {
  color: #b8d98c;
}

.character-creator-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.character-creator-actions button {
  min-height: 44px;
  border: 3px solid #070a0a;
  border-radius: 0;
  outline: 1px solid #8f6731;
  padding: 9px 14px;
  color: #fff1cf;
  font: 900 12px/1 "Courier New", Courier, monospace;
  text-transform: uppercase;
  cursor: pointer;
}

.character-primary-action {
  background: #36513a;
}

.character-secondary-action {
  background: #192125;
}

.character-creator-actions button:hover,
.character-creator-actions button:focus-visible,
.character-name-field input:focus-visible,
.character-player-choice:focus-visible {
  outline: 3px solid #f0d58d;
  outline-offset: 2px;
}

.character-creator-actions button:hover {
  background: #4b673f;
}

.character-creator-actions button:disabled,
.character-player-choice:disabled,
.character-name-field input:disabled {
  cursor: wait;
  opacity: 0.64;
}

.character-preview-card[hidden] {
  display: none;
}

.character-layer-stack {
  position: relative;
}

.character-layer-stack img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  user-select: none;
}

@media (max-width: 800px), (max-height: 520px) {
  .character-creator-titlebar {
    min-height: 40px;
    padding: 4px 8px;
  }

  .character-creator-wordmark {
    font-size: 15px;
  }

  .character-creator-crown {
    width: 28px;
    height: 28px;
  }

  .character-creator-heading {
    top: 10%;
  }

  .character-creator-heading h1 {
    font-size: clamp(24px, 5vw, 36px);
  }

  .character-creator-heading > p:last-child {
    display: none;
  }

  .character-player-options {
    top: 22%;
    bottom: 18%;
    width: min(620px, 78%);
  }

  .character-player-options-grid {
    gap: 14px;
  }

  .character-player-choice {
    min-height: 180px;
    border-width: 3px;
    padding: 10px 10px 8px;
  }

  .character-player-choice img {
    width: clamp(92px, 15vw, 138px);
    max-height: 82%;
  }

  .character-player-choice strong {
    padding: 6px;
    font-size: 13px;
  }

  .character-registration-bar {
    min-height: 70px;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 8px;
    padding: 7px 9px;
  }

  .character-creator-status {
    display: none;
  }

  .character-name-field {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .character-name-field input {
    min-height: 40px;
  }

  .character-creator-actions button {
    min-height: 40px;
    padding-inline: 10px;
  }
}

@media (max-width: 640px) {
  .character-creator-step,
  .character-name-field > span {
    display: none;
  }

  .character-player-options {
    width: 86%;
  }

  .character-registration-bar {
    grid-template-columns: minmax(150px, 1fr) auto;
  }

  .character-secondary-action {
    display: none;
  }
}

.danya-speedruns-screen {
  min-height: calc(100vh - 64px);
  min-width: 0;
  padding: 18px;
  background: #f7f2e9;
}

.danya-speedruns-shell {
  display: grid;
  gap: 14px;
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0 auto;
}

.danya-speedruns-library {
  min-width: 0;
  max-width: 100%;
}

.danya-speedruns-watch-heading,
.danya-speedruns-library-grid > *,
.danya-speedruns-analysis-panel {
  border: 1px solid var(--border);
  background: rgba(255, 253, 248, 0.94);
}

.danya-speedruns-watch-heading h2,
.danya-speedruns-video-panel h2,
.danya-speedruns-next-panel h2 {
  margin: 0;
}

.danya-speedruns-description,
.danya-speedruns-status {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.danya-speedruns-status.error {
  color: #a23a2a;
}

.danya-speedruns-status:empty {
  display: none;
}

.danya-speedruns-series-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  min-width: 0;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.danya-speedruns-series-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.danya-speedruns-series-tabs button:last-child {
  border-right: 0;
}

.danya-speedruns-series-tabs button.active {
  background: #171411;
  color: white;
}

.danya-speedruns-series-tabs span,
.danya-speedruns-progress-pill {
  border: 1px solid color-mix(in srgb, var(--border) 68%, white);
  border-radius: 999px;
  background: #f2eee6;
  color: #5f574f;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 900;
}

.danya-speedruns-library-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 14px;
  min-width: 0;
}

.danya-speedruns-video-panel,
.danya-speedruns-next-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 14px;
}

.danya-speedruns-video-list {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-height: calc(100vh - 310px);
  overflow: auto;
}

.danya-speedruns-video-row,
.danya-speedruns-next-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 82px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--text);
  padding: 8px;
  text-align: left;
}

.danya-speedruns-video-row:hover,
.danya-speedruns-next-card:hover {
  border-color: #3a2a1f;
}

.danya-speedruns-video-row.viewed {
  border-color: color-mix(in srgb, var(--kids-accent) 42%, var(--border));
  background:
    linear-gradient(0deg, rgba(92, 154, 67, 0.11), rgba(92, 154, 67, 0.11)),
    #fffdf8;
}

.danya-speedruns-video-row.viewed .danya-speedruns-video-row-index {
  background: color-mix(in srgb, var(--kids-accent) 18%, #f2eee6);
  color: #244f28;
}

.danya-speedruns-video-row.next {
  border-color: #3a2a1f;
  box-shadow: inset 4px 0 0 #171411;
}

.danya-speedruns-video-row.next:not(.viewed) {
  background: #fffaf0;
}

.danya-speedruns-video-row img,
.danya-speedruns-next-card img {
  width: 132px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  background: #171411;
}

.danya-speedruns-video-row-body,
.danya-speedruns-next-card span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.danya-speedruns-video-row-body strong,
.danya-speedruns-next-card strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danya-speedruns-video-row-body span,
.danya-speedruns-next-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.danya-speedruns-video-row-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #f2eee6;
  font-weight: 900;
}

.danya-speedruns-next-card {
  grid-template-columns: 132px minmax(0, 1fr);
}

.danya-speedruns-next-actions,
.danya-speedruns-video-actions,
.danya-speedruns-watch-heading-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.danya-speedruns-next-actions button,
.danya-speedruns-video-actions button,
.danya-speedruns-video-actions a,
.danya-speedruns-watch-heading button,
.danya-speedruns-board-room button:not(.square) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: #fffdf8;
  color: var(--text);
  padding: 0 12px;
  font-weight: 900;
  line-height: 1.05;
  text-decoration: none;
  white-space: nowrap;
}

#danya-speedruns-start-next,
#danya-speedruns-mark-viewed-next {
  background: #171411;
  color: white;
}

.danya-speedruns-watch {
  display: grid;
  grid-template-columns: minmax(520px, 55fr) minmax(420px, 45fr);
  gap: 14px;
  min-height: 0;
}

.danya-speedruns-screen.board-focus .danya-speedruns-watch {
  grid-template-columns: minmax(420px, 42fr) minmax(560px, 58fr);
}

.danya-speedruns-video-room,
.danya-speedruns-board-room {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.danya-speedruns-watch-heading,
.danya-speedruns-board-room > .learning-node-heading {
  padding: 12px;
}

.danya-speedruns-player {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid #3a2a1f;
  background: #171411;
  aspect-ratio: 16 / 9;
}

.danya-speedruns-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.danya-speedruns-playlist-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 112px;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 2px;
}

.danya-speedruns-strip-item {
  position: relative;
  min-height: 64px;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  padding: 0;
  background: #171411;
}

.danya-speedruns-strip-item.active {
  border-color: #3a2a1f;
}

.danya-speedruns-strip-item img {
  width: 100%;
  height: 64px;
  object-fit: cover;
  opacity: 0.82;
}

.danya-speedruns-strip-item span {
  position: absolute;
  top: 5px;
  left: 5px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  font-size: 12px;
  font-weight: 900;
}

.danya-speedruns-screen .danya-speedruns-board-area {
  --review-board-size: min(calc(100% - 42px), calc(100vh - 390px), 720px);
}

.danya-speedruns-screen .danya-speedruns-board-area.eval-hidden {
  --review-board-size: min(100%, calc(100vh - 390px), 720px);
}

.danya-speedruns-screen.board-focus .danya-speedruns-board-area {
  --review-board-size: min(calc(100% - 42px), calc(100vh - 300px), 880px);
}

.danya-speedruns-screen.board-focus .danya-speedruns-board-area.eval-hidden {
  --review-board-size: min(100%, calc(100vh - 300px), 880px);
}

.danya-speedruns-analysis-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.danya-speedruns-screen .danya-speedruns-board-controls {
  grid-template-columns: 42px 42px 42px minmax(116px, auto);
  justify-content: center;
  gap: 8px;
}

.danya-speedruns-screen .danya-speedruns-board-controls button:not(.square) {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1.05;
}

.danya-speedruns-screen .danya-speedruns-board-controls button.learning-icon-control:not(.square) {
  min-width: 42px;
  width: 42px;
  padding: 0;
  font-size: 18px;
}

.danya-speedruns-move-panel {
  padding: 10px;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.danya-speedruns-move-list {
  max-height: 152px;
}

.danya-speedruns-analysis-panel .review-position-fen {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .danya-speedruns-series-tabs,
  .danya-speedruns-library-grid,
  .danya-speedruns-watch,
  .danya-speedruns-screen.board-focus .danya-speedruns-watch {
    grid-template-columns: 1fr;
  }

  .danya-speedruns-series-tabs {
    overflow-x: auto;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
  }

  .danya-speedruns-screen .danya-speedruns-board-area,
  .danya-speedruns-screen.board-focus .danya-speedruns-board-area {
    --review-board-size: min(100%, 86vw);
  }
}

:root[data-kids-theme="pink"] {
  --bg: #fff0f7;
  --panel: #fff8fc;
  --border: #eac0d4;
  --surface: #fffafd;
  --soft-surface: rgba(255, 250, 253, 0.82);
  --soft-hover: rgba(255, 224, 240, 0.72);
  --light-square: #f8dfed;
  --dark-square: #ad6a94;
  --selected: #7bd7ff;
  --target: rgba(79, 46, 73, 0.3);
  --board-border: #5b334c;
  --kids-accent: #d8589b;
  --kids-accent-2: #4e9edb;
  --kids-accent-soft: #ffe1ef;
  --kids-piece-glow: rgba(216, 88, 155, 0.34);
}

:root[data-kids-theme="blue"] {
  --bg: #edf7ff;
  --panel: #f7fbff;
  --border: #bbd8ee;
  --surface: #fbfdff;
  --soft-surface: rgba(248, 252, 255, 0.84);
  --soft-hover: rgba(216, 235, 255, 0.72);
  --light-square: #dceffc;
  --dark-square: #618bbe;
  --selected: #ffd965;
  --target: rgba(30, 63, 103, 0.3);
  --board-border: #2f4667;
  --kids-accent: #347bc2;
  --kids-accent-2: #18a999;
  --kids-accent-soft: #dff0ff;
  --kids-piece-glow: rgba(52, 123, 194, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-kids-theme] body {
  background:
    radial-gradient(circle at 8% 12%, color-mix(in srgb, var(--kids-accent-soft) 72%, transparent), transparent 26%),
    radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--kids-accent-2) 16%, transparent), transparent 22%),
    var(--bg);
}

button,
select,
input,
textarea {
  font: inherit;
}

button:not(:disabled),
[role="button"]:not([aria-disabled="true"]) {
  cursor: pointer;
}

button:disabled,
[role="button"][aria-disabled="true"] {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.svg-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.boot-screen {
  display: grid;
  min-height: 100vh;
  padding: 64px clamp(24px, 6vw, 96px) 44px;
  grid-template-rows: 1fr auto;
  place-items: center;
}

.boot-loader {
  display: grid;
  justify-items: center;
  gap: 28px;
  align-self: center;
}

.boot-logo-orbit {
  position: relative;
  display: grid;
  width: 232px;
  height: 232px;
  place-items: center;
}

.boot-logo-orbit::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 3px solid rgba(218, 206, 185, 0.62);
  border-radius: 50%;
}

.boot-orbit-spinner {
  position: absolute;
  inset: 12px;
  border: 3px solid transparent;
  border-top-color: #327f48;
  border-right-color: rgba(50, 127, 72, 0.72);
  border-radius: 50%;
  animation: boot-orbit 1.65s linear infinite;
}

.boot-orbit-spinner::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #327f48;
  box-shadow: 0 0 0 3px rgba(50, 127, 72, 0.08);
  transform: translateX(-50%);
}

.boot-logo-tile {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 8px 28px rgba(58, 42, 31, 0.08);
}

.boot-logo-tile img {
  width: 86px;
  height: 86px;
  border-radius: 18px;
  object-fit: contain;
}

.boot-loader p {
  margin: 0;
  color: var(--text);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.boot-loop {
  display: flex;
  width: min(1080px, 100%);
  padding-top: 24px;
  border-top: 1px solid rgba(218, 206, 185, 0.78);
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 750;
}

.boot-loop span + span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 13px;
  border-radius: 50%;
  background: #327f48;
  vertical-align: middle;
}

@keyframes boot-orbit {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-orbit-spinner {
    animation: none;
    transform: rotate(30deg);
  }
}

/* RPG Game Review presentation. The shared review board and engine remain unchanged. */
body.review-rpg-mode {
  overflow: hidden;
  background:
    linear-gradient(rgba(3, 5, 4, 0.22), rgba(3, 5, 4, 0.38)),
    url("/assets/review-rpg/review-room-background.png") center / cover fixed,
    #030706;
}

body.review-rpg-mode .app-header {
  display: none;
}

body.board-first-mode.review-rpg-mode .shell.review-mode {
  width: calc(100vw - 16px);
  height: calc(100vh - 16px);
  margin: 8px auto;
}

body.board-first-mode.review-rpg-mode .review-screen.review-board-active {
  width: 100%;
  height: 100%;
}

.review-screen.review-board-active.review-rpg-theme {
  --review-canvas: #07100d;
  --review-surface: #e1c18a;
  --review-ink: #2d1a0e;
  --review-muted: #6a4a2f;
  --review-line: #8a5e2a;
  --review-accent: #315c46;
  --review-accent-hover: #244735;
  --review-accent-soft: #b9b17b;
  --review-warm: #c89d4f;
  position: relative;
  border: 4px solid #3d270f;
  outline: 2px solid #ba8736;
  outline-offset: -7px;
  background:
    linear-gradient(rgba(4, 7, 5, 0.18), rgba(4, 7, 5, 0.34)),
    url("/assets/review-rpg/review-room-background.png") center / cover,
    #07100d;
  padding: 14px;
  color: #ead6aa;
  image-rendering: auto;
}

.review-screen.review-board-active.review-rpg-theme::before {
  position: absolute;
  z-index: 0;
  inset: 8px;
  border: 1px solid rgba(214, 158, 70, 0.48);
  box-shadow: inset 0 0 44px #000;
  content: "";
  pointer-events: none;
}

.review-screen.review-board-active.review-rpg-theme .review-result,
.review-screen.review-board-active.review-rpg-theme .review-game-layout {
  position: relative;
  z-index: 1;
}

.review-screen.review-board-active.review-rpg-theme .review-game-layout {
  grid-template-columns: minmax(520px, 1.06fr) minmax(480px, 0.94fr);
  gap: 14px;
}

.review-screen.review-board-active.review-rpg-theme .review-board-panel {
  display: grid;
  align-content: center;
  min-width: 0;
  border: 5px solid #2d1a0a;
  outline: 2px solid #a9762c;
  outline-offset: -8px;
  background:
    linear-gradient(90deg, rgba(255, 203, 113, 0.04), transparent 18%, rgba(0, 0, 0, 0.24)),
    repeating-linear-gradient(0deg, #27170d 0 5px, #2f1c10 6px 11px);
  padding: 16px;
  box-shadow: inset 0 0 30px #080402, 0 10px 26px rgba(0, 0, 0, 0.54);
}

.review-screen.review-board-active.review-rpg-theme .review-board-area {
  --review-board-size: min(calc(100% - 38px), calc(100vh - 112px));
}

.review-screen.review-board-active.review-rpg-theme .review-board-area.eval-hidden {
  --review-board-size: min(100%, calc(100vh - 112px));
}

.review-screen.review-board-active.review-rpg-theme .review-board-wrap {
  border: 9px ridge #6b431d;
  outline: 2px solid #c18b37;
  outline-offset: 2px;
  background: #1f1209;
  box-shadow: 0 14px 36px #000, inset 0 0 0 2px #1a0d06;
}

.review-screen.review-board-active.review-rpg-theme .review-board .square.light {
  background: #d7bd8b;
}

.review-screen.review-board-active.review-rpg-theme .review-board .square.dark {
  background: #72583d;
}

.review-screen.review-board-active.review-rpg-theme .review-player-row {
  color: #ead6aa;
  font-family: Georgia, "Times New Roman", serif;
  text-shadow: 1px 2px #000;
}

.review-screen.review-board-active.review-rpg-theme .review-eval-bar {
  border: 2px solid #a9762c;
  background: #100b07;
  box-shadow: 0 0 0 3px #2d1a0a;
}

.review-screen.review-board-active.review-rpg-theme .review-eval-label {
  border-color: #a9762c;
  background: #19120c;
  color: #e6bd67;
}

.review-screen.review-board-active.review-rpg-theme .review-side-panel {
  gap: 9px;
  border: 4px solid #2d1a0a;
  outline: 2px solid #a9762c;
  outline-offset: -7px;
  background:
    linear-gradient(rgba(22, 12, 6, 0.16), rgba(10, 6, 3, 0.4)),
    repeating-linear-gradient(0deg, #382215 0 6px, #2e1b10 7px 13px);
  padding: 12px;
  box-shadow: inset 0 0 28px #080402, 0 10px 26px rgba(0, 0, 0, 0.52);
}

.review-screen.review-board-active.review-rpg-theme .review-workspace-heading {
  min-height: 58px;
  border: 2px solid #b17b2f;
  outline: 4px solid #27170c;
  border-radius: 0;
  background: linear-gradient(#17332b, #0c211b);
  padding: 8px 10px;
  box-shadow: inset 0 0 12px #020706;
}

.review-screen.review-board-active.review-rpg-theme .review-workspace-title h1 {
  color: #f0d99e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 1.45vw, 25px);
  letter-spacing: 0.055em;
  text-shadow: 2px 3px #060806;
  text-transform: uppercase;
}

.review-screen.review-board-active.review-rpg-theme .review-workspace-mark {
  border: 1px solid #d3a453;
  border-radius: 0;
  background: #4e3419;
  color: #efcf83;
}

.review-rpg-navigation {
  width: 38px;
  min-width: 38px;
  min-height: 34px;
  border: 2px solid #9d6c29;
  border-radius: 0;
  background: linear-gradient(#26362e, #101b17);
  color: #e5c986;
  padding: 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#review-rpg-home::before {
  content: "⌂";
  font-size: 18px;
}

#review-rpg-exit::before {
  content: "F";
  font-size: 14px;
}

.review-screen.review-board-active.review-rpg-theme :is(.review-import-pgn-button, .review-recent-games-trigger) {
  border: 2px solid #9d6c29;
  border-radius: 0;
  background: linear-gradient(#312319, #17100c);
  color: #e5c986;
  font-family: Georgia, "Times New Roman", serif;
  padding-inline: 7px;
  font-size: 10px;
}

.review-screen.review-board-active.review-rpg-theme .review-recent-games-trigger {
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-screen.review-board-active.review-rpg-theme :is(.review-rpg-navigation, .review-import-pgn-button, .review-recent-games-trigger):hover,
.review-screen.review-board-active.review-rpg-theme :is(.review-rpg-navigation, .review-import-pgn-button, .review-recent-games-trigger):focus-visible {
  border-color: #e0b45c;
  background: #315c46;
  color: #fff0c7;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage,
.review-screen.review-board-active.review-rpg-theme .review-summary-stage {
  gap: 9px;
  scrollbar-color: #9f7134 #25150c;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage {
  padding: 0 3px 0 0;
}

.review-screen.review-board-active.review-rpg-theme .review-summary-stage {
  border: 3px solid #8d5b24;
  background:
    radial-gradient(circle at 25% 10%, rgba(255, 246, 193, 0.32), transparent 26%),
    linear-gradient(96deg, #d9bb82, #ebd29d 55%, #cfae73);
  color: #332113;
  padding: 14px;
  box-shadow: inset 0 0 20px rgba(83, 47, 15, 0.36);
}

.review-rpg-coach-note {
  order: 4;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 3px solid #8d5b24;
  background:
    radial-gradient(circle at 12% 22%, rgba(255, 245, 194, 0.35), transparent 24%),
    linear-gradient(98deg, #d8b77d, #ead09b);
  color: #352014;
  padding: 7px 10px;
  box-shadow: inset 0 0 16px rgba(86, 49, 17, 0.3);
}

.review-rpg-coach-note[hidden] {
  display: none !important;
}

.review-rpg-coach-note img {
  width: 58px;
  height: 58px;
  border: 3px solid #5e3b1c;
  background: #385044;
  object-fit: cover;
  image-rendering: pixelated;
}

.review-rpg-coach-note span,
.review-rpg-coach-note strong {
  display: block;
}

.review-rpg-coach-note span {
  margin-bottom: 4px;
  color: #69431f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-rpg-coach-note strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(17px, 1.25vw, 22px);
  line-height: 1.2;
}

.review-screen.review-board-active.review-rpg-theme .review-move-insight {
  order: 8;
  border: 3px solid #8d5b24;
  border-radius: 0;
  background: linear-gradient(100deg, #e5c88f, #d7b579);
  color: #342014;
  padding: 8px 10px;
  box-shadow: inset 0 0 14px rgba(87, 49, 15, 0.24);
}

.review-screen.review-board-active.review-rpg-theme .review-move-insight h2,
.review-screen.review-board-active.review-rpg-theme #review-move-insight-eval {
  color: #342014;
}

.review-screen.review-board-active.review-rpg-theme #review-move-insight-eval {
  border: 1px solid #8c602e;
  border-radius: 0;
  background: rgba(255, 241, 194, 0.42);
}

.review-screen.review-board-active.review-rpg-theme .review-insight-next {
  border-color: #7b531e;
  border-radius: 0;
  background: #315c46;
  color: #fff0c7;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-move-panel {
  order: 20;
  flex: 1 1 118px;
  border: 3px solid #8d5b24;
  border-radius: 0;
  background: linear-gradient(96deg, #ddbf86, #ead19b);
  color: #352014;
  box-shadow: inset 0 0 15px rgba(85, 48, 15, 0.26);
}

.review-screen.review-board-active.review-rpg-theme .review-panel-heading {
  border-bottom-color: #9b713d;
}

.review-screen.review-board-active.review-rpg-theme .review-move-button {
  color: #392416;
}

.review-screen.review-board-active.review-rpg-theme .review-move-button.current {
  background: #315c46;
  color: #fff0c7;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-playback-controls {
  order: 30;
}

.review-screen.review-board-active.review-rpg-theme .review-playback-controls {
  gap: 5px;
  border: 3px solid #6e451d;
  background: #26160c;
  padding: 5px;
}

.review-screen.review-board-active.review-rpg-theme .review-playback-controls button {
  min-height: 38px;
  border: 2px solid #95652a;
  border-radius: 0;
  background: linear-gradient(#302219, #17100b);
  color: #e8cb86;
}

.review-screen.review-board-active.review-rpg-theme .review-playback-controls button.review-playback-primary {
  background: #315c46;
  color: #fff0c7;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-view-controls {
  order: 35;
  border: 3px solid #6e451d;
  background: #26160c;
  padding: 4px;
}

.review-screen.review-board-active.review-rpg-theme .review-view-controls button {
  border-color: #95652a;
  border-radius: 0;
  background: #19110c;
  color: #e8cb86;
}

.review-rpg-position-analysis {
  order: 40;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  min-height: 124px;
  gap: 8px;
  border: 3px solid #8d5b24;
  background: linear-gradient(96deg, #d8b77d, #ecd39e);
  color: #352014;
  padding: 8px 12px;
  box-shadow: inset 0 0 16px rgba(85, 48, 15, 0.28);
}

.review-rpg-position-analysis[hidden] {
  display: none !important;
}

.review-rpg-position-analysis h2 {
  align-self: start;
  grid-column: 1 / -1;
  margin: 0;
  border-bottom: 1px solid #9b713d;
  padding-bottom: 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.review-rpg-gauge {
  position: relative;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 150px minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-items: center;
  min-height: 84px;
  gap: 12px;
}

.review-rpg-gauge svg {
  grid-row: 1 / 3;
  width: 150px;
  height: 88px;
  overflow: visible;
  filter: drop-shadow(0 3px 1px rgba(69, 38, 13, 0.32));
}

.review-rpg-gauge-face {
  fill: #c6a66f;
  stroke: #5b391a;
  stroke-width: 20;
}

.review-rpg-gauge-scale {
  fill: none;
  stroke: #ecdbad;
  stroke-width: 12;
}

.review-rpg-gauge-ticks {
  fill: none;
  stroke: #4d371f;
  stroke-width: 3;
}

.review-rpg-gauge-needle {
  fill: #315c46;
  transform-box: view-box;
  transform-origin: 120px 108px;
  transition: transform 260ms ease-out;
}

.review-rpg-gauge-pin {
  fill: #b47c2d;
  stroke: #4a2d13;
  stroke-width: 4;
}

.review-rpg-gauge text {
  fill: #3a2515;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 900;
}

#review-rpg-gauge-value,
#review-rpg-gauge-description {
  grid-column: 2;
}

#review-rpg-gauge-value {
  grid-row: 1;
  align-self: end;
  color: #315c46;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 2.2vw, 40px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

#review-rpg-gauge-description {
  grid-row: 2;
  align-self: start;
  color: #53371e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: 700;
}

.review-rpg-gauge.pending #review-rpg-gauge-value,
.review-rpg-gauge.off #review-rpg-gauge-value {
  color: #78664b;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-analysis-board-live {
  order: 45;
  border: 3px solid #8d5b24;
  border-radius: 0;
  background: #dfc18b;
  color: #352014;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-analysis,
.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-final-report,
.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-analysis-board-actions,
.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-accuracy-timeline,
.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-eval-graph,
.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-guided {
  order: 50;
  border-color: #8d5b24;
  border-radius: 0;
  background: #dfc18b;
  color: #352014;
}

/* Pixel Club review kit: one carved workspace rather than a stack of web cards. */
.review-screen.review-board-active.review-rpg-theme .review-game-layout {
  grid-template-columns: minmax(560px, 1.08fr) minmax(510px, 0.92fr);
  gap: 10px;
}

.review-screen.review-board-active.review-rpg-theme .review-board-panel,
.review-screen.review-board-active.review-rpg-theme .review-side-panel {
  border: 12px solid transparent;
  border-image: url("/assets/world/ui/panel-frame.png") 16 fill round;
  outline: 1px solid #c08a35;
  outline-offset: -8px;
}

.review-screen.review-board-active.review-rpg-theme .review-board-panel {
  background: rgba(18, 10, 6, 0.78);
  padding: 12px;
}

.review-screen.review-board-active.review-rpg-theme .review-side-panel {
  gap: 7px;
  background: rgba(17, 10, 6, 0.84);
  padding: 10px;
}

.review-screen.review-board-active.review-rpg-theme .review-workspace-heading {
  position: relative;
  min-height: 62px;
  border: 0;
  border-image: none;
  outline: 0;
  background:
    linear-gradient(90deg, rgba(232, 191, 103, 0.09), transparent 24% 76%, rgba(232, 191, 103, 0.09)),
    #0d201b;
  box-shadow:
    inset 0 0 0 2px #9d6b27,
    inset 0 0 0 6px #27170b,
    0 4px 0 #100804;
  padding: 9px 12px;
}

.review-screen.review-board-active.review-rpg-theme .review-workspace-heading::before,
.review-screen.review-board-active.review-rpg-theme .review-workspace-heading::after {
  position: absolute;
  top: 5px;
  bottom: 5px;
  width: 7px;
  border-block: 2px solid #d1a450;
  content: "";
  pointer-events: none;
}

.review-screen.review-board-active.review-rpg-theme .review-workspace-heading::before {
  left: 5px;
  border-left: 2px solid #d1a450;
}

.review-screen.review-board-active.review-rpg-theme .review-workspace-heading::after {
  right: 5px;
  border-right: 2px solid #d1a450;
}

.review-screen.review-board-active.review-rpg-theme .review-workspace-title h1,
.review-screen.review-board-active.review-rpg-theme :is(button, select),
.review-screen.review-board-active.review-rpg-theme .review-panel-heading h2 {
  font-family: ui-monospace, Menlo, Monaco, "Courier New", monospace;
}

.review-screen.review-board-active.review-rpg-theme .review-workspace-title h1 {
  font-size: clamp(18px, 1.35vw, 25px);
  letter-spacing: 0.08em;
}

.review-screen.review-board-active.review-rpg-theme .review-workspace-tools {
  gap: 5px;
}

.review-screen.review-board-active.review-rpg-theme .review-mode-switch {
  display: none;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(300px, 1.2fr);
  grid-auto-flow: row dense;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 7px 0;
  overflow-y: auto;
  padding: 1px 3px 3px 1px;
}

.review-screen.review-board-active.review-rpg-theme .review-rpg-coach-note {
  grid-column: 1;
  order: 4;
  min-height: 102px;
  border-width: 3px 0 3px 3px;
  background:
    linear-gradient(100deg, rgba(255, 244, 200, 0.2), transparent 48%),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(94, 61, 27, 0.09) 24px 25px),
    #dcc18c;
  box-shadow: inset 8px 0 18px rgba(79, 42, 14, 0.18);
}

.review-screen.review-board-active.review-rpg-theme .review-rpg-coach-note img {
  width: 68px;
  height: 68px;
  border: 5px solid transparent;
  border-image: url("/assets/world/ui/portrait-frame.png") 18 fill round;
  background: #31483d;
}

.review-screen.review-board-active.review-rpg-theme .review-rpg-coach-note strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(15px, 1vw, 18px);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.review-screen.review-board-active.review-rpg-theme .review-move-insight {
  grid-column: 2;
  order: 4;
  min-height: 102px;
  gap: 4px;
  border-width: 3px 3px 3px 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 241, 190, 0.38), transparent 34%),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(94, 61, 27, 0.09) 24px 25px),
    #e6cd99;
  padding: 11px 12px 8px;
}

.review-screen.review-board-active.review-rpg-theme .review-move-insight-main {
  align-items: center;
}

.review-screen.review-board-active.review-rpg-theme .review-move-insight h2 {
  font-size: clamp(18px, 1.35vw, 25px);
}

.review-screen.review-board-active.review-rpg-theme #review-move-insight-eval {
  min-width: 86px;
  border: 3px double #845822;
  background: rgba(249, 226, 169, 0.56);
  color: #2d5e48;
  font-size: clamp(20px, 1.5vw, 29px);
}

.review-screen.review-board-active.review-rpg-theme .review-insight-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.review-screen.review-board-active.review-rpg-theme .review-insight-next {
  width: 100%;
  min-height: 32px;
  justify-self: start;
  font-size: 13px;
}

.review-screen.review-board-active.review-rpg-theme .review-insight-highlights[hidden] + .review-insight-next {
  grid-column: 1 / -1;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage > :is(
  .review-move-panel,
  .review-position-controls,
  .review-playback-controls,
  .review-view-controls,
  .review-eval-graph,
  .review-accuracy-timeline,
  .review-final-report,
  .review-analysis-board-actions,
  .review-guided,
  .review-analysis
) {
  grid-column: 1 / -1;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-move-panel {
  order: 20;
  min-height: 108px;
  max-height: 154px;
  border: 12px solid transparent;
  border-image: url("/assets/world/ui/panel-frame.png") 16 round;
  background:
    repeating-linear-gradient(0deg, transparent 0 25px, rgba(93, 59, 25, 0.11) 26px 27px),
    #dfc28d;
  padding: 4px 8px 7px;
}

.review-screen.review-board-active.review-rpg-theme .review-panel-heading {
  min-height: 32px;
  border-bottom: 2px solid #8e612c;
}

.review-screen.review-board-active.review-rpg-theme .review-panel-heading h2,
.review-screen.review-board-active.review-rpg-theme .review-rpg-position-analysis h2 {
  color: #4c2f16;
  font-size: 15px;
  letter-spacing: 0.09em;
}

.review-screen.review-board-active.review-rpg-theme .review-panel-heading-actions button {
  min-height: 27px;
  border: 1px solid #9a6828;
  border-radius: 0;
  background: #18251f;
  color: #e8cb87;
  padding: 3px 9px;
}

.review-screen.review-board-active.review-rpg-theme .review-position-controls {
  order: 25;
  border: 2px solid #6a421c;
  background: #24140b;
  color: #edd39a;
  padding: 3px;
}

.review-screen.review-board-active.review-rpg-theme .review-position-controls button {
  min-height: 30px;
  border: 1px solid #9b6b2a;
  border-radius: 0;
  background: #130d09;
  color: #ead093;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-playback-controls {
  order: 30;
}

.review-screen.review-board-active.review-rpg-theme .review-playback-controls,
.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-view-controls {
  border: 7px solid transparent;
  border-image: url("/assets/world/ui/panel-frame.png") 16 fill round;
  background: #170e09;
  padding: 2px;
}

.review-screen.review-board-active.review-rpg-theme .review-playback-controls button,
.review-screen.review-board-active.review-rpg-theme .review-view-controls button,
.review-screen.review-board-active.review-rpg-theme .review-analysis-board-live button,
.review-screen.review-board-active.review-rpg-theme .review-analysis-board-actions button {
  border: 0;
  border-radius: 0;
  background: url("/assets/world/ui/button-default.png") center / 100% 100% no-repeat;
  color: #efd69b;
  text-shadow: 1px 2px #0a0502;
}

.review-screen.review-board-active.review-rpg-theme .review-playback-controls button:hover,
.review-screen.review-board-active.review-rpg-theme .review-view-controls button:hover,
.review-screen.review-board-active.review-rpg-theme .review-analysis-board-live button:hover,
.review-screen.review-board-active.review-rpg-theme .review-analysis-board-actions button:hover {
  background-image: url("/assets/world/ui/button-hover.png");
}

.review-screen.review-board-active.review-rpg-theme .review-playback-controls button.review-playback-primary,
.review-screen.review-board-active.review-rpg-theme :is(.review-view-controls, .review-analysis-board-live) button.active {
  background-image: url("/assets/world/ui/button-active.png");
  background-color: transparent;
  color: #fff0bd;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-view-controls {
  order: 35;
}

.review-screen.review-board-active.review-rpg-theme .review-rpg-position-analysis {
  grid-column: 1;
  order: 40;
  min-height: 152px;
  border-width: 3px 0 3px 3px;
  background:
    radial-gradient(circle at 20% 90%, rgba(105, 65, 25, 0.18), transparent 40%),
    #e0c38d;
  padding: 8px 10px;
}

.review-screen.review-board-active.review-rpg-theme .review-rpg-gauge {
  grid-template-columns: minmax(118px, 0.9fr) minmax(85px, 1fr);
  gap: 7px;
}

.review-screen.review-board-active.review-rpg-theme .review-rpg-gauge svg {
  width: min(150px, 100%);
}

.review-screen.review-board-active.review-rpg-theme #review-rpg-gauge-value {
  font-size: clamp(27px, 2vw, 38px);
}

.review-screen.review-board-active.review-rpg-theme #review-rpg-gauge-description {
  font-size: 12px;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-analysis-board-live {
  grid-column: 2;
  order: 40;
  min-height: 152px;
  border-width: 3px 3px 3px 0;
  background:
    linear-gradient(90deg, rgba(255, 242, 194, 0.08), transparent),
    #dec08a;
  padding: 10px;
}

.review-screen.review-board-active.review-rpg-theme .review-analysis-board-live-heading {
  border-bottom: 1px solid #95682f;
  padding-bottom: 5px;
}

.review-screen.review-board-active.review-rpg-theme .review-analysis-board-live-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.review-screen.review-board-active.review-rpg-theme .review-analysis-board-live button {
  min-height: 35px;
  padding: 5px 6px;
  font-size: 10px;
}

.review-screen.review-board-active.review-rpg-theme .review-analysis-depth-controls {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.review-screen.review-board-active.review-rpg-theme .review-analysis-depth-controls select {
  min-height: 34px;
  border: 2px solid #855820;
  border-radius: 0;
  background: #f0d59e;
  color: #352014;
}

.review-screen.review-board-active.review-rpg-theme .review-active-stage .review-analysis-board-actions {
  order: 45;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border: 7px solid transparent;
  border-image: url("/assets/world/ui/panel-frame.png") 16 fill round;
  background: #170e09;
  padding: 3px;
}

.review-screen.review-board-active.review-rpg-theme .review-analysis-board-actions button {
  min-height: 36px;
  flex: 1 1 80px;
  padding: 5px 7px;
  font-size: 10px;
}

.review-screen.review-board-active.review-rpg-theme .review-analysis-board-actions #review-analysis-board-status {
  flex: 1 0 100%;
  color: #d8bc7a;
  font-size: 10px;
}

@media (max-width: 1100px) {
  body.review-rpg-mode {
    overflow: auto;
  }

  body.board-first-mode.review-rpg-mode .shell.review-mode,
  body.board-first-mode.review-rpg-mode .review-screen.review-board-active {
    height: auto;
    min-height: calc(100vh - 16px);
  }

  .review-screen.review-board-active.review-rpg-theme .review-game-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .review-screen.review-board-active.review-rpg-theme .review-board-panel,
  .review-screen.review-board-active.review-rpg-theme .review-side-panel {
    max-height: none;
  }

  .review-screen.review-board-active.review-rpg-theme .review-board-area {
    --review-board-size: min(calc(100% - 38px), 82vh);
  }
}

@media (prefers-reduced-motion: reduce) {
  .review-rpg-gauge-needle {
    transition: none;
  }
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  padding: 48px;
  place-items: center;
}

.auth-panel {
  width: min(760px, 100%);
  padding: 34px;
  border: 1px solid var(--border);
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 24px 70px rgba(58, 42, 31, 0.08);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 32px;
}

.auth-brand-logo {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
}

.auth-brand-logo img {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: contain;
}

.auth-brand p,
.auth-login-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.auth-login-card {
  padding: 26px;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.auth-login-card h2 {
  margin: 0;
  font-size: 28px;
}

.google-sign-in-button {
  min-height: 44px;
  margin-top: 22px;
}

.local-auth-form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.local-auth-divider {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.local-auth-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
}

.local-auth-form input {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.local-auth-form button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid #151311;
  border-radius: 6px;
  background: #151311;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.auth-status {
  min-height: 22px;
  font-size: 14px;
}

.auth-status.error {
  color: #a91616;
  font-weight: 800;
}

#auth-retry {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  font-weight: 800;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 250, 242, 0.96);
}

body.board-first-mode .app-header {
  min-height: 44px;
  padding: 7px 20px;
}

body.board-first-mode .app-home-link {
  width: 34px;
  height: 34px;
}

body.board-first-mode .app-section-back {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 13px;
}

.app-home-link {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  text-decoration: none;
}

.app-home-link:hover,
.app-home-link:focus {
  outline: 2px solid rgba(58, 42, 31, 0.24);
  outline-offset: 2px;
}

.app-home-link img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
  object-fit: contain;
}

.app-section-back {
  margin-left: auto;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.app-section-back:hover,
.app-section-back:focus {
  background: #171717;
  color: white;
}

.header-menu {
  position: relative;
}

.app-language-switch,
.home-language-switch {
  margin-left: auto;
}

.app-section-back:not([hidden]) + .app-language-switch {
  margin-left: 0;
}

.header-menu-button {
  display: inline-grid;
  min-width: 40px;
  min-height: 36px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.language-menu-button {
  font-size: 18px;
  line-height: 1;
}

.header-menu-button:hover,
.header-menu-button:focus,
.header-menu-button[aria-expanded="true"] {
  background: #171717;
  color: white;
}

.profile-menu-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.header-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: grid;
  min-width: 170px;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  box-shadow: 0 18px 50px rgba(58, 42, 31, 0.14);
}

.header-menu-panel[hidden] {
  display: none !important;
}

.language-menu-panel {
  min-width: 76px;
}

.header-menu-panel button,
.header-menu-panel a {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: flex-start;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 900;
  text-align: left;
  text-decoration: none;
}

.header-menu-panel button:hover,
.header-menu-panel button:focus,
.header-menu-panel a:hover,
.header-menu-panel a:focus,
.header-menu-panel button.active,
.header-menu-panel button[aria-pressed="true"] {
  background: #171717;
  color: white;
}

.profile-menu-panel {
  min-width: 230px;
}

.profile-menu-name {
  display: block;
  max-width: 210px;
  overflow: hidden;
  padding: 7px 9px 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kids-theme-control {
  display: grid;
  gap: 8px;
  padding: 7px 9px 9px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.kids-theme-control > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.kids-theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
}

.header-menu-panel .kids-theme-options button {
  justify-content: center;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.header-menu-panel .kids-theme-options button.active,
.header-menu-panel .kids-theme-options button[aria-pressed="true"] {
  background: var(--kids-accent);
  color: white;
}

.language-menu-panel button {
  justify-content: center;
  min-width: 36px;
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.language-menu-panel button.active,
.language-menu-panel button[aria-pressed="true"] {
  background: #171717;
  color: white;
}

:root[data-kids-theme] .app-header,
:root[data-kids-theme] .auth-panel,
:root[data-kids-theme] .home-dashboard,
:root[data-kids-theme] .side,
:root[data-kids-theme] .career-screen,
:root[data-kids-theme] .placement-tournament-screen,
:root[data-kids-theme] .review-screen,
:root[data-kids-theme] .learning-screen,
:root[data-kids-theme] .opening-practice-screen {
  background:
    radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--kids-accent-soft) 62%, transparent), transparent 28%),
    var(--panel);
}

:root[data-kids-theme] .app-header {
  border-bottom-color: var(--border);
}

:root[data-kids-theme] .header-menu-panel,
:root[data-kids-theme] .auth-login-card,
:root[data-kids-theme] .home-continue,
:root[data-kids-theme] .home-tip,
:root[data-kids-theme] .home-card-stack.mode-actions button,
:root[data-kids-theme] .career-panel,
:root[data-kids-theme] .career-summary-card,
:root[data-kids-theme] .placement-tournament-panel,
:root[data-kids-theme] .placement-tournament-summary-card,
:root[data-kids-theme] .opening-practice-panel,
:root[data-kids-theme] .opening-practice-source-panel,
:root[data-kids-theme] .opening-practice-board-panel,
:root[data-kids-theme] .opening-practice-side-panel,
:root[data-kids-theme] .review-analysis,
:root[data-kids-theme] .review-panel,
:root[data-kids-theme] .learning-panel {
  background: var(--soft-surface);
  border-color: var(--border);
  box-shadow: 0 16px 38px color-mix(in srgb, var(--kids-accent) 10%, transparent);
}

:root[data-kids-theme] .header-menu-button,
:root[data-kids-theme] .app-section-back,
:root[data-kids-theme] .home-settings-button,
:root[data-kids-theme] .home-tip button,
:root[data-kids-theme] button:not(.square):not(.review-move-button):not(.home-continue-item) {
  border-color: var(--border);
}

:root[data-kids-theme] .header-menu-button:hover,
:root[data-kids-theme] .header-menu-button:focus,
:root[data-kids-theme] .header-menu-button[aria-expanded="true"],
:root[data-kids-theme] .app-section-back:hover,
:root[data-kids-theme] .app-section-back:focus,
:root[data-kids-theme] .home-settings-button:hover,
:root[data-kids-theme] .home-tip button:hover {
  background: var(--kids-accent);
  color: white;
}

:root[data-kids-theme] .home-continue-item:hover,
:root[data-kids-theme] .home-continue-item:focus,
:root[data-kids-theme] .home-card-stack.mode-actions button:hover,
:root[data-kids-theme] .home-card-stack.mode-actions button:focus,
:root[data-kids-theme] .home-card-stack.mode-actions button.selected-mode {
  background: var(--soft-hover);
}

:root[data-kids-theme] .home-icon,
:root[data-kids-theme] .home-tip-icon,
:root[data-kids-theme] .home-section-heading > span {
  border-color: color-mix(in srgb, var(--kids-accent) 28%, var(--border));
  background:
    linear-gradient(145deg, var(--surface), var(--kids-accent-soft));
  color: var(--kids-accent);
}

:root[data-kids-theme] .home-section-heading > span {
  background: transparent;
  color: var(--kids-accent);
}

:root[data-kids-theme] .home-progress span {
  background: linear-gradient(90deg, var(--kids-accent), var(--kids-accent-2));
}

:root[data-kids-theme] .home-card-arrow,
:root[data-kids-theme] .material-advantage {
  color: var(--kids-accent);
}

:root[data-kids-theme] .board-wrap {
  border-color: var(--board-border);
  box-shadow: 0 18px 42px color-mix(in srgb, var(--kids-accent) 18%, transparent);
}

:root[data-kids-theme] .piece img,
:root[data-kids-theme] .captured-piece img {
  filter:
    drop-shadow(0 0 5px var(--kids-piece-glow))
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.42));
}

:root[data-kids-theme] .home-piece-icon img {
  filter:
    brightness(0)
    drop-shadow(0 0 7px var(--kids-piece-glow));
}

.app-user-menu {
  display: block;
  margin-left: 0;
}

.home-user-menu {
  display: block;
  margin-left: 0;
}

.mode-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

#mode-screen {
  padding: 0;
}

.app-header:not([hidden]) ~ .mode-screen {
  min-height: calc(100vh - 56px);
}

.mode-panel {
  display: grid;
  gap: 18px;
  width: min(560px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.mode-panel h1 {
  font-size: 32px;
}

.mode-panel p {
  color: var(--muted);
}

.mode-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.mode-actions button {
  display: grid;
  gap: 6px;
  min-height: 112px;
  align-content: center;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.mode-actions button:hover,
.mode-actions button.selected-mode {
  background: #171717;
  color: white;
}

.mode-actions button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.mode-actions strong,
.mode-actions span {
  display: block;
}

.mode-actions strong {
  font-size: 20px;
  line-height: 1.1;
}

.mode-actions span {
  color: inherit;
  font-size: 13px;
  line-height: 1.35;
}

.home-dashboard {
  width: min(1535px, 100%);
  min-height: 100vh;
  gap: 30px;
  padding: 36px 48px 32px;
  border-radius: 4px;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.9), transparent 34%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.72), rgba(255, 251, 245, 0.94) 46%, rgba(247, 244, 239, 0.96)),
    var(--panel);
  box-shadow: none;
}

.home-experience-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 49px;
  padding: 4px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.74);
}

.home-experience-switch button {
  min-width: 64px;
  min-height: 39px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  padding: 7px 11px;
  font-weight: 900;
  cursor: pointer;
}

.home-experience-switch button:hover,
.home-experience-switch button:focus-visible,
.home-experience-switch button.active {
  background: #171717;
  color: white;
}

.world-home {
  display: none;
}

#mode-screen[data-home-experience="world"] {
  position: fixed;
  inset: 0;
  z-index: 20;
  width: 100vw;
  height: 100vh;
  min-height: 0;
  place-content: center;
  padding: 8px;
  box-sizing: border-box;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 22%, #17201d 0, #080b0a 46%, #020303 100%);
  color: #f4e4bb;
}

#mode-screen[data-home-experience="world"] .home-dashboard {
  display: none;
}

#mode-screen[data-home-experience="world"] .world-home {
  display: block;
}

.world-home.pixel-club {
  width: auto;
  padding: 0;
}

.pixel-club-game {
  --pixel-club-width: min(1800px, calc(100vw - 16px), calc(177.777vh - 30px));
  position: relative;
  width: var(--pixel-club-width);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 4px solid #080b0a;
  outline: 2px solid #a8742f;
  background: #0c1314;
  box-shadow:
    0 0 0 4px #2c2118,
    0 18px 54px rgba(0, 0, 0, 0.7);
  color: #f4e4bb;
  font-family: "Courier New", Courier, monospace;
  image-rendering: pixelated;
}

.pixel-club-titlebar {
  position: absolute;
  z-index: 12;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 3px solid #090d0d;
  background: linear-gradient(rgba(23, 33, 38, 0.98), rgba(16, 23, 27, 0.96));
  padding: 7px 12px;
}

.pixel-club-wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff1cf;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-shadow: 2px 2px 0 #000;
  text-transform: uppercase;
}

.pixel-club-crown {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid #b27d32;
  background: #293b2c;
  color: #e1b55c;
}

.pixel-club-focus-link {
  border: 2px solid #070a0a;
  outline: 1px solid #8f6731;
  background: #192125;
  color: #d9c59a;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.pixel-club-focus-link:hover,
.pixel-club-focus-link:focus-visible {
  background: #36513a;
  color: #fff4d3;
  outline: 3px solid #f0d58d;
  outline-offset: 2px;
}

.pixel-club-title-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pixel-club-scene {
  position: absolute;
  inset: 0;
  width: auto;
  aspect-ratio: auto;
  overflow: hidden;
  background: #202826 url("/assets/pixel-club/clubhouse.png?v=landscape-20260718") center / cover no-repeat;
  image-rendering: pixelated;
  isolation: isolate;
}

.pixel-club-player-card {
  position: absolute;
  z-index: 4;
  top: 9%;
  left: 1.8%;
  display: grid;
  grid-template-columns: 62px minmax(112px, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 205px;
  border: 3px solid #070a0a;
  outline: 2px solid #8f6731;
  background: rgba(15, 24, 28, 0.94);
  padding: 7px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.48);
}

.pixel-club-player-card-action {
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pixel-club-player-card-action:hover,
.pixel-club-player-card-action:focus-visible {
  background: rgba(37, 58, 48, 0.97);
  outline: 3px solid #f0d58d;
  outline-offset: 3px;
  transform: translateY(-2px);
}

.pixel-club-player-portrait {
  width: 62px;
  height: 62px;
  overflow: hidden;
  border: 2px solid #0a0d0d;
  outline: 1px solid #9d7337;
  background: #365468;
}

.pixel-club-player-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  transform: scale(1.52);
  image-rendering: pixelated;
}

.pixel-club-player-card strong,
.pixel-club-player-card span {
  display: block;
  text-shadow: 2px 2px 0 #000;
}

.pixel-club-player-card strong {
  color: #fff1cf;
  font-size: 17px;
}

.pixel-club-player-card span {
  margin-top: 4px;
  color: #b9d281;
  font-size: 13px;
  font-weight: 900;
}

.pixel-club-hotspot {
  position: absolute;
  z-index: 4;
  display: grid;
  min-height: 38px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px;
  border: 3px solid #070a0a;
  outline: 1px solid #8f6731;
  background: rgba(18, 25, 29, 0.95);
  color: #fff0cb;
  padding: 5px 9px;
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.5);
  font: 900 15px/1 "Courier New", Courier, monospace;
  text-shadow: 2px 2px 0 #000;
  cursor: pointer;
}

.pixel-club-hotspot small {
  display: none;
}

.pixel-club-hotspot:hover,
.pixel-club-hotspot:focus-visible {
  background: #36513a;
  outline: 3px solid #f0d58d;
  outline-offset: 2px;
  transform: translateY(-2px);
}

.pixel-club-alert {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 2px solid #111;
  border-radius: 4px;
  background: #fff0cd;
  color: #8d3e20;
  font: 900 18px/1 Georgia, serif;
  text-shadow: none;
}

.pixel-club-hotspot-coach { top: 29%; left: 11%; }
.pixel-club-hotspot-tournament {
  top: 34%;
  left: 50%;
  max-width: 230px;
  transform: translateX(-50%);
  text-align: left;
}
.pixel-club-hotspot-tournament:hover,
.pixel-club-hotspot-tournament:focus-visible {
  transform: translate(-50%, -2px);
}
.pixel-club-hotspot-rivals { top: 29%; right: 9%; }
.pixel-club-hotspot-analysis { bottom: 20%; left: 8%; }
.pixel-club-hotspot-openings { right: 7%; bottom: 20%; }

.pixel-club-load-status {
  position: absolute;
  z-index: 5;
  right: 12px;
  bottom: 82px;
  max-width: 52%;
  margin: 0;
  border: 2px solid #080b0a;
  background: rgba(13, 19, 20, 0.92);
  color: #ead493;
  padding: 5px 8px;
  font-size: 11px;
}

.pixel-club-load-status:empty {
  display: none;
}

.pixel-club-retry {
  position: absolute;
  z-index: 6;
  right: 14px;
  bottom: 112px;
  border: 2px solid #8f6731;
  background: #283f2d;
  color: #fff1cf;
  padding: 7px 10px;
  font: 900 12px/1 "Courier New", Courier, monospace;
  cursor: pointer;
}

.pixel-club-nav {
  position: absolute;
  z-index: 12;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr) minmax(190px, 1.45fr);
  min-height: 76px;
  border-top: 3px solid #070a0a;
  background: rgba(16, 24, 29, 0.97);
}

.pixel-club-nav button,
.pixel-club-next-event {
  min-width: 0;
  border: 0;
  border-right: 2px solid #080b0a;
  background: linear-gradient(#1c2830, #11191e);
  color: #e9dbb8;
  padding: 8px 6px;
  font-family: "Courier New", Courier, monospace;
}

.pixel-club-nav button {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.pixel-club-nav button::before {
  content: "";
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #d5a84d;
  font: 900 23px/1 Georgia, serif;
  text-shadow: 2px 2px 0 #000;
}

.pixel-club-nav button[data-mode-engine]::before { content: "♞"; }
.pixel-club-nav button[data-mode-learning]::before { content: "▤"; }
.pixel-club-nav button[data-mode-review]::before { content: "⌕"; }
.pixel-club-nav button[data-mode-tournament]::before { content: "♜"; }
.pixel-club-nav button[data-home-career-route="/map"]::before { content: "♜"; }
.pixel-club-nav button[data-mode-career]::before { content: "♟"; }

.pixel-club-nav button:hover,
.pixel-club-nav button:focus-visible {
  background: #304835;
  color: #fff4d3;
  outline: 3px solid #e5c267;
  outline-offset: -5px;
}

.pixel-club-next-event {
  display: grid;
  align-content: center;
  gap: 2px;
  border-right: 0;
  padding-inline: 13px;
  text-align: left;
}

.pixel-club-next-event span {
  color: #c79a48;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pixel-club-next-event strong {
  overflow: hidden;
  color: #fff0cc;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pixel-club-next-event small {
  color: #b8c884;
  font-size: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .pixel-club-hotspot {
    transition: none;
  }
}

.game-world-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  width: 100vw;
  height: 100vh;
  place-content: center;
  overflow: hidden;
  box-sizing: border-box;
  background: radial-gradient(circle at 50% 22%, #17201d 0, #080b0a 46%, #020303 100%);
  padding: 8px;
  color: #f4e4bb;
}

.game-world-screen[hidden] {
  display: none;
}

.game-world-frame {
  --game-world-width: min(1800px, calc(100vw - 16px), calc(177.777vh - 30px));
  position: relative;
  width: var(--game-world-width);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 4px solid #080b0a;
  outline: 2px solid #a8742f;
  background: #0c1314;
  box-shadow: 0 0 0 4px #2c2118, 0 18px 54px rgba(0, 0, 0, 0.7);
  font-family: "Courier New", Courier, monospace;
  image-rendering: pixelated;
}

.game-world-titlebar {
  position: absolute;
  z-index: 20;
  inset: 0 0 auto;
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 3px solid #090d0d;
  background: linear-gradient(rgba(23, 33, 38, 0.98), rgba(16, 23, 27, 0.96));
  padding: 7px 12px;
}

.game-world-player-card {
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(58px, 5vw) minmax(0, 1fr);
  align-items: center;
  gap: clamp(7px, 0.7vw, 13px);
  min-width: 0;
  border: 3px solid #070a0a;
  outline: 2px solid #8f6731;
  background: rgba(15, 24, 28, 0.95);
  padding: clamp(7px, 0.8vw, 14px);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.48);
  color: #fff1cf;
}

.game-world-player-portrait {
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid #0a0d0d;
  outline: 1px solid #9d7337;
  background: #365468;
}

.game-world-player-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  transform: scale(1.52);
  image-rendering: pixelated;
}

.game-world-player-card strong,
.game-world-player-card span,
.game-world-player-card small {
  display: block;
  text-shadow: 2px 2px 0 #000;
}

.game-world-player-card span {
  margin-bottom: 4px;
  color: #d3a852;
  font-size: clamp(8px, 0.7vw, 12px);
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.game-world-player-card strong {
  overflow: hidden;
  font-size: clamp(13px, 1.25vw, 21px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-world-player-card small {
  margin-top: 4px;
  color: #b9d281;
  font-size: clamp(9px, 0.8vw, 14px);
  font-weight: 900;
}

.career-desk-surface {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #271207 url("/assets/career-desk/career-desk-fixed-16x9.png?v=20260718") center / 100% 100% no-repeat;
  box-sizing: border-box;
}

.career-desk-frame {
  --career-desk-scale: 1;
  width: 1672px;
  height: 941px;
  max-width: none;
  aspect-ratio: auto;
  transform: scale(var(--career-desk-scale));
  transform-origin: center;
}

.career-desk-frame .game-world-titlebar {
  height: 89px;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.career-desk-frame .pixel-club-wordmark {
  position: absolute;
  top: 12px;
  left: 174px;
  display: grid;
  width: 306px;
  height: 48px;
  place-items: center;
  color: #26170d;
  font: 900 20px/1 Georgia, serif;
  letter-spacing: 0.08em;
  text-shadow: 1px 1px 0 rgba(255, 231, 166, 0.42);
  text-transform: uppercase;
}

.career-desk-frame .pixel-club-crown { display: none; }

.career-desk-frame .pixel-club-title-links {
  position: absolute;
  top: 24px;
  right: 79px;
  display: grid;
  width: 403px;
  height: 35px;
  grid-template-columns: repeat(3, 1fr);
  gap: 3.8%;
}

.career-desk-frame .pixel-club-focus-link {
  display: grid;
  min-height: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: #382316;
  padding: 0 4px;
  font: 900 11px/1.05 "Courier New", Courier, monospace;
  text-align: center;
  text-shadow: 1px 1px 0 rgba(255, 230, 164, 0.45);
  text-transform: uppercase;
}

.career-desk-frame .pixel-club-focus-link:hover,
.career-desk-frame .pixel-club-focus-link:focus-visible {
  color: #0d2118;
  outline: 2px solid #f3d986;
  outline-offset: 1px;
}

.career-desk-player-card {
  position: absolute;
  z-index: 4;
  top: 184px;
  left: 89px;
  display: block;
  width: 346px;
  height: 280px;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  color: #f5e4b6;
}

.career-desk-player-card .game-world-player-portrait {
  position: absolute;
  top: 20%;
  left: 15%;
  width: 30%;
  height: 42%;
  border: 0;
  outline: 0;
  background: transparent;
}

.career-desk-player-card > div:last-child {
  position: absolute;
  top: 23%;
  left: 50%;
  width: 43%;
}

.career-desk-player-card span {
  color: #c5a761;
  font-size: 11px;
}

.career-desk-player-card strong {
  color: #fff0c6;
  font-size: 17px;
  line-height: 1.1;
  text-overflow: clip;
  white-space: normal;
}

.career-desk-player-card small {
  color: #bad57b;
  font-size: 13px;
}

.desk-paper,
.desk-record-card {
  position: absolute;
  z-index: 2;
  display: block;
  min-width: 0;
  min-height: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  color: #2a1b0d;
  text-shadow: none;
  transform: none;
}

.desk-paper-coach { top: 155px; left: 472px; width: 441px; height: 320px; }
.desk-paper-tournament { top: 156px; left: 903px; width: 380px; height: 301px; }
.desk-paper-review { top: 503px; left: 207px; width: 368px; height: 282px; }
.desk-paper-learning { top: 514px; left: 594px; width: 451px; height: 282px; }
.desk-paper-opening { top: 527px; left: 1053px; width: 338px; height: 259px; }
.desk-record-card { top: 146px; left: 1326px; width: 259px; height: 358px; }

.desk-paper-pin { display: none; }

.desk-paper-eyebrow {
  position: absolute;
  top: 14%;
  left: 9%;
  width: 82%;
  margin: 0 0 6px;
  color: #604019;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.desk-paper h2,
.desk-record-card h2,
.map-event-panel h2 {
  margin: 0;
  color: #24170c;
  font: 900 21px/1.12 Georgia, serif;
}

.desk-paper h2 {
  position: absolute;
  top: 25%;
  left: 9%;
  width: 82%;
}

.desk-paper > p:not(.desk-paper-eyebrow):not(.desk-paper-rival) {
  position: absolute;
  top: 41%;
  left: 9%;
  width: 82%;
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0;
  color: #4d3822;
  font: 700 13px/1.35 Georgia, serif;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.desk-paper-coach,
.desk-paper-tournament,
.desk-paper-review,
.desk-paper-learning,
.desk-paper-opening,
.desk-record-card {
  padding: 0;
  box-sizing: border-box;
}

.desk-paper-tournament .desk-paper-eyebrow { top: 36%; left: 8%; width: 84%; }
.desk-paper-tournament h2 { top: 44%; left: 8%; width: 84%; font-size: 17px; }
.desk-paper-tournament > p:not(.desk-paper-eyebrow):not(.desk-paper-rival) { top: 55%; left: 8%; width: 84%; }

.desk-paper-review .desk-paper-eyebrow { top: 12%; left: 8%; width: 53%; }
.desk-paper-review h2 { top: 26%; left: 8%; width: 53%; font-size: 18px; }
.desk-paper-review > p:not(.desk-paper-eyebrow):not(.desk-paper-rival) { top: 43%; left: 8%; width: 53%; }

.desk-paper-learning .desk-paper-eyebrow { top: 14%; left: 8%; width: 40%; }
.desk-paper-learning h2 { top: 28%; left: 8%; width: 40%; font-size: 18px; }
.desk-paper-learning > p:not(.desk-paper-eyebrow):not(.desk-paper-rival) { top: 46%; left: 8%; width: 40%; }

.desk-paper-opening .desk-paper-eyebrow { top: 14%; left: 8%; width: 84%; }
.desk-paper-opening h2 { top: 28%; left: 8%; width: 84%; font-size: 18px; }
.desk-paper-opening > p:not(.desk-paper-eyebrow):not(.desk-paper-rival) { top: 46%; left: 8%; width: 84%; }

.desk-paper-rival,
.map-event-rival {
  position: absolute;
  top: 68%;
  left: 8%;
  width: 84%;
  margin: 5px 0 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: #542810;
  font-size: 11px;
  font-weight: 900;
}

.desk-paper button,
.desk-record-card button {
  position: absolute;
  z-index: 3;
  display: grid;
  min-height: 0;
  place-items: center;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff0c8;
  padding: 0 6px;
  font: 900 12px/1 "Courier New", Courier, monospace;
  text-align: center;
  text-shadow: 1px 2px 0 #000;
  cursor: pointer;
}

.desk-paper-coach button { left: 28%; bottom: 2.5%; width: 44%; height: 15%; }
.desk-paper-tournament button { left: 29%; bottom: 1%; width: 44%; height: 15%; }
.desk-paper-review button { left: 20%; bottom: 5%; width: 42%; height: 15%; }
.desk-paper-learning button { left: 27%; bottom: 5%; width: 46%; height: 16%; }
.desk-paper-opening button { left: 25%; bottom: 4%; width: 50%; height: 17%; }
.desk-record-card > button { left: 18%; bottom: 5%; width: 64%; height: 13%; }

.desk-paper button:hover,
.desk-paper button:focus-visible,
.desk-record-card button:hover,
.desk-record-card button:focus-visible {
  outline: 2px solid #fff1bd;
  outline-offset: -2px;
}

.map-event-panel button {
  position: relative;
  z-index: 2;
  width: fit-content;
  min-height: 31px;
  margin-top: auto;
  border: 3px solid #26160c;
  outline: 1px solid #b17e38;
  background: #283d2b;
  color: #fff0c8;
  padding: 5px 10px;
  font: 900 clamp(9px, 0.75vw, 13px)/1 "Courier New", Courier, monospace;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.map-event-panel button:hover,
.map-event-panel button:focus-visible {
  background: #47623b;
  outline: 3px solid #fff1bd;
  outline-offset: 2px;
}

.desk-record-values {
  position: absolute;
  top: 16%;
  left: 9%;
  display: grid;
  width: 82%;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin: 3% 0 4%;
}

.desk-record-values span {
  display: grid;
  min-width: 0;
  place-items: center;
  padding: 3px 1px;
}

.desk-record-values strong {
  color: #5d3518;
  font-size: 19px;
}

.desk-record-values small {
  color: #76502d;
  font-size: 8px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.desk-rating-chart {
  position: absolute;
  top: 37%;
  left: 9%;
  width: 82%;
  height: 43%;
  border: 0;
  background: transparent;
  padding: 0;
}

.desk-rating-chart svg { width: 100%; height: 100%; min-height: 0; }
.desk-rating-grid { fill: none; stroke: rgba(65, 45, 25, 0.25); stroke-width: 1; }
.desk-rating-line { fill: none; stroke: #31533a; stroke-linecap: square; stroke-linejoin: bevel; stroke-width: 4; }
.desk-rating-chart p {
  position: absolute;
  inset: 50% 12px auto;
  margin: 0;
  color: #604423;
  font: 700 11px/1.35 Georgia, serif;
  text-align: center;
  transform: translateY(-50%);
}

.game-world-load-status {
  position: absolute;
  z-index: 12;
  right: 2%;
  bottom: 2%;
  max-width: 46%;
  margin: 0;
  border: 2px solid #080b0a;
  background: rgba(13, 19, 20, 0.94);
  color: #ead493;
  padding: 5px 8px;
  font-size: 11px;
}

.game-world-load-status:empty { display: none; }

.game-world-retry {
  position: absolute;
  z-index: 13;
  right: 2%;
  bottom: 6%;
  border: 2px solid #8f6731;
  background: #283f2d;
  color: #fff1cf;
  padding: 7px 10px;
  font: 900 12px/1 "Courier New", Courier, monospace;
}

.tournament-map-surface {
  position: absolute;
  inset: 0 0 9%;
  overflow: hidden;
  background: #132528 url("/assets/pixel-club/tournament-map.png?v=20260718") center / cover no-repeat;
}

.tournament-map-surface::after {
  position: absolute;
  inset: 6% 0 0;
  z-index: 1;
  background: linear-gradient(90deg, transparent 0 68%, rgba(4, 8, 9, 0.2) 73%, rgba(4, 8, 9, 0.72) 100%);
  content: "";
  pointer-events: none;
}

.tournament-map-player-card {
  position: absolute;
  top: 9%;
  left: 1.5%;
  width: min(20%, 290px);
}

.map-event-location {
  position: absolute;
  z-index: 4;
  display: grid;
  max-width: 23%;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 3px 8px;
  border: 3px solid #070a0a;
  outline: 2px solid #9a6d2f;
  background: rgba(15, 24, 28, 0.95);
  color: #fff0cb;
  padding: clamp(6px, 0.7vw, 12px);
  box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.48);
  font-family: "Courier New", Courier, monospace;
  text-align: left;
  cursor: pointer;
}

.map-event-location > span {
  grid-row: 1 / span 2;
  color: #e0b158;
  font: 900 clamp(17px, 1.8vw, 30px)/1 Georgia, serif;
  text-shadow: 2px 2px 0 #000;
}

.map-event-location strong,
.map-event-location small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-event-location strong { font-size: clamp(9px, 0.9vw, 15px); }
.map-event-location small { color: #b8c884; font-size: clamp(7px, 0.62vw, 11px); }
.map-event-location:hover,
.map-event-location:focus-visible,
.map-event-location.is-active {
  background: #304835;
  outline-color: #f0d58d;
}
.map-event-location:focus-visible { outline-width: 4px; outline-offset: 3px; }
.map-event-location-1 { top: 43%; left: 5%; }
.map-event-location-2 { top: 16%; left: 34%; }
.map-event-location-3 { top: 51%; left: 50%; }
.map-event-location-4 { top: 22%; left: 55%; }

.map-event-panel {
  position: absolute;
  z-index: 5;
  top: 12%;
  right: 1.5%;
  display: flex;
  width: 23%;
  min-height: 47%;
  flex-direction: column;
  border: 3px solid #080b0a;
  outline: 2px solid #a8742f;
  background: rgba(15, 24, 28, 0.97);
  padding: clamp(10px, 1.2vw, 21px);
  box-shadow: 6px 7px 0 rgba(0, 0, 0, 0.48);
  color: #f4e4bb;
}

.map-event-panel .desk-paper-eyebrow { color: #d5a84d; }
.map-event-panel h2 { color: #fff0cc; text-shadow: 2px 2px 0 #000; }
.map-event-panel > p:not(.desk-paper-eyebrow):not(.map-event-rival) {
  margin: 9px 0;
  color: #d6c9a9;
  font: 700 clamp(9px, 0.78vw, 14px)/1.45 Georgia, serif;
}

.tournament-map-dock {
  position: absolute;
  z-index: 15;
  inset: auto 0 0;
  display: grid;
  height: 9%;
  grid-template-columns: repeat(4, 1fr);
  border-top: 3px solid #070a0a;
  background: rgba(16, 24, 29, 0.98);
}

.tournament-map-dock button {
  border: 0;
  border-right: 2px solid #080b0a;
  background: linear-gradient(#1c2830, #11191e);
  color: #e9dbb8;
  font: 900 clamp(9px, 0.9vw, 15px)/1 "Courier New", Courier, monospace;
  text-transform: uppercase;
  cursor: pointer;
}

.tournament-map-dock button:last-child { border-right: 0; }
.tournament-map-dock button:hover,
.tournament-map-dock button:focus-visible {
  background: #304835;
  color: #fff4d3;
  outline: 3px solid #e5c267;
  outline-offset: -5px;
}

@media (max-width: 800px) {
  .pixel-club-title-links { gap: 4px; }
  .pixel-club-focus-link { padding: 5px 6px; font-size: 9px; }
}
.home-dashboard h1,
.home-dashboard h2,
.home-dashboard p {
  margin: 0;
}

.home-dashboard h2 {
  color: var(--text);
  text-transform: none;
}

.home-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
  align-items: start;
  gap: 12px;
}

.home-logo-link {
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  border-radius: 18px;
  text-decoration: none;
}

.home-logo-link:hover,
.home-logo-link:focus {
  outline: 2px solid rgba(58, 42, 31, 0.24);
  outline-offset: 3px;
}

.home-logo-link img {
  width: 78px;
  height: 78px;
  border-radius: 18px;
  object-fit: contain;
}

.home-hero h1 {
  font-size: clamp(44px, 4.2vw, 58px);
  line-height: 0.96;
  letter-spacing: -0.01em;
}

.home-hero p {
  margin-top: 11px;
  color: #5e574f;
  font-size: 20px;
  line-height: 1.15;
}

.home-settings-button,
.home-tip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 49px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  padding: 10px 17px;
  font-size: 16px;
  font-weight: 900;
}

.home-settings-button:hover,
.home-tip button:hover {
  background: #171717;
  color: white;
}

.home-settings-icon {
  display: grid;
  place-items: center;
}

.home-settings-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.home-continue,
.home-tip {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 252, 247, 0.68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.home-continue {
  display: grid;
  gap: 22px;
  padding: 18px 20px 22px;
}

.home-continue h2,
.home-section h2 {
  color: var(--text);
  font-size: 21px;
  line-height: 1.05;
}

.home-continue-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
}

.home-continue-item {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  min-height: 58px;
  padding: 0 20px;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.home-continue-item:first-child {
  border-left: 0;
}

.home-continue-item:hover,
.home-continue-item:focus {
  background: rgba(238, 231, 220, 0.72);
}

.home-continue-item > span:nth-child(2),
.home-card-stack button > span:nth-child(2),
.home-tip div > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.home-continue-item strong,
.home-card-stack strong,
.home-tip strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.05;
}

.home-continue-item span span,
.home-card-stack span span,
.home-tip span span {
  color: #39332d;
  font-size: 14px;
  line-height: 1.28;
}

.home-continue-item > span:nth-child(2) span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-icon,
.home-tip-icon,
.home-section-heading > span {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid #e3d7c8;
  border-radius: 6px;
  background: linear-gradient(150deg, #fffdf8, #f0e7da);
  color: #2d241c;
}

.home-icon svg,
.home-tip-icon svg,
.home-section-heading > span svg {
  display: block;
  width: 32px;
  height: 32px;
  fill: currentColor;
  overflow: visible;
}

.home-piece-icon img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: brightness(0);
}

.home-progress {
  position: absolute;
  right: 20px;
  bottom: 4px;
  width: 86px;
  height: 8px;
  align-self: end;
  border-radius: 99px;
  background: #d5d1cc;
}

.home-progress::before {
  content: attr(data-label);
  position: absolute;
  right: 0;
  bottom: 15px;
  color: #39332d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.home-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #5c9a43;
}

.home-card-arrow {
  color: #201a15;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.home-section-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 40px;
}

.home-section {
  display: grid;
  align-content: start;
  gap: 18px;
}

.home-section-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  min-height: 64px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.home-section-heading > span {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
}

.home-section-heading > span svg {
  width: 35px;
  height: 35px;
}

.home-section-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.home-card-stack.mode-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.home-card-stack.mode-actions button {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 140px;
  align-content: stretch;
  gap: 14px;
  padding: 14px 15px;
  border-color: var(--border);
  border-radius: 6px;
  background: rgba(255, 252, 247, 0.74);
  box-shadow: 0 16px 32px rgba(58, 42, 31, 0.045);
}

.home-card-stack.mode-actions button:hover,
.home-card-stack.mode-actions button:focus,
.home-card-stack.mode-actions button.selected-mode {
  border-color: #3a2a1f;
  background: #fffdf8;
  color: var(--text);
  transform: translateY(-1px);
}

.home-card-stack .home-icon {
  width: 58px;
  height: 58px;
  color: #171717;
}

.home-card-stack .home-icon svg {
  width: 44px;
  height: 44px;
}

.home-card-stack .home-piece-icon img {
  width: 50px;
  height: 50px;
}

.home-card-stack small {
  width: fit-content;
  margin-top: 6px;
  border-radius: 6px;
  background: #dcefd3;
  color: #2d6420;
  padding: 3px 8px 4px;
  font-size: 12px;
  font-weight: 900;
}

.home-card-stack small.status-analysis,
.home-card-stack small.status-practice {
  background: #f5e4bf;
  color: #8a5b12;
}

.home-card-stack small.status-experimental {
  background: #d7ece6;
  color: #1d5f52;
}

.home-tip {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: 22px;
  padding: 20px 24px;
}

.home-tip div {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.home-tip div + div {
  padding-left: 24px;
  border-left: 1px solid var(--border);
}

.home-tip button {
  min-width: 150px;
  background: #171717;
  color: white;
}

.home-tip button:hover {
  background: white;
  color: var(--text);
}

.resources-screen {
  place-items: stretch;
  min-height: calc(100vh - 56px);
  padding: 32px 48px 20px;
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 255, 255, 0.88), transparent 34%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.76), rgba(255, 251, 245, 0.96) 48%, rgba(247, 244, 239, 0.98)),
    var(--panel);
}

.resources-shell {
  display: grid;
  width: min(1500px, 100%);
  gap: 22px;
  justify-self: center;
}

.resources-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.resources-header h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(42px, 4vw, 58px);
  line-height: 0.95;
}

.resources-header p {
  margin: 8px 0 0;
  color: #39332d;
  font-size: 19px;
  line-height: 1.25;
}

.resources-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.9fr);
  gap: 52px;
}

.resources-checklist,
.resources-quick-actions,
.resources-footer,
.resources-tip {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 252, 247, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.resources-checklist {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: center;
  gap: 24px;
  min-height: 235px;
  padding: 20px 22px;
}

.resources-checklist h2,
.resources-quick-actions h2,
.resources-toolkit h2 {
  margin: 0;
  color: var(--text);
  font-size: 23px;
  line-height: 1.05;
  text-transform: none;
}

.resources-checklist-grid {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.resources-checklist-grid label {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: #201a15;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.25;
}

.resources-checklist-grid input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: #5c9a43;
}

.resources-tip {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  background: rgba(255, 252, 247, 0.82);
}

.resources-tip-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #171717;
}

.resources-tip-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.resources-tip strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  line-height: 1.1;
}

.resources-tip p {
  margin: 10px 0 0;
  color: #39332d;
  font-size: 15px;
  line-height: 1.35;
}

.resources-quick-actions {
  display: grid;
  align-content: start;
  padding: 16px 24px;
}

.resources-quick-actions h2 {
  margin-bottom: 10px;
}

.resources-quick-actions button,
.resources-toolkit-grid button {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.resources-quick-actions button {
  min-height: 58px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.resources-quick-actions button:last-child {
  border-bottom: 0;
}

.resources-quick-actions button:hover,
.resources-quick-actions button:focus,
.resources-toolkit-grid button:hover,
.resources-toolkit-grid button:focus,
.resources-footer button:hover,
.resources-footer button:focus {
  background: rgba(238, 231, 220, 0.66);
}

.resources-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid #e3d7c8;
  border-radius: 6px;
  background: linear-gradient(150deg, #fffdf8, #f0e7da);
  color: #171717;
}

.resources-icon svg {
  display: block;
  width: 36px;
  height: 36px;
  fill: currentColor;
}

.resources-icon img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: brightness(0);
}

.resources-piece-pair {
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 8px;
}

.resources-piece-pair img {
  width: 30px;
  height: 30px;
}

.resources-piece-pair svg {
  width: 27px;
  height: 27px;
}

.resources-quick-actions strong,
.resources-toolkit-grid strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  line-height: 1.1;
}

.resources-quick-actions small,
.resources-toolkit-grid span span {
  display: block;
  margin-top: 6px;
  color: #39332d;
  font-size: 15px;
  line-height: 1.25;
}

.resources-toolkit {
  display: grid;
  gap: 12px;
}

.resources-toolkit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 26px;
}

.resources-toolkit-grid button {
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 252, 247, 0.74);
  box-shadow: 0 16px 32px rgba(58, 42, 31, 0.045);
}

.resources-toolkit-grid button:hover,
.resources-toolkit-grid button:focus {
  border-color: #3a2a1f;
  transform: translateY(-1px);
}

.resources-toolkit-grid small {
  display: inline-block;
  width: fit-content;
  margin-top: 10px;
  border-radius: 6px;
  background: #dcefd3;
  color: #2d6420;
  padding: 3px 8px 4px;
  font-size: 12px;
  font-weight: 900;
}

.resources-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 18px;
}

.resources-footer p,
.resources-footer button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: #39332d;
  font-size: 15px;
  line-height: 1.3;
}

.resources-footer p svg,
.resources-footer button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.resources-footer p > span:first-child {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #171717;
}

.resources-footer button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 252, 247, 0.9);
  color: var(--text);
  padding: 7px 11px;
  font-weight: 900;
  cursor: pointer;
}

.resources-footer button .home-card-arrow {
  font-size: 20px;
}

.resources-status {
  min-height: 18px;
  margin: -12px 0 0;
  color: #2d6420;
  font-size: 13px;
  font-weight: 800;
}

.resources-status.error {
  color: #8b1e1e;
}

@media (max-width: 1180px) {
  .home-dashboard {
    padding: 28px;
  }

  .home-continue-grid,
  .home-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .resources-screen {
    padding: 28px;
  }

  .resources-top-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .resources-toolkit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .home-continue-item {
    border: 1px solid var(--border);
    border-radius: 6px;
  }
}

@media (max-width: 720px) {
  .mode-screen {
    padding: 12px;
  }

  .home-dashboard {
    padding: 18px;
  }

  .resources-screen {
    padding: 18px 14px;
  }

  .resources-header h1 {
    font-size: 42px;
  }

  .resources-header p {
    font-size: 16px;
  }

  .resources-checklist,
  .resources-quick-actions,
  .resources-toolkit-grid button,
  .resources-footer {
    padding: 16px;
  }

  .resources-checklist {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .resources-toolkit-grid {
    grid-template-columns: 1fr;
  }

  .resources-quick-actions button,
  .resources-toolkit-grid button {
    grid-template-columns: 56px minmax(0, 1fr) auto;
  }

  .resources-icon {
    width: 52px;
    height: 52px;
  }

  .resources-icon svg {
    width: 34px;
    height: 34px;
  }

  .resources-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .home-hero,
  .home-tip {
    grid-template-columns: 1fr;
  }

  .home-brand-mark {
    width: 56px;
    height: 56px;
  }

  .home-hero h1 {
    font-size: 42px;
  }

  .home-settings-button {
    justify-self: start;
  }

  .home-continue-grid,
  .home-section-grid {
    grid-template-columns: 1fr;
  }

  .home-continue-item {
    grid-template-columns: 56px minmax(0, 1fr) 86px;
    min-height: 76px;
    padding: 8px 12px;
  }

  .home-progress {
    position: relative;
    right: auto;
    bottom: auto;
    justify-self: end;
  }

  .home-tip div + div {
    padding-left: 0;
    border-left: 0;
  }
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.opponent-scout {
  width: min(1080px, 100%);
}

.opponent-scout h1,
.opponent-scout h2,
.opponent-scout h3,
.opponent-scout p {
  margin: 0;
}

.opponent-scout h2,
.opponent-scout h3 {
  font-size: 16px;
}

.opponent-list {
  display: grid;
  gap: 14px;
}

.opponent-step-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.opponent-step-heading span {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  min-height: 26px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.opponent-step-heading strong {
  font-size: 18px;
}

.opponent-time-setup {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.opponent-time-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1.3fr) repeat(4, minmax(116px, 1fr));
  gap: 10px;
}

.opponent-time-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.opponent-time-grid select,
.opponent-time-grid input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

.opponent-practice-row {
  justify-self: start;
}

.opponent-engine-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(88px, 1fr));
  gap: 4px;
  justify-self: start;
  padding: 4px;
  border: 1px solid #3a2a1f;
  border-radius: 8px;
  background: #fffdf8;
}

.opponent-engine-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  font-weight: 900;
  cursor: pointer;
}

.opponent-engine-tabs button.active {
  background: #171717;
  color: white;
}

.opponent-tab-description {
  max-width: 760px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.opponent-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.opponent-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.opponent-card-header h2 {
  font-size: 22px;
}

.opponent-rating {
  display: grid;
  place-items: center;
  min-width: 62px;
  min-height: 38px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  font-size: 15px;
}

.opponent-description,
.opponent-empty {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.opponent-facts,
.opponent-game-details,
.opponent-debug-panel dl {
  display: grid;
  grid-template-columns: minmax(104px, max-content) minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.opponent-facts div {
  display: contents;
}

.opponent-facts dt,
.opponent-game-details dt,
.opponent-debug-panel dt {
  color: var(--text);
  font-weight: 900;
}

.opponent-facts dd,
.opponent-game-details dd,
.opponent-debug-panel dd {
  margin: 0;
}

.opponent-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.opponent-columns section,
.scout-note {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.opponent-columns ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.scout-note p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.opponent-actions,
.opponent-game-actions,
.opponent-result-actions,
.opponent-card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.opponent-card-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.opponent-screen-actions {
  grid-template-columns: minmax(0, 1fr);
}

.opponent-actions button,
.opponent-game-actions button,
.opponent-result-actions button,
.opponent-card-actions button {
  min-height: 40px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: #171717;
  color: white;
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.opponent-actions button:nth-child(3),
.opponent-game-actions button:nth-child(2),
.opponent-result-actions button:nth-child(n + 3) {
  background: white;
  color: var(--text);
}

.opponent-screen-actions button {
  background: white;
  color: var(--text);
}

.opponent-actions button:disabled,
.opponent-game-actions button:disabled,
.opponent-result-actions button:disabled,
.opponent-card-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.shell {
  display: grid;
  grid-template-columns: minmax(760px, 1fr) minmax(280px, 320px);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
  justify-content: center;
  width: min(1280px, calc(100vw - 48px));
  margin: 32px auto;
}

body.board-first-mode .shell {
  margin: 10px auto;
}

body.board-first-mode .shell.review-mode,
body.board-first-mode .shell.danya-speedruns-mode {
  width: calc(100vw - 24px);
  max-width: none;
}

body.board-first-mode .shell.danya-speedruns-mode {
  height: calc(100vh - 64px);
  min-height: 0;
  overflow: hidden;
}

body.board-first-mode .danya-speedruns-screen {
  height: calc(100vh - 64px);
  min-height: 0;
  padding: 10px;
  overflow: hidden;
}

body.board-first-mode .danya-speedruns-shell,
body.board-first-mode .danya-speedruns-watch {
  height: 100%;
  min-height: 0;
}

body.board-first-mode .danya-speedruns-video-room,
body.board-first-mode .danya-speedruns-board-room {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}

body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) {
  --play-side-width: clamp(280px, 19vw, 340px);
  --play-eval-width: 36px;
  --play-top-width: clamp(104px, 8vw, 132px);
  --play-shell-gap: clamp(18px, 3vw, 48px);
  --play-board-size: min(
    calc(100vh - 138px),
    calc(100vw - var(--play-side-width) - var(--play-eval-width) - var(--play-top-width) - var(--play-shell-gap) - 58px)
  );
  grid-template-columns: minmax(0, calc(var(--play-top-width) + var(--play-eval-width) + var(--play-board-size) + 20px)) var(--play-side-width);
  gap: var(--play-shell-gap);
  width: min(
    calc(100vw - 32px),
    calc(var(--play-top-width) + var(--play-eval-width) + var(--play-board-size) + var(--play-side-width) + var(--play-shell-gap) + 20px)
  );
  height: calc(100vh - 64px);
  min-height: 0;
  overflow: hidden;
}

body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) .side {
  align-self: stretch;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}

body.board-first-mode .shell.opponent-mode {
  height: calc(100vh - 74px);
  min-height: 0;
  overflow: hidden;
}

body.board-first-mode .shell.opponent-mode .side {
  align-self: stretch;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}

body.board-first-mode .review-screen.review-board-active,
body.board-first-mode .learning-screen.board-lesson-active,
body.board-first-mode .opening-practice-screen.practice-active,
body.board-first-mode .endgame-practice-screen.practice-active,
body.board-first-mode .puzzles-screen.puzzle-active {
  height: calc(100vh - 64px);
  min-height: 0;
  overflow: hidden;
}

.shell.review-mode {
  grid-template-columns: minmax(0, 1fr);
  width: min(1500px, calc(100vw - 32px));
}

.shell.learning-mode {
  grid-template-columns: minmax(0, 1fr);
  width: min(1540px, calc(100vw - 32px));
}

.shell.opening-practice-mode {
  grid-template-columns: minmax(0, 1fr);
  width: min(1800px, calc(100vw - 24px));
}

.shell.endgame-practice-mode {
  grid-template-columns: minmax(0, 1fr);
  width: min(1800px, calc(100vw - 24px));
}

.shell.puzzles-mode {
  grid-template-columns: minmax(0, 1fr);
  width: min(1500px, calc(100vw - 24px));
}

.shell.board-recorder-mode {
  grid-template-columns: minmax(0, 1fr);
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
}

.shell.placement-tournament-mode {
  grid-template-columns: minmax(0, 1fr);
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
}

.shell.stats-mode {
  grid-template-columns: minmax(0, 1fr);
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
}

.shell.career-mode {
  grid-template-columns: minmax(0, 1fr);
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
}

.shell.opponent-mode {
  --opponent-side-width: clamp(260px, 16vw, 300px);
  --opponent-shell-gap: clamp(12px, 1.7vw, 28px);
  --opponent-play-gaps: 24px;
  --opponent-moves-width: clamp(150px, 10vw, 190px);
  --opponent-eval-width: 32px;
  --opponent-top-width: clamp(128px, 9vw, 156px);
  --opponent-player-row-height: 44px;
  --opponent-board-gap: 8px;
  --opponent-board-size: min(
    calc(100vh - 178px),
    calc(
      100vw - var(--opponent-side-width) - var(--opponent-moves-width) - var(--opponent-eval-width) -
        var(--opponent-top-width) - var(--opponent-shell-gap) - var(--opponent-play-gaps) - 48px
    )
  );
  grid-template-columns: minmax(0, 1fr) var(--opponent-side-width);
  gap: var(--opponent-shell-gap);
  width: min(
    calc(100vw - 20px),
    calc(
      var(--opponent-board-size) + var(--opponent-side-width) + var(--opponent-moves-width) + var(--opponent-eval-width) +
        var(--opponent-top-width) + var(--opponent-shell-gap) + var(--opponent-play-gaps)
    )
  );
}

.play-area {
  display: grid;
  grid-template-columns: 36px minmax(96px, 116px) minmax(0, 1fr);
  gap: 10px;
  justify-self: end;
  width: min(100%, calc(100vh + 72px), 780px);
  max-width: 100%;
}

body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) .play-area {
  grid-template-areas: "top eval board";
  grid-template-columns: var(--play-top-width) var(--play-eval-width) var(--play-board-size);
  width: calc(var(--play-top-width) + var(--play-eval-width) + var(--play-board-size) + 20px);
}

body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) .top-lines {
  grid-area: top;
  max-height: calc(var(--play-board-size) + 80px);
  overflow: auto;
}

body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) .eval-bar {
  grid-area: eval;
  align-self: start;
  height: var(--play-board-size);
  min-height: 0;
  margin-top: 40px;
}

body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) .board-column {
  grid-area: board;
  width: var(--play-board-size);
}

.shell.opponent-mode .play-area {
  grid-template-areas: "moves top eval board";
  grid-template-columns:
    var(--opponent-moves-width)
    var(--opponent-top-width)
    var(--opponent-eval-width)
    var(--opponent-board-size);
  align-items: start;
  justify-self: end;
  width: calc(
    var(--opponent-moves-width) + var(--opponent-eval-width) + var(--opponent-top-width) + var(--opponent-board-size) + 30px
  );
}

.shell.opponent-mode .play-moves-slot {
  grid-area: moves;
  display: grid;
  grid-template-rows: minmax(96px, 1fr) auto;
  gap: 10px;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
}

.shell.opponent-mode .eval-bar {
  grid-area: eval;
  align-self: start;
  height: var(--opponent-board-size);
  margin-top: calc(var(--opponent-player-row-height) + var(--opponent-board-gap));
  min-height: 0;
}

.shell.opponent-mode .top-lines {
  grid-area: top;
}

.shell.opponent-mode .board-column {
  grid-area: board;
  grid-template-rows: var(--opponent-player-row-height) var(--opponent-board-size) var(--opponent-player-row-height);
  gap: var(--opponent-board-gap);
  align-self: start;
}

.shell.opponent-mode .board-wrap {
  height: 100%;
}

.shell.maia3-engine-mode {
  --maia3-side-width: clamp(240px, 15vw, 300px);
  --maia3-eval-width: 32px;
  --maia3-top-width: clamp(132px, 10vw, 200px);
  --maia3-play-gaps: 18px;
  --maia3-shell-gap: clamp(12px, 1.5vw, 26px);
  --maia3-player-row-height: 32px;
  --maia3-board-gap: 8px;
  --maia3-board-size: min(
    calc(100vh - 144px),
    calc(
      100vw - var(--maia3-side-width) - var(--maia3-top-width) - var(--maia3-eval-width) -
        var(--maia3-shell-gap) - var(--maia3-play-gaps) - 48px
    )
  );
  grid-template-columns: minmax(0, 1fr) var(--maia3-side-width);
  gap: var(--maia3-shell-gap);
  width: min(
    calc(100vw - 20px),
    calc(
      var(--maia3-board-size) + var(--maia3-side-width) + var(--maia3-top-width) + var(--maia3-eval-width) +
        var(--maia3-shell-gap) + var(--maia3-play-gaps)
    )
  );
}

.shell.maia3-engine-mode:not(.engine-show-eval) {
  --maia3-eval-width: 0px;
  --maia3-play-gaps: 10px;
}

.shell.maia3-engine-mode:not(.engine-show-top) {
  --maia3-top-width: 0px;
  --maia3-play-gaps: 10px;
}

.shell.maia3-engine-mode:not(.engine-show-eval):not(.engine-show-top) {
  --maia3-play-gaps: 0px;
}

.shell.maia3-engine-mode .play-area {
  grid-template-areas: "top eval board";
  grid-template-columns: var(--maia3-top-width) var(--maia3-eval-width) var(--maia3-board-size);
  width: calc(var(--maia3-eval-width) + var(--maia3-top-width) + var(--maia3-board-size) + var(--maia3-play-gaps));
}

.shell.maia3-engine-mode:not(.engine-show-eval) .play-area {
  grid-template-areas: "top board";
  grid-template-columns: var(--maia3-top-width) var(--maia3-board-size);
}

.shell.maia3-engine-mode:not(.engine-show-top) .play-area {
  grid-template-areas: "eval board";
  grid-template-columns: var(--maia3-eval-width) var(--maia3-board-size);
}

.shell.maia3-engine-mode:not(.engine-show-eval):not(.engine-show-top) .play-area {
  grid-template-areas: "board";
  grid-template-columns: var(--maia3-board-size);
}

.shell.maia3-engine-mode .eval-bar {
  grid-area: eval;
  align-self: start;
  height: var(--maia3-board-size);
  min-height: 0;
  margin-top: calc(var(--maia3-player-row-height) + var(--maia3-board-gap));
}

.shell.maia3-engine-mode .top-lines {
  grid-area: top;
  max-height: calc(var(--maia3-board-size) + 80px);
  overflow: auto;
  padding: 10px;
}

.shell.maia3-engine-mode .board-column {
  grid-area: board;
  grid-template-rows: var(--maia3-player-row-height) var(--maia3-board-size) var(--maia3-player-row-height);
  gap: var(--maia3-board-gap);
  width: var(--maia3-board-size);
}

.shell.maia3-engine-mode .board-wrap {
  height: 100%;
}

.shell.maia3-engine-mode .top-moves {
  padding-left: 0;
  list-style: none;
  font-size: 12px;
}

.shell.maia3-engine-mode .top-moves .engine-top-line-summary {
  gap: 6px;
}

.shell.maia3-engine-mode .top-moves .engine-eval-badge {
  min-width: 42px;
  padding: 1px 5px;
  font-size: 12px;
}

.shell.maia3-engine-mode .top-moves .engine-top-line-preview {
  font-size: 12px;
}

.shell.maia3-engine-mode .top-moves .engine-top-line-continuation {
  padding-left: 50px;
  font-size: 11px;
}

.eval-bar {
  position: relative;
  align-self: stretch;
  min-height: 100%;
  overflow: hidden;
  border: 3px solid #3a2a1f;
  background: #171411;
}

.eval-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 50%;
  background: #f8f5ee;
  transition: height 180ms ease;
}

.eval-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  z-index: 1;
  color: #f8f5ee;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  transform: translateX(-50%);
}

.eval-label.on-white {
  color: #171411;
}

.top-lines {
  align-self: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.top-lines h2 {
  margin-bottom: 8px;
}

.top-moves {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.25;
}

.top-moves li {
  min-width: 0;
}

.top-moves li::marker {
  color: var(--muted);
  font-weight: 800;
}

.top-moves span,
.top-moves strong {
  display: block;
}

.top-moves span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-moves strong {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.top-moves .empty-line {
  color: var(--muted);
  list-style: none;
}

.board-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.player-strip {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 32px;
  gap: 10px;
  color: #3a2a1f;
}

.live-player-portrait {
  display: none;
}

.shell.live-match-frame .player-strip {
  min-height: 32px;
  gap: 7px;
  border: 2px solid var(--world-near-black);
  border-image: url("/assets/world/ui/panel-frame.png") 16 fill / 8px / 0 stretch;
  background: linear-gradient(90deg, rgba(18, 26, 22, 0.98), rgba(35, 27, 20, 0.98));
  color: var(--world-text-cream);
  padding: 1px 7px;
  box-shadow: inset 0 0 0 1px var(--world-walnut);
}

.shell.live-match-frame .live-player-portrait {
  display: block;
  width: 28px;
  height: 28px;
  overflow: hidden;
  border: 1px solid var(--world-brass);
  background: var(--world-deep-background);
  box-shadow: inset 0 0 0 1px var(--world-near-black);
}

.shell.live-match-frame .live-player-portrait > img:only-child {
  position: static;
}

.shell.live-match-frame .player-name {
  flex: 0 1 auto;
  min-width: 54px;
  max-width: 38%;
  overflow: hidden;
  color: var(--world-text-cream);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 0 var(--world-near-black);
  white-space: nowrap;
}

.shell.live-match-frame .captured-piece img {
  filter: drop-shadow(0 1px 0 rgba(244, 222, 172, 0.44));
}

.shell.live-match-frame .material-advantage {
  color: var(--world-brass-highlight);
  font-size: 16px;
}

.shell.live-match-frame .player-clock {
  min-width: 78px;
  border: 2px solid var(--world-brass);
  border-radius: 0;
  background: var(--world-deep-background);
  color: var(--world-parchment);
  padding: 5px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  box-shadow: inset 0 0 0 1px var(--world-near-black);
}

.shell.live-match-frame .player-clock.active {
  border-color: var(--world-text-cream);
  background: var(--world-moss);
  color: var(--world-text-cream);
  box-shadow: inset 0 0 0 2px var(--world-near-black), 0 0 0 2px rgba(195, 154, 75, 0.2);
}

.shell.live-match-frame .player-clock.low {
  border-color: #d77263;
  color: #ffb3a6;
}

.shell.live-match-frame .player-clock.active.low {
  background: var(--world-oxblood);
  color: #fff0df;
}

#top-player {
  order: 1;
}

#bottom-player {
  order: 3;
}

.player-name {
  flex: 0 0 54px;
  font-size: 18px;
  line-height: 1;
}

.player-clock {
  margin-left: auto;
  min-width: 88px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  padding: 6px 10px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.player-clock.active {
  background: #171717;
  color: white;
}

.player-clock.low {
  border-color: #9b1c1c;
  color: #9b1c1c;
}

.player-clock.active.low {
  background: #9b1c1c;
  color: white;
}

.captured-pieces {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 28px;
  overflow: hidden;
}

.captured-piece {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 28px;
  margin-left: -3px;
}

.captured-piece:first-child {
  margin-left: 0;
}

.captured-piece img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.42));
}

.material-advantage {
  flex: 0 0 auto;
  min-width: 34px;
  color: #60758a;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  text-align: right;
}

.material-advantage:empty {
  display: none;
}

.board-wrap {
  position: relative;
  order: 2;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 1;
  border: 10px solid #3a2a1f;
  box-shadow: 0 18px 40px rgba(40, 28, 18, 0.24);
}

.shell.live-match-frame .board-wrap {
  border-color: var(--world-walnut);
  border-image: url("/assets/world/ui/panel-frame.png") 16 fill / 10px / 0 stretch;
  background: var(--world-near-black);
  box-shadow:
    0 0 0 2px var(--world-near-black),
    0 0 0 4px var(--world-brass),
    0 18px 40px rgba(0, 0, 0, 0.48);
}

.board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  touch-action: none;
}

.annotation-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.promotion-picker {
  position: absolute;
  z-index: 25;
  display: flex;
  flex-direction: column;
  width: var(--promotion-square-size, 64px);
  overflow: hidden;
  border: 1px solid rgba(58, 42, 31, 0.24);
  border-radius: 4px;
  background: #f8f5ee;
  box-shadow: 0 14px 32px rgba(20, 16, 12, 0.28);
}

.promotion-picker.from-bottom {
  flex-direction: column-reverse;
}

.promotion-picker-option,
.promotion-picker-cancel {
  display: grid;
  width: var(--promotion-square-size, 64px);
  min-width: 0;
  place-items: center;
  border: 0;
  border-bottom: 1px solid rgba(58, 42, 31, 0.15);
  background: #fffdf8;
  color: #81766b;
  padding: 0;
  cursor: pointer;
}

.promotion-picker.from-bottom .promotion-picker-option,
.promotion-picker.from-bottom .promotion-picker-cancel {
  border-top: 1px solid rgba(58, 42, 31, 0.15);
  border-bottom: 0;
}

.promotion-picker-option {
  height: var(--promotion-square-size, 64px);
}

.promotion-picker-option:hover,
.promotion-picker-option:focus-visible,
.promotion-picker-cancel:hover,
.promotion-picker-cancel:focus-visible {
  background: #f1dfb9;
  outline: none;
}

.promotion-picker-option img {
  display: block;
  width: 86%;
  height: 86%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.promotion-picker-cancel {
  height: calc(var(--promotion-square-size, 64px) * 0.62);
  font-size: calc(var(--promotion-square-size, 64px) * 0.38);
  font-weight: 900;
  line-height: 1;
}

.square {
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  appearance: none;
  color: var(--text);
  padding: 0;
  min-width: 0;
  min-height: 0;
  cursor: pointer;
  line-height: 1;
  user-select: none;
}

.square.light {
  background: var(--light-square);
}

.square.dark {
  background: var(--dark-square);
}

.square.last-move {
  background-image: linear-gradient(rgba(237, 230, 72, 0.48), rgba(237, 230, 72, 0.48));
}

.square.marked-square::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--mark-color, rgba(241, 176, 0, 0.36));
  pointer-events: none;
}

.square.in-check::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at center, rgba(210, 45, 45, 0.66), rgba(210, 45, 45, 0.28) 52%, rgba(210, 45, 45, 0.08));
  pointer-events: none;
}

.square.selected {
  outline: 4px solid var(--selected);
  outline-offset: -4px;
}

.square.target::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 26%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--target);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.square.capture-target::after {
  z-index: 1;
  width: 92%;
  border: clamp(3px, 0.65vmin, 6px) solid var(--target);
  background: transparent;
  box-sizing: border-box;
}

.square.capture-target .piece {
  z-index: 2;
}

.board .square.board-piece-animation-destination .piece {
  opacity: 0;
}

.piece {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: translateY(-4%);
}

.piece img {
  display: block;
  width: 86%;
  height: 86%;
  object-fit: contain;
}

.square.drag-source .piece {
  opacity: 0;
}

.board-piece-animation-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: visible;
  pointer-events: none;
}

.board-piece-animation-piece {
  position: absolute;
  display: grid;
  width: 12.5%;
  aspect-ratio: 1;
  place-items: center;
  transform: translate(-50%, -50%);
  transition: transform var(--board-piece-animation-duration, 300ms) cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}

.board-piece-animation-piece.moving {
  transform: translate(-50%, -50%) translate(var(--board-piece-animation-x, 0), var(--board-piece-animation-y, 0));
}

.board-piece-animation-piece .piece {
  width: 100%;
  height: 100%;
}

.drag-piece {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  width: var(--drag-piece-size, clamp(32px, 8vmin, 74px));
  height: var(--drag-piece-size, clamp(32px, 8vmin, 74px));
  transform: translate(-50%, -58%);
}

.drag-piece img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.coord {
  position: absolute;
  z-index: 2;
  color: rgba(58, 42, 31, 0.62);
  font-size: clamp(11px, 1.5vmin, 16px);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.square.dark .coord {
  color: rgba(247, 240, 222, 0.78);
}

.rank-coord {
  top: 5px;
  left: 5px;
}

.file-coord {
  right: 5px;
  bottom: 5px;
}

.side {
  display: grid;
  gap: 20px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.shell.live-match-frame .side {
  gap: 12px;
  border: 3px solid var(--world-near-black);
  border-image: url("/assets/world/ui/panel-frame.png") 16 fill / 12px / 0 stretch;
  outline: 2px solid var(--world-brass);
  outline-offset: -5px;
  background:
    linear-gradient(rgba(16, 24, 20, 0.96), rgba(24, 20, 17, 0.98)),
    repeating-linear-gradient(90deg, #24160f 0 24px, #2c1b12 24px 26px);
  color: var(--world-parchment);
  padding: 14px;
  box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.28);
}

.live-match-status-panel {
  display: grid;
  gap: 9px;
}

.live-match-event {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--world-walnut);
  padding: 2px 2px 10px;
}

.live-match-event img {
  width: 42px;
  height: 42px;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  object-fit: contain;
}

.live-match-event .eyebrow {
  margin: 0 0 2px;
  color: var(--world-brass-highlight);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.live-match-event h1 {
  margin: 0;
  overflow: hidden;
  color: var(--world-text-cream);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.05;
  text-overflow: ellipsis;
  text-shadow: 2px 2px 0 var(--world-near-black);
  white-space: nowrap;
}

.live-match-meta {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  color: var(--world-parchment);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
}

.shell.live-match-frame #status {
  margin: 0;
  border: 1px solid var(--world-walnut);
  background: rgba(6, 11, 9, 0.64);
  color: var(--world-text-cream);
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.shell.live-match-frame .opponent-game-panel,
.shell.live-match-frame .controls,
.shell.live-match-frame .moves-panel,
.shell.live-match-frame .automatic-review-status,
.shell.live-match-frame .opponent-result-panel,
.shell.live-match-frame .play-tips-panel,
.shell.live-match-frame .opponent-practice-panel,
.shell.live-match-frame .opponent-debug-panel {
  border: 2px solid var(--world-walnut);
  border-radius: 0;
  background: rgba(11, 17, 14, 0.88);
  color: var(--world-parchment);
  box-shadow: inset 0 0 0 1px var(--world-near-black);
}

.shell.live-match-frame .opponent-game-panel h2,
.shell.live-match-frame .opponent-game-panel h3,
.shell.live-match-frame .controls h2,
.shell.live-match-frame .moves-panel h2,
.shell.live-match-frame .opponent-debug-panel summary,
.shell.live-match-frame .opponent-game-details dd {
  color: var(--world-text-cream);
}

.shell.live-match-frame .opponent-game-details dt,
.shell.live-match-frame .opponent-game-summary,
.shell.live-match-frame .maia3-play-summary {
  color: var(--world-brass-highlight);
}

.shell.live-match-frame .side button {
  min-height: 40px;
  border: 2px solid var(--world-walnut);
  border-radius: 0;
  background: var(--world-panel);
  color: var(--world-text-cream);
  font-weight: 850;
  box-shadow: inset 0 0 0 1px var(--world-brass);
}

.shell.live-match-frame .side button:hover:not(:disabled),
.shell.live-match-frame .side button.active,
.shell.live-match-frame .side button[aria-pressed="true"] {
  border-color: var(--world-brass);
  background: var(--world-moss);
  color: var(--world-text-cream);
}

.shell.live-match-frame .side button:focus-visible {
  outline: 3px solid var(--world-text-cream);
  outline-offset: 2px;
}

.shell.live-match-frame .side button:disabled {
  background: #2f302b;
  color: #a99f8c;
  box-shadow: none;
}

.shell.live-match-frame .eval-bar {
  border-color: var(--world-near-black);
  outline: 1px solid var(--world-brass);
  background: var(--world-deep-background);
}

.shell.live-match-frame .top-lines {
  border: 2px solid var(--world-walnut);
  border-radius: 0;
  background: var(--world-panel);
  color: var(--world-parchment);
  box-shadow: inset 0 0 0 1px var(--world-near-black);
}

.shell.live-match-frame .top-lines h2,
.shell.live-match-frame .top-moves strong {
  color: var(--world-brass-highlight);
}

.opponent-game-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.play-result-banner {
  display: grid;
  gap: 4px;
  min-height: 82px;
  align-content: center;
  border: 1px solid currentColor;
  border-radius: 7px;
  padding: 14px 16px 14px 20px;
  color: #17613f;
  background: #e5f4eb;
  box-shadow: inset 5px 0 0 currentColor;
  animation: play-result-banner-enter 180ms ease-out both;
}

.play-result-banner[hidden] {
  display: none;
}

.play-result-banner[data-outcome="loss"] {
  color: #8f2929;
  background: #f8e5e2;
}

.play-result-banner[data-outcome="draw"],
.play-result-banner[data-outcome="finished"] {
  color: #66521e;
  background: #f3ecd5;
}

.play-result-banner strong {
  font-size: clamp(25px, 2vw, 32px);
  font-weight: 950;
  letter-spacing: -0.035em;
  line-height: 0.95;
  text-transform: uppercase;
}

.play-result-banner p {
  margin: 0;
  color: currentColor;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

@keyframes play-result-banner-enter {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.opponent-game-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.opponent-game-heading h2 {
  margin: 0;
  font-size: 20px;
}

.opponent-game-heading strong {
  display: grid;
  place-items: center;
  min-width: 58px;
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  font-size: 14px;
}

.opponent-game-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.opponent-game-actions,
.opponent-result-actions {
  grid-template-columns: 1fr;
}

.opponent-assist-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.opponent-assist-actions button {
  min-height: 38px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-weight: 800;
  cursor: pointer;
}

.opponent-assist-actions button.active {
  background: #171717;
  color: white;
}

.play-tips-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  background: #fffaf0;
}

.play-tips-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.play-tips-heading h3 {
  margin: 0;
  font-size: 15px;
  text-transform: uppercase;
}

.play-tips-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.play-tips-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.play-tips-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #cf8f1d;
  background: #fff4d8;
}

.play-tips-card strong {
  font-size: 15px;
}

.play-tips-idea {
  color: #2f6b3f !important;
  font-weight: 800;
}

.play-tips-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.play-tips-actions button {
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 8px;
  font-weight: 800;
  cursor: pointer;
}

.play-tips-actions button:first-child {
  background: #171717;
  color: white;
}

.opponent-fide-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.opponent-fide-actions button {
  min-height: 38px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: #fff7d8;
  color: var(--text);
  padding: 0 10px;
  font-weight: 800;
  cursor: pointer;
}

.opponent-fide-actions button:hover,
.opponent-fide-actions button:focus {
  background: #ffeeb8;
}

.opponent-practice-panel {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.play-moves-slot .opponent-practice-panel {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.opponent-practice-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.opponent-practice-heading h3 {
  margin: 0;
  font-size: 16px;
}

.opponent-practice-progress {
  min-width: 48px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
}

.opponent-practice-checklist {
  display: grid;
  gap: 8px;
}

.opponent-practice-checklist label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.play-moves-slot .opponent-practice-checklist label {
  font-size: 12.5px;
}

.opponent-practice-checklist input {
  margin-top: 2px;
}

.opponent-practice-checklist label.checked {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.opponent-practice-checklist input:disabled + span {
  color: var(--muted);
}

.opponent-vision-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.opponent-vision-heading {
  display: grid;
  gap: 8px;
}

.opponent-vision-heading h3 {
  margin: 0;
  font-size: 15px;
}

.opponent-vision-heading label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.opponent-vision-heading select {
  width: 100%;
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
}

.opponent-vision-drills {
  display: grid;
  gap: 8px;
}

.opponent-vision-drill {
  display: grid;
  gap: 7px;
  border: 1px solid var(--border);
  background: #fffdf8;
  padding: 8px;
}

.opponent-vision-drill.disabled {
  background: #f7f2ea;
}

.opponent-vision-drill > label {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 850;
  line-height: 1.3;
}

.opponent-vision-drill.disabled > label {
  color: var(--muted);
}

.opponent-vision-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.opponent-vision-shortcut {
  min-height: 32px;
  border: 1px solid #8d8176;
  border-radius: 6px;
  background: white;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.opponent-vision-shortcut.active,
.opponent-vision-shortcut:not(:disabled):hover {
  border-color: #171717;
  background: #171717;
  color: white;
}

.opponent-vision-shortcut:disabled {
  cursor: default;
  opacity: 0.55;
}

.opponent-vision-controls {
  display: grid;
  grid-template-columns: minmax(52px, 0.7fr) minmax(0, 1fr);
  gap: 6px;
}

.opponent-vision-controls input,
.opponent-vision-controls button,
.opponent-vision-reveal {
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
}

.opponent-vision-controls input {
  min-width: 0;
}

.opponent-vision-controls button,
.opponent-vision-reveal {
  cursor: pointer;
}

.opponent-vision-controls button:not(:disabled) {
  background: #171717;
  color: white;
}

.opponent-vision-controls button:disabled {
  cursor: default;
  opacity: 0.55;
}

.opponent-vision-drill.disabled .opponent-vision-shortcut,
.opponent-vision-drill.disabled .opponent-vision-controls input,
.opponent-vision-drill.disabled .opponent-vision-controls button {
  background: #f4eee5;
  border-color: #c8b7a2;
}

.opponent-vision-feedback,
.opponent-vision-moves {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.opponent-vision-feedback.correct {
  color: #146c2e;
}

.opponent-vision-feedback.incorrect {
  color: #9b1c1c;
}

.opponent-game-actions button,
.opponent-result-actions button {
  width: 100%;
}

.opponent-game-actions button:first-child {
  border-color: #9b1c1c;
  background: #9b1c1c;
}

.opponent-game-actions button:nth-child(3),
.opponent-result-actions button:first-child {
  background: #171717;
  color: white;
}

.opponent-result-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.opponent-result-panel h2,
.opponent-result-panel p {
  margin: 0;
}

.opponent-result-panel h2 {
  font-size: 16px;
}

.opponent-result-panel p {
  color: var(--text);
  font-weight: 800;
  line-height: 1.35;
}

.automatic-review-status {
  display: grid;
  gap: 10px;
  margin-top: 2px;
  border-block: 1px solid var(--border);
  padding: 13px 0;
}

.automatic-review-status[hidden] {
  display: none;
}

.automatic-review-status-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.automatic-review-status-heading > div {
  display: grid;
  gap: 3px;
}

.automatic-review-status-heading .eyebrow {
  color: #1f7a57;
  font-size: 10px;
}

.automatic-review-status-heading strong {
  font-size: 15px;
  line-height: 1.2;
}

.automatic-review-status-heading > span {
  color: #1f7a57;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.automatic-review-status > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.automatic-review-status-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(31, 122, 87, 0.16);
}

.automatic-review-status-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #1f7a57;
  transition: width 220ms ease;
}

.automatic-review-status[data-state="ready"] .automatic-review-status-track span {
  background: #146c2e;
}

.automatic-review-status[data-state="failed"] .automatic-review-status-heading > span,
.automatic-review-status[data-state="failed"] .automatic-review-status-heading .eyebrow {
  color: #9b1c1c;
}

.automatic-review-status[data-state="failed"] .automatic-review-status-track span {
  background: #9b1c1c;
}

@media (prefers-reduced-motion: reduce) {
  .play-result-banner {
    animation: none;
  }

  .automatic-review-status-track span {
    transition: none;
  }
}

.opponent-debug-panel {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.opponent-debug-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.opponent-debug-panel:not([open]) > :not(summary) {
  display: none;
}

.opponent-debug-panel dl {
  margin-top: 10px;
}

.opponent-debug-controls {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.opponent-debug-controls:empty,
.play-controls-slot:empty {
  display: none;
}

.maia3-play-actions {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.maia3-play-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.maia3-play-action-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.maia3-play-action-buttons button {
  min-height: 40px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: #111;
  color: white;
  font-weight: 900;
}

.maia3-play-action-buttons button:not(.active) {
  background: white;
  color: var(--text);
}

.maia3-play-action-buttons .maia3-resign-button {
  grid-column: 1 / -1;
  border-color: #7f1d1d;
  background: #7f1d1d;
  color: white;
}

.maia3-play-action-buttons .maia3-resign-button:disabled {
  opacity: 0.55;
}

.blindfold-play-panel {
  display: grid;
  gap: 10px;
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--border);
}

.blindfold-play-panel[hidden] {
  display: none;
}

.blindfold-play-header {
  display: grid;
  gap: 2px;
}

#blindfold-play-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
}

#blindfold-play-metrics,
.blindfold-move-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.blindfold-move-form {
  display: grid;
  gap: 6px;
}

.blindfold-move-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.blindfold-move-row input {
  min-width: 0;
  font-size: 16px;
  font-weight: 800;
}

.blindfold-move-row button,
.blindfold-play-action-buttons button {
  min-height: 38px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-weight: 900;
}

.blindfold-move-row button,
.blindfold-play-action-buttons button.active {
  background: #111;
  color: white;
}

.blindfold-settings {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(58, 42, 31, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.42);
}

.blindfold-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.blindfold-setting-label {
  color: var(--muted);
  font-weight: 900;
}

.blindfold-switch {
  display: inline-grid;
  grid-template-columns: auto minmax(28px, auto);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  min-width: 92px;
  border: 1px solid #3a2a1f;
  border-radius: 999px;
  background: white;
  color: var(--text);
  padding: 4px 10px 4px 5px;
  font-weight: 900;
}

.blindfold-switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #9d9287;
}

.blindfold-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 160ms ease;
}

.blindfold-switch.active {
  background: #111;
  color: white;
}

.blindfold-switch.active .blindfold-switch-track {
  background: #2f6b29;
}

.blindfold-switch.active .blindfold-switch-thumb {
  transform: translateX(16px);
}

.blindfold-play-action-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.blindfold-move-row button:disabled,
.blindfold-switch:disabled,
.blindfold-play-action-buttons button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shell.blindfold-pieces-hidden .board .piece,
.shell.blindfold-pieces-hidden .board-piece-animation-layer {
  opacity: 0;
}

.shell.blindfold-board-hidden .board-wrap {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%) 0 0 / 40px 40px,
    linear-gradient(315deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%) 0 0 / 40px 40px,
    #141210;
}

.shell.blindfold-board-hidden .board-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.12), transparent 26%),
    rgba(12, 10, 9, 0.9);
  pointer-events: none;
}

.shell.blindfold-board-hidden .board,
.shell.blindfold-board-hidden .annotation-layer,
.shell.blindfold-board-hidden .board-piece-animation-layer {
  opacity: 0;
  pointer-events: none;
}

.learning-screen {
  display: grid;
  gap: 18px;
  width: 100%;
  padding: 24px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.learning-screen.classroom-active {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
}

.learning-header,
.learning-panel-heading,
.learning-node-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.learning-header h1,
.learning-node-heading h2,
.learning-panel-heading h2 {
  margin: 0;
}

.learning-header h1 {
  font-size: 28px;
}

.learning-screen.classroom-active .learning-header {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  gap: 0;
  align-items: center;
}

.learning-screen.classroom-active .learning-header > div {
  display: none;
}

.learning-screen.classroom-active .learning-header button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.learning-panel-heading h2,
.learning-node-heading h2 {
  font-size: 18px;
}

.learning-node-heading h2 {
  white-space: nowrap;
}

.learning-node-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.learning-screen.classroom-active .learning-node-actions {
  gap: 6px;
}

.learning-header button,
.learning-node-actions button,
.learning-panel-heading button,
.learning-position-controls button,
.learning-progress-actions button,
#learning-next-module,
#learning-toggle-library,
#learning-reset-progress,
#learning-save-notes {
  min-height: 38px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.learning-screen.classroom-active .learning-node-actions button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 13px;
  line-height: 1.15;
}

.learning-progress-actions button:first-child {
  background: #171717;
  color: white;
}

#learning-mark-complete.completed,
#learning-next-node.completed,
#learning-reading-next-node.completed {
  border-color: #15803d;
  background: #15803d;
  color: white;
}

#learning-mark-complete.completed::before,
#learning-next-node.completed::before,
#learning-reading-next-node.completed::before {
  content: "\2713";
  margin-right: 6px;
}

#learning-mark-complete.completed:hover,
#learning-next-node.completed:hover,
#learning-reading-next-node.completed:hover {
  border-color: #166534;
  background: #166534;
  color: white;
}

#learning-mark-correction {
  border-color: #b91c1c;
  color: #b91c1c;
  font-size: 12px;
}

#learning-mark-correction:hover {
  background: #b91c1c;
  color: white;
}

.learning-header button:hover,
.learning-node-actions button:hover,
.learning-panel-heading button:hover,
.learning-position-controls button:hover,
.learning-progress-actions button:hover,
#learning-next-module:hover,
#learning-toggle-library:hover,
#learning-save-notes:hover,
.learning-item:hover,
.learning-item.selected {
  background: #171717;
  color: white;
}

#learning-mark-correction:hover {
  background: #b91c1c;
  color: white;
}

.learning-position-controls button:disabled,
.learning-reading-controls button:disabled,
.learning-node-actions button:disabled,
.learning-panel-heading button:disabled,
.learning-progress-actions button:disabled,
#learning-next-module:disabled,
#learning-toggle-library:disabled,
#learning-save-notes:disabled {
  cursor: default;
  opacity: 0.5;
}

.learning-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.learning-screen.classroom-active .learning-status {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  min-height: 0;
  font-size: 12px;
  line-height: 1.25;
}

.learning-screen.classroom-active .learning-classroom-toolbar,
.learning-screen.classroom-active .learning-library,
.learning-screen.classroom-active .learning-classroom {
  grid-column: 1 / -1;
}

.learning-status.error {
  color: #9b1c1c;
}

.learning-classroom-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px) auto;
  gap: 14px;
  align-items: end;
  border: 1px solid var(--border);
  background: #fffdf8;
  padding: 14px;
}

.learning-classroom-toolbar h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.learning-classroom-toolbar .eyebrow {
  margin-bottom: 4px;
}

.learning-lesson-jump {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.learning-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: end;
}

.learning-lesson-jump select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-transform: none;
}

.learning-screen.classroom-active .learning-classroom-toolbar {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 380px) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
}

.learning-screen.classroom-active .learning-classroom-toolbar h2 {
  font-size: 15px;
  line-height: 1.2;
}

.learning-screen.classroom-active .learning-classroom-toolbar .eyebrow {
  display: none;
}

.learning-screen.classroom-active .learning-lesson-jump {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  font-size: 11px;
  white-space: nowrap;
}

.learning-screen.classroom-active .learning-lesson-jump select,
.learning-screen.classroom-active #learning-toggle-library {
  min-height: 32px;
  font-size: 13px;
}

.learning-library {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 14px;
}

.learning-library.has-parts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.learning-library-panel,
.learning-source-panel,
.learning-board-panel,
.learning-side-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
  border: 1px solid var(--border);
  background: #fffdf8;
  padding: 14px;
}

.learning-library-panel[hidden] {
  display: none;
}

.learning-list {
  display: grid;
  gap: 8px;
}

.learning-book-overview {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  background: white;
  padding: 12px;
}

.learning-book-overview strong,
.learning-book-overview span {
  display: block;
}

.learning-book-overview span,
.learning-book-overview p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.learning-item {
  display: grid;
  gap: 5px;
  position: relative;
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 10px 34px 10px 10px;
  text-align: left;
  cursor: pointer;
}

.learning-item strong,
.learning-item span {
  display: block;
}

.learning-item-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.learning-item span {
  color: inherit;
  font-size: 12px;
  line-height: 1.35;
}

.learning-item .learning-item-progress {
  font-weight: 900;
}

.learning-book-card {
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: start;
  min-height: 124px;
}

.learning-book-cover {
  width: 74px;
  aspect-ratio: 2 / 3;
  border: 1px solid var(--border);
  border-radius: 4px;
  object-fit: cover;
  background: #f3eee5;
}

.learning-book-card:hover .learning-book-cover,
.learning-book-card.selected .learning-book-cover {
  border-color: currentColor;
}

.learning-item.planned {
  border-style: dashed;
  color: var(--muted);
}

.learning-item.completed {
  border-color: #15803d;
  background: #f0fdf4;
  color: #14532d;
}

.learning-item.completed::after {
  content: "✓";
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: #15803d;
  color: white;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.learning-item.completed:hover,
.learning-item.completed.selected {
  background: #15803d;
  color: white;
}

.learning-item.completed:hover::after,
.learning-item.completed.selected::after {
  background: white;
  color: #15803d;
}

.learning-item:disabled:hover {
  background: white;
  color: var(--muted);
}

.learning-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.opening-practice-screen {
  display: grid;
  align-content: start;
  gap: 16px;
  width: min(1480px, calc(100vw - 32px));
  min-height: 0;
  margin: 16px auto;
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.opening-practice-header,
.opening-practice-setup,
.opening-practice-workspace {
  min-width: 0;
}

.opening-practice-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.opening-practice-header h1,
.opening-practice-header p {
  margin: 0;
}

.opening-practice-header button,
.opening-practice-quick-start button,
.opening-practice-settings button,
.opening-practice-side-toggle button,
.opening-practice-result-actions button,
.opening-practice-board-panel .learning-node-actions button,
.opening-practice-board-panel .learning-position-controls button,
.opening-practice-source-panel button {
  min-height: 36px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 7px 12px;
  font-weight: 900;
  cursor: pointer;
}

.opening-practice-header button:hover,
.opening-practice-quick-start button:hover:not(:disabled),
.opening-practice-settings button:hover:not(:disabled),
.opening-practice-side-toggle button:hover:not(:disabled),
.opening-practice-side-toggle button.selected,
.opening-practice-result-actions button:hover:not(:disabled),
.opening-practice-board-panel .learning-node-actions button:hover:not(:disabled),
.opening-practice-board-panel .learning-position-controls button:hover:not(:disabled),
.opening-practice-source-panel button:hover:not(:disabled),
.opening-practice-board-panel .learning-node-actions button.active,
.opening-practice-board-panel .learning-position-controls button.active {
  background: #171717;
  color: white;
}

.opening-practice-header button:disabled,
.opening-practice-quick-start button:disabled,
.opening-practice-settings button:disabled,
.opening-practice-side-toggle button:disabled,
.opening-practice-result-actions button:disabled,
.opening-practice-board-panel .learning-node-actions button:disabled,
.opening-practice-board-panel .learning-position-controls button:disabled,
.opening-practice-source-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.opening-practice-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.opening-practice-status.error {
  color: #b42318;
}

.opening-practice-setup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 14px;
  align-items: start;
}

.opening-practice-setup-side {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
  border: 1px solid var(--border);
  background: #fffdf8;
  padding: 14px;
}

.opening-practice-setup-side > .opening-practice-panel {
  border: 0;
  background: transparent;
  padding: 0;
}

.opening-practice-setup-side > .opening-practice-panel + .opening-practice-panel {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.opening-practice-setup-side .opening-practice-options {
  gap: 6px;
}

.opening-practice-setup-side .opening-practice-option {
  min-height: 66px;
  padding: 9px 10px;
}

.opening-practice-setup-side .opening-practice-option span {
  line-height: 1.25;
}

.opening-practice-setup > .opening-practice-panel:first-child > .learning-panel-heading {
  display: none;
}

.opening-practice-panel,
.opening-practice-source-panel,
.opening-practice-board-panel,
.opening-practice-side-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
  border: 1px solid var(--border);
  background: #fffdf8;
  padding: 14px;
}

.opening-practice-options,
.opening-practice-settings {
  display: grid;
  gap: 8px;
}

.opening-practice-custom-start-panel {
  gap: 10px;
}

.opening-practice-custom-board-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.opening-practice-custom-board-panel[hidden] {
  display: none;
}

.opening-practice-custom-board-shell,
.opening-practice-custom-board-controls {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.opening-practice-custom-board-toolbar,
.opening-practice-custom-start-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opening-practice-custom-board-toolbar button,
.opening-practice-custom-start-actions button,
.opening-practice-custom-start-panel > button {
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
}

.opening-practice-custom-start-actions button:first-child,
.opening-practice-custom-board-toolbar button {
  border-color: var(--border);
  font-size: 12px;
}

.opening-practice-custom-board-toolbar button:hover:not(:disabled),
.opening-practice-custom-start-actions button:hover:not(:disabled),
.opening-practice-custom-start-panel > button:hover:not(:disabled) {
  background: #171717;
  color: white;
}

.opening-practice-custom-board-toolbar button:disabled,
.opening-practice-custom-start-actions button:disabled,
.opening-practice-custom-start-panel > button:disabled {
  opacity: 0.55;
  cursor: default;
}

.opening-practice-custom-board-wrap {
  width: 100%;
  border-width: 8px;
  box-shadow: 0 12px 28px rgba(40, 28, 18, 0.18);
}

.opening-practice-custom-side-control {
  display: grid;
  gap: 6px;
}

.opening-practice-custom-side-toggle {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.opening-practice-custom-turn-summary {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-left: 5px solid #2f8a4b;
  background: #f8fbf6;
  padding: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.opening-practice-custom-turn-summary span {
  display: inline-flex;
  align-items: center;
}

.opening-practice-custom-turn-summary strong {
  color: #14532d;
}

.opening-practice-custom-turn-summary strong.stockfish-first {
  color: #7a3b08;
}

.opening-practice-custom-start-field {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.opening-practice-custom-start-field textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  font-weight: 700;
  line-height: 1.35;
}

.opening-practice-custom-start-field textarea:disabled {
  background: #f4efe6;
  color: var(--muted);
}

.opening-practice-custom-start-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.opening-practice-custom-start-help.error {
  color: #b42318;
}

.opening-practice-custom-move-list {
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.opening-practice-custom-move {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.opening-practice-setup-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fffdf8;
}

.opening-practice-setup-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  font-weight: 900;
  cursor: pointer;
}

.opening-practice-setup-tab:last-child {
  border-right: 0;
}

.opening-practice-setup-tab span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  min-height: 22px;
  border-radius: 999px;
  background: rgba(58, 42, 31, 0.08);
  color: var(--muted);
  padding: 0 6px;
  font-size: 12px;
}

.opening-practice-setup-tab.selected,
.opening-practice-setup-tab:hover {
  background: #171717;
  color: white;
}

.opening-practice-setup-tab.selected span,
.opening-practice-setup-tab:hover span {
  background: rgba(255, 255, 255, 0.92);
  color: #171717;
}

.opening-practice-section-heading {
  display: grid;
  gap: 3px;
}

.opening-practice-section-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.opening-practice-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.opening-practice-today-section,
.opening-practice-danya-overview,
.opening-practice-repertoire-section {
  display: grid;
  gap: 12px;
}

.opening-practice-danya-overview,
.opening-practice-danya-setup-panel,
.opening-practice-danya-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf8;
}

.opening-practice-danya-overview {
  padding: 14px;
}

.opening-practice-danya-overview-body,
.opening-practice-danya-setup-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.opening-practice-danya-stat {
  display: grid;
  grid-template-columns: 34px minmax(42px, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  padding: 9px 10px;
}

.opening-practice-danya-stat-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #e6f4df;
  color: #2f6424;
  font-size: 12px;
  font-weight: 900;
}

.opening-practice-danya-stat.video .opening-practice-danya-stat-icon {
  background: #eef6ec;
}

.opening-practice-danya-stat strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.opening-practice-danya-stat span:last-child {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
}

.opening-practice-danya-lines,
.opening-practice-danya-setup-list {
  display: grid;
  gap: 6px;
}

.opening-practice-danya-line {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(80px, 0.75fr) max-content;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
}

.opening-practice-danya-line.compact {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.opening-practice-danya-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opening-practice-danya-line-meter {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: rgba(58, 42, 31, 0.08);
  overflow: hidden;
}

.opening-practice-danya-line-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2f9e44;
}

.opening-practice-danya-setup-panel {
  display: grid;
  gap: 10px;
}

.opening-practice-danya-setup-list {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.opening-practice-danya-setup-video-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 8px;
}

.opening-practice-danya-setup-video-summary span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.opening-practice-danya-setup-video-summary strong {
  border: 1px solid #b7dfba;
  border-radius: 999px;
  background: #eef8ed;
  color: #1f7a35;
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
}

.opening-practice-danya-setup-video-list {
  display: grid;
  gap: 7px;
}

.opening-practice-danya-setup-video {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: var(--text);
  padding: 7px;
  text-decoration: none;
}

.opening-practice-danya-setup-video:hover {
  border-color: #3a2a1f;
  box-shadow: inset 0 0 0 1px #3a2a1f;
}

.opening-practice-danya-setup-video.viewed,
.opening-practice-danya-video.viewed {
  border-color: #b7dfba;
  background: #f5fbf3;
}

.opening-practice-danya-setup-thumbnail {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 5px;
  background: #171717;
}

.opening-practice-danya-setup-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.opening-practice-danya-setup-video-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.opening-practice-danya-setup-video-body strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.opening-practice-danya-setup-video-body span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.opening-practice-danya-setup-time {
  border-radius: 5px;
  background: #171717;
  color: white;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 900;
}

.opening-practice-danya-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.opening-practice-today-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.opening-practice-today-task {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  min-height: 112px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.opening-practice-today-task:hover,
.opening-practice-today-task.selected {
  border-color: #3a2a1f;
  box-shadow: inset 0 0 0 1px #3a2a1f;
}

.opening-practice-task-number {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #e9f1e4;
  color: #4f7a45;
  font-size: 14px;
  font-weight: 900;
}

.opening-practice-today-task.repair .opening-practice-task-number {
  background: #f7dfcf;
  color: #b6481e;
}

.opening-practice-today-task.new .opening-practice-task-number {
  background: #eee9dc;
  color: #6b604d;
}

.opening-practice-task-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.opening-practice-task-label,
.opening-practice-task-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.opening-practice-task-copy strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.1;
}

.opening-practice-task-arrow,
.opening-practice-repertoire-arrow {
  color: var(--text);
  font-size: 22px;
  font-weight: 400;
}

.opening-practice-mobile-selected-action {
  display: none;
}

.opening-practice-repertoire-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.opening-practice-repertoire-card {
  display: grid;
  gap: 0;
  align-content: start;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.opening-practice-repertoire-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
}

.opening-practice-repertoire-heading h4 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.opening-practice-repertoire-heading span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.opening-practice-repertoire-table {
  display: grid;
}

.opening-practice-repertoire-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 62px minmax(96px, 0.58fr) minmax(96px, 0.58fr) 16px;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 9px 16px;
  text-align: left;
}

button.opening-practice-repertoire-row {
  cursor: pointer;
}

button.opening-practice-repertoire-row:hover,
button.opening-practice-repertoire-row.selected {
  background: #fff8ec;
}

.opening-practice-repertoire-row:last-child {
  border-bottom: 0;
}

.opening-practice-repertoire-row.header {
  min-height: 34px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: none;
}

.opening-practice-repertoire-opening {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.opening-practice-repertoire-opening strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opening-practice-repertoire-opening span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.opening-practice-repertoire-number {
  color: var(--text);
  font-weight: 900;
}

.opening-practice-repertoire-meter {
  display: grid;
  grid-template-columns: minmax(42px, 1fr) max-content;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.opening-practice-meter-track {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: rgba(58, 42, 31, 0.08);
  overflow: hidden;
}

.opening-practice-meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #6f8c64;
}

.opening-practice-repertoire-meter.repair .opening-practice-meter-fill {
  background: #c54f25;
}

.opening-practice-view-all {
  min-height: 44px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: #4f7a45;
  font-weight: 900;
  cursor: pointer;
}

.opening-practice-view-all:hover {
  background: #f6f0e5;
}

.opening-practice-quick-start {
  display: grid;
  gap: 10px;
  border: 1px solid #3a2a1f;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf8 0%, #f9f1e3 100%);
  padding: 14px;
}

.opening-practice-quick-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 14px;
  align-items: center;
}

.opening-practice-quick-header h3,
.opening-practice-quick-header p {
  margin: 0;
}

.opening-practice-quick-header h3 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.opening-practice-quick-header > div {
  display: grid;
  gap: 8px;
}

.opening-practice-quick-header > div > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.opening-practice-quick-start button {
  min-width: 172px;
  background: #171717;
  color: white;
}

.opening-practice-quick-start button:hover:not(:disabled) {
  background: white;
  color: #171717;
}

.opening-practice-quick-stats,
.opening-practice-repair-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.opening-practice-repair-preview {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.opening-practice-repair-preview strong {
  color: var(--text);
  text-transform: uppercase;
}

.opening-practice-repair-list span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  padding: 3px 8px;
  font-weight: 800;
}

.opening-practice-opening-group {
  display: grid;
  gap: 8px;
}

.opening-practice-opening-group + .opening-practice-opening-group {
  margin-top: 10px;
}

.opening-practice-opening-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.opening-practice-opening-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.opening-practice-opening-strip {
  display: grid;
  grid-auto-columns: minmax(180px, 240px);
  grid-auto-flow: column;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.opening-practice-option {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 78px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.opening-practice-option.compact {
  min-height: 72px;
}

.opening-practice-option strong,
.opening-practice-option span {
  display: block;
}

.opening-practice-option span {
  color: inherit;
  font-size: 12px;
  line-height: 1.35;
}

.opening-practice-option .opening-practice-option-meta {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 22px;
  border-radius: 999px;
  background: #e6f4df;
  color: #2f6424;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 900;
}

.opening-practice-option.selected .opening-practice-option-meta,
.opening-practice-option:hover .opening-practice-option-meta {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.opening-practice-option:hover,
.opening-practice-option.selected {
  border-color: #171717;
  background: #171717;
  color: white;
}

.opening-practice-settings label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.opening-practice-setting-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.opening-practice-side-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.opening-practice-side-toggle button {
  justify-content: center;
  width: 100%;
}

.opening-practice-settings select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 14px;
  font-weight: 800;
  text-transform: none;
}

.opening-practice-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(390px, 1.15fr) minmax(220px, 0.48fr);
  gap: 14px;
  align-items: start;
}

.endgame-practice-setup {
  grid-template-columns: minmax(320px, 1fr) minmax(280px, 420px);
}

.endgame-practice-setup > .opening-practice-panel:first-child {
  grid-row: auto;
}

.endgame-practice-workspace {
  grid-template-columns: minmax(430px, 1fr) minmax(300px, 420px);
}

.endgame-practice-board-panel .learning-position-controls {
  grid-template-columns: 44px 44px 44px minmax(88px, 0.8fr) minmax(118px, 1fr) minmax(118px, 1fr);
}

.endgame-practice-side-panel {
  grid-template-areas:
    "line"
    "goal"
    "engine"
    "progress";
  grid-template-columns: minmax(0, 1fr);
  align-content: stretch;
  gap: 14px;
}

.endgame-practice-goal-panel {
  grid-area: goal;
  min-height: 150px;
}

.endgame-practice-side-panel .opening-practice-source-panel {
  position: static;
  max-height: none;
  overflow: visible;
}

.endgame-practice-engine-panel,
.endgame-practice-line-panel,
.endgame-practice-progress-panel {
  border: 1px solid var(--border);
  background: #fffdf8;
  padding: 12px;
}

.endgame-practice-engine-panel {
  grid-area: engine;
  gap: 8px;
}

.endgame-practice-line-panel {
  grid-area: line;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr);
  min-height: 330px;
}

.endgame-practice-progress-panel {
  grid-area: progress;
}

.endgame-practice-move-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.endgame-practice-move-actions button {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
}

#endgame-practice-move-list {
  display: grid;
  align-content: start;
  gap: 0;
  max-height: min(46vh, 520px);
  overflow: auto;
  padding: 0;
  font-size: 14px;
  line-height: 1.35;
}

.endgame-practice-goal-panel .learning-panel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  gap: 8px;
}

.endgame-practice-goal-panel .learning-panel-heading button {
  max-width: 128px;
  line-height: 1.1;
  white-space: normal;
}

.endgame-practice-move-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  min-height: 34px;
  column-gap: 6px;
  padding: 3px 4px;
}

.endgame-practice-move-row:nth-child(even) {
  background: rgba(58, 42, 31, 0.035);
}

.endgame-practice-move-number {
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

.endgame-practice-move-button,
.endgame-practice-move-empty {
  min-width: 0;
}

.endgame-practice-move-button {
  min-height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  padding: 3px 4px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 900;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endgame-practice-move-button:hover,
.endgame-practice-move-button:focus-visible {
  background: rgba(58, 42, 31, 0.08);
}

.endgame-practice-move-button.current {
  background: rgba(23, 23, 23, 0.92);
  color: white;
}

.endgame-practice-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.endgame-practice-review-button {
  min-height: 34px;
  padding: 0 12px;
}

.opening-practice-board-panel,
.opening-practice-side-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.opening-practice-line-description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.opening-practice-score {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opening-practice-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.opening-practice-result {
  display: grid;
  gap: 9px;
  border: 1px solid var(--border);
  background: white;
  padding: 12px;
}

.opening-practice-result.passed {
  border-color: #15803d;
  background: #f0fdf4;
}

.opening-practice-result.failed {
  border-color: #b42318;
  background: #fff1f0;
}

.opening-practice-result.failed .opening-practice-result-actions #opening-practice-next-line,
.opening-practice-result.passed .opening-practice-result-actions #opening-practice-next-line {
  background: #171717;
  color: white;
}

.opening-practice-result.failed .opening-practice-result-actions #opening-practice-next-line:hover:not(:disabled),
.opening-practice-result.passed .opening-practice-result-actions #opening-practice-next-line:hover:not(:disabled) {
  background: white;
  color: #171717;
}

.opening-practice-result h3,
.opening-practice-result p {
  margin: 0;
}

.opening-practice-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opening-practice-board-area {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.opening-practice-board-wrap {
  position: relative;
}

.opening-practice-eval-rail {
  flex: 0 0 28px;
}

.opening-practice-eval-rail[hidden] {
  display: none;
}

.opening-practice-eval-track {
  position: relative;
  width: 28px;
  height: 100%;
  min-height: 240px;
  overflow: hidden;
  border: 3px solid #3a2a1f;
  background: #171411;
}

.opening-practice-eval-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 50%;
  background: #f8f5ee;
  transition: height 180ms ease;
}

.opening-practice-eval-label {
  position: absolute;
  left: 50%;
  z-index: 1;
  color: #f8f5ee;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: center;
  white-space: nowrap;
}

.opening-practice-eval-label.positive {
  bottom: 12px;
  color: #171411;
}

.opening-practice-eval-label.negative {
  top: 12px;
  color: #f8f5ee;
}

.opening-practice-eval-label.pending,
.opening-practice-eval-label:not(.positive):not(.negative) {
  top: 50%;
  color: #f8f5ee;
}

.opening-practice-side-panel #opening-practice-engine-panel {
  gap: 7px;
  border-color: var(--border);
  background: #fffdf8;
  padding: 9px;
}

.opening-practice-side-panel #opening-practice-engine-panel .learning-engine-heading {
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.opening-practice-side-panel #opening-practice-engine-panel .learning-engine-heading h3 {
  font-size: 13px;
  text-transform: uppercase;
}

.opening-practice-danya-panel {
  display: grid;
  gap: 9px;
  padding: 10px;
}

.opening-practice-danya-panel .learning-panel-heading {
  align-items: center;
  gap: 8px;
}

.opening-practice-danya-match {
  justify-self: end;
  border: 1px solid #b7dfba;
  border-radius: 999px;
  background: #eef8ed;
  color: #1f7a35;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
  text-align: right;
}

.opening-practice-danya-match:empty {
  display: none;
}

.opening-practice-danya-content {
  display: grid;
  gap: 9px;
}

.opening-practice-danya-move-groups {
  display: grid;
  gap: 6px;
}

.opening-practice-danya-move-group {
  display: grid;
  gap: 5px;
  border-radius: 6px;
  padding: 7px 8px;
}

.opening-practice-danya-move-group.danya {
  background: #edf8ed;
  color: #1f6f32;
}

.opening-practice-danya-move-group.opponent {
  background: #fff1f0;
  color: #a12a2a;
}

.opening-practice-danya-move-group strong {
  font-size: 12px;
}

.opening-practice-danya-move-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.opening-practice-danya-move-chips span {
  border: 1px solid currentColor;
  border-radius: 6px;
  background: white;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

.opening-practice-danya-video-list {
  display: grid;
  gap: 7px;
}

.opening-practice-danya-video {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 9px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: var(--text);
  padding: 7px;
  text-decoration: none;
}

.opening-practice-danya-video:hover {
  border-color: #3a2a1f;
  box-shadow: inset 0 0 0 1px #3a2a1f;
}

.opening-practice-danya-thumbnail {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 5px;
  background: #171717;
}

.opening-practice-danya-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.opening-practice-danya-thumbnail span {
  position: absolute;
  right: 4px;
  bottom: 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.78);
  color: white;
  padding: 1px 4px;
  font-size: 10px;
  font-weight: 900;
}

.opening-practice-danya-video-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.opening-practice-danya-video-body strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.opening-practice-danya-video-body span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.opening-practice-danya-watch {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.opening-practice-danya-empty {
  margin: 0;
}

#opening-practice-engine-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

#opening-practice-top-moves {
  gap: 5px;
  padding-left: 0;
  list-style: none;
  font-size: 12px;
}

#opening-practice-top-moves[hidden] {
  display: none;
}

#opening-practice-top-moves .engine-top-line-summary {
  gap: 6px;
  min-height: 24px;
}

#opening-practice-top-moves .engine-eval-badge {
  min-width: 42px;
  padding: 1px 5px;
  font-size: 12px;
}

#opening-practice-top-moves .engine-top-line-preview {
  font-size: 12px;
}

#opening-practice-top-moves .engine-top-line-continuation {
  margin-top: 3px;
  padding-left: 50px;
  font-size: 11px;
}

.opening-practice-screen.practice-active {
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
  width: min(1800px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 10px;
}

.opening-practice-screen.practice-active .opening-practice-header,
.opening-practice-screen.practice-active .opening-practice-status {
  display: none;
}

.opening-practice-screen.practice-active .opening-practice-header {
  align-items: center;
}

.opening-practice-screen.practice-active .opening-practice-header > div {
  display: none;
}

.opening-practice-screen.practice-active .opening-practice-header button,
.opening-practice-screen.practice-active .opening-practice-board-panel .learning-node-actions button,
.opening-practice-screen.practice-active .opening-practice-board-panel .learning-position-controls button,
.opening-practice-screen.practice-active .opening-practice-source-panel button {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}

.opening-practice-screen.practice-active .opening-practice-board-panel .learning-position-controls {
  grid-template-columns: minmax(64px, 1fr) 44px minmax(84px, 1.2fr) minmax(92px, 0.82fr) minmax(118px, 0.95fr);
}

.opening-practice-screen.practice-active .opening-practice-board-panel .learning-position-controls:has(#opening-practice-previous-line:not([hidden])) {
  grid-template-columns: minmax(52px, 0.8fr) 44px minmax(72px, 0.95fr) minmax(78px, 0.82fr) minmax(116px, 1.05fr) minmax(118px, 1.05fr);
}

.opening-practice-screen.practice-active .opening-practice-board-panel .learning-position-controls .opening-practice-inline-result-action {
  min-width: 0;
  line-height: 1.1;
  white-space: nowrap;
}

.opening-practice-screen.practice-active .opening-practice-status {
  min-height: 0;
  font-size: 12px;
  line-height: 1.25;
}

.opening-practice-screen.practice-active .opening-practice-workspace {
  grid-template-areas:
    "board source"
    "board side";
  grid-template-columns: minmax(500px, min(58vw, calc(100vh - 92px))) minmax(340px, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  gap: 10px 14px;
}

.opening-practice-screen.practice-active .opening-practice-source-panel {
  grid-area: source;
}

.opening-practice-screen.practice-active .opening-practice-board-panel {
  grid-area: board;
}

.opening-practice-screen.practice-active .opening-practice-side-panel {
  grid-area: side;
}

.opening-practice-screen.practice-active .opening-practice-source-panel,
.opening-practice-screen.practice-active .opening-practice-board-panel,
.opening-practice-screen.practice-active .opening-practice-side-panel {
  position: static;
  gap: 9px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 10px;
}

.opening-practice-screen.practice-active .opening-practice-board-panel {
  overflow: hidden auto;
}

.opening-practice-screen.practice-active .opening-practice-side-panel {
  max-height: 100%;
}

.opening-practice-screen.practice-active .opening-practice-source-panel {
  gap: 7px;
}

.opening-practice-screen.practice-active .opening-practice-source-panel .learning-panel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.opening-practice-screen.practice-active .opening-practice-source-panel .learning-panel-heading .eyebrow {
  display: none;
}

.opening-practice-screen.practice-active .opening-practice-source-panel .learning-panel-heading h2 {
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opening-practice-screen.practice-active .opening-practice-source-panel #opening-practice-change-setup {
  min-height: 30px;
  padding: 4px 10px;
  white-space: nowrap;
}

.opening-practice-screen.practice-active .opening-practice-line-description {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opening-practice-screen.practice-active .opening-practice-score {
  gap: 5px;
}

.opening-practice-screen.practice-active .opening-practice-chip {
  min-height: 24px;
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.1;
}

.opening-practice-screen.practice-active .opening-practice-result {
  gap: 6px;
  padding: 9px 10px;
}

.opening-practice-screen.practice-active .opening-practice-result h3 {
  font-size: 18px;
  line-height: 1.12;
}

.opening-practice-screen.practice-active .opening-practice-result p {
  font-size: 13px;
  line-height: 1.25;
}

.opening-practice-screen.practice-active .opening-practice-result-actions {
  gap: 6px;
}

.opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) .opening-practice-side-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) .opening-practice-side-panel #opening-practice-engine-panel {
  grid-column: 1 / -1;
  order: -1;
}

.opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) .opening-practice-progress-panel {
  grid-column: 1 / -1;
}

.opening-practice-screen.practice-active .opening-practice-board-area {
  justify-self: center;
  width: min(100%, calc(100vh - 154px));
}

.opening-practice-screen.practice-active .opening-practice-board-wrap {
  width: min(100%, calc(100vh - 190px));
}

.opening-practice-screen.practice-active .opening-practice-board-area.has-eval .opening-practice-board-wrap {
  width: min(calc(100% - 36px), calc(100vh - 190px));
}

.opening-practice-screen.practice-active .learning-node-heading {
  align-items: center;
}

.opening-practice-screen.practice-active .learning-node-heading h2 {
  font-size: 16px;
}

.opening-practice-screen.practice-active .opening-practice-line-description,
.opening-practice-screen.practice-active .review-details {
  font-size: 12px;
  line-height: 1.3;
}

.puzzles-screen {
  display: grid;
  align-content: start;
  gap: 16px;
  width: min(1480px, calc(100vw - 32px));
  min-height: 0;
  margin: 16px auto;
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.puzzles-header,
.puzzles-workspace {
  min-width: 0;
}

.puzzles-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.puzzles-header h1,
.puzzles-header p {
  margin: 0;
}

.puzzles-header button,
.puzzles-board-panel .learning-node-actions button,
.puzzles-board-panel .learning-position-controls button,
.puzzles-catalog-button {
  min-height: 36px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 7px 12px;
  font-weight: 900;
  cursor: pointer;
}

.puzzles-header button:hover,
.puzzles-board-panel .learning-node-actions button:hover:not(:disabled),
.puzzles-board-panel .learning-position-controls button:hover:not(:disabled),
.puzzles-catalog-button:hover,
.puzzles-catalog-button.selected {
  background: #171717;
  color: white;
}

.puzzles-header button:disabled,
.puzzles-board-panel .learning-node-actions button:disabled,
.puzzles-board-panel .learning-position-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.puzzles-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.puzzles-status.error {
  color: #b42318;
}

.puzzles-screen.puzzle-active {
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
  width: min(1500px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 10px;
}

.puzzles-screen.puzzle-active .puzzles-header,
.puzzles-screen.puzzle-active .puzzles-status {
  display: none;
}

.puzzles-workspace {
  display: grid;
  grid-template-columns: minmax(560px, min(70vw, calc(100vh - 134px))) minmax(320px, 420px);
  gap: 10px 14px;
  height: 100%;
  min-height: 0;
}

.puzzles-board-panel,
.puzzles-side-panel,
.puzzles-solve-panel,
.puzzles-feedback,
.puzzles-catalog-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  background: #fffaf3;
}

.puzzles-board-panel {
  overflow: hidden auto;
}

.puzzles-side-panel {
  max-height: 100%;
  overflow: auto;
  border: 0;
  background: transparent;
  padding: 0;
}

.puzzles-board-wrap {
  justify-self: center;
  width: min(100%, calc(100vh - 190px));
}

.puzzles-board-panel .learning-position-controls {
  grid-template-columns: 44px minmax(120px, 1fr);
}

.puzzles-timer {
  align-self: start;
  justify-self: end;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 900;
}

.puzzles-solve-status,
.puzzles-progress-summary,
.puzzles-feedback p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.4;
}

.puzzles-feedback[data-result="correct"] {
  border-color: #2f8a4b;
}

.puzzles-feedback[data-result="incorrect"],
.puzzles-feedback[data-result="inaccurate"] {
  border-color: #b42318;
}

.puzzles-correct-square {
  background-image: linear-gradient(rgba(70, 170, 92, 0.52), rgba(70, 170, 92, 0.52));
}

.puzzles-incorrect-square {
  background-image: linear-gradient(rgba(205, 60, 55, 0.48), rgba(205, 60, 55, 0.48));
}

.puzzles-answer-square {
  background-image: linear-gradient(rgba(85, 165, 230, 0.5), rgba(85, 165, 230, 0.5));
}

.puzzles-feedback h3 {
  margin: 4px 0 0;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

.puzzles-alternatives {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
}

.puzzles-alternatives li {
  display: grid;
  gap: 2px;
}

.puzzles-alternatives strong {
  color: var(--text);
}

.puzzles-alternatives span {
  color: var(--muted);
}

.puzzles-explanation {
  display: grid;
  gap: 6px;
}

.puzzles-catalog-list {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
}

.puzzles-catalog-button {
  display: grid;
  grid-template-columns: minmax(84px, auto) 1fr auto;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.puzzles-catalog-button span,
.puzzles-catalog-button small {
  font-size: 12px;
  font-weight: 800;
}

.puzzles-catalog-button small {
  justify-self: end;
  color: inherit;
  opacity: 0.74;
}

@media (max-width: 900px) {
  body.board-first-mode .shell.puzzles-mode:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.opponent-mode) {
    height: auto;
    overflow: visible;
  }

  body.board-first-mode .puzzles-screen.puzzle-active {
    height: auto;
    min-height: calc(100vh - 64px);
    overflow: visible;
  }

  .puzzles-screen {
    width: min(100%, calc(100vw - 16px));
    padding: 12px;
  }

  .puzzles-workspace {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .puzzles-board-wrap {
    width: min(100%, calc(100vw - 40px));
  }

  .puzzles-side-panel {
    max-height: none;
  }

  .puzzles-board-panel {
    overflow: visible;
  }
}

.board-recorder-screen {
  width: min(1760px, calc(100vw - 20px));
  min-height: calc(100dvh - 104px);
  margin: 10px auto 16px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #070a09;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.board-recorder-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: min(720px, calc(100vw - 36px));
  min-height: 34px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(20, 20, 20, 0.56);
  color: #f4f2e8;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
}

.board-recorder-workspace {
  display: block;
  height: min(920px, calc(100dvh - 104px));
  min-height: 660px;
}

.board-recorder-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(34, 34, 34, 0.58);
  color: #f8f3e8;
  padding: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.board-recorder-panel p {
  margin: 0;
  color: rgba(248, 243, 232, 0.78);
  line-height: 1.35;
}

.board-recorder-camera-panel {
  position: relative;
  display: block;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #070a09;
  box-shadow: none;
  overflow: hidden;
}

.board-recorder-hud {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.board-recorder-hud-interactive {
  pointer-events: auto;
}

.board-recorder-topbar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: auto minmax(130px, auto) minmax(420px, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(24, 24, 24, 0.54);
  padding: 9px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px);
}

.board-recorder-back-button,
.board-recorder-camera-actions button,
.board-recorder-debug-frame a,
.board-recorder-actions button,
.board-recorder-controls button,
.board-recorder-manual-form button {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.66);
  color: #f8f3e8;
  padding: 8px 12px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.board-recorder-back-button:hover,
.board-recorder-back-button:focus,
.board-recorder-camera-actions button:hover:not(:disabled),
.board-recorder-camera-actions button:focus:not(:disabled),
.board-recorder-actions button:hover:not(:disabled),
.board-recorder-actions button:focus:not(:disabled),
.board-recorder-controls button:hover:not(:disabled),
.board-recorder-controls button:focus:not(:disabled),
.board-recorder-manual-form button:hover:not(:disabled),
.board-recorder-manual-form button:focus:not(:disabled),
.board-recorder-debug-frame a:hover,
.board-recorder-debug-frame a:focus {
  border-color: rgba(41, 178, 255, 0.72);
  background: rgba(0, 137, 255, 0.82);
  color: white;
}

.board-recorder-title {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: #f8f3e8;
  font-size: 17px;
  font-weight: 950;
  white-space: nowrap;
}

.board-recorder-badge {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(57, 255, 150, 0.14);
  color: #aafbd0;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.board-recorder-status-stack {
  position: absolute;
  top: 92px;
  left: max(16px, env(safe-area-inset-left));
  display: grid;
  gap: 7px;
  max-width: min(660px, calc(100vw - 560px));
}

.board-recorder-status-stack .board-recorder-inline-status {
  width: fit-content;
  max-width: min(660px, calc(100vw - 560px));
  border: 1px solid rgba(255, 230, 80, 0.3);
  border-radius: 8px;
  background: rgba(34, 34, 34, 0.58);
  color: #ffe45c;
  padding: 8px 10px;
  font: 900 18px/1.18 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
}

.board-recorder-status-stack .board-recorder-camera-status {
  width: fit-content;
  max-width: min(520px, calc(100vw - 560px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(20, 20, 20, 0.48);
  color: rgba(248, 243, 232, 0.82);
  padding: 6px 9px;
  backdrop-filter: blur(14px);
}

.board-recorder-camera-status[hidden],
.board-recorder-screen[data-recording-status="setup"] #board-recorder-candidate-status {
  display: none;
}

.board-recorder-camera-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.board-recorder-camera-controls label {
  display: grid;
  gap: 4px;
  color: rgba(248, 243, 232, 0.72);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.board-recorder-camera-controls select {
  min-height: 34px;
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #171717;
  padding: 0 10px;
  font-weight: 800;
}

.board-recorder-camera-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: end;
}

.board-recorder-camera-actions button:disabled,
.board-recorder-actions button:disabled,
.board-recorder-controls button:disabled,
.board-recorder-manual-form button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.board-recorder-camera-stage {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 10px;
  background:
    linear-gradient(rgba(29, 124, 87, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 124, 87, 0.2) 1px, transparent 1px),
    #101413;
  background-size: 12.5% 12.5%;
  color: #dff5ea;
  overflow: hidden;
}

.board-recorder-source-frame {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 10px;
  background: #101413;
  overflow: hidden;
}

.board-recorder-camera-stage[data-source-type="image"] .board-recorder-source-frame,
.board-recorder-camera-stage[data-source-type="video"] .board-recorder-source-frame {
  top: 138px;
  right: calc(max(16px, env(safe-area-inset-right)) + min(520px, 39vw) + 18px);
  bottom: max(16px, env(safe-area-inset-bottom));
  left: calc(max(16px, env(safe-area-inset-left)) + min(380px, 34vw) + 18px);
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

.board-recorder-camera-stage[data-source-type="image"] .board-recorder-source-frame::after,
.board-recorder-camera-stage[data-source-type="video"] .board-recorder-source-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border: 1px solid rgba(57, 255, 150, 0.24);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.42);
}

.board-recorder-video,
.board-recorder-media-image {
  position: absolute;
  z-index: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  left: 0;
  top: 0;
  object-fit: fill;
  background: #101413;
}

.board-recorder-media-image[hidden],
.board-recorder-video[hidden] {
  display: none;
}

.board-recorder-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  touch-action: none;
  pointer-events: none;
}

.board-recorder-screen[data-calibrated="true"] .board-recorder-source-frame {
  cursor: grab;
}

.board-recorder-screen[data-calibration-dragging="true"] .board-recorder-source-frame {
  cursor: grabbing;
}

.board-recorder-camera-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 18px;
  background: rgba(16, 20, 19, 0.74);
  font-weight: 900;
  text-align: center;
}

.board-recorder-camera-placeholder[hidden] {
  display: none;
}

.board-recorder-camera-placeholder svg {
  width: 58px;
  height: 58px;
}

.board-recorder-camera-status {
  min-height: 20px;
  margin: 0;
  color: rgba(248, 243, 232, 0.8);
  font-size: 13px;
  font-weight: 800;
}

.board-recorder-camera-status.error {
  color: #ffb4a8;
}

.board-recorder-debug-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 8px;
}

.board-recorder-debug-frame[hidden] {
  display: none;
}

.board-recorder-debug-frame > div {
  display: grid;
  gap: 4px;
}

.board-recorder-debug-frame strong {
  font-size: 13px;
}

.board-recorder-debug-frame span {
  color: rgba(248, 243, 232, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.board-recorder-debug-frame img {
  width: 82px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: #101413;
}

.board-recorder-debug-frame a {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.board-recorder-step-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.board-recorder-step-list span {
  border-radius: 999px;
  background: rgba(57, 255, 150, 0.13);
  color: #bafbd8;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
}

.board-recorder-field-row,
.board-recorder-actions,
.board-recorder-controls,
.board-recorder-manual-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.board-recorder-media-tools {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.board-recorder-media-tools > label {
  display: grid;
  gap: 6px;
  color: rgba(248, 243, 232, 0.72);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.board-recorder-media-tools input[type="file"] {
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8f3e8;
  padding: 7px;
  font-weight: 800;
}

.board-recorder-video-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.board-recorder-video-tools[hidden] {
  display: none;
}

.board-recorder-video-tools button {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.66);
  color: #f8f3e8;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.board-recorder-video-tools button:hover,
.board-recorder-video-tools button:focus {
  border-color: rgba(41, 178, 255, 0.72);
  background: rgba(0, 137, 255, 0.82);
  color: white;
}

.board-recorder-video-tools button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.board-recorder-crop-details {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.board-recorder-crop-details summary {
  width: fit-content;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  color: #f8f3e8;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.board-recorder-crop-details summary:hover,
.board-recorder-crop-details summary:focus {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.board-recorder-crop-details[open] {
  gap: 8px;
}

.board-recorder-crop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.board-recorder-crop-grid label {
  display: grid;
  gap: 3px;
  color: rgba(248, 243, 232, 0.72);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.board-recorder-crop-grid input[type="range"] {
  width: 100%;
  accent-color: #39ff96;
}

.board-recorder-crop-details button {
  justify-self: start;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.66);
  color: #f8f3e8;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.board-recorder-crop-details button:hover,
.board-recorder-crop-details button:focus {
  border-color: rgba(41, 178, 255, 0.72);
  background: rgba(0, 137, 255, 0.82);
  color: white;
}

.board-recorder-field-row label,
.board-recorder-manual-form label {
  display: grid;
  flex: 1 1 190px;
  gap: 6px;
  color: rgba(248, 243, 232, 0.72);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.board-recorder-field-row select,
.board-recorder-manual-form input {
  min-height: 36px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #171717;
  padding: 0 10px;
  font-weight: 800;
}

.board-recorder-inline-status {
  min-height: 20px;
  margin: 0;
  color: rgba(248, 243, 232, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.board-recorder-status.error,
.board-recorder-inline-status.error {
  color: #ffb4a8;
}

.board-recorder-calibration-points {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.board-recorder-calibration-points li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 8px;
  color: rgba(248, 243, 232, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.board-recorder-calibration-points li[data-state="done"] {
  border-color: rgba(57, 255, 150, 0.24);
  background: rgba(57, 255, 150, 0.11);
  color: rgba(218, 255, 235, 0.82);
}

.board-recorder-calibration-points li[data-state="current"] {
  border-color: rgba(255, 230, 80, 0.44);
  background: rgba(255, 230, 80, 0.16);
  color: #fff2a1;
}

.board-recorder-calibration-points strong {
  color: #f8f3e8;
}

.board-recorder-hud-panel {
  position: absolute;
  z-index: 5;
}

.board-recorder-hud-panel .learning-panel-heading {
  margin: 0;
}

.board-recorder-hud-panel .learning-panel-heading h2 {
  margin: 0;
  color: #f8f3e8;
  font-size: 14px;
  line-height: 1.1;
}

.board-recorder-calibration-panel {
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(380px, 34vw);
  max-height: min(430px, 48vh);
  overflow: auto;
}

.board-recorder-live-panel {
  top: 92px;
  right: max(16px, env(safe-area-inset-right));
  bottom: 122px;
  width: min(520px, 39vw);
  align-content: stretch;
  overflow: hidden;
}

.board-recorder-pgn-panel {
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(520px, 39vw);
  gap: 8px;
}

.board-recorder-pgn-panel .learning-panel-heading {
  display: none;
}

.board-recorder-screen[data-has-moves="false"]:not([data-recording-status="ended"]) .board-recorder-pgn-panel {
  display: none;
}

.board-recorder-screen[data-has-moves="false"]:not([data-recording-status="ended"]) .board-recorder-live-panel {
  bottom: max(16px, env(safe-area-inset-bottom));
}

.board-recorder-guardrails-panel {
  left: max(16px, env(safe-area-inset-left));
  top: 240px;
  width: min(390px, 34vw);
  max-height: min(390px, 46vh);
  padding: 0;
  overflow: visible;
}

.board-recorder-debug-details {
  min-width: 0;
}

.board-recorder-debug-details summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  color: #f8f3e8;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.board-recorder-debug-details summary:hover,
.board-recorder-debug-details summary:focus {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.board-recorder-debug-details[open] {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.board-recorder-debug-details[open] summary {
  padding: 0;
}

.board-recorder-debug-body {
  display: grid;
  gap: 10px;
  max-height: min(320px, 38vh);
  overflow: auto;
}

.board-recorder-vision-debug {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(57, 255, 150, 0.2);
  border-radius: 8px;
  background: rgba(6, 20, 14, 0.46);
  padding: 8px;
}

.board-recorder-vision-debug > div {
  display: grid;
  gap: 4px;
}

.board-recorder-vision-debug strong {
  color: #f8f3e8;
  font-size: 13px;
  font-weight: 900;
}

.board-recorder-warp-canvas {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1;
  border: 1px solid rgba(57, 255, 150, 0.38);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.36);
  image-rendering: auto;
}

.board-recorder-square-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 2px;
  min-width: 0;
}

.board-recorder-square-grid figure {
  position: relative;
  min-width: 0;
  margin: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
}

.board-recorder-square-grid figure[data-occupancy="occupied"] {
  border-color: rgba(57, 255, 150, 0.78);
}

.board-recorder-square-grid figure[data-piece-color="white"] {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.board-recorder-square-grid figure[data-piece-color="black"] {
  box-shadow: inset 0 0 0 1px rgba(99, 132, 255, 0.72);
}

.board-recorder-square-grid figure[data-piece-color="unknown"] {
  box-shadow: inset 0 0 0 1px rgba(255, 224, 92, 0.76);
}

.board-recorder-square-grid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.board-recorder-square-grid figcaption {
  position: absolute;
  left: 2px;
  bottom: 1px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.62);
  color: rgba(255, 255, 255, 0.92);
  padding: 1px 2px;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
}

.board-recorder-square-detection {
  position: absolute;
  top: 2px;
  right: 2px;
  max-width: calc(100% - 4px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 3px;
  background: rgba(6, 16, 12, 0.78);
  color: #f8f3e8;
  padding: 1px 2px;
  font-size: 7px;
  font-weight: 900;
  line-height: 1;
}

.board-recorder-live-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 0;
}

.board-recorder-board-column,
.board-recorder-moves-column {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.board-recorder-board-wrap {
  order: initial;
  width: min(100%, 410px, calc(100dvh - 290px));
  max-width: 100%;
  margin: 0 auto;
  border-width: 6px;
  box-shadow: 0 14px 28px rgba(40, 28, 18, 0.18);
}

.board-recorder-board-wrap .board-arrow-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.board-recorder-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.board-recorder-manual-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.board-recorder-move-list {
  display: grid;
  gap: 4px;
  max-height: 92px;
  min-height: 58px;
  margin: 0;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  list-style: none;
}

.board-recorder-move-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  min-height: 24px;
  color: #f8f3e8;
  font-weight: 900;
}

.board-recorder-move-list li.muted {
  display: block;
  color: rgba(248, 243, 232, 0.68);
  font-weight: 800;
}

.board-recorder-move-list .move-number {
  color: rgba(248, 243, 232, 0.68);
}

.board-recorder-move-list small {
  border-radius: 999px;
  background: rgba(57, 255, 150, 0.14);
  color: #bafbd8;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.board-recorder-pgn-preview {
  width: 100%;
  min-height: 54px;
  max-height: 74px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #171717;
  padding: 8px;
  font: 800 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 900px) {
  .shell.board-recorder-mode {
    width: 100vw;
    margin: 0;
  }

  .board-recorder-screen {
    position: fixed;
    inset: 0;
    z-index: 60;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .board-recorder-workspace,
  .board-recorder-camera-panel,
  .board-recorder-camera-stage {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
  }

  .board-recorder-topbar {
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px;
    min-height: 0;
    padding: 7px;
  }

  .board-recorder-title {
    justify-content: end;
    font-size: 14px;
  }

  .board-recorder-badge {
    padding: 3px 7px;
    font-size: 10px;
  }

  .board-recorder-camera-controls {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .board-recorder-back-button,
  .board-recorder-camera-actions button,
  .board-recorder-debug-frame a,
  .board-recorder-actions button,
  .board-recorder-controls button,
  .board-recorder-manual-form button {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .board-recorder-camera-actions {
    justify-content: end;
  }

  .board-recorder-back-button {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .board-recorder-status-stack {
    top: 116px;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    max-width: none;
    gap: 5px;
  }

  .board-recorder-status,
  .board-recorder-status-stack .board-recorder-inline-status,
  .board-recorder-status-stack .board-recorder-camera-status {
    max-width: calc(100vw - 16px);
  }

  .board-recorder-status {
    min-height: 30px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .board-recorder-status-stack .board-recorder-inline-status {
    padding: 7px 8px;
    font-size: 14px;
  }

  .board-recorder-status-stack .board-recorder-camera-status {
    display: none;
  }

  .board-recorder-status-stack .board-recorder-status:not(.error) {
    display: inline-flex;
  }

  .board-recorder-camera-stage[data-camera-state="idle"] #board-recorder-camera-stop,
  .board-recorder-camera-stage[data-camera-state="error"] #board-recorder-camera-stop,
  .board-recorder-camera-stage[data-camera-state="live"] #board-recorder-camera-start {
    display: none;
  }

  .board-recorder-screen:not([data-recording-status="ended"]) .board-recorder-pgn-panel,
  .board-recorder-screen[data-has-moves="false"] .board-recorder-move-list {
    display: none;
  }

  .board-recorder-screen[data-recording-status="recording"] .board-recorder-calibration-panel,
  .board-recorder-screen[data-recording-status="ended"] .board-recorder-calibration-panel {
    display: none;
  }

  .board-recorder-screen[data-recording-status="setup"] .board-recorder-manual-form {
    display: none;
  }

  .board-recorder-live-panel {
    top: 176px;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(420px, 47vw);
    padding: 9px;
  }

  .board-recorder-screen[data-recording-status="ended"] .board-recorder-live-panel {
    bottom: 96px;
  }

  .board-recorder-pgn-panel {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(420px, 47vw);
    padding: 8px;
  }

  .board-recorder-pgn-preview {
    display: none;
  }

  .board-recorder-pgn-panel .board-recorder-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .board-recorder-pgn-panel .board-recorder-actions button {
    min-height: 32px;
    padding: 5px 6px;
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  .board-recorder-calibration-panel {
    left: max(8px, env(safe-area-inset-left));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(380px, 47vw);
    max-height: 38vh;
    padding: 9px;
  }

  .board-recorder-guardrails-panel {
    left: max(8px, env(safe-area-inset-left));
    top: auto;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    max-width: min(320px, calc(100vw - 16px));
    max-height: 46vh;
  }

  .board-recorder-live-panel > p,
  .board-recorder-calibration-panel > p {
    display: none;
  }

  .board-recorder-board-wrap {
    width: min(100%, 34vh, 290px);
    border-width: 4px;
  }

  .board-recorder-move-list {
    max-height: 70px;
    min-height: 46px;
    padding: 7px;
  }

  .board-recorder-move-list li {
    grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr);
    gap: 5px;
    min-height: 22px;
    font-size: 13px;
  }

  .board-recorder-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .board-recorder-manual-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .board-recorder-field-row label,
  .board-recorder-manual-form label {
    font-size: 10px;
  }

  .board-recorder-field-row select,
  .board-recorder-manual-form input {
    min-height: 32px;
    font-size: 12px;
  }

  .board-recorder-actions {
    gap: 6px;
  }

  .board-recorder-calibration-points {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .board-recorder-calibration-points li {
    display: grid;
    gap: 2px;
    padding: 5px 7px;
    font-size: 11px;
  }

  .board-recorder-debug-frame img {
    width: 100%;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .board-recorder-topbar {
    right: auto;
    grid-template-columns: auto auto;
    min-height: 42px;
    width: auto;
    max-width: calc(100vw - 16px);
  }

  .board-recorder-title {
    display: none;
  }

  .board-recorder-camera-controls {
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  .board-recorder-camera-controls label {
    display: none;
  }

  .board-recorder-camera-actions {
    flex-wrap: nowrap;
  }

  .board-recorder-status-stack {
    top: 60px;
    right: auto;
    max-width: min(360px, 39vw);
  }

  .board-recorder-status,
  .board-recorder-status-stack .board-recorder-inline-status,
  .board-recorder-status-stack .board-recorder-camera-status {
    max-width: min(360px, 39vw);
  }

  .board-recorder-status-stack .board-recorder-inline-status {
    font-size: 12px;
    padding: 6px 8px;
  }

  .board-recorder-live-panel {
    top: 58px;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(590px, 56vw);
    padding: 9px;
  }

  .board-recorder-screen[data-recording-status="ended"] .board-recorder-live-panel {
    bottom: 62px;
  }

  .board-recorder-live-panel .learning-panel-heading {
    display: none;
  }

  .board-recorder-live-preview {
    grid-template-columns: minmax(210px, 1fr) minmax(112px, 0.48fr);
    align-items: start;
  }

  .board-recorder-board-wrap {
    width: min(100%, 68vh, 320px);
  }

  .board-recorder-move-list {
    max-height: 48px;
    min-height: 36px;
  }

  .board-recorder-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .board-recorder-controls button {
    min-height: 34px;
    padding: 5px 8px;
  }

  .board-recorder-manual-form {
    display: none;
  }

  .board-recorder-pgn-panel {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(590px, 56vw);
    padding: 6px;
  }

  .board-recorder-pgn-preview {
    display: none;
  }

  .board-recorder-calibration-panel {
    width: min(350px, 38vw);
    max-height: 38vh;
    overflow: hidden;
  }

  .board-recorder-calibration-panel .learning-panel-heading {
    display: none;
  }

  .board-recorder-calibration-panel .board-recorder-field-row label {
    gap: 3px;
  }

  .board-recorder-calibration-panel .board-recorder-field-row label span {
    display: none;
  }

  .board-recorder-calibration-panel .board-recorder-field-row select {
    min-height: 32px;
  }

  .board-recorder-calibration-panel .board-recorder-actions button {
    min-height: 31px;
    padding: 5px 9px;
  }

  .board-recorder-calibration-panel .board-recorder-inline-status {
    font-size: 11px;
  }

  .board-recorder-calibration-panel .board-recorder-calibration-points {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .board-recorder-calibration-panel .board-recorder-calibration-points li {
    display: grid;
    gap: 1px;
    padding: 4px 6px;
    font-size: 10px;
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  .board-recorder-status-stack {
    top: 116px;
  }

  .board-recorder-live-panel {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    top: auto;
    bottom: 78px;
    width: auto;
    max-height: 44vh;
  }

  .board-recorder-live-preview {
    grid-template-columns: minmax(150px, 0.92fr) minmax(0, 1fr);
    align-items: start;
  }

  .board-recorder-board-wrap {
    width: min(47vw, 30vh, 230px);
  }

  .board-recorder-calibration-panel {
    top: 206px;
    bottom: auto;
    width: min(360px, calc(100vw - 16px));
    max-height: 20vh;
  }

  .board-recorder-pgn-panel {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    width: auto;
  }
}

@media (max-width: 560px) {
  .board-recorder-topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .board-recorder-title {
    justify-content: end;
  }

  .board-recorder-camera-controls {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr);
  }

  .board-recorder-camera-controls label {
    display: none;
  }

  .board-recorder-camera-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
  }

  .board-recorder-status-stack {
    top: 112px;
  }

  .board-recorder-live-panel {
    bottom: 78px;
    max-height: 40vh;
  }

  .board-recorder-calibration-panel {
    top: 204px;
    max-height: 18vh;
  }

  .board-recorder-controls button {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 560px) and (min-height: 760px) {
  .board-recorder-calibration-panel {
    max-height: 28vh;
  }
}

.learning-classroom {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(380px, 1.25fr) minmax(210px, 0.42fr);
  gap: 14px;
  align-items: start;
}

.learning-classroom.reading-only {
  grid-template-columns: minmax(420px, 1fr) minmax(210px, 0.42fr);
}

.learning-screen.board-lesson-active {
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
}

.learning-screen.board-lesson-active .learning-header,
.learning-screen.board-lesson-active .learning-classroom-toolbar,
.learning-screen.board-lesson-active .learning-status {
  display: none;
}

.learning-screen.board-lesson-active .learning-classroom-toolbar {
  grid-template-columns: minmax(0, 1fr) minmax(200px, 320px) auto;
  padding: 6px 10px;
}

.learning-screen.board-lesson-active .learning-classroom {
  --learning-side-width: clamp(300px, 20vw, 380px);
  --learning-board-size: min(calc(100vh - 176px), calc(100vw - var(--learning-side-width) - 116px));
  grid-template-areas:
    "board side"
    "board source";
  grid-template-columns: minmax(560px, calc(var(--learning-board-size) + 42px)) var(--learning-side-width);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  gap: 10px 14px;
}

.learning-screen.board-lesson-active .learning-source-panel {
  grid-area: source;
}

.learning-screen.board-lesson-active .learning-board-panel {
  grid-area: board;
}

.learning-screen.board-lesson-active .learning-side-panel {
  grid-area: side;
}

.learning-screen.board-lesson-active .learning-source-panel,
.learning-screen.board-lesson-active .learning-board-panel,
.learning-screen.board-lesson-active .learning-side-panel {
  position: static;
  gap: 9px;
  align-self: stretch;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  padding: 10px;
}

.learning-screen.board-lesson-active .learning-board-panel {
  overflow: hidden auto;
}

.learning-screen.board-lesson-active .learning-side-panel {
  height: 100%;
  max-height: 100%;
}

.learning-screen.board-lesson-active .learning-source-panel {
  height: 100%;
}

.learning-screen.board-lesson-active .learning-board-area {
  justify-self: center;
  display: grid;
  grid-template-columns: var(--learning-board-size);
  align-items: start;
  gap: 8px;
  width: var(--learning-board-size);
  max-width: 100%;
}

.learning-screen.board-lesson-active .learning-board-area:has(.learning-eval-strip:not([hidden])) {
  grid-template-columns: 28px var(--learning-board-size);
  width: calc(var(--learning-board-size) + 36px);
}

.learning-screen.board-lesson-active .learning-board-wrap {
  justify-self: center;
  width: var(--learning-board-size);
  max-width: 100%;
}

.learning-screen.board-lesson-active .learning-board-area .learning-eval-strip {
  min-height: 0;
  height: var(--learning-board-size);
  border-radius: 0;
}

.learning-screen.board-lesson-active .learning-board-area .learning-eval-fill {
  inset: auto 0 0 0;
  width: 100% !important;
}

.learning-screen.board-lesson-active .learning-board-area .learning-eval-label {
  min-height: 0;
  height: var(--learning-board-size);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.learning-screen.board-lesson-active .learning-source-viewer,
.learning-screen.board-lesson-active .learning-source-viewer img,
.learning-screen.board-lesson-active .learning-source-viewer iframe,
.learning-screen.board-lesson-active .learning-source-placeholder {
  min-height: 180px;
}

.learning-screen.board-lesson-active .learning-node-heading h2 {
  font-size: 16px;
}

.learning-board-panel,
.learning-side-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.learning-source-viewer {
  display: grid;
  gap: 10px;
  min-height: 420px;
  overflow: visible;
  border: 1px solid var(--border);
  background: white;
}

.learning-source-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
  min-width: 0;
}

.learning-source-viewer img,
.learning-source-viewer iframe {
  display: block;
  width: 100%;
  min-height: 420px;
  border: 0;
  object-fit: contain;
  background: white;
}

.learning-source-placeholder {
  display: grid;
  gap: 10px;
  align-content: center;
  min-width: 0;
  min-height: 420px;
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.learning-source-placeholder strong {
  color: var(--text);
  font-size: 18px;
}

.learning-source-placeholder span {
  overflow-wrap: anywhere;
}

.learning-text-reader {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
  min-height: 420px;
  padding: 20px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.65;
}

.learning-text-reader h3,
.learning-text-reader h4,
.learning-text-reader p,
.learning-text-reader ul,
.learning-text-reader ol {
  margin: 0;
}

.learning-text-reader h3 {
  font-family: Inter, system-ui, sans-serif;
  font-size: 22px;
  line-height: 1.25;
}

.learning-question {
  display: grid;
  gap: 14px;
  align-content: start;
  min-height: 420px;
  padding: 22px;
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.learning-question h3,
.learning-question h4,
.learning-question p {
  margin: 0;
}

.learning-question h3 {
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.05;
}

.learning-question-prompt {
  max-width: 62ch;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

.learning-question-description {
  display: grid;
  gap: 8px;
  max-width: 72ch;
  color: #4f4740;
  font-size: 16px;
  line-height: 1.55;
}

.learning-question-image-frame {
  width: min(100%, 560px);
  margin: 0;
  justify-self: start;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.learning-question-image {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.learning-question-choices {
  display: grid;
  gap: 10px;
}

.learning-question-choice {
  min-height: 54px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--text);
  padding: 12px 14px;
  text-align: left;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.learning-question-choice:hover:not(:disabled),
.learning-question-choice.selected {
  border-color: #171717;
  background: #171717;
  color: white;
}

.learning-question.correct .learning-question-choice.selected {
  border-color: #15803d;
  background: #dcfce7;
  color: #14532d;
}

.learning-question.incorrect .learning-question-choice.selected {
  border-color: #b91c1c;
  background: #fee2e2;
  color: #7f1d1d;
}

.learning-question-choice:disabled {
  cursor: default;
}

.learning-question-feedback {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-left-width: 5px;
  background: #f8fafc;
  padding: 14px;
}

.learning-question-feedback.correct {
  border-left-color: #16a34a;
  background: #f0fdf4;
}

.learning-question-feedback.incorrect {
  border-left-color: #dc2626;
  background: #fff1f2;
}

.learning-question-feedback h4 {
  font-size: 18px;
  line-height: 1.2;
}

.learning-question-explanation {
  color: var(--muted);
}

.learning-question-next {
  justify-self: start;
  min-height: 38px;
  border: 1px solid #171717;
  border-radius: 6px;
  background: #171717;
  color: white;
  padding: 0 14px;
  font-weight: 900;
  cursor: pointer;
}

.learning-question-next:hover:not(:disabled) {
  background: #2b2b2b;
}

@media (max-width: 520px) {
  .learning-question {
    min-height: 0;
    padding: 16px;
    gap: 12px;
  }

  .learning-question h3 {
    font-size: 26px;
  }

  .learning-question-prompt {
    font-size: 15px;
  }

  .learning-question-description {
    font-size: 14px;
  }

  .learning-question-image-frame {
    width: 100%;
  }

  .learning-question-image {
    max-height: 200px;
  }

  .learning-question-choice {
    min-height: 48px;
    padding: 10px 12px;
  }
}

.learning-tts-paragraph {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.learning-tts-controls {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 74px;
  font-family: Inter, system-ui, sans-serif;
}

.learning-tts-button {
  min-height: 32px;
  border: 1px solid #111827;
  border-radius: 6px;
  background: white;
  color: #111827;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.learning-tts-button:hover:not(:disabled),
.learning-tts-button.playing {
  background: #111827;
  color: white;
}

.learning-tts-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.learning-tts-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: right;
}

.learning-tts-status[hidden] {
  display: none;
}

.placement-tournament-screen {
  display: grid;
  gap: 16px;
  width: min(1460px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.placement-tournament-header,
.placement-tournament-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.placement-tournament-header h1,
.placement-tournament-header p,
.placement-tournament-panel h2,
.placement-tournament-summary-card h2 {
  margin: 0;
}

.placement-tournament-header > div:first-child {
  display: grid;
  gap: 6px;
}

.placement-tournament-header > div:first-child > p:last-child {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.placement-tournament-actions,
.placement-tournament-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.placement-tournament-actions button,
.placement-tournament-primary-actions button,
.placement-tournament-panel-heading button,
.placement-tournament-list-button,
.placement-tournament-table button,
.placement-tournament-review-table button,
.placement-pairings-table button {
  min-height: 38px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 14px;
  font-weight: 800;
}

.placement-tournament-primary-actions button:first-child {
  background: #171717;
  color: white;
}

.placement-tournament-actions button:disabled,
.placement-tournament-primary-actions button:disabled,
.placement-tournament-panel-heading button:disabled,
.placement-tournament-table button:disabled,
.placement-tournament-review-table button:disabled,
.placement-pairings-table button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.placement-tournament-primary-actions button.placement-tournament-danger,
.placement-tournament-list-delete.placement-tournament-danger {
  border-color: #9b1c1c;
  color: #9b1c1c;
}

.placement-tournament-primary-actions button.placement-tournament-danger:hover:not(:disabled),
.placement-tournament-list-delete.placement-tournament-danger:hover:not(:disabled) {
  background: #fff1f1;
}

.placement-tournament-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.placement-tournament-status.error {
  color: #9b1c1c;
  font-weight: 800;
}

.placement-tournament-presentation {
  display: inline-flex;
  justify-self: start;
  gap: 6px;
  border: 2px solid var(--world-near-black);
  outline: 1px solid var(--world-brass);
  background: var(--world-panel);
  padding: 5px;
}

.placement-tournament-presentation button,
.placement-journey-table-access button {
  min-height: 44px;
  border: 2px solid transparent;
  background: transparent;
  color: var(--world-parchment);
  padding: 8px 18px;
  font-weight: 900;
  cursor: pointer;
}

.placement-tournament-presentation button.active,
.placement-tournament-presentation button:hover,
.placement-tournament-presentation button:focus-visible,
.placement-journey-table-access button:hover,
.placement-journey-table-access button:focus-visible {
  border-color: var(--world-brass);
  background: var(--world-moss);
  color: var(--world-text-cream);
  outline: 2px solid var(--world-text-cream);
  outline-offset: 2px;
}

.placement-tournament-journey {
  display: grid;
  gap: 18px;
  min-width: 0;
  overflow: hidden;
  padding: 20px;
  background-color: var(--world-deep-background);
  background-image: linear-gradient(rgba(9, 15, 13, 0.74), rgba(9, 15, 13, 0.92)), url("/assets/pixel-club/clubhouse.png?v=landscape-20260718");
  background-position: center;
  background-size: cover;
  color: var(--world-text-cream);
}

.placement-journey-event {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--world-walnut);
  padding-bottom: 14px;
}

.placement-journey-event > img { width: 56px; height: 56px; image-rendering: pixelated; }
.placement-journey-event h2,
.placement-journey-event p,
.placement-journey-layout h3,
.placement-journey-current p,
.placement-journey-table-access p { margin: 0; }
.placement-journey-event h2 {
  color: var(--world-text-cream);
  font-size: clamp(25px, 4vw, 42px);
  line-height: 1;
  text-shadow: 3px 3px 0 var(--world-near-black);
}
.placement-journey-event p:last-child { margin-top: 7px; color: var(--world-parchment); overflow-wrap: anywhere; }

.placement-journey-scoreboard {
  display: grid;
  grid-template-columns: minmax(230px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
}
.placement-journey-player {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 2px solid var(--world-walnut);
  background: rgba(17, 26, 22, 0.94);
  padding: 10px;
}
.placement-journey-player span { display: grid; gap: 4px; min-width: 0; }
.placement-journey-player small,
.placement-journey-opponent-row small {
  color: var(--world-brass-highlight);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.placement-journey-player strong {
  overflow: hidden;
  color: var(--world-text-cream);
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.placement-journey-portrait {
  width: 72px;
  height: 72px;
  border: 2px solid var(--world-near-black);
  outline: 1px solid var(--world-brass);
  background: var(--world-muted-blue);
  object-fit: contain;
}
.placement-journey-scoreboard > dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.placement-journey-scoreboard > dl > div {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  border: 2px solid var(--world-walnut);
  background: rgba(17, 26, 22, 0.94);
  padding: 12px;
  text-align: center;
}
.placement-journey-scoreboard dt { color: var(--world-brass-highlight); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.placement-journey-scoreboard dd { margin: 0; color: var(--world-text-cream); font-size: 24px; font-weight: 900; }

.placement-journey-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}
.placement-journey-layout > section { display: grid; gap: 12px; }
.placement-journey-layout > section > h3 { color: var(--world-brass-highlight); }
.placement-journey-rounds {
  display: grid;
  grid-template-columns: repeat(7, minmax(105px, 1fr));
  gap: 8px;
  margin: 0;
  overflow-x: auto;
  padding: 3px 3px 10px;
  list-style: none;
  scrollbar-color: var(--world-brass) var(--world-deep-background);
}
.placement-journey-round {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 105px;
  min-height: 138px;
  border: 2px solid var(--world-walnut);
  background: rgba(17, 26, 22, 0.92);
  padding: 10px;
}
.placement-journey-round > span:last-child { display: grid; gap: 6px; }
.placement-journey-round-marker {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--world-brass);
  background: var(--world-deep-background);
  color: var(--world-text-cream);
  font-weight: 900;
}
.placement-journey-round strong { color: var(--world-text-cream); }
.placement-journey-round small { color: var(--world-parchment); line-height: 1.35; }
.placement-journey-round-complete { border-color: var(--world-moss); }
.placement-journey-round-complete .placement-journey-round-marker { background: var(--world-moss); }
.placement-journey-round-current { border-color: var(--world-brass-highlight); outline: 2px solid var(--world-text-cream); outline-offset: 2px; }
.placement-journey-round-upcoming { opacity: 0.72; }

.placement-journey-current { display: grid; gap: 14px; min-width: 0; padding: 16px; }
.placement-journey-opponent-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.placement-journey-opponent-row .placement-journey-portrait { width: 84px; height: 84px; }
.placement-journey-opponent-row h3 { margin-top: 5px; overflow-wrap: anywhere; color: var(--world-text-cream); font-size: 23px; }
.placement-journey-current > p:not(.eyebrow) { color: var(--world-parchment); line-height: 1.45; }
.placement-journey-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.placement-journey-actions button,
.placement-journey-table-access button {
  min-height: 46px;
  border: 2px solid var(--world-near-black);
  outline: 1px solid var(--world-brass);
  background: var(--world-moss);
  color: var(--world-text-cream);
  padding: 8px 12px;
  font-weight: 900;
  cursor: pointer;
}
.placement-journey-actions button:first-child { background: var(--world-oxblood); }
.placement-journey-actions button:focus-visible { outline: 3px solid var(--world-text-cream); outline-offset: 3px; }
.placement-journey-actions button:disabled { cursor: wait; opacity: 0.6; }
.placement-journey-table-access {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-top: 2px solid var(--world-walnut);
  padding-top: 14px;
}
.placement-journey-table-access p { color: var(--world-parchment); line-height: 1.4; }

.placement-tournament-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.placement-tournament-setup {
  border: 1px solid var(--border);
  background: #fffdf8;
  min-width: 0;
  padding: 14px;
}

.placement-tournament-setup-form {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.placement-tournament-setup-form fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  border: 0;
  padding: 0;
}

.placement-tournament-setup-form legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.placement-time-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.placement-name-controls {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr);
  gap: 10px;
}

.placement-name-controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.placement-name-controls span,
.placement-name-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.placement-name-picker,
.placement-name-controls input {
  min-height: 40px;
  border: 1px solid #8e7d69;
  border-radius: 4px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  padding: 8px 10px;
}

.placement-name-picker {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  text-align: left;
}

.placement-name-picker strong,
.placement-name-picker small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.placement-name-picker strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
}

.placement-name-picker small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.placement-name-help {
  margin: 0;
}

.placement-title-modal-panel {
  width: min(620px, 100%);
}

.placement-title-modal-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.placement-title-modal-heading > div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.placement-title-modal-heading button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 12px;
  font-weight: 900;
}

.placement-title-options {
  display: grid;
  gap: 8px;
  max-height: min(58vh, 420px);
  overflow: auto;
}

.placement-title-option {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: 7px;
  background: white;
  color: var(--text);
  padding: 11px 12px;
  text-align: left;
}

.placement-title-option[aria-selected="true"] {
  border-color: #3a2a1f;
  background: #fff8df;
}

.placement-title-option strong {
  font-size: 15px;
  line-height: 1.2;
}

.placement-title-option span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.placement-rating-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.placement-time-options label,
.placement-rating-options label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 8px;
  align-items: start;
  min-height: 74px;
  border: 1px solid var(--border);
  background: white;
  padding: 10px;
  cursor: pointer;
}

.placement-fide-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  max-width: 620px;
  border: 1px solid var(--border);
  background: white;
  padding: 10px;
  cursor: pointer;
}

.placement-fide-option > span {
  display: grid;
  gap: 3px;
}

.placement-time-options label:has(input:checked),
.placement-rating-options label:has(input:checked),
.placement-fide-option:has(input:checked) {
  border-color: #171717;
  background: #fff4c7;
}

.placement-time-options input,
.placement-rating-options input,
.placement-fide-option input {
  margin-top: 2px;
}

.placement-time-options strong,
.placement-time-options span,
.placement-rating-options strong,
.placement-rating-options span,
.placement-fide-option strong,
.placement-fide-option span {
  min-width: 0;
}

.placement-time-options span,
.placement-rating-options span,
.placement-fide-option > span > span {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.placement-time-specific {
  width: 100%;
  max-width: 460px;
}

.placement-time-control-select {
  display: grid;
  gap: 6px;
}

.placement-time-control-select span,
.placement-time-control-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.placement-time-control-select select {
  min-height: 40px;
  border: 1px solid #8e7d69;
  border-radius: 4px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  padding: 8px 10px;
}

.placement-time-control-chips {
  display: grid;
  grid-template-columns: repeat(6, minmax(88px, 1fr));
  gap: 8px;
  max-width: 760px;
}

.placement-time-control-chip {
  display: grid;
  gap: 3px;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 7px 9px;
  text-align: center;
}

.placement-time-control-chip:hover,
.placement-time-control-chip:focus {
  border-color: #8e7d69;
  background: #fffdf8;
}

.placement-time-control-chip.active,
.placement-time-control-chip[aria-checked="true"] {
  border-color: #171717;
  background: #fff7d8;
  box-shadow: inset 0 0 0 1px #171717;
}

.placement-time-control-chip strong {
  font-size: 13px;
  line-height: 1.1;
}

.placement-time-control-chip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.placement-time-control-help {
  margin: -2px 0 0;
}

.placement-time-control-select {
  display: none;
}

.placement-tournament-summary-card,
.placement-tournament-panel {
  border: 1px solid var(--border);
  background: #fffdf8;
}

.placement-tournament-summary-card {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.placement-tournament-summary-card h2,
.placement-tournament-panel h2 {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.placement-tournament-summary-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.placement-tournament-summary-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.placement-tournament-danger {
  border-color: #9b1c1c;
  color: #9b1c1c;
}

.placement-tournament-danger:hover:not(:disabled) {
  background: #fff1f1;
}

.placement-tournament-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
}

.placement-tournament-review-panel {
  gap: 16px;
}

.placement-tournament-review-panel .placement-tournament-panel-heading p:last-child {
  margin: 4px 0 0;
  color: var(--muted);
}

.placement-tournament-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.placement-tournament-review-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.placement-tournament-review-card {
  display: grid;
  gap: 5px;
  border: 1px solid var(--border);
  background: white;
  padding: 12px;
}

.placement-tournament-review-card h3,
.placement-tournament-review-section h3 {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.placement-tournament-review-card strong {
  font-size: 22px;
  line-height: 1.1;
}

.placement-tournament-review-card span,
.placement-tournament-review-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.placement-tournament-review-section {
  display: grid;
  gap: 8px;
}

.placement-tournament-review-section ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 22px;
}

.placement-tournament-certificate {
  border: 1px solid #d1b06f;
  background: #fff8df;
  padding: 12px;
}

.placement-tournament-certificate dl {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.placement-tournament-certificate div {
  min-width: 0;
  border-left: 1px solid #d1b06f;
  padding-left: 10px;
}

.placement-tournament-certificate dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.placement-tournament-certificate dd {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.placement-tournament-review-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 13px;
}

.placement-tournament-review-table th,
.placement-tournament-review-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.placement-tournament-review-table th {
  background: #f5efe5;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.placement-tournament-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  background: white;
}

.placement-tournament-table,
.placement-pairings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.placement-tournament-table th,
.placement-tournament-table td,
.placement-pairings-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.placement-tournament-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5efe5;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.placement-tournament-help {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.placement-tournament-table tr.user-row,
.placement-pairings-table tr.user-row {
  background: #fff4c7;
}

.placement-round-cell {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.placement-round-cell button {
  min-height: 28px;
  max-width: 100%;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.placement-tournament-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 14px;
  align-items: start;
}

.placement-tournament-rounds {
  display: grid;
  gap: 8px;
}

.placement-tournament-rounds details {
  border: 1px solid var(--border);
  background: white;
}

.placement-tournament-rounds summary {
  padding: 10px 12px;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.placement-pairings-table td:first-child {
  width: 46px;
  color: var(--muted);
  font-weight: 800;
}

.placement-tournament-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.placement-tournament-list-section {
  display: grid;
  gap: 8px;
}

.placement-tournament-list-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.placement-tournament-list-group {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.placement-tournament-list-empty {
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 800;
}

.placement-tournament-certificate-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.placement-tournament-list-item {
  display: grid;
  gap: 6px;
}

.placement-tournament-list-button {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  text-align: left;
}

.placement-tournament-list-button strong,
.placement-tournament-list-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.placement-tournament-list-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.placement-tournament-list-button.active {
  border-color: #1f7a57;
  background: #f4fbf7;
}

.placement-tournament-list-delete {
  justify-self: start;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.placement-tournament-certificate-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
}

.placement-tournament-certificate-item > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.placement-tournament-certificate-item strong,
.placement-tournament-certificate-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.placement-tournament-certificate-item span,
.placement-tournament-certificate-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.placement-tournament-certificate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.placement-tournament-certificate-actions button {
  min-height: 32px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.placement-tournament-screen.placement-tournament-hub-state {
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.78fr);
  grid-template-areas:
    "header header"
    "status status"
    "summary summary"
    "setup side";
  align-content: start;
}

.placement-tournament-screen.placement-tournament-active-state {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  grid-template-areas:
    "header header"
    "status status"
    "presentation presentation"
    "journey journey"
    "summary summary"
    "actions actions"
    "review review"
    "standings side";
  align-content: start;
}

.placement-tournament-screen.placement-tournament-active-state.placement-tournament-setup-visible {
  grid-template-areas:
    "header header"
    "status status"
    "presentation presentation"
    "setup setup"
    "journey journey"
    "summary summary"
    "actions actions"
    "review review"
    "standings side";
}

#placement-tournament-screen > .placement-tournament-header {
  grid-area: header;
}

#placement-tournament-screen > .placement-tournament-status {
  grid-area: status;
}

#placement-tournament-screen > .placement-tournament-presentation {
  grid-area: presentation;
}

#placement-tournament-screen > .placement-tournament-journey {
  grid-area: journey;
}

#placement-tournament-screen > .placement-tournament-setup {
  grid-area: setup;
}

#placement-tournament-screen > .placement-tournament-summary {
  grid-area: summary;
}

#placement-tournament-screen > .placement-tournament-primary-actions {
  grid-area: actions;
}

#placement-tournament-screen > .placement-tournament-review-panel {
  grid-area: review;
}

#placement-tournament-screen > .placement-tournament-standings-panel {
  grid-area: standings;
}

#placement-tournament-screen > .placement-tournament-columns {
  grid-area: side;
}

#placement-tournament-screen.placement-tournament-hub-state > .placement-tournament-primary-actions {
  display: none;
}

.placement-tournament-hub-state .placement-tournament-columns {
  display: grid;
  grid-template-columns: 1fr;
}

.placement-tournament-hub-state #placement-tournament-rounds-panel {
  display: none;
}

.placement-tournament-active-state .placement-tournament-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-self: start;
}

.placement-tournament-active-state .placement-tournament-columns > .placement-tournament-panel {
  min-height: 0;
}

.placement-tournament-active-state .placement-tournament-table-wrap {
  max-height: min(72vh, 790px);
}

.placement-tournament-hub-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.placement-tournament-command {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr);
  gap: 18px;
  align-items: stretch;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(248, 242, 232, 0.8));
  padding: 18px;
}

.placement-tournament-command-main {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
}

.placement-tournament-command-main h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(26px, 3vw, 36px);
  line-height: 0.98;
}

.placement-tournament-command-main p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.placement-tournament-command-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.placement-tournament-command-stats div {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.74);
  padding: 12px;
}

.placement-tournament-command-stats dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.placement-tournament-command-stats dd {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.05;
}

.placement-tournament-command-stats span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.placement-setup-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.placement-setup-stepper li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.placement-setup-stepper span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid #3a2a1f;
  border-radius: 50%;
  background: #171717;
  color: white;
  font-weight: 900;
}

.placement-setup-stepper strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.placement-tournament-setup {
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.78);
  box-shadow: 0 14px 34px rgba(58, 42, 31, 0.045);
}

.placement-tournament-setup-form fieldset {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.placement-rating-options {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.placement-time-options {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.placement-time-options label,
.placement-rating-options label {
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

.placement-time-options label:hover,
.placement-rating-options label:hover {
  border-color: #8e7d69;
  background: #fffdf8;
}

.placement-time-options label:has(input:checked),
.placement-rating-options label:has(input:checked) {
  border-color: #171717;
  background: #fff7d8;
  box-shadow: inset 0 0 0 1px #171717;
}

.placement-time-specific {
  max-width: none;
}

.placement-time-control-select {
  max-width: 440px;
}

.placement-time-control-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.placement-tournament-hub-state .placement-tournament-panel {
  background: rgba(255, 253, 248, 0.78);
}

.placement-tournament-list-button {
  gap: 8px;
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
}

.placement-tournament-list-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.placement-tournament-list-heading strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.placement-tournament-list-status {
  flex: 0 0 auto;
  border-radius: 6px;
  background: #dcefd3;
  color: #2d6420;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.placement-tournament-list-button span:not(.placement-tournament-list-heading):not(.placement-tournament-list-status):not(.placement-tournament-list-progress) {
  white-space: normal;
}

.placement-tournament-list-progress {
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #ddd7cf;
}

.placement-tournament-list-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #5c9a43;
}

.placement-round-details {
  overflow: hidden;
  border-radius: 6px;
}

.placement-round-details.current-round {
  border-color: #3a2a1f;
  box-shadow: inset 4px 0 0 #d79b2b;
}

.placement-round-details.completed-round summary {
  color: #2d6420;
}

.placement-tournament-active-state .placement-tournament-rounds {
  max-height: min(56vh, 560px);
  overflow: auto;
}

.placement-tournament-active-state .placement-pairings-table {
  table-layout: fixed;
  font-size: 11px;
}

.placement-tournament-active-state .placement-pairings-table td {
  overflow: hidden;
  padding: 6px;
  text-overflow: ellipsis;
}

.placement-tournament-active-state .placement-pairings-table td:first-child {
  width: 28px;
}

.placement-tournament-active-state .placement-pairings-table td:nth-child(3) {
  width: 42px;
  text-align: center;
}

.placement-tournament-active-state .placement-pairings-table td:nth-child(5) {
  width: 58px;
}

.placement-tournament-active-state .placement-tournament-primary-actions {
  align-items: center;
  padding-bottom: 2px;
}

.placement-tournament-active-state .placement-tournament-primary-actions button {
  min-height: 42px;
}

.placement-tournament-active-state .placement-tournament-primary-actions #placement-tournament-end {
  margin-left: auto;
}

.placement-tournament-standings-panel {
  padding: 12px;
}

.placement-tournament-standings-panel .placement-tournament-panel-heading {
  min-height: 32px;
}

.placement-tournament-table {
  font-size: 12px;
}

.placement-tournament-table th,
.placement-tournament-table td {
  padding: 7px 9px;
}

.placement-tournament-table tr.user-row {
  box-shadow: inset 4px 0 0 #d79b2b;
}

.placement-tournament-table button {
  min-height: 26px;
  border-color: #3a2a1f;
  background: #fffdf8;
  padding: 0 8px;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .placement-tournament-screen.placement-tournament-hub-state {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "status"
      "summary"
      "setup"
      "side";
  }

  .placement-tournament-screen.placement-tournament-active-state,
  .placement-tournament-screen.placement-tournament-active-state.placement-tournament-setup-visible {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "status"
      "presentation"
      "setup"
      "journey"
      "summary"
      "actions"
      "review"
      "standings"
      "side";
  }

  .placement-tournament-hub-state .placement-tournament-columns {
    grid-area: side;
  }

  .placement-rating-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .placement-time-control-chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .placement-tournament-command,
  .placement-tournament-command-stats,
  .placement-tournament-certificate dl {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .placement-tournament-screen {
    width: min(100%, calc(100vw - 20px));
    margin: 10px auto;
    padding: 12px;
  }

  .placement-tournament-hub-summary,
  .placement-setup-stepper,
  .placement-name-controls,
  .placement-rating-options,
  .placement-time-options,
  .placement-time-control-chips,
  .placement-tournament-certificate-item {
    grid-template-columns: 1fr;
  }

  .placement-tournament-certificate-actions {
    justify-content: stretch;
  }

  .placement-tournament-certificate-actions button {
    flex: 1 1 140px;
  }

  .placement-tournament-command-main h2 {
    font-size: 28px;
  }

  .placement-tournament-presentation {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .placement-tournament-journey {
    padding: 14px;
    padding-bottom: 82px;
    background-image: linear-gradient(rgba(9, 15, 13, 0.78), rgba(9, 15, 13, 0.94)), url("/assets/pixel-club/clubhouse.png?v=landscape-20260718");
  }

  .placement-journey-scoreboard,
  .placement-journey-layout {
    grid-template-columns: 1fr;
  }

  .placement-journey-table-access {
    align-items: stretch;
    flex-direction: column;
  }

  #placement-journey-start-round:not([hidden]) {
    position: fixed;
    right: 16px;
    bottom: 14px;
    left: 16px;
    z-index: 30;
    min-height: 52px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  }

  .placement-tournament-active-state .placement-tournament-primary-actions #placement-tournament-end {
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  .placement-journey-event { grid-template-columns: 48px minmax(0, 1fr); }
  .placement-journey-event > img { width: 42px; height: 42px; }
  .placement-journey-scoreboard > dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .placement-journey-scoreboard dd { font-size: 19px; }
  .placement-journey-actions { grid-template-columns: 1fr; }
}

.career-screen {
  display: grid;
  gap: 16px;
  width: min(1460px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.career-header,
.career-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.career-header > div:first-child,
.career-panel-heading > div:first-child {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.career-header h1,
.career-header p,
.career-panel h2 {
  margin: 0;
}

.career-header > div:first-child > p:last-child,
.career-panel-heading p,
.career-status,
.career-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.career-header-actions,
.career-filter-row,
.career-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.career-header-actions button,
.career-filter-row button,
.career-tabs button,
.career-next-focus button,
.career-review-item button {
  min-height: 36px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 13px;
  font-weight: 900;
  cursor: pointer;
}

.career-filter-row button,
.career-tabs button {
  min-height: 32px;
  border-color: var(--border);
  font-size: 12px;
}

.career-filter-row button.active,
.career-filter-row button[aria-pressed="true"],
.career-tabs button.active,
.career-tabs button[aria-selected="true"] {
  border-color: #171717;
  background: #171717;
  color: white;
}

.career-status {
  min-height: 20px;
  margin: 0;
}

.career-status.error {
  color: #9b1c1c;
  font-weight: 900;
}

.career-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.career-summary-card,
.career-panel {
  border: 1px solid var(--border);
  background: #fffdf8;
}

.career-summary-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
}

.career-summary-card h2,
.career-panel h2 {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.career-summary-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 26px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.career-summary-card span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.career-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(320px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.career-side,
.career-next-focus,
.career-openings,
.career-reviews {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.career-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
}

.career-chart-panel {
  min-height: 360px;
}

.career-chart {
  display: grid;
  align-items: center;
  min-height: 290px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: white;
}

.career-chart svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 260px;
}

.career-chart-grid line {
  stroke: #e5d7c8;
  stroke-width: 1;
}

.career-chart-grid text,
.career-chart-axis text {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.career-chart-line-shadow {
  fill: none;
  stroke: rgba(58, 42, 31, 0.12);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 9;
}

.career-chart-line {
  fill: none;
  stroke: #2187c8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.career-chart-points circle {
  fill: #d79b2b;
  stroke: white;
  stroke-width: 2;
}

.career-next-focus {
  align-content: start;
  min-height: 132px;
  border-left: 4px solid #d79b2b;
  background: rgba(255, 244, 199, 0.42);
  padding: 12px;
}

.career-next-focus strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.15;
}

.career-next-focus span,
.career-timeline span,
.career-timeline time,
.career-opening-item span,
.career-review-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.career-next-focus button {
  justify-self: start;
  background: #171717;
  color: white;
}

.career-timeline {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.career-timeline li {
  display: grid;
  gap: 3px;
  border-bottom: 1px solid rgba(208, 190, 169, 0.72);
  padding: 0 0 8px;
}

.career-timeline strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.career-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.career-opening-item,
.career-review-item {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid rgba(208, 190, 169, 0.8);
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
}

.career-opening-item strong,
.career-review-item strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.career-mini-progress {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #ddd7cf;
}

.career-mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #5c9a43;
}

.career-review-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.career-review-item span {
  grid-column: 1;
}

.career-review-item button {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.career-table-panel {
  gap: 14px;
}

.career-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  background: white;
}

.career-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.career-table th,
.career-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.career-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5efe5;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.career-empty {
  margin: 0;
  padding: 12px;
}

@media (max-width: 1180px) {
  .career-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .career-layout,
  .career-detail-grid {
    grid-template-columns: 1fr;
  }

  .career-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .career-screen {
    width: min(100%, calc(100vw - 20px));
    min-height: auto;
    margin: 10px auto;
    padding: 12px;
  }

  .career-header,
  .career-panel-heading {
    align-items: start;
    flex-direction: column;
  }

  .career-header-actions,
  .career-filter-row,
  .career-tabs {
    width: 100%;
  }

  .career-header-actions button,
  .career-filter-row button,
  .career-tabs button {
    flex: 1 1 auto;
  }

  .career-summary,
  .career-side {
    grid-template-columns: 1fr;
  }

  .career-summary-card {
    padding: 12px;
  }

  .career-chart-panel {
    min-height: 0;
  }

  .career-chart {
    min-height: 220px;
  }

  .career-chart svg {
    min-width: 620px;
  }

  .career-table {
    font-size: 12px;
  }
}

.stats-screen {
  display: grid;
  gap: 16px;
  width: min(1320px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.stats-header,
.stats-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stats-header h1,
.stats-panel h2,
.stats-summary-card h2 {
  margin: 0;
}

.stats-header-actions {
  display: flex;
  gap: 10px;
}

.stats-header-actions button,
.stats-recent-item button,
.ai-debug-heading button {
  min-height: 38px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 14px;
  font-weight: 800;
}

.stats-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.stats-status.error {
  color: #9b1c1c;
  font-weight: 800;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stats-summary-card,
.stats-panel,
.stats-item,
.stats-recent-item {
  border: 1px solid var(--border);
  background: #fffdf8;
}

.stats-summary-card {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.stats-summary-card h2 {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.stats-summary-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.stats-summary-card span,
.stats-item span,
.stats-recent-item span,
.stats-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.stats-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stats-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.stats-panel h2 {
  color: var(--muted);
  font-size: 18px;
  text-transform: uppercase;
}

.stats-list,
.stats-recent-list {
  display: grid;
  gap: 8px;
}

.stats-item,
.stats-recent-item {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.stats-recent-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.stats-recent-item.failed {
  border-color: #d53636;
}

.stats-recent-item button:disabled {
  opacity: 0.55;
}

.ai-debug-modal-panel {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.ai-debug-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.ai-debug-heading h2,
.ai-debug-section h3 {
  margin: 0;
}

.ai-debug-meta {
  margin: 0;
}

.ai-debug-audio {
  display: grid;
  gap: 8px;
}

.ai-debug-audio audio {
  width: 100%;
}

.ai-debug-section {
  display: grid;
  gap: 8px;
}

.ai-debug-section pre {
  max-height: 320px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--border);
  background: white;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.learning-section-context {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.learning-text-lead-in {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  background: #fffaf0;
  padding: 12px;
}

.learning-text-lead-in summary {
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.learning-text-lead-in-body {
  display: grid;
  gap: 10px;
}

.learning-answer-reveal {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.learning-answer-toggle {
  justify-self: start;
  min-height: 38px;
  border: 1px solid #111827;
  border-radius: 6px;
  background: #111827;
  color: white;
  padding: 0 14px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.learning-answer-toggle:hover {
  background: #1f2937;
}

.learning-answer-body {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  padding: 14px;
}

.learning-text-reader h4 {
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.3;
}

.learning-text-reader p {
  overflow-wrap: anywhere;
}

.learning-source-move {
  margin: 0;
  border: 0;
  border-radius: 4px;
  background: #fff1a8;
  color: #3a2a1f;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  vertical-align: baseline;
  box-shadow: 0 0 0 2px #fff1a8, inset 0 -2px 0 rgba(177, 120, 0, 0.24);
}

.learning-source-move.current {
  background: #172554;
  color: white;
  box-shadow: 0 0 0 2px #172554;
}

.learning-text-eyebrow,
.learning-text-path {
  font-family: Inter, system-ui, sans-serif;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.learning-text-reader ul,
.learning-text-reader ol {
  display: grid;
  gap: 8px;
  padding-left: 22px;
  color: var(--muted);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.learning-text-path {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  overflow-wrap: anywhere;
}

.learning-reading-controls {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr) minmax(84px, 0.34fr);
  gap: 10px;
}

.learning-reading-controls button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 14px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.learning-reading-controls button:hover:not(:disabled) {
  background: #171717;
  color: white;
}

.learning-badge,
#learning-source-status {
  display: inline-grid;
  place-items: center;
  min-height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.learning-badge[hidden],
#learning-source-status[hidden] {
  display: none;
}

.learning-board-area {
  justify-self: center;
  display: grid;
  width: min(100%, 680px);
}

.learning-board-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 10px solid #3a2a1f;
  box-shadow: 0 18px 34px rgba(40, 28, 18, 0.2);
}

.learning-board-wrap.variation-line {
  border-color: #2d74bd;
}

.learning-board {
  width: 100%;
  height: 100%;
}

.learning-position-controls,
.learning-progress-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.learning-position-controls {
  grid-template-columns: minmax(0, 0.8fr) 44px minmax(0, 1fr) minmax(78px, 0.34fr) 44px 44px;
}

.learning-position-controls button[hidden] {
  display: none;
}

.learning-position-controls .learning-icon-control {
  min-width: 44px;
  padding: 0;
  font-size: 26px;
  line-height: 1;
}

#learning-flip-board {
  font-size: 22px;
}

.learning-progress-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(38px, auto));
}

#learning-mark-complete,
#learning-next-node,
#learning-reading-next-node {
  line-height: 1.15;
  white-space: normal;
}

#learning-mark-complete {
  grid-row: 1 / span 2;
  min-height: 84px;
}

#learning-skip-lesson,
#learning-skip-node,
#learning-reading-skip-node {
  font-size: 12px;
}

#learning-skip-lesson,
#learning-mark-correction {
  min-height: 38px;
}

.learning-engine-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  background: white;
  padding: 12px;
}

.learning-engine-panel[hidden] {
  display: none;
}

.learning-engine-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.learning-engine-heading h3 {
  margin: 0;
  font-size: 15px;
}

#learning-engine-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.learning-engine-controls {
  display: grid;
  grid-template-columns: auto minmax(62px, 1fr) minmax(78px, auto);
  align-items: center;
  gap: 8px;
}

.learning-engine-controls label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

#learning-engine-depth {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 800;
}

#learning-engine-analyze {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.learning-eval-strip {
  position: relative;
  min-height: 28px;
  overflow: hidden;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: #171717;
}

.learning-eval-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  background: white;
}

.learning-eval-label {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 28px;
  place-items: center;
  color: var(--text);
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.learning-eval-label.negative {
  color: white;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.learning-engine-top-moves {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 22px;
  font-size: 13px;
  line-height: 1.35;
}

.learning-engine-top-moves li {
  min-width: 0;
}

.learning-engine-top-moves span {
  overflow-wrap: anywhere;
}

.learning-engine-top-moves strong {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.learning-side-panel section {
  display: grid;
  gap: 8px;
}

.learning-side-panel {
  gap: 10px;
  padding: 10px;
}

.learning-side-panel .learning-panel-heading {
  gap: 8px;
}

.learning-side-panel .learning-panel-heading h2 {
  font-size: 17px;
}

.learning-side-panel .learning-panel-heading button,
.learning-side-panel .learning-progress-actions button,
.learning-side-panel #learning-save-notes {
  min-height: 32px;
  padding: 0 8px;
  font-size: 13px;
}

.learning-move-list {
  display: grid;
  gap: 6px;
  max-height: 118px;
  overflow: auto;
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.35;
}

#learning-source-line {
  max-height: 260px;
}

.learning-move-list button {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 8px;
  text-align: left;
}

.learning-move-list button.current {
  border-color: #3a2a1f;
  background: #171717;
  color: white;
}

.opening-practice-move-list {
  gap: 0;
  max-height: 250px;
}

.opening-practice-move-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  min-height: 32px;
  padding: 2px 4px;
  column-gap: 6px;
}

.opening-practice-move-row:nth-child(even) {
  background: rgba(58, 42, 31, 0.035);
}

.opening-practice-move-number {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.opening-practice-move-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 27px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  padding: 3px 5px;
  font-size: 13px;
  font-weight: 900;
  text-align: left;
}

.opening-practice-move-list .opening-practice-move-button {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 3px 5px;
  text-align: left;
}

.opening-practice-move-button.classified-move {
  grid-template-columns: auto minmax(0, 1fr);
}

.opening-practice-move-button:hover,
.opening-practice-move-button:focus-visible {
  background: rgba(58, 42, 31, 0.08);
}

.opening-practice-move-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.opening-practice-move-text {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opening-practice-move-button.current {
  background: rgba(23, 23, 23, 0.92);
  color: white;
}

.opening-practice-move-list .opening-practice-move-button.current {
  border-color: transparent;
  background: rgba(23, 23, 23, 0.92);
  color: white;
}

.opening-practice-move-button.classification-inaccuracy:not(.current) {
  color: #c17a15;
}

.opening-practice-move-button.classification-mistake:not(.current) {
  color: #d45d24;
}

.opening-practice-move-button.classification-blunder:not(.current),
.opening-practice-move-button.classification-missed-win:not(.current) {
  color: #d74949;
}

.opening-practice-move-button.classification-best:not(.current),
.opening-practice-move-button.classification-excellent:not(.current),
.opening-practice-move-button.classification-great-find:not(.current),
.opening-practice-move-button.classification-good:not(.current) {
  color: #68a832;
}

.learning-notes-label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.learning-notes-label textarea {
  width: 100%;
  min-height: 118px;
  max-height: 180px;
  resize: vertical;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 10px;
  font-weight: 400;
  line-height: 1.45;
}

.learning-selected-from {
  outline: 4px solid var(--selected);
  outline-offset: -4px;
}

.learning-legal-target::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 26%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--target);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.learning-capture-target::after {
  z-index: 1;
  width: 92%;
  border: clamp(3px, 0.65vmin, 6px) solid var(--target);
  background: transparent;
}

.learning-last-from,
.learning-last-to {
  background-image: linear-gradient(rgba(237, 230, 72, 0.48), rgba(237, 230, 72, 0.48));
}

.review-screen {
  display: grid;
  gap: 18px;
  width: 100%;
  padding: 24px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.review-header h1 {
  font-size: 28px;
}

.review-header button {
  min-height: 40px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 12px;
  font-weight: 700;
}

.review-input-label {
  display: grid;
  gap: 8px;
}

.review-input-label textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 12px;
  line-height: 1.45;
}

.review-input-label textarea:focus-visible {
  outline: 3px solid var(--selected);
  outline-offset: 2px;
}

.review-form {
  display: grid;
  gap: 14px;
}

.review-input-panel {
  display: grid;
  gap: 12px;
}

.review-input-panel.collapsed {
  gap: 0;
}

.review-input-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border: 1px solid var(--border);
  background: #fffdf8;
  padding: 8px 12px;
}

.review-input-panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.review-input-panel-heading strong {
  font-size: 14px;
}

.review-input-panel-heading button {
  min-height: 30px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.review-input-panel-body {
  display: grid;
  gap: 14px;
}

.review-setup-draft-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  background: #f8f1e6;
  padding: 10px 12px;
}

.review-setup-draft-prompt[hidden] {
  display: none;
}

.review-setup-draft-prompt strong {
  display: block;
  font-size: 14px;
}

.review-setup-draft-prompt p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.review-setup-draft-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.review-setup-draft-actions button {
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: #171412;
  color: white;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
}

.review-setup-draft-actions button.secondary {
  background: white;
  color: var(--text);
}

.review-position-setup {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(340px, 1fr);
  gap: 16px;
  border: 1px solid var(--border);
  background: #fffdf8;
  padding: 12px;
}

.review-position-setup[hidden] {
  display: none;
}

.review-position-setup-board-panel,
.review-position-setup-controls {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.review-position-setup-toolbar,
.review-setup-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-position-setup-toolbar button,
.review-setup-action-row button,
.review-position-setup-controls > button {
  min-height: 36px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 12px;
  font-weight: 800;
}

.review-setup-action-row button:first-child,
#review-setup-start-analysis {
  background: #171412;
  color: white;
}

.review-setup-board-wrap {
  width: min(100%, 520px);
  border-width: 8px;
  box-shadow: none;
}

.review-setup-board .square.review-setup-last-square {
  background-image: linear-gradient(rgba(58, 137, 196, 0.34), rgba(58, 137, 196, 0.34));
}

.review-setup-board .piece {
  cursor: grab;
}

.review-position-setup-controls h2,
.review-position-setup-controls h3 {
  margin: 0;
}

.review-position-setup-controls p {
  margin: 4px 0 0;
  color: var(--muted);
}

.review-setup-palette {
  display: grid;
  grid-template-columns: repeat(7, minmax(38px, 48px));
  gap: 8px;
}

.review-setup-piece-button {
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8f1e6;
  padding: 2px;
  cursor: pointer;
}

.review-setup-piece-button.active {
  border-color: #171412;
  background: #f1dfb9;
  box-shadow: inset 0 0 0 2px #171412;
}

.review-setup-piece-button img {
  display: block;
  width: 92%;
  height: 92%;
  object-fit: contain;
}

.review-setup-piece-empty {
  color: #9a332d;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.review-setup-options {
  display: grid;
  grid-template-columns: minmax(160px, 1.5fr) minmax(96px, 0.7fr) minmax(96px, 0.7fr);
  gap: 10px;
}

.review-position-setup-controls label,
.review-setup-castling {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.review-position-setup-controls input,
.review-position-setup-controls select,
.review-position-setup-controls textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.review-position-setup-controls textarea {
  min-height: 96px;
  resize: vertical;
}

.review-setup-castling {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
  padding: 10px;
}

.review-setup-castling legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 900;
}

.review-setup-castling label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.review-setup-castling input {
  width: auto;
  min-height: 0;
}

.review-scoresheet-scan {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  background: #fffdf8;
  padding: 12px;
}

.review-scoresheet-scan-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-scoresheet-scan-heading strong {
  font-size: 14px;
}

.review-scoresheet-scan-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.review-scoresheet-scan-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.review-scoresheet-file {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.review-scoresheet-file input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 8px 10px;
}

.review-scoresheet-scan-actions button {
  min-height: 40px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 14px;
  font-weight: 800;
}

.review-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: end;
}

.review-actions button {
  min-height: 40px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: #171717;
  color: white;
  padding: 0 14px;
  font-weight: 800;
}

.review-actions button.secondary {
  background: white;
  color: var(--text);
}

.review-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.review-status.error {
  color: #9b1c1c;
}

.review-progress {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fffaf2;
}

.review-progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.review-progress-heading span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.review-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfce;
}

.review-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #1f7a57;
  transition: width 180ms ease;
}

.review-progress-message {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.review-progress-logs {
  display: grid;
  gap: 4px;
  max-height: 126px;
  overflow: auto;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.review-saved {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.review-saved-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-saved-heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: end;
  gap: 8px;
}

.review-saved-heading h2 {
  margin: 0;
  font-size: 16px;
}

.review-saved-heading button,
.review-saved-heading-actions button {
  min-height: 32px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.review-collections {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr);
  gap: 10px;
  align-items: end;
}

.review-collection-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.review-collection-form button {
  min-height: 36px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.review-saved-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.review-saved-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.review-saved-button {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
}

.review-saved-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 160px) auto;
  gap: 8px;
  align-items: stretch;
}

.review-saved-button strong,
.review-saved-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-saved-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.review-saved-button.last-saved {
  border-color: #1f7a57;
  background: #f4fbf7;
}

.review-played-game-button.reviewed {
  border-color: #1f7a57;
  background: #f4fbf7;
}

.review-played-game-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.review-played-game-heading strong {
  min-width: 0;
}

.review-played-game-category {
  flex: 0 0 auto;
  max-width: 46%;
  border: 1px solid #d7c8b5;
  border-radius: 999px;
  background: #fff8e7;
  color: #6b5c4d;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
}

.review-played-game-status {
  color: #5f5449;
  font-size: 12px;
  font-weight: 800;
}

.review-board-played-games {
  display: none;
}

.review-screen.review-board-active .review-board-played-games {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
}

.review-screen.review-board-active .review-board-played-games .review-saved-heading {
  align-items: center;
}

.review-screen.review-board-active .review-board-played-games .review-saved-heading-actions button {
  min-height: 30px;
  padding: 0 10px;
}

.review-screen.review-board-active .review-board-played-games .review-saved-status {
  min-height: 0;
}

.review-played-games-modal-panel {
  width: min(680px, 100%);
  max-height: min(720px, calc(100vh - 36px));
}

.review-played-games-modal-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.review-played-games-modal-heading > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.review-played-games-modal-heading button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 12px;
  font-weight: 800;
}

.review-played-games-modal-list {
  grid-template-columns: 1fr;
  max-height: min(520px, calc(100vh - 220px));
  overflow: auto;
  padding-right: 2px;
}

.review-saved-collection {
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.review-saved-delete {
  min-width: 72px;
  min-height: 58px;
  border: 1px solid #b44545;
  border-radius: 6px;
  background: white;
  color: #9b1c1c;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .review-collections,
  .review-collection-form,
  .review-saved-item {
    grid-template-columns: 1fr;
  }

  .opponent-columns,
  .opponent-actions,
  .opponent-card-actions {
    grid-template-columns: 1fr;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 23, 23, 0.45);
}

.modal-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf8;
  padding: 18px;
  box-shadow: 0 18px 48px rgba(23, 23, 23, 0.24);
}

.modal-panel h2,
.modal-panel p {
  margin: 0;
}

.modal-panel h2 {
  font-size: 20px;
}

.modal-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.modal-actions button {
  min-height: 38px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 800;
}

.review-import-pgn-button {
  min-height: 34px;
  border-color: #1f6f50 !important;
  border-radius: 7px;
  background: #1f7a57 !important;
  color: white !important;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.review-analysis-modal {
  z-index: 60;
  background: rgba(25, 22, 19, 0.64);
  backdrop-filter: blur(3px);
}

.review-analysis-panel {
  width: min(640px, calc(100vw - 32px));
  max-height: min(760px, calc(100svh - 32px));
  overflow: auto;
  gap: 18px;
  border-color: #3a2a1f;
  border-radius: 12px;
  padding: 24px;
  animation: review-analysis-enter 160ms ease-out both;
}

.review-analysis-import-form,
.review-analysis-progress {
  display: grid;
  gap: 18px;
}

.review-analysis-import-form[hidden],
.review-analysis-progress[hidden] {
  display: none;
}

.review-analysis-modal-heading {
  display: grid;
  gap: 5px;
}

.review-analysis-modal-heading .eyebrow {
  color: #1f7a57;
}

.review-analysis-modal-heading h2 {
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.05;
}

.review-analysis-modal-heading p:last-child {
  max-width: 56ch;
}

.review-analysis-import-input {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.review-analysis-import-input textarea {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid #5a493d;
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 13px 14px;
  font: 600 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.review-analysis-import-input textarea:focus-visible {
  outline: 3px solid rgba(31, 122, 87, 0.32);
  outline-offset: 2px;
}

.review-analysis-import-actions button:last-child,
#review-analysis-progress-primary {
  background: #1f7a57;
  color: white;
}

.review-analysis-progress {
  min-height: 270px;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.review-analysis-progress-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(31, 122, 87, 0.1);
}

.review-analysis-progress-mark span {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(31, 122, 87, 0.22);
  border-top-color: #1f7a57;
  border-radius: 50%;
  animation: review-analysis-spin 800ms linear infinite;
}

.review-analysis-progress-copy {
  width: min(470px, 100%);
  display: grid;
  gap: 8px;
}

.review-analysis-progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.review-analysis-progress-heading strong {
  font-size: 18px;
}

.review-analysis-progress-heading span {
  color: #1f7a57;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.review-analysis-progress-copy p {
  text-align: left;
}

.review-analysis-progress-track {
  width: min(470px, 100%);
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(31, 122, 87, 0.16);
}

.review-analysis-progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #1f7a57;
  transition: width 220ms ease;
}

.review-analysis-progress-logs {
  width: min(470px, 100%);
  min-height: 56px;
  max-height: 108px;
  overflow: auto;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  list-style: none;
  text-align: left;
}

.review-analysis-progress-actions {
  width: min(470px, 100%);
}

@keyframes review-analysis-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes review-analysis-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .review-analysis-panel,
  .review-analysis-progress-mark span {
    animation: none;
  }

  .review-analysis-progress-track span {
    transition: none;
  }
}

.maia3-setup-panel {
  width: min(560px, 100%);
}

.maia3-setup-form {
  display: grid;
  gap: 14px;
}

.maia3-setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.maia3-setup-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.maia3-setup-grid select,
.maia3-setup-grid input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-weight: 800;
}

.modal-secondary {
  background: white;
  color: var(--text);
}

.modal-danger {
  background: #9b1c1c;
  color: white;
}

.opponent-result-modal {
  z-index: 50;
  background: rgba(23, 20, 17, 0.62);
}

.opponent-result-modal-panel {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  gap: 18px;
  border-color: #3a2a1f;
  background: #201f1d;
  color: white;
  padding: 0;
  overflow: hidden;
}

.opponent-result-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.opponent-result-modal-close:hover,
.opponent-result-modal-close:focus {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.opponent-result-modal-heading {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 28px 52px 24px;
  background: #3a3835;
  text-align: center;
}

.opponent-result-modal-heading .eyebrow,
.opponent-result-modal-heading h2,
.opponent-result-modal-heading p,
#opponent-result-modal-message {
  margin: 0;
}

.opponent-result-modal-heading h2 {
  color: white;
  font-size: 30px;
  line-height: 1.05;
}

.opponent-result-modal-heading p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
  font-weight: 850;
}

#opponent-result-modal-message {
  padding: 8px 28px 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  font-weight: 750;
  text-align: center;
}

.opponent-result-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 28px 28px;
}

.opponent-result-modal-actions button {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: #33302d;
  color: white;
  cursor: pointer;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 900;
}

.opponent-result-modal-actions button:disabled {
  cursor: default;
  opacity: 0.55;
}

.opponent-result-modal-actions .opponent-result-modal-primary {
  grid-column: 1 / -1;
  min-height: 58px;
  border-color: #7eb64c;
  background: #6ead42;
  color: white;
  font-size: 22px;
}

.tournament-match-presentation {
  z-index: 54;
  background:
    linear-gradient(rgba(2, 5, 4, 0.68), rgba(2, 5, 4, 0.82)),
    url("/assets/review-rpg/review-room-background.png") center / cover;
}

.tournament-match-panel {
  display: grid;
  width: min(780px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  gap: 14px;
  overflow: auto;
  border: 16px solid transparent;
  border-image: url("/assets/world/ui/panel-frame.png") 16 fill round;
  outline: 2px solid #c08b39;
  outline-offset: -10px;
  background: rgba(16, 10, 6, 0.94);
  color: #ecd7a4;
  padding: 12px 18px 18px;
  box-shadow: 0 24px 70px #000;
}

.tournament-match-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-bottom: 2px solid #8f6228;
  padding: 4px 10px 13px;
  text-align: center;
}

.tournament-match-header img {
  width: 46px;
  height: 46px;
  image-rendering: pixelated;
}

.tournament-match-header :is(p, h2) {
  margin: 0;
}

.tournament-match-header h2 {
  color: #f0d79a;
  font-family: ui-monospace, Menlo, Monaco, "Courier New", monospace;
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: 0.055em;
  text-transform: uppercase;
  text-shadow: 2px 3px #080401;
}

.tournament-match-versus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.tournament-match-player-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 4px 14px;
  min-width: 0;
  border: 10px solid transparent;
  border-image: url("/assets/world/ui/panel-frame.png") 16 fill round;
  background: #102019;
  padding: 6px 10px;
}

.tournament-match-portrait {
  grid-row: 1 / 3;
  width: 112px;
  height: 136px;
  border: 7px solid transparent;
  border-image: url("/assets/world/ui/portrait-frame.png") 18 fill round;
  background: #31483f;
  object-fit: cover;
  image-rendering: pixelated;
}

.tournament-match-player-card strong {
  align-self: end;
  overflow: hidden;
  color: #f1dda9;
  font-family: ui-monospace, Menlo, Monaco, "Courier New", monospace;
  font-size: clamp(17px, 2vw, 24px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tournament-match-player-card > span {
  align-self: start;
  color: #9bb972;
  font-weight: 900;
}

.tournament-match-vs {
  color: #d2a54d;
  font-family: ui-monospace, Menlo, Monaco, "Courier New", monospace;
  font-size: 28px;
  font-weight: 900;
  text-align: center;
  text-shadow: 2px 3px #000;
}

.tournament-match-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border: 3px double #976b2d;
  background: #dfc38d;
  color: #3a2413;
}

.tournament-match-facts div {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 10px;
}

.tournament-match-facts div + div {
  border-left: 1px solid #9c7139;
}

.tournament-match-facts dt {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tournament-match-facts dd {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 900;
}

.tournament-match-coach {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 3px solid #8f6228;
  background:
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(93, 59, 25, 0.1) 23px 24px),
    #e4ca98;
  color: #3c2615;
  padding: 8px 12px;
}

.tournament-match-coach img {
  width: 62px;
  height: 62px;
  border: 3px solid #62401e;
  object-fit: cover;
  image-rendering: pixelated;
}

.tournament-match-coach span {
  color: #70491f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.tournament-match-coach p {
  margin: 3px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 800;
}

.tournament-match-actions {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(210px, 1.3fr);
  gap: 10px;
}

.tournament-match-actions button,
.opponent-result-modal.tournament-result-presentation .opponent-result-modal-actions button {
  min-height: 50px;
  border: 0;
  border-radius: 0;
  background: url("/assets/world/ui/button-default.png") center / 100% 100% no-repeat;
  color: #f0d69b;
  padding: 8px 16px;
  font-family: ui-monospace, Menlo, Monaco, "Courier New", monospace;
  font-size: 14px;
  font-weight: 900;
  text-shadow: 1px 2px #070301;
}

#tournament-match-enter,
.opponent-result-modal.tournament-result-presentation .opponent-result-modal-actions .opponent-result-modal-primary {
  background-image: url("/assets/world/ui/button-active.png");
  font-size: 17px;
}

.tournament-match-actions button:hover,
.opponent-result-modal.tournament-result-presentation .opponent-result-modal-actions button:hover {
  background-image: url("/assets/world/ui/button-hover.png");
}

.opponent-result-modal.tournament-result-presentation {
  background:
    linear-gradient(rgba(2, 5, 4, 0.7), rgba(2, 5, 4, 0.8)),
    url("/assets/review-rpg/review-room-background.png") center / cover;
}

.opponent-result-modal.tournament-result-presentation .opponent-result-modal-panel {
  width: min(620px, calc(100vw - 32px));
  border: 16px solid transparent;
  border-image: url("/assets/world/ui/panel-frame.png") 16 fill round;
  outline: 2px solid #bd8735;
  outline-offset: -10px;
  background: #170e09;
  color: #f0dba6;
  padding: 10px;
}

.opponent-result-modal.tournament-result-presentation .opponent-result-modal-heading {
  border: 3px solid #916328;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 240, 184, 0.35), transparent 42%),
    #dfc28c;
  color: #382313;
}

.opponent-result-modal-tournament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.opponent-result-modal-tournament[hidden] {
  display: none;
}

.opponent-result-modal-tournament img {
  width: 38px;
  height: 38px;
  image-rendering: pixelated;
}

.opponent-result-modal-tournament div {
  display: grid;
  justify-items: start;
}

.opponent-result-modal-tournament strong {
  color: #432a15;
  font-family: ui-monospace, Menlo, Monaco, "Courier New", monospace;
  font-size: 14px;
  text-transform: uppercase;
}

.opponent-result-modal-tournament span {
  color: #765127;
  font-size: 12px;
  font-weight: 900;
}

.opponent-result-modal.tournament-result-presentation .opponent-result-modal-heading :is(.eyebrow, h2, p) {
  color: #382313;
}

.opponent-result-modal.tournament-result-presentation #opponent-result-modal-message {
  color: #e2c891;
}

.opponent-result-modal.tournament-result-presentation .opponent-result-modal-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 8px 8px;
}

.opponent-result-modal.tournament-result-presentation .opponent-result-modal-primary {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .tournament-match-versus {
    grid-template-columns: 1fr;
  }

  .tournament-match-vs {
    font-size: 20px;
  }

  .tournament-match-player-card {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .tournament-match-portrait {
    width: 84px;
    height: 96px;
  }

  .opponent-result-modal.tournament-result-presentation .opponent-result-modal-actions,
  .tournament-match-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .opponent-result-modal-actions {
    grid-template-columns: 1fr;
  }
}

.review-result {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.review-result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-result-heading strong {
  font-size: 18px;
}

.review-result-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.review-export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.review-export-actions button,
.review-training-heading button {
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
  font-weight: 800;
}

.review-export-actions button:hover,
.review-training-heading button:hover {
  background: #f2eee7;
}

.review-export-actions button:disabled,
.review-training-heading button:disabled {
  opacity: 0.55;
}

.review-export-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.review-details {
  display: grid;
  grid-template-columns: minmax(110px, max-content) minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.review-details dt {
  color: var(--text);
  font-weight: 800;
}

.review-details dd {
  margin: 0;
}

.review-game-layout {
  order: 1;
  display: grid;
  grid-template-columns: minmax(560px, 1.65fr) minmax(360px, 0.95fr);
  align-items: start;
  gap: 16px;
}

.review-screen.review-board-active {
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
}

.review-screen.review-board-active .review-header,
.review-screen.review-board-active .review-input-panel,
.review-screen.review-board-active .review-result-heading,
.review-screen.review-board-active .review-export-actions,
.review-screen.review-board-active #review-summary,
.review-screen.review-board-active #review-details,
.review-screen.review-board-active #review-debug {
  display: none;
}

.review-screen.review-board-active .review-result {
  min-height: 0;
  gap: 8px;
  overflow: hidden;
  border-top: 0;
  padding-top: 0;
}

.review-screen.review-board-active .review-game-layout {
  grid-template-areas: "board side";
  grid-template-columns: minmax(560px, min(62vw, calc(100vh - 92px))) minmax(380px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  gap: 12px;
}

.review-screen.review-board-active .review-board-panel {
  grid-area: board;
}

.review-screen.review-board-active .review-side-panel {
  grid-area: side;
}

.review-screen.review-board-active .review-board-panel,
.review-screen.review-board-active .review-side-panel {
  min-height: 0;
  max-height: 100%;
}

.review-screen.review-board-active .review-board-panel {
  align-content: start;
  overflow: hidden;
}

.review-screen.review-board-active .review-side-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--border);
  background: #f1eadf;
}

.review-screen.review-board-active.review-guided-active .review-side-panel {
  gap: 10px;
  background: color-mix(in srgb, var(--surface) 88%, var(--kids-accent-soft));
}

.review-screen.review-board-active .review-board-played-games {
  order: 10;
}

.review-screen.review-board-active .review-mode-switch {
  order: 20;
}

.review-screen.review-board-active .review-guided {
  order: 30;
}

.review-screen.review-board-active .review-analysis-board-live {
  order: 35;
}

.review-screen.review-board-active .review-final-report {
  order: 40;
}

.review-screen.review-board-active .review-analysis {
  order: 50;
}

.review-screen.review-board-active .review-eval-graph {
  order: 60;
}

.review-screen.review-board-active .review-position-controls {
  order: 70;
}

.review-screen.review-board-active .review-view-controls {
  order: 80;
}

.review-screen.review-board-active .review-accuracy-timeline {
  order: 90;
}

.review-screen.review-board-active .review-analysis-board-actions {
  order: 95;
}

.review-screen.review-board-active .review-move-panel {
  order: 100;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.review-screen.review-board-active .review-board-area {
  --review-board-size: min(calc(100% - 38px), calc(100vh - 168px));
  grid-template-columns: 26px minmax(0, 1fr);
  justify-content: stretch;
}

.review-screen.review-board-active .review-board-area.eval-hidden {
  --review-board-size: min(100%, calc(100vh - 168px));
}

.review-screen.review-board-active.review-guided-active .review-board-area {
  --review-board-size: min(100%, calc(100vh - 134px));
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "review-top-player"
    "review-board"
    "review-bottom-player";
}

.review-screen.review-board-active.review-guided-active .review-eval-bar,
.review-screen.review-board-active.review-guided-active .review-analysis,
.review-screen.review-board-active.review-guided-active .review-final-report,
.review-screen.review-board-active.review-guided-active .review-move-panel,
.review-screen.review-board-active.review-guided-active .review-eval-graph,
.review-screen.review-board-active.review-guided-active .review-view-controls,
.review-screen.review-board-active.review-guided-active .review-accuracy-timeline,
.review-screen.review-board-active.review-guided-active .review-board-played-games {
  display: none;
}

.review-screen.review-board-active .review-board-wrap {
  border-width: 7px;
}

.review-screen.review-board-active .review-move-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.review-screen.review-board-active .review-panel-heading h2,
.review-screen.review-board-active .review-analysis-heading h2 {
  font-size: 14px;
}

.review-screen.review-board-active .review-position-controls button,
.review-screen.review-board-active .review-panel-heading button,
.review-screen.review-board-active .review-view-controls button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.review-screen.review-board-active .review-label-legend,
.review-screen.review-board-active .review-position-fen,
.review-screen.review-board-active .review-position-details {
  display: none;
}

.review-move-panel,
.review-board-panel,
.review-side-panel {
  min-width: 0;
}

.review-move-panel,
.review-board-panel {
  display: grid;
  gap: 12px;
}

.review-screen.review-board-active .review-move-panel {
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.review-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-screen.review-board-active .review-panel-heading {
  gap: 8px;
}

.review-panel-heading h2 {
  margin: 0;
  font-size: 16px;
}

.review-panel-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-panel-heading button,
.review-view-controls button {
  min-height: 32px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.review-panel-heading button:disabled,
.review-view-controls button:disabled {
  cursor: default;
  opacity: 0.45;
}

.review-board-area {
  --review-board-size: min(100%, 880px);
  display: grid;
  grid-template-columns: 28px minmax(0, 880px);
  grid-template-areas:
    ". review-top-player"
    "review-eval review-board"
    ". review-bottom-player";
  justify-content: center;
  column-gap: 10px;
  row-gap: 5px;
  width: 100%;
}

.review-board-area.eval-hidden {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "review-top-player"
    "review-board"
    "review-bottom-player";
}

.review-screen.review-board-active .review-board-area.eval-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.review-player-row {
  display: flex;
  align-items: center;
  justify-self: center;
  width: var(--review-board-size);
  min-height: 30px;
  gap: 8px;
  color: #3a2a1f;
}

.review-player-row-top {
  grid-area: review-top-player;
}

.review-player-row-bottom {
  grid-area: review-bottom-player;
}

.review-player-identity {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 4px;
}

.review-player-identity .player-name {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 210px;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-player-rating {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.review-captured-pieces {
  flex: 0 1 auto;
  min-height: 24px;
}

.review-captured-pieces .captured-piece {
  flex-basis: 19px;
  width: 19px;
  height: 24px;
  margin-left: -4px;
}

.review-material-advantage {
  min-width: 28px;
  margin-left: -2px;
  font-size: 15px;
  text-align: left;
}

.review-player-clock {
  min-width: 66px;
  padding: 5px 8px;
  font-size: 15px;
}

.review-board-wrap {
  grid-area: review-board;
  justify-self: center;
  position: relative;
  width: var(--review-board-size);
  border: 8px solid #3a2a1f;
  box-shadow: 0 10px 24px rgba(40, 28, 18, 0.18);
}

.review-eval-bar {
  grid-area: review-eval;
  position: relative;
  align-self: stretch;
  min-height: 240px;
  overflow: hidden;
  border: 3px solid #3a2a1f;
  background: #171411;
}

.review-eval-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 50%;
  background: #f8f5ee;
  transition: height 180ms ease;
}

.review-eval-label {
  position: absolute;
  left: 50%;
  z-index: 1;
  color: #f8f5ee;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: center;
  white-space: nowrap;
}

.review-eval-label.positive {
  bottom: 12px;
  color: #171411;
}

.review-eval-label.negative {
  top: 12px;
  color: #f8f5ee;
}

.review-eval-label.pending,
.review-eval-label.off {
  top: 50%;
  color: #f8f5ee;
}

.review-eval-graph {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: #3d3933;
  box-shadow: inset 0 0 0 1px rgba(255, 253, 248, 0.07);
}

.review-eval-graph-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.review-eval-graph-heading h2 {
  margin: 0;
  color: #f8f5ee;
  font-size: 13px;
  text-transform: uppercase;
}

.review-eval-graph-heading span {
  color: rgba(248, 245, 238, 0.72);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.review-eval-graph svg {
  display: block;
  width: 100%;
  height: 128px;
}

.review-screen.review-board-active .review-eval-graph {
  gap: 0;
  padding: 0;
}

.review-screen.review-board-active .review-eval-graph-heading {
  display: none;
}

.review-screen.review-board-active .review-eval-graph svg {
  height: clamp(58px, 9vh, 78px);
}

.review-eval-graph-zero {
  stroke: rgba(184, 184, 184, 0.95);
  stroke-width: 1.3;
}

.review-eval-graph-selected-line {
  stroke: rgba(248, 245, 238, 0.9);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}

.review-eval-graph-area {
  fill: #fffdf8;
  stroke: none;
}

.review-eval-graph-line {
  fill: none;
  stroke: #2d2a25;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.review-eval-graph-point {
  cursor: pointer;
}

.review-eval-graph-point:focus {
  outline: none;
}

.review-eval-graph-point:focus-visible circle:first-child {
  stroke: #fffdf8;
  stroke-width: 3;
}

.review-eval-graph-point circle:first-child {
  fill: #58708a;
  stroke: #3d3933;
  stroke-width: 1.4;
}

.review-eval-graph-point:not(.visible-marker) circle:first-child {
  opacity: 0;
}

.review-eval-graph-point.current circle:first-child {
  stroke: #16b6ad;
  stroke-width: 2.4;
  opacity: 1;
}

.review-eval-graph-point.classification-best circle:first-child {
  fill: #2f9e44;
}

.review-eval-graph-point.classification-excellent circle:first-child {
  fill: #52b788;
}

.review-eval-graph-point.classification-brilliant circle:first-child {
  fill: #18a7a0;
}

.review-eval-graph-point.classification-great-find circle:first-child {
  fill: #22a699;
}

.review-eval-graph-point.classification-good circle:first-child,
.review-eval-graph-point.classification-book circle:first-child,
.review-eval-graph-point.classification-forced circle:first-child {
  fill: #8bc34a;
}

.review-eval-graph-point.classification-inaccuracy circle:first-child {
  fill: #f1b93f;
}

.review-eval-graph-point.classification-mistake circle:first-child {
  fill: #e8882d;
}

.review-eval-graph-point.classification-blunder circle:first-child,
.review-eval-graph-point.classification-missed-win circle:first-child {
  fill: #d64550;
}

.review-eval-graph-hit {
  fill: transparent;
  stroke: transparent;
}

.review-eval-graph-current-notch {
  fill: #fffdf8;
  stroke: none;
}

.review-label-legend {
  border: 1px solid var(--border);
  background: #fffdf8;
  padding: 10px;
}

.review-label-legend summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.review-label-legend dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 10px;
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.35;
}

.review-label-legend dt {
  font-weight: 900;
}

.review-label-legend dd {
  margin: 0;
  color: var(--muted);
}

.review-label-legend dt::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 999px;
  background: #8bbd4c;
}

.review-label-legend dt[data-label-key="inaccuracy"]::before {
  background: #f1b93f;
}

.review-label-legend dt[data-label-key="mistake"]::before {
  background: #e8882d;
}

.review-label-legend dt[data-label-key="blunder"]::before,
.review-label-legend dt[data-label-key="missed-win"]::before {
  background: #d64550;
}

.review-label-legend dt[data-label-key="great-find"]::before {
  background: #22a699;
}

.review-label-legend dt[data-label-key="brilliant"]::before {
  background: #18a7a0;
  box-shadow: 0 0 0 2px rgba(24, 167, 160, 0.18);
}

.review-accuracy {
  display: grid;
  gap: 9px;
  border: 1px solid #b8d7d2;
  background: linear-gradient(145deg, #f4fbf9, #fffdf8 72%);
  padding: 11px;
}

.review-accuracy[hidden] {
  display: none;
}

.review-accuracy-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.review-accuracy-heading span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.review-accuracy-scores {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.review-accuracy-score {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 8px;
  border-top: 2px solid #d8e9e5;
  padding-top: 7px;
}

.review-accuracy-score > span {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-accuracy-score > strong {
  grid-row: span 2;
  color: #147c78;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

.review-accuracy-score > small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.review-mode-switch {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.review-mode-switch > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.review-mode-switch strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
  text-transform: uppercase;
}

.review-mode-switch span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: right;
}

.review-mode-switch-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.review-mode-switch-buttons button {
  min-height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.review-mode-switch-buttons button.active {
  background: #171717;
  color: #ffffff;
}

.review-guided {
  display: grid;
  gap: 10px;
}

.review-guided-heading,
.review-guided-card-kicker,
.review-guided-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-guided-heading .eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
}

.review-guided-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1.12;
}

.review-guided-heading span {
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--kids-accent) 34%, var(--border));
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}

.review-guided-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  overflow-x: auto;
  padding: 2px 0 4px;
}

.review-guided-dot {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: transparent;
  padding: 0;
}

.review-guided-dot span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #78a85b;
}

.review-guided-dot[data-tone="great"] span {
  background: #22a699;
}

.review-guided-dot[data-tone="small"] span {
  background: #f1b93f;
}

.review-guided-dot[data-tone="practice"] span {
  background: #e8882d;
}

.review-guided-dot.current {
  border-color: #171717;
}

.review-guided-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.review-guided-card,
.review-guided-story {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.review-guided-card {
  border-left-width: 6px;
}

.review-guided-card[data-tone="great"] {
  border-left-color: #22a699;
}

.review-guided-card[data-tone="good"] {
  border-left-color: #78a85b;
}

.review-guided-card[data-tone="small"] {
  border-left-color: #f1b93f;
}

.review-guided-card[data-tone="practice"] {
  border-left-color: #e8882d;
}

.review-guided-card-kicker {
  align-items: baseline;
}

.review-guided-tone {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--kids-accent-soft) 80%, #ffffff);
  color: var(--text);
  padding: 0 9px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.review-guided-card-kicker strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-guided-card p {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 850;
  line-height: 1.35;
}

.review-guided-details,
.review-guided-story-details {
  grid-template-columns: minmax(84px, max-content) minmax(0, 1fr);
  gap: 6px 9px;
  border-top: 1px solid var(--border);
  padding-top: 9px;
  font-size: 12px;
  line-height: 1.35;
}

.review-guided-choices {
  display: grid;
  gap: 6px;
}

.review-guided-choice {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 900;
  text-align: left;
}

.review-guided-choice.active {
  border-color: #171717;
  background: #171717;
  color: #ffffff;
}

.review-guided-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, 1fr) minmax(0, 1fr);
  gap: 7px;
}

.review-guided-actions button {
  min-height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
}

.review-guided-actions button:nth-child(2) {
  background: #171717;
  color: #ffffff;
}

.review-guided-actions button:disabled {
  cursor: default;
  opacity: 0.45;
}

.review-guided-story h3 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
  text-transform: uppercase;
}

.review-final-report {
  order: 2;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #9cb0bd;
  background: #f7fbfc;
}

.review-final-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.review-final-heading h2 {
  margin-bottom: 0;
  color: var(--text);
}

.review-final-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  text-align: right;
}

.review-final-verdict {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
}

.review-final-details {
  border-top: 1px solid #d5e0e7;
  padding-top: 10px;
}

.review-final-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.review-final-columns section {
  min-width: 0;
}

.review-final-columns h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
  text-transform: uppercase;
}

.review-final-columns ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.review-final-report[data-source="fallback"] .review-final-heading span {
  color: #884018;
}

.review-screen.review-board-active .review-final-report {
  order: 40;
  gap: 8px;
  padding: 10px;
  border-color: #d5c3ac;
  background: #fffdf8;
}

.review-screen.review-board-active .review-final-heading {
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.review-screen.review-board-active .review-final-heading h2 {
  font-size: 14px;
  line-height: 1.15;
  text-transform: uppercase;
}

.review-screen.review-board-active .review-final-heading span {
  font-size: 11px;
}

.review-screen.review-board-active .review-final-verdict {
  font-size: 13px;
  line-height: 1.35;
}

.review-screen.review-board-active .review-final-details {
  grid-template-columns: minmax(88px, max-content) minmax(0, 1fr);
  gap: 4px 8px;
  padding-top: 7px;
  font-size: 11px;
  line-height: 1.25;
}

.review-screen.review-board-active .review-final-columns {
  grid-template-columns: 1fr;
  gap: 8px;
}

.review-screen.review-board-active .review-final-columns h3 {
  margin-bottom: 4px;
  font-size: 11px;
}

.review-screen.review-board-active .review-final-columns ul {
  gap: 4px;
  padding-left: 16px;
  font-size: 11px;
  line-height: 1.3;
}

.review-training-plan {
  display: grid;
  gap: 10px;
  border-top: 1px solid #d5e0e7;
  padding-top: 12px;
}

.review-training-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-training-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
  text-transform: uppercase;
}

.review-training-plan ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.review-training-plan li {
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.review-training-plan li strong {
  display: block;
}

.review-training-plan li span {
  color: var(--muted);
}

.review-training-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.review-training-tag {
  border: 1px solid #b9c3cb;
  border-radius: 999px;
  background: #ffffff;
  color: #3d5163;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.review-screen.review-board-active .review-training-plan {
  gap: 7px;
  padding-top: 8px;
}

.review-screen.review-board-active .review-training-heading h3 {
  font-size: 11px;
}

.review-screen.review-board-active .review-training-plan ol {
  gap: 5px;
  padding-left: 18px;
}

.review-screen.review-board-active .review-training-plan li {
  font-size: 11px;
  line-height: 1.25;
}

.review-screen.review-board-active .review-training-tag {
  padding: 2px 7px;
  font-size: 10px;
}

.review-final-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.review-screen.review-board-active .review-final-heading-actions {
  align-items: center;
}

.review-final-heading-actions button,
.review-final-heading-actions a {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
}

.review-full-report-active {
  display: block;
  max-width: 1120px;
  margin: 0 auto;
}

.review-screen.review-full-report-active > .review-header {
  display: none;
}

.review-full-report-screen {
  display: grid;
  gap: 16px;
}

.review-full-report-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.review-full-report-toolbar button {
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
}

.review-full-report-toolbar button:hover,
.review-full-report-toolbar button:focus-visible {
  background: #f4eadb;
}

.review-full-report-paper {
  display: grid;
  gap: 26px;
  border: 1px solid #c7d2d9;
  background: #ffffff;
  color: var(--text);
  padding: clamp(22px, 3vw, 44px);
  box-shadow: 0 18px 45px rgba(36, 43, 48, 0.12);
}

.review-full-report-cover {
  display: grid;
  gap: 10px;
  border-bottom: 2px solid #24323b;
  padding-bottom: 18px;
}

.review-full-report-cover h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
}

.review-full-report-cover p {
  max-width: 850px;
  margin: 0;
}

#review-full-report-meta {
  color: #4d6677;
  font-size: 13px;
  font-weight: 800;
}

#review-full-report-summary {
  color: #24323b;
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 800;
  line-height: 1.35;
}

.review-full-report-content {
  display: grid;
  gap: 28px;
}

.review-full-section {
  display: grid;
  gap: 12px;
  break-inside: avoid;
}

.review-full-section h2 {
  margin: 0;
  border-bottom: 1px solid #d8e0e5;
  color: #24323b;
  font-size: 20px;
  line-height: 1.2;
  padding-bottom: 8px;
}

.review-full-section p {
  margin: 0;
  color: #465763;
  font-size: 15px;
  line-height: 1.55;
}

.review-full-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.review-full-list li {
  color: #465763;
  font-size: 14px;
  line-height: 1.45;
}

.review-full-list strong,
.review-full-list span {
  display: block;
}

.review-full-list strong {
  color: #1f2a31;
}

.review-full-critical-list {
  display: grid;
  gap: 16px;
}

.review-full-critical-card {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 16px;
  border: 1px solid #d8e0e5;
  background: #fbfcfd;
  padding: 14px;
  break-inside: avoid;
}

.review-full-critical-card[data-classification="blunder"],
.review-full-critical-card[data-classification="missed-win"] {
  border-color: #e1a1a7;
  background: #fffafa;
}

.review-full-critical-card[data-classification="mistake"] {
  border-color: #e7bd8e;
  background: #fffaf3;
}

.review-full-board-frame {
  align-self: start;
  width: 100%;
  aspect-ratio: 1;
  border: 6px solid #2e3b44;
  background: #2e3b44;
}

.review-full-board {
  touch-action: auto;
}

.review-full-board .square {
  cursor: default;
}

.review-full-board .coord {
  display: none;
}

.review-full-board .review-full-played-from,
.review-full-board .review-full-played-to {
  background-image: linear-gradient(rgba(214, 69, 80, 0.34), rgba(214, 69, 80, 0.34));
}

.review-full-board .review-full-best-from,
.review-full-board .review-full-best-to {
  box-shadow: inset 0 0 0 4px rgba(34, 166, 153, 0.78);
}

.review-full-critical-body {
  display: grid;
  align-content: start;
  gap: 8px;
}

.review-full-critical-body h3 {
  margin: 0;
  color: #1f2a31;
  font-size: 17px;
  line-height: 1.25;
}

.review-full-critical-meta {
  color: #5e6f7b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.review-full-critical-details {
  grid-template-columns: minmax(110px, max-content) minmax(0, 1fr);
  gap: 7px 12px;
  color: #465763;
  font-size: 13px;
  line-height: 1.42;
}

.review-full-critical-details dt {
  color: #24323b;
}

@media (max-width: 760px) {
  .review-full-report-paper {
    padding: 18px;
  }

  .review-full-critical-card {
    grid-template-columns: 1fr;
  }

  .review-full-board-frame {
    width: min(220px, 100%);
  }

  .review-full-critical-details {
    grid-template-columns: 1fr;
  }
}

@media print {
  .app-header,
  .review-header,
  .review-full-report-toolbar {
    display: none !important;
  }

  body,
  .shell,
  .review-screen,
  .review-full-report-active {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  .review-full-report-paper {
    border: 0;
    padding: 0;
    box-shadow: none;
  }

  .review-full-critical-card {
    page-break-inside: avoid;
  }
}

.review-debug {
  order: 3;
  border: 1px solid #d5c3ac;
  background: #fffaf2;
  padding: 10px 12px;
}

.review-debug summary {
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.review-debug dl {
  margin-top: 10px;
}

.review-board {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  cursor: default;
}

.review-board .square {
  cursor: grab;
}

.review-board-wrap.variation-line .square.light {
  background: color-mix(in srgb, var(--light-square) 90%, #ffffff);
}

.review-board-wrap.variation-line .square.dark {
  background: color-mix(in srgb, var(--dark-square) 90%, #ffffff);
}

.review-board .review-played-from,
.review-board .review-played-to {
  box-shadow: inset 0 0 0 999px rgba(47, 138, 75, 0.24);
}

.review-board .review-best-from,
.review-board .review-best-to {
  box-shadow: inset 0 0 0 999px rgba(45, 116, 189, 0.24);
}

.review-board .review-line-from,
.review-board .review-line-to {
  box-shadow: inset 0 0 0 999px rgba(122, 91, 184, 0.2);
}

.review-board .review-classification-great {
  box-shadow: inset 0 0 0 999px rgba(111, 161, 202, 0.38);
}

.review-board .review-classification-good {
  box-shadow: inset 0 0 0 999px rgba(130, 183, 88, 0.34);
}

.review-board .review-classification-inaccuracy {
  box-shadow: inset 0 0 0 999px rgba(245, 197, 72, 0.42);
}

.review-board .review-classification-mistake {
  box-shadow: inset 0 0 0 999px rgba(226, 124, 57, 0.36);
}

.review-board .review-classification-blunder {
  box-shadow: inset 0 0 0 999px rgba(213, 69, 69, 0.34);
}

.review-back-main-line-item {
  list-style: none;
  margin-top: 10px;
}

.review-back-main-line {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
}

.review-arrow-layer,
.review-annotation-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.review-arrow-layer {
  z-index: 2;
}

.review-annotation-layer {
  z-index: 3;
}

.review-classification-layer {
  --review-board-classification-badge-size: clamp(22px, 4.3vmin, 34px);
  --review-board-classification-badge-safe-inset: calc(var(--review-board-classification-badge-size) * 0.55);
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: visible;
  pointer-events: none;
}

.review-board-classification-badge {
  position: absolute;
  width: var(--review-board-classification-badge-size);
  aspect-ratio: 1;
  border-radius: 999px;
  filter: drop-shadow(0 2px 3px rgba(28, 20, 14, 0.28));
  transform: translate(-45%, -48%);
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .board-piece-animation-piece {
    transition: none;
  }
}

.review-position-controls {
  display: grid;
  grid-template-columns: minmax(96px, auto) minmax(0, 1fr) minmax(96px, auto);
  align-items: center;
  gap: 10px;
}

.review-screen.review-board-active .review-position-controls {
  grid-template-columns: minmax(86px, auto) minmax(0, 1fr) minmax(86px, auto);
  gap: 6px;
  padding-top: 2px;
}

.review-position-controls button,
.review-move-button {
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-weight: 700;
}

.review-position-controls button:disabled {
  opacity: 0.45;
}

.review-position-controls strong {
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-view-controls {
  display: grid;
  gap: 10px;
}

.review-screen.review-board-active .review-view-controls {
  grid-template-columns: minmax(150px, 0.72fr) minmax(0, 1.28fr);
  gap: 6px;
}

.review-screen.review-board-active .review-segmented,
.review-screen.review-board-active .review-tool-buttons {
  flex-wrap: nowrap;
}

.review-screen.review-board-active .review-segmented button,
.review-screen.review-board-active .review-tool-buttons button {
  flex: 1 1 0;
}

.review-segmented,
.review-tool-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.review-analysis-board-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.review-analysis-board-actions button {
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.review-analysis-board-actions button:first-child {
  background: #171717;
  color: white;
}

.review-analysis-board-actions button:disabled {
  cursor: default;
  opacity: 0.5;
}

.review-analysis-board-actions span {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.review-view-controls button.active {
  background: #171717;
  color: white;
}

.review-accuracy-timeline {
  display: grid;
  gap: 4px;
  min-width: 0;
  border-top: 1px solid var(--review-line);
  padding-top: 5px;
}

.review-accuracy-timeline[hidden] {
  display: none;
}

.review-accuracy-timeline-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
  gap: 10px;
  color: var(--review-muted);
  font-size: 10px;
  font-weight: 800;
}

.review-accuracy-timeline-heading strong {
  overflow: hidden;
  color: var(--review-ink);
  font-size: 11px;
  letter-spacing: 0.035em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.review-accuracy-timeline-heading span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.review-accuracy-timeline-body {
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}

.review-accuracy-timeline-scores {
  display: grid;
  grid-template-rows: repeat(2, 24px);
  min-width: 0;
  color: var(--review-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.review-accuracy-timeline-scores > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 7px;
}

.review-accuracy-timeline-scores strong {
  color: var(--review-ink);
  font-size: 11px;
}

.review-accuracy-timeline-scores [data-accuracy-color="w"]::before,
.review-accuracy-timeline-scores [data-accuracy-color="b"]::before {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--review-warm);
  content: "";
}

.review-accuracy-timeline-scores [data-accuracy-color="b"]::before {
  background: var(--review-accent);
}

.review-accuracy-timeline-scores > span > span {
  margin-right: auto;
}

.review-accuracy-timeline svg {
  width: 100%;
  height: 48px;
  overflow: visible;
  cursor: pointer;
}

.review-accuracy-timeline-guide {
  stroke: color-mix(in srgb, var(--review-line) 70%, transparent);
  stroke-width: 1;
}

.review-accuracy-timeline-line {
  fill: none;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.review-accuracy-timeline-line.white {
  stroke: var(--review-warm);
}

.review-accuracy-timeline-line.black {
  stroke: var(--review-accent);
}

.review-accuracy-timeline-selected {
  stroke: color-mix(in srgb, var(--review-ink) 62%, transparent);
  stroke-dasharray: 2 2;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.review-accuracy-timeline-current {
  fill: var(--review-surface);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.review-accuracy-timeline-current.white {
  stroke: var(--review-warm);
}

.review-accuracy-timeline-current.black {
  stroke: var(--review-accent);
}

.review-accuracy-timeline-hit {
  fill: transparent;
}

.review-position-fen {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.review-analysis {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #b9c3cb;
  background: #f8fbfd;
}

.review-screen.review-board-active .review-analysis {
  gap: 6px;
  min-height: 0;
  max-height: clamp(150px, 22vh, 240px);
  overflow: auto;
  padding: 8px;
  border-color: var(--border);
  background: #fffdf8;
}

.review-screen.review-board-active .review-analysis.review-analysis-lines-only {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
}

.review-screen.review-board-active .review-analysis.review-analysis-lines-only .review-top-lines {
  max-height: none;
}

.review-analysis-board-live {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #d5c3ac;
  background: #fffdf8;
}

.review-screen.review-board-active .review-analysis-board-live {
  gap: 7px;
  margin-bottom: 0;
  padding: 9px;
}

.review-analysis-board-live-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.review-analysis-board-live-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
  text-transform: uppercase;
}

.review-analysis-board-live-heading span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  text-align: right;
}

.review-analysis-board-live-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-analysis-board-live-actions button {
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.review-analysis-board-live-actions #review-toggle-best-arrow {
  min-width: 142px;
  padding-inline: 14px;
  white-space: nowrap;
}

.review-analysis-board-live-actions button.active {
  background: #171717;
  color: white;
}

.review-analysis-board-live-actions button:disabled {
  cursor: default;
  opacity: 0.5;
}

.review-analysis-depth-controls {
  display: grid;
  grid-template-columns: auto minmax(62px, 1fr) minmax(78px, auto);
  align-items: center;
  gap: 8px;
}

.review-analysis-depth-controls label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

#review-analysis-depth {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 800;
}

#review-analysis-depth-analyze {
  min-height: 34px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

#review-analysis-depth-analyze:disabled {
  cursor: default;
  opacity: 0.5;
}

.review-analysis-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.review-screen.review-board-active .review-analysis-heading {
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.review-analysis-heading h2 {
  margin-bottom: 0;
}

.review-screen.review-board-active .review-analysis-heading h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-analysis-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  text-align: right;
}

.review-analysis-heading button {
  flex: 0 0 auto;
  min-height: 30px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.review-analysis-heading button:hover {
  background: #f2eee7;
}

.review-analysis-heading button:disabled {
  cursor: default;
  opacity: 0.55;
}

.review-analysis-metrics {
  border-top: 1px solid #d5e0e7;
  grid-template-columns: minmax(90px, max-content) minmax(0, 1fr);
  gap: 5px 12px;
  padding-top: 8px;
  font-size: 12px;
  line-height: 1.25;
}

.review-screen.review-board-active .review-analysis-metrics {
  border-top: 0;
  grid-template-columns: minmax(76px, max-content) minmax(0, 1fr) minmax(72px, max-content) minmax(0, 1fr);
  gap: 3px 8px;
  padding-top: 0;
  font-size: 11px;
}

.review-analysis-metrics dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.review-label-explanation {
  border-top: 1px solid #d5e0e7;
  padding-top: 10px;
}

.review-label-explanation summary {
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.review-label-explanation summary::marker {
  color: var(--muted);
}

.review-label-explanation-body {
  display: grid;
  gap: 8px;
  padding-top: 9px;
}

.review-label-explanation-body p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
}

.review-label-explanation[data-classification="inaccuracy"] {
  border-left: 4px solid #f1b93f;
  padding-left: 10px;
}

.review-label-explanation[data-classification="mistake"] {
  border-left: 4px solid #e8882d;
  padding-left: 10px;
}

.review-label-explanation[data-classification="blunder"],
.review-label-explanation[data-classification="missed-win"] {
  border-left: 4px solid #d64550;
  padding-left: 10px;
}

.review-label-explanation[data-classification="brilliant"],
.review-label-explanation[data-classification="great-find"],
.review-label-explanation[data-classification="best"],
.review-label-explanation[data-classification="excellent"] {
  border-left: 4px solid #22a699;
  padding-left: 10px;
}

.review-ai-comment {
  display: grid;
  gap: 10px;
  border-top: 1px solid #d5e0e7;
  padding-top: 12px;
}

.review-screen.review-board-active .review-ai-comment {
  gap: 5px;
  border: 1px solid #d5c3ac;
  background: #fffaf2;
  padding: 7px;
}

.review-ai-comment-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.review-ai-comment-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.review-ai-comment-heading h3 {
  flex: 0 0 auto;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  text-transform: uppercase;
}

.review-screen.review-board-active .review-ai-comment-heading h3 {
  font-size: 12px;
}

.review-ai-comment-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  text-align: right;
}

.review-ai-comment-heading button {
  min-height: 24px;
  border: 1px solid #b9a58c;
  border-radius: 5px;
  background: #fffdf8;
  color: var(--text);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.review-screen.review-board-active .review-ai-comment-heading span {
  font-size: 10px;
}

.review-screen.review-board-active .review-ai-comment-heading button {
  min-height: 22px;
  padding: 0 7px;
  font-size: 10px;
}

.review-ai-move-comment {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

.review-screen.review-board-active .review-ai-move-comment {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.26;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.review-ai-comment-details {
  border-left: 3px solid #b9c3cb;
  padding-left: 10px;
}

.review-screen.review-board-active .review-ai-comment-details {
  grid-template-columns: minmax(78px, max-content) minmax(0, 1fr);
  gap: 3px 7px;
  border-left-color: #b9a58c;
  padding-left: 7px;
  font-size: 11px;
  line-height: 1.2;
}

.review-screen.review-board-active .review-ai-comment-details dd {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.review-screen.review-board-active .review-ai-tags {
  display: none;
}

.review-screen.review-board-active .review-ai-comment.expanded .review-ai-move-comment,
.review-screen.review-board-active .review-ai-comment.expanded .review-ai-comment-details dd {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.review-screen.review-board-active .review-ai-comment.expanded .review-ai-comment-details {
  gap: 7px 9px;
  font-size: 12px;
  line-height: 1.3;
}

.review-screen.review-board-active .review-ai-comment.expanded .review-ai-tags {
  display: flex;
}

.review-ai-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.review-ai-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #b9c3cb;
  border-radius: 999px;
  background: white;
  color: #334451;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
}

.review-ai-comment[data-source="fallback"] .review-ai-comment-heading span {
  color: #884018;
}

.review-top-lines {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 24px;
}

.review-screen.review-board-active .review-top-lines {
  gap: 5px;
  padding-left: 0;
  list-style: none;
  max-height: 86px;
  overflow: hidden;
}

.review-screen.review-board-active .review-analysis.review-analysis-lines-only .review-top-lines {
  max-height: none;
  overflow: visible;
}

.review-top-lines li {
  min-width: 0;
}

.review-top-lines li::marker {
  color: #60758a;
  font-weight: 800;
}

.review-top-line-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.review-top-line-header strong,
.review-top-line-header span {
  min-width: 0;
  line-height: 1.25;
}

.review-top-line-header strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-top-line-header span {
  flex: 0 0 auto;
  color: #60758a;
  font-weight: 800;
}

.review-top-lines p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.review-top-lines .empty-line {
  color: var(--muted);
  list-style: none;
}

:is(.top-moves, .learning-engine-top-moves, .review-top-lines) .engine-top-line-item {
  min-width: 0;
}

.engine-top-line {
  min-width: 0;
}

.engine-top-line-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
  list-style: none;
}

.review-screen.review-board-active .review-top-lines .engine-top-line-summary {
  gap: 4px;
}

.engine-top-line-summary::-webkit-details-marker {
  display: none;
}

:is(.top-moves, .learning-engine-top-moves, .review-top-lines) .engine-eval-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fffdf8;
  color: #171411;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
}

.review-screen.review-board-active .review-top-lines .engine-eval-badge {
  min-width: 38px;
  padding: 1px 5px;
  font-size: 11px;
}

:is(.top-moves, .learning-engine-top-moves, .review-top-lines) .engine-eval-badge.is-black {
  border-color: #171411;
  background: #171411;
  color: #fffdf8;
}

:is(.top-moves, .learning-engine-top-moves, .review-top-lines) .engine-eval-badge.is-neutral {
  background: var(--panel);
  color: var(--muted);
}

:is(.top-moves, .learning-engine-top-moves, .review-top-lines) .engine-top-line-preview {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-screen.review-board-active .review-top-lines .engine-top-line-preview {
  font-size: 11px;
}

:is(.top-moves, .learning-engine-top-moves, .review-top-lines) .engine-top-line-toggle {
  width: 0;
  height: 0;
  border-top: 5px solid var(--muted);
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  transition: transform 160ms ease;
}

.engine-top-line[open] .engine-top-line-toggle {
  transform: rotate(180deg);
}

.engine-top-line.no-expansion .engine-top-line-toggle {
  visibility: hidden;
}

:is(.top-moves, .learning-engine-top-moves, .review-top-lines) .engine-top-line-continuation {
  margin: 5px 0 0;
  padding-left: 52px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.review-screen.review-board-active .review-top-lines .engine-top-line-continuation {
  margin-top: 3px;
  padding-left: 48px;
  font-size: 11px;
}

.review-move-list {
  display: grid;
  gap: 0;
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 1.4;
}

.review-move-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  min-height: 34px;
  padding: 3px 4px;
  column-gap: 6px;
}

.review-screen.review-board-active .review-move-row {
  grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr);
  min-height: 28px;
  padding: 2px 3px;
}

.review-move-row:nth-child(even) {
  background: rgba(58, 42, 31, 0.035);
}

.review-move-number {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  text-align: right;
}

.review-screen.review-board-active .review-move-number {
  font-size: 12px;
}

.review-move-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  padding: 3px 4px;
  font-size: 14px;
  font-weight: 900;
  text-align: left;
}

.review-screen.review-board-active .review-move-button {
  min-height: 24px;
  padding: 2px 4px;
  font-size: 12px;
}

.review-move-button:hover,
.review-move-button:focus-visible {
  background: rgba(58, 42, 31, 0.08);
}

.review-move-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.review-screen.review-board-active .review-move-icon {
  width: 14px;
  height: 14px;
}

.review-move-text {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-move-button.current {
  background: rgba(23, 23, 23, 0.92);
  color: white;
}

.review-move-button.reviewed-move:not(.current) {
  color: #2f628c;
}

.review-move-button.analyzed-move:not(.current) {
  background: transparent;
}

.review-move-button.classification-inaccuracy:not(.current) {
  color: #c17a15;
}

.review-move-button.classification-mistake:not(.current) {
  color: #d45d24;
}

.review-move-button.classification-blunder:not(.current),
.review-move-button.classification-missed-win:not(.current) {
  color: #d74949;
}

.review-move-button.classification-brilliant:not(.current),
.review-move-button.classification-best:not(.current),
.review-move-button.classification-excellent:not(.current),
.review-move-button.classification-great-find:not(.current),
.review-move-button.classification-good:not(.current),
.review-move-button.classification-book:not(.current),
.review-move-button.classification-forced:not(.current) {
  color: #68a832;
}

.review-analysis[data-classification="inaccuracy"] {
  border-color: #d5a139;
  background: #fffaf0;
}

.review-analysis[data-classification="mistake"] {
  border-color: #cf7947;
  background: #fff5ef;
}

.review-analysis[data-classification="blunder"],
.review-analysis[data-classification="missed-win"] {
  border-color: #bf4a4a;
  background: #fff5f5;
}

.review-analysis[data-classification="brilliant"],
.review-analysis[data-classification="best"],
.review-analysis[data-classification="excellent"],
.review-analysis[data-classification="great-find"] {
  border-color: #8aa873;
  background: #f5fbf2;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
}

#status {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.controls {
  display: grid;
  gap: 10px;
}

.controls button,
select,
.engine-actions button {
  min-height: 40px;
  border: 1px solid #3a2a1f;
  background: #171717;
  color: white;
  padding: 0 12px;
  border-radius: 6px;
}

.controls button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.engine-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  background: white;
  color: var(--text);
}

input:not([type="checkbox"]):not([type="range"]) {
  width: 100%;
  min-height: 36px;
  border: 1px solid #3a2a1f;
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
}

input[type="range"] {
  width: 100%;
}

.engine-settings {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.engine-settings summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.engine-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

[data-engine-panel] {
  display: grid;
  gap: 12px;
}

[data-engine-panel][hidden] {
  display: none;
}

.engine-form fieldset {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.engine-form legend {
  margin-bottom: 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.checkbox-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.advanced-settings {
  display: grid;
  gap: 10px;
}

.advanced-settings summary {
  font-size: 12px;
  text-transform: none;
}

.advanced-settings[open] {
  display: grid;
}

.advanced-settings[open] fieldset:first-of-type {
  margin-top: 10px;
}

.engine-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.engine-actions button:nth-child(n + 2) {
  background: white;
  color: var(--text);
}

.engine-actions button:nth-child(3) {
  grid-column: 1 / -1;
}

.engine-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.moves-panel {
  min-width: 0;
}

.play-moves-slot .moves-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.play-moves-slot .moves {
  align-content: start;
  max-height: none;
  min-height: 0;
}

.moves-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.moves-header h2 {
  margin-bottom: 0;
}

.copy-moves {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.copy-moves:disabled {
  cursor: default;
  opacity: 0.45;
}

.moves {
  display: grid;
  gap: 7px;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding-left: 28px;
  font-size: 14px;
  line-height: 1.25;
}

.moves li {
  padding-left: 2px;
}

.moves li::marker {
  font-weight: 600;
}

.moves li span {
  display: inline-block;
  min-width: 48px;
}

.moves .current {
  font-weight: 800;
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .opponent-time-grid {
    grid-template-columns: 1fr 1fr;
  }

  .learning-classroom-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .learning-library,
  .learning-classroom,
  .opening-practice-setup,
  .opening-practice-workspace,
  .endgame-practice-setup,
  .endgame-practice-workspace,
  .placement-tournament-summary,
  .placement-tournament-review-cards,
  .placement-tournament-columns,
  .placement-time-options,
  .placement-rating-options {
    grid-template-columns: 1fr;
  }

  .opening-practice-setup > .opening-practice-panel:first-child {
    grid-row: auto;
  }

  .opening-practice-today-grid,
  .opening-practice-repertoire-grid {
    grid-template-columns: 1fr;
  }

  .opening-practice-mobile-selected-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    gap: 10px;
    border: 1px solid #3a2a1f;
    border-radius: 8px;
    background: #fff8ec;
    padding: 12px;
  }

  .opening-practice-mobile-selected-action > div {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .opening-practice-mobile-selected-action strong {
    font-size: 15px;
    line-height: 1.1;
  }

  .opening-practice-mobile-selected-action span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
  }

  .opening-practice-mobile-selected-action button {
    min-height: 40px;
    border: 1px solid #171717;
    border-radius: 6px;
    background: #171717;
    color: white;
    padding: 0 12px;
    font-weight: 900;
  }

  .placement-tournament-header,
  .placement-tournament-actions,
  .placement-tournament-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .learning-library.has-parts {
    grid-template-columns: 1fr;
  }

  .learning-board-panel,
  .learning-side-panel,
  .opening-practice-board-panel,
  .opening-practice-side-panel,
  .endgame-practice-board-panel,
  .endgame-practice-side-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .endgame-practice-side-panel {
    grid-template-areas:
      "line"
      "goal"
      "engine"
      "progress";
    grid-template-columns: 1fr;
  }

  .learning-source-viewer,
  .learning-source-viewer img,
  .learning-source-viewer iframe,
  .learning-text-reader,
  .learning-source-placeholder {
    min-height: 300px;
  }

  .review-game-layout {
    grid-template-columns: 1fr;
  }

  body.board-first-mode .review-screen.review-board-active,
  body.board-first-mode .learning-screen.board-lesson-active,
  body.board-first-mode .opening-practice-screen.practice-active,
  body.board-first-mode .endgame-practice-screen.practice-active {
    height: auto;
    overflow: visible;
  }

  .review-screen.review-board-active .review-game-layout,
  .learning-screen.board-lesson-active .learning-classroom,
  .opening-practice-screen.practice-active .opening-practice-workspace,
  .endgame-practice-screen.practice-active .endgame-practice-workspace {
    grid-template-areas: none;
    grid-template-columns: 1fr;
    height: auto;
  }

  .learning-screen.board-lesson-active .learning-classroom {
    --learning-board-size: min(calc(100vw - 52px), 620px);
  }

  .learning-screen.board-lesson-active .learning-classroom:has(.learning-eval-strip:not([hidden])) {
    --learning-board-size: min(calc(100vw - 88px), 584px);
  }

  .review-screen.review-board-active .review-analysis {
    max-height: none;
    overflow: visible;
  }

  .review-screen.review-board-active .review-view-controls {
    grid-template-columns: 1fr;
  }

  .review-screen.review-board-active .review-move-panel,
  .review-screen.review-board-active .review-board-panel,
  .review-screen.review-board-active .review-side-panel,
  .learning-screen.board-lesson-active .learning-source-panel,
  .learning-screen.board-lesson-active .learning-board-panel,
  .learning-screen.board-lesson-active .learning-side-panel,
  .opening-practice-screen.practice-active .opening-practice-source-panel,
  .opening-practice-screen.practice-active .opening-practice-board-panel,
  .opening-practice-screen.practice-active .opening-practice-side-panel {
    grid-area: auto;
    max-height: none;
    overflow: visible;
  }

  .review-screen.review-board-active .review-board-panel,
  .learning-screen.board-lesson-active .learning-board-panel,
  .opening-practice-screen.practice-active .opening-practice-board-panel {
    order: 1;
  }

  .review-screen.review-board-active .review-side-panel,
  .learning-screen.board-lesson-active .learning-side-panel,
  .opening-practice-screen.practice-active .opening-practice-source-panel {
    order: 2;
  }

  .learning-screen.board-lesson-active .learning-source-panel,
  .opening-practice-screen.practice-active .opening-practice-side-panel {
    order: 3;
  }

  .review-board-area {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .review-move-list {
    max-height: 220px;
  }

  .play-area {
    justify-self: center;
    width: min(calc(100vw - 32px), 620px);
    margin: 0 auto;
  }

  .shell.opponent-mode {
    grid-template-columns: 1fr;
    width: min(1000px, calc(100vw - 32px));
    --opponent-board-size: min(100%, calc(100vh - 250px));
  }

  .shell.opponent-mode .play-area,
  .shell.opponent-mode.opponent-show-eval .play-area,
  .shell.opponent-mode.opponent-show-top .play-area,
  .shell.opponent-mode.opponent-show-eval.opponent-show-top .play-area {
    grid-template-areas:
      "board"
      "moves"
      "eval"
      "top";
    grid-template-columns: 1fr;
    width: min(calc(100vw - 32px), 620px);
  }

  .shell.opponent-mode .eval-bar {
    height: auto;
    margin-top: 0;
    min-height: 32px;
  }

  .shell.opponent-mode .board-column {
    display: grid;
    grid-area: board;
    grid-template-rows: auto;
  }

  .shell.opponent-mode #top-player,
  .shell.opponent-mode .board-wrap,
  .shell.opponent-mode #bottom-player {
    grid-area: auto;
  }

  .shell.opponent-mode .board-wrap {
    height: auto;
  }

  .shell.maia3-engine-mode {
    --maia3-board-size: min(calc(100vw - 32px), 620px);
    --maia3-play-gaps: 0px;
    grid-template-columns: 1fr;
    width: min(1000px, calc(100vw - 32px));
  }

  .shell.maia3-engine-mode .play-area,
  .shell.maia3-engine-mode.engine-show-eval .play-area,
  .shell.maia3-engine-mode.engine-show-top .play-area,
  .shell.maia3-engine-mode.engine-show-eval.engine-show-top .play-area {
    grid-template-areas:
      "eval board"
      "top top";
    grid-template-columns: var(--maia3-eval-width) var(--maia3-board-size);
    width: calc(var(--maia3-eval-width) + var(--maia3-board-size) + var(--maia3-play-gaps));
  }

  .shell.maia3-engine-mode.engine-show-eval {
    --maia3-eval-width: 26px;
    --maia3-board-size: min(calc(100vw - 66px), 586px);
    --maia3-play-gaps: 8px;
  }

  .shell.maia3-engine-mode:not(.engine-show-eval) .play-area {
    grid-template-areas:
      "board"
      "top";
    grid-template-columns: var(--maia3-board-size);
  }

  .shell.maia3-engine-mode .eval-bar {
    height: var(--maia3-board-size);
    min-height: 0;
    margin-top: calc(var(--maia3-player-row-height) + var(--maia3-board-gap));
  }

  .shell.maia3-engine-mode .board-column {
    grid-area: board;
    grid-template-rows: var(--maia3-player-row-height) var(--maia3-board-size) var(--maia3-player-row-height);
    width: var(--maia3-board-size);
  }

  .shell.maia3-engine-mode .board-wrap {
    height: 100%;
  }

  body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) {
    --play-eval-width: 26px;
    --play-board-size: min(calc(100vw - 66px), 586px);
    --play-shell-gap: 12px;
    grid-template-columns: 1fr;
    width: min(1000px, calc(100vw - 32px));
    height: auto;
    overflow: visible;
  }

  body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) .play-area {
    grid-template-areas:
      "eval board"
      "top top";
    grid-template-columns: var(--play-eval-width) var(--play-board-size);
    justify-self: center;
    width: calc(var(--play-eval-width) + var(--play-board-size) + 8px);
  }

  body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) .board-column {
    grid-area: board;
    width: var(--play-board-size);
  }

  body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) .eval-bar {
    grid-area: eval;
    height: var(--play-board-size);
    min-height: 0;
    margin-top: 40px;
  }

  body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) .top-lines {
    grid-area: top;
    max-height: none;
  }

  body.board-first-mode .shell:not(.review-mode):not(.learning-mode):not(.opening-practice-mode):not(.endgame-practice-mode):not(.puzzles-mode):not(.board-recorder-mode):not(.opponent-mode):not(.maia3-engine-mode) .side {
    max-height: none;
    overflow: visible;
  }

  .shell.live-match-frame {
    margin-top: 8px;
  }

  .shell.live-match-frame.maia3-engine-mode {
    --maia3-player-row-height: 40px;
  }

  .shell.live-match-frame .play-area {
    order: 1;
  }

  .shell.live-match-frame .side {
    order: 2;
    width: min(100%, 620px);
    margin: 2px auto 24px;
    padding: 12px;
  }

  .shell.live-match-frame .player-strip {
    min-height: 40px;
  }

  .shell.live-match-frame .live-player-portrait {
    width: 34px;
    height: 34px;
  }

  .shell.live-match-frame .player-name {
    max-width: 34%;
    font-size: 13px;
  }

  .shell.live-match-frame .player-clock {
    min-width: 74px;
    min-height: 34px;
    padding: 5px 6px;
    font-size: 15px;
  }

  .shell.live-match-frame .live-match-event h1 {
    white-space: normal;
  }
}

@media (min-width: 821px) and (max-width: 1160px) {
  .shell {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
    gap: 20px;
    width: min(1000px, calc(100vw - 32px));
  }

  .play-area {
    width: min(100%, calc(100vh + 72px), 700px);
  }

  .shell.opponent-mode {
    grid-template-columns: 1fr;
    width: min(1000px, calc(100vw - 32px));
    --opponent-board-size: clamp(440px, calc(100vh - 245px), 560px);
    --opponent-moves-width: 138px;
    --opponent-top-width: 140px;
  }

  .shell.opponent-mode .play-area {
    justify-self: center;
    width: calc(
      var(--opponent-moves-width) + var(--opponent-eval-width) + var(--opponent-top-width) + var(--opponent-board-size) + 30px
    );
  }
}

@media (max-width: 520px) {
  .mode-actions {
    grid-template-columns: 1fr;
  }

  .opponent-time-grid {
    grid-template-columns: 1fr;
  }

  .opponent-facts,
  .opponent-game-details,
  .opponent-debug-panel dl {
    grid-template-columns: 1fr;
  }

  .review-screen {
    padding: 18px;
  }

  .learning-screen,
  .opening-practice-screen {
    padding: 18px;
  }

  .learning-header,
  .opening-practice-header,
  .learning-node-heading,
  .learning-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .learning-source-actions,
  .stats-header,
  .stats-header-actions,
  .stats-panel-heading,
  .ai-debug-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .learning-node-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .opening-practice-custom-board-panel {
    grid-template-columns: 1fr;
  }

  .opening-practice-custom-board-wrap {
    justify-self: center;
    width: min(100%, 360px);
  }

  .learning-header button,
  .opening-practice-header button,
  .opening-practice-quick-start button,
  .opening-practice-custom-board-toolbar button,
  .opening-practice-custom-start-actions button,
  .opening-practice-settings button,
  .opening-practice-result-actions button,
  .learning-node-actions button,
  .learning-panel-heading button,
  .learning-position-controls button,
  .learning-reading-controls button,
  .learning-progress-actions button,
  #learning-next-module,
  #learning-toggle-library,
  #learning-save-notes {
    width: 100%;
  }

  .opening-practice-screen {
    width: min(100vw, calc(100vw - 14px));
    margin: 7px auto;
    padding: 10px;
  }

  .opening-practice-setup {
    gap: 10px;
  }

  .opening-practice-setup-tabs {
    grid-template-columns: repeat(4, minmax(76px, 1fr));
    overflow-x: auto;
  }

  .opening-practice-setup-tab {
    min-height: 40px;
    gap: 5px;
    padding: 0 8px;
    font-size: 13px;
    white-space: nowrap;
  }

  .opening-practice-panel,
  .opening-practice-source-panel,
  .opening-practice-board-panel,
  .opening-practice-side-panel {
    padding: 10px;
  }

  .opening-practice-section-heading h3 {
    font-size: 14px;
  }

  .opening-practice-today-grid {
    gap: 8px;
  }

  .opening-practice-today-task {
    grid-template-columns: 42px minmax(0, 1fr) 14px;
    min-height: 88px;
    gap: 10px;
    padding: 10px;
  }

  .opening-practice-task-number {
    width: 36px;
    height: 36px;
  }

  .opening-practice-task-copy strong {
    font-size: 16px;
  }

  .opening-practice-mobile-selected-action {
    grid-template-columns: 1fr;
  }

  .opening-practice-mobile-selected-action button {
    width: 100%;
  }

  .opening-practice-repertoire-heading {
    padding: 12px;
  }

  .opening-practice-repertoire-row {
    grid-template-columns: minmax(0, 1fr) 36px 52px 52px 12px;
    gap: 7px;
    min-height: 56px;
    padding: 8px 10px;
  }

  .opening-practice-repertoire-row.header {
    min-height: 30px;
    font-size: 10px;
  }

  .opening-practice-repertoire-opening strong {
    font-size: 13px;
    white-space: normal;
  }

  .opening-practice-repertoire-opening span {
    font-size: 11px;
  }

  .opening-practice-repertoire-meter {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .opening-practice-repertoire-arrow {
    font-size: 18px;
  }

  .opening-practice-quick-start {
    padding: 12px;
  }

  .opening-practice-quick-header {
    grid-template-columns: 1fr;
  }

  .opening-practice-quick-header h3 {
    font-size: 32px;
  }

  .opening-practice-opening-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .opening-practice-opening-strip {
    grid-auto-columns: minmax(145px, 1fr);
  }

  .opening-practice-option {
    min-height: 76px;
    padding: 8px;
  }

  .opening-practice-option strong {
    font-size: 14px;
    line-height: 1.15;
  }

  .opening-practice-repair-preview {
    grid-template-columns: 1fr;
  }

  .learning-position-controls,
  .learning-reading-controls,
  .learning-progress-actions {
    grid-template-columns: 1fr;
  }

  .learning-text-reader {
    padding: 16px;
    font-size: 16px;
  }

  .learning-text-reader h3 {
    font-size: 20px;
  }

  .stats-summary,
  .stats-columns,
  .stats-recent-item {
    grid-template-columns: 1fr;
  }

  .review-header {
    align-items: stretch;
    flex-direction: column;
  }

  .review-header button {
    width: 100%;
  }

  .review-input-label textarea {
    min-height: 260px;
  }

  .review-options {
    grid-template-columns: 1fr;
  }

  .review-scoresheet-scan-actions {
    grid-template-columns: 1fr;
  }

  .review-scoresheet-scan-actions button {
    width: 100%;
  }

  .review-actions button {
    width: 100%;
  }

  .review-result-heading {
    align-items: start;
    flex-direction: column;
  }

  .review-details {
    grid-template-columns: 1fr;
  }

  .review-details dd {
    margin-bottom: 4px;
  }

  .review-analysis-metrics {
    grid-template-columns: minmax(86px, max-content) minmax(0, 1fr);
  }

  .review-analysis-metrics dd {
    margin-bottom: 0;
  }

  .review-position-controls {
    grid-template-columns: 1fr 1fr;
  }

  .review-position-controls strong {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .review-segmented,
  .review-tool-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-analysis-heading,
  .review-ai-comment-heading,
  .review-final-heading,
  .review-top-line-header {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .review-analysis-heading span,
  .review-ai-comment-heading span,
  .review-final-heading span {
    text-align: left;
  }

  .review-final-columns {
    grid-template-columns: 1fr;
  }

  .play-area {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .top-lines {
    grid-column: 1 / -1;
    order: 3;
  }

  .board-wrap {
    order: 2;
  }

  .board-column {
    order: 2;
  }

  .shell.maia3-engine-mode .play-area {
    grid-template-columns: var(--maia3-eval-width) var(--maia3-board-size);
  }

  .shell.maia3-engine-mode:not(.engine-show-eval) .play-area {
    grid-template-columns: var(--maia3-board-size);
  }

  .maia3-setup-grid,
  .maia3-play-action-buttons {
    grid-template-columns: 1fr;
  }

  .player-name {
    flex-basis: 46px;
    font-size: 16px;
  }

  .captured-piece {
    flex-basis: 19px;
    width: 19px;
    height: 25px;
  }

  .material-advantage {
    min-width: 30px;
    font-size: 18px;
  }
}

@media (max-width: 820px) {
  body.board-first-mode .app-header {
    min-height: 40px;
    flex-wrap: nowrap;
    gap: 7px;
    padding: 5px 8px;
  }

  body.board-first-mode .app-home-link {
    width: 32px;
    height: 32px;
  }

  body.board-first-mode .header-menu-button {
    min-width: 32px;
    min-height: 30px;
    font-size: 11px;
  }

  body.board-first-mode .shell.opening-practice-mode,
  body.board-first-mode .shell.endgame-practice-mode {
    width: 100vw;
    margin: 0;
  }

  body.board-first-mode .opening-practice-screen.practice-active {
    width: 100vw;
    height: calc(100svh - 38px);
    margin: 0;
    overflow: auto;
    border: 0;
    padding: 4px 4px calc(88px + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    -webkit-overflow-scrolling: touch;
  }

  .opening-practice-screen.practice-active .opening-practice-workspace {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel,
  .opening-practice-screen.practice-active .opening-practice-source-panel,
  .opening-practice-screen.practice-active .opening-practice-side-panel {
    flex: 0 0 auto;
    grid-area: auto;
    position: static;
    min-width: 0;
    min-height: 0;
    max-height: none;
    border-color: var(--border);
    background: #fffdf8;
    box-shadow: none;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel {
    order: 1;
    gap: 5px;
    overflow: visible;
    padding: 4px;
  }

  .opening-practice-screen.practice-active .opening-practice-source-panel {
    order: 3;
    gap: 4px;
    padding: 6px 8px;
    overflow: visible;
  }

  .opening-practice-screen.practice-active .opening-practice-side-panel {
    order: 2;
    align-self: stretch;
    gap: 5px;
    height: auto;
    max-height: min(22svh, 166px);
    overflow: auto;
    padding: 7px 8px;
    -webkit-overflow-scrolling: touch;
  }

  .opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) .opening-practice-side-panel {
    order: 2;
    height: auto;
    max-height: min(34svh, 248px);
  }

  .opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) .opening-practice-source-panel {
    order: 3;
  }

  .opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) .opening-practice-source-panel:not(:has(#opening-practice-result:not([hidden]))) {
    display: none;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-node-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-node-heading .eyebrow {
    margin: 0 0 1px;
    font-size: 10px;
    line-height: 1.1;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-node-heading h2 {
    margin: 0;
    font-size: 14px;
    line-height: 1.12;
  }

  .opening-practice-screen.practice-active.practice-failed .opening-practice-board-panel {
    border-color: #b42318;
    background: #fff1f0;
  }

  .opening-practice-screen.practice-active.practice-failed .opening-practice-board-wrap {
    box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.32), 0 8px 18px rgba(40, 28, 18, 0.16);
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-node-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-node-actions button,
  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-position-controls button,
  .opening-practice-screen.practice-active .opening-practice-source-panel button {
    width: auto;
    min-height: 30px;
    border-radius: 5px;
    padding: 3px 7px;
    font-size: 11px;
    line-height: 1.1;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-node-actions {
    max-width: 150px;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-node-actions button {
    min-width: 54px;
    max-width: 62px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .opening-practice-screen.practice-active #opening-practice-toggle-eval,
  .opening-practice-screen.practice-active #opening-practice-toggle-top-moves {
    font-size: 0;
  }

  .opening-practice-screen.practice-active #opening-practice-toggle-eval::after,
  .opening-practice-screen.practice-active #opening-practice-toggle-top-moves::after {
    font-size: 11px;
  }

  .opening-practice-screen.practice-active #opening-practice-toggle-eval::after {
    content: "Eval";
  }

  .opening-practice-screen.practice-active #opening-practice-toggle-top-moves::after {
    content: "Moves";
  }

  .opening-practice-screen.practice-active .opening-practice-board-area {
    justify-self: center;
    width: min(100%, calc(100vw - 8px));
    gap: 5px;
  }

  .opening-practice-screen.practice-active .opening-practice-board-wrap {
    width: min(100%, calc(100vw - 12px), calc(100svh - 156px));
    border-width: 5px;
    box-shadow: 0 8px 18px rgba(40, 28, 18, 0.16);
  }

  .opening-practice-screen.practice-active .opening-practice-board-area.has-eval .opening-practice-board-wrap {
    width: min(calc(100% - 31px), calc(100vw - 43px), calc(100svh - 156px));
  }

  .opening-practice-screen.practice-active .opening-practice-eval-rail {
    flex-basis: 24px;
  }

  .opening-practice-screen.practice-active .opening-practice-eval-track {
    width: 24px;
    min-height: 0;
    border-width: 2px;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-position-controls {
    display: grid;
    grid-template-columns: 34px 34px 34px minmax(74px, 0.76fr) minmax(106px, 1fr);
    gap: 5px;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-position-controls:has(#opening-practice-previous-line:not([hidden])) {
    grid-template-columns: 34px 34px 34px minmax(62px, 0.7fr) minmax(86px, 0.95fr) minmax(86px, 1fr);
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-position-controls .learning-icon-control {
    min-width: 0;
    padding: 0;
    font-size: 20px;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-position-controls #opening-practice-new-line:not(.opening-practice-inline-result-action) {
    white-space: normal;
  }

  .opening-practice-screen.practice-active .opening-practice-board-panel .learning-position-controls .opening-practice-inline-result-action {
    font-size: 11px;
    line-height: 1.05;
    white-space: nowrap;
  }

  .opening-practice-screen.practice-active .opening-practice-source-panel .learning-panel-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
  }

  .opening-practice-screen.practice-active .opening-practice-source-panel .learning-panel-heading .eyebrow {
    display: none;
  }

  .opening-practice-screen.practice-active .opening-practice-source-panel .learning-panel-heading h2 {
    margin: 0;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .opening-practice-screen.practice-active .opening-practice-source-panel #opening-practice-change-setup {
    min-height: 26px;
    padding: 2px 7px;
    font-size: 10px;
  }

  .opening-practice-screen.practice-active .opening-practice-line-description {
    display: none;
  }

  .opening-practice-screen.practice-active .opening-practice-score {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .opening-practice-screen.practice-active .opening-practice-chip {
    justify-content: center;
    min-height: 22px;
    padding: 2px 7px;
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }

  .opening-practice-screen.practice-active .opening-practice-result {
    order: -1;
    gap: 5px;
    padding: 7px;
  }

  .opening-practice-screen.practice-active .opening-practice-result h3 {
    font-size: 15px;
    line-height: 1.15;
  }

  .opening-practice-screen.practice-active .opening-practice-result p {
    font-size: 12px;
    line-height: 1.25;
  }

  .opening-practice-screen.practice-active .opening-practice-result-actions {
    display: flex;
  }

  .opening-practice-screen.practice-active .opening-practice-result:not(.passed) .opening-practice-result-actions,
  .opening-practice-screen.practice-active .opening-practice-result-actions #opening-practice-next-line,
  .opening-practice-screen.practice-active .opening-practice-result-actions #opening-practice-result-previous-line,
  .opening-practice-screen.practice-active .opening-practice-result-actions #opening-practice-retry-line {
    display: none;
  }

  .opening-practice-screen.practice-active .opening-practice-result-actions button {
    width: auto;
    min-height: 30px;
    padding: 3px 8px;
    font-size: 11px;
  }

  .opening-practice-screen.practice-active .opening-practice-result-actions #opening-practice-continue-loss {
    flex: 1 1 100%;
    width: 100%;
  }

  .opening-practice-screen.practice-active .opening-practice-side-panel section {
    display: grid;
    gap: 5px;
    min-width: 0;
  }

  .opening-practice-screen.practice-active .opening-practice-side-panel .learning-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 0;
  }

  .opening-practice-screen.practice-active .opening-practice-side-panel .learning-panel-heading h2,
  .opening-practice-screen.practice-active .opening-practice-side-panel .learning-engine-heading h3 {
    margin: 0;
    font-size: 12px;
    line-height: 1.1;
  }

  .opening-practice-screen.practice-active .opening-practice-side-panel .learning-move-list {
    max-height: 106px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.2;
  }

  .opening-practice-screen.practice-active .opening-practice-move-row {
    grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr);
    min-height: 27px;
    padding: 1px 2px;
    column-gap: 4px;
  }

  .opening-practice-screen.practice-active .opening-practice-move-number {
    font-size: 11px;
  }

  .opening-practice-screen.practice-active .opening-practice-move-button {
    min-height: 24px;
    padding: 2px 4px;
    font-size: 11px;
  }

  .opening-practice-screen.practice-active .opening-practice-move-icon {
    width: 14px;
    height: 14px;
  }

  .opening-practice-screen.practice-active .opening-practice-side-panel .review-details {
    grid-template-columns: minmax(86px, max-content) minmax(0, 1fr);
    gap: 3px 8px;
    font-size: 11px;
    line-height: 1.2;
  }

  .opening-practice-screen.practice-active .opening-practice-side-panel #opening-practice-engine-panel {
    padding: 7px;
  }

  .opening-practice-screen.practice-active .opening-practice-progress-panel {
    display: none;
  }

  .opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) .opening-practice-side-panel #opening-practice-engine-panel {
    order: -1;
    padding: 8px;
  }

  .opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) .opening-practice-line-panel,
  .opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) .opening-practice-temporary-panel,
  .opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) .opening-practice-progress-panel {
    display: none;
  }

  .opening-practice-screen.practice-active #opening-practice-top-moves {
    max-height: 86px;
    overflow: auto;
  }

  .opening-practice-screen.practice-active:has(#opening-practice-engine-panel:not([hidden])) #opening-practice-top-moves {
    max-height: min(22svh, 172px);
  }
}

@media (max-width: 900px) {
  .review-position-setup {
    grid-template-columns: 1fr;
  }

  .review-position-setup-board-panel {
    order: 1;
  }

  .review-position-setup-controls {
    order: 2;
  }

  .review-setup-board-wrap {
    width: min(100%, 560px);
    justify-self: center;
  }

  .review-setup-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .review-screen {
    padding: 10px;
  }

  .review-input-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .review-input-panel-actions {
    justify-content: stretch;
  }

  .review-input-panel-actions button {
    flex: 1 1 140px;
  }

  .review-setup-draft-prompt {
    align-items: stretch;
    flex-direction: column;
  }

  .review-setup-draft-actions {
    justify-content: stretch;
  }

  .review-setup-draft-actions button {
    flex: 1 1 140px;
  }

  .review-position-setup {
    padding: 8px;
  }

  .review-position-setup-toolbar,
  .review-setup-action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-position-setup-toolbar button,
  .review-setup-action-row button,
  .review-position-setup-controls > button {
    min-height: 40px;
    padding: 0 8px;
    font-size: 12px;
  }

  .review-setup-palette {
    grid-template-columns: repeat(7, minmax(34px, 1fr));
    gap: 6px;
  }

  .review-setup-piece-button {
    width: 100%;
    min-width: 0;
  }

  .review-setup-castling {
    grid-template-columns: 1fr;
  }
}

.endgame-practice-screen.practice-active .endgame-practice-workspace {
  grid-template-areas: "board side";
  grid-template-columns: minmax(520px, min(68vw, calc(100vh - 118px))) minmax(380px, 520px);
  grid-template-rows: minmax(0, 1fr);
}

.endgame-practice-screen.practice-active .endgame-practice-side-panel {
  grid-area: side;
  display: grid;
  grid-template-areas:
    "line line"
    "goal progress"
    "engine engine";
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(300px, 1fr) auto auto;
  align-content: stretch;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}

.endgame-practice-screen.practice-active .endgame-practice-board-panel .learning-position-controls {
  grid-template-columns: 42px 42px 42px minmax(76px, 0.75fr) minmax(106px, 1fr) minmax(106px, 1fr);
}

.endgame-practice-screen.practice-active .endgame-practice-board-panel .learning-position-controls button {
  min-width: 0;
  min-height: 38px;
  line-height: 1.1;
  white-space: normal;
}

.endgame-practice-screen.practice-active .endgame-practice-line-panel {
  grid-area: line;
  grid-template-rows: auto minmax(260px, 1fr);
  min-height: 330px;
}

.endgame-practice-screen.practice-active .endgame-practice-line-panel .learning-panel-heading {
  align-items: center;
}

.endgame-practice-screen.practice-active .endgame-practice-side-panel .endgame-practice-goal-panel {
  grid-area: goal;
}

.endgame-practice-screen.practice-active .endgame-practice-progress-panel {
  grid-area: progress;
}

.endgame-practice-screen.practice-active .endgame-practice-engine-panel {
  grid-area: engine;
}

.endgame-practice-screen.practice-active #endgame-practice-move-list {
  max-height: min(52vh, 560px);
  min-height: 0;
  font-size: 14px;
  line-height: 1.35;
}

@media (max-width: 820px) {
  .endgame-practice-screen.practice-active .endgame-practice-workspace {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .endgame-practice-screen.practice-active .endgame-practice-side-panel {
    order: 2;
    display: grid;
    grid-template-areas:
      "line"
      "goal"
      "engine"
      "progress";
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 5px;
    max-height: none;
    overflow: visible;
  }

  .endgame-practice-screen.practice-active .endgame-practice-board-area {
    width: 100%;
    justify-content: center;
  }

  .endgame-practice-screen.practice-active .endgame-practice-board-wrap {
    width: min(calc(100vw - 24px), calc(100svh - 176px));
  }

  .endgame-practice-screen.practice-active .endgame-practice-board-panel .learning-position-controls {
    grid-template-columns: 34px 34px 34px repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .endgame-practice-screen.practice-active .endgame-practice-board-panel .learning-position-controls button {
    min-height: 36px;
    padding: 3px 6px;
    font-size: 11px;
  }

  .endgame-practice-screen.practice-active .endgame-practice-board-panel .learning-position-controls .learning-icon-control {
    padding: 0;
    font-size: 20px;
  }

  .endgame-practice-screen.practice-active .endgame-practice-line-panel .learning-panel-heading {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .endgame-practice-screen.practice-active .endgame-practice-move-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    gap: 6px;
  }

  .endgame-practice-screen.practice-active .endgame-practice-move-actions button {
    width: 100%;
  }

  .endgame-practice-screen.practice-active #endgame-practice-move-list {
    max-height: 220px;
  }
}

/* Game Review: warm two-stage summary and active-review workspace. */
.review-screen.review-board-active {
  --review-canvas: #fbf8f1;
  --review-surface: #fffdf8;
  --review-ink: #211d18;
  --review-muted: #766e64;
  --review-line: #d8cec0;
  --review-accent: #184f3e;
  --review-accent-hover: #123e31;
  --review-accent-soft: #dcebe5;
  --review-warm: #a98a60;
  background: radial-gradient(circle at 80% 0%, rgba(169, 138, 96, 0.08), transparent 32%), var(--review-canvas);
  color: var(--review-ink);
}

.review-screen.review-board-active .review-game-layout {
  grid-template-columns: minmax(560px, min(60vw, calc(100vh - 86px))) minmax(420px, 1fr);
  gap: 18px;
}

.review-screen.review-board-active .review-side-panel {
  gap: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--review-line);
  background: transparent;
  padding: 0 0 0 20px;
}

.review-stage[hidden],
.review-workspace-heading [hidden] {
  display: none !important;
}

.review-workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 54px;
  gap: 16px;
  border-bottom: 1px solid var(--review-line);
  padding: 2px 0 10px;
}

.review-workspace-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.review-workspace-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 10px;
}

.review-recent-games-trigger {
  min-height: 34px;
  border: 1px solid var(--review-line);
  border-radius: 7px;
  background: transparent;
  color: var(--review-ink);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.review-recent-games-trigger:hover,
.review-recent-games-trigger:focus-visible {
  border-color: var(--review-accent);
  background: var(--review-accent-soft);
  color: var(--review-accent);
}

.review-workspace-title h1 {
  overflow: hidden;
  margin: 0;
  color: var(--review-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 2.2vw, 36px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-workspace-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 999px;
  background: var(--review-warm);
  color: white;
  font-size: 15px;
}

.review-back-summary {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--review-ink);
  color: white;
  padding: 0;
  font-size: 22px;
  font-weight: 900;
}

.review-step-active .review-workspace-mark {
  display: none;
}

.review-screen.review-board-active .review-mode-switch {
  display: block;
  min-width: min(290px, 44%);
  border: 0;
  background: transparent;
  padding: 0;
}

.review-screen.review-board-active .review-mode-switch > div:first-child {
  display: none;
}

.review-screen.review-board-active .review-mode-switch-buttons {
  gap: 0;
  border: 1px solid #8d8377;
  border-radius: 7px;
  overflow: hidden;
}

.review-screen.review-board-active .review-mode-switch-buttons button {
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--review-ink);
}

.review-screen.review-board-active .review-mode-switch-buttons button.active {
  background: var(--review-ink);
  color: white;
}

.review-summary-stage,
.review-active-stage {
  min-height: 0;
  flex: 1 1 auto;
}

.review-summary-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 16px 4px 0 0;
}

.review-stage-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.review-summary-stage .review-accuracy {
  border: 0;
  border-top: 1px solid var(--review-line);
  border-bottom: 1px solid var(--review-line);
  background: color-mix(in srgb, var(--review-surface) 76%, var(--review-warm) 4%);
  padding: 10px 0;
}

.review-summary-stage .review-accuracy-scores {
  display: grid;
  grid-template-columns: var(--review-quality-columns);
  align-items: center;
  gap: 0;
}

.review-summary-stage .review-accuracy-score:first-child {
  grid-column: 2;
}

.review-summary-stage .review-accuracy-versus {
  grid-column: 3;
}

.review-summary-stage .review-accuracy-score:last-child {
  grid-column: 4;
}

.review-summary-stage .review-accuracy-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  border: 0;
  padding: 0;
}

.review-summary-stage .review-accuracy-pawn {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--review-warm);
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 33px;
  line-height: 1;
}

.review-summary-stage .review-accuracy-score[data-accuracy-color="b"] .review-accuracy-pawn {
  background: var(--review-accent);
}

.review-summary-stage .review-accuracy-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.review-summary-stage .review-accuracy-copy > span:first-child {
  overflow: hidden;
  color: var(--review-ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-summary-stage .review-accuracy-copy > strong {
  color: var(--review-warm);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 2.6vw, 38px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  line-height: 0.98;
}

.review-summary-stage .review-accuracy-score[data-accuracy-color="b"] .review-accuracy-copy > strong {
  color: var(--review-accent);
}

.review-summary-stage .review-accuracy-label {
  margin-top: 3px;
  color: var(--review-muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.review-summary-stage .review-accuracy-meta {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.review-summary-stage .review-accuracy-versus {
  display: grid;
  align-self: stretch;
  place-items: center;
  border-right: 1px solid var(--review-line);
  border-left: 1px solid var(--review-line);
  color: var(--review-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.review-summary-eval-graph {
  order: initial !important;
  display: grid;
  flex: 0 0 auto;
  min-height: 0;
  gap: 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.review-summary-eval-label {
  color: var(--review-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.review-summary-eval-graph svg {
  display: block;
  width: 100%;
  height: clamp(58px, 9vh, 78px);
  border: 1px solid var(--review-line);
  background: #f4f0e8;
}

.review-screen.review-board-active .review-summary-stage .review-summary-eval-graph {
  gap: 5px;
}

.review-screen.review-board-active .review-summary-stage .review-summary-eval-graph svg {
  height: clamp(58px, 9vh, 78px);
}

.review-quality-breakdown {
  --review-quality-columns: minmax(120px, 1fr) minmax(110px, 1fr) 56px minmax(110px, 1fr);
  display: grid;
  flex: 0 0 auto;
  min-height: auto;
  gap: 6px;
}

.review-quality-breakdown-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-quality-breakdown-heading h2 {
  margin: 0;
  color: var(--review-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
}

.review-quality-breakdown-heading button {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid var(--review-line);
  border-radius: 999px;
  background: transparent;
  color: var(--review-muted);
  padding: 0;
  font-weight: 900;
}

.review-quality-breakdown-table {
  display: grid;
  min-height: auto;
}

.review-quality-row {
  display: grid;
  grid-template-columns: var(--review-quality-columns);
  align-items: center;
  min-height: 30px;
  border-bottom: 1px solid color-mix(in srgb, var(--review-line) 72%, transparent);
  color: var(--review-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.review-quality-row > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--review-ink);
  font-weight: 800;
}

.review-quality-row > .review-quality-label {
  justify-content: flex-start;
  padding-left: 8px;
  text-align: left;
}

.review-quality-row > .review-quality-icon {
  min-width: 0;
}

.review-quality-row img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.review-quality-row > strong:nth-child(2) {
  color: var(--review-warm);
}

.review-quality-row > strong:last-child {
  color: var(--review-accent);
}

.review-start-walkthrough,
.review-insight-next {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  gap: 16px;
  border: 1px solid var(--review-accent);
  border-radius: 7px;
  background: var(--review-accent);
  color: white;
  padding: 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(24, 79, 62, 0.14);
  transition: background 160ms ease, transform 160ms ease;
}

.review-start-walkthrough:hover,
.review-insight-next:hover {
  background: var(--review-accent-hover);
  transform: translateY(-1px);
}

.review-start-walkthrough::after,
.review-insight-next::after {
  content: "→";
  font-family: inherit;
}

.review-start-walkthrough > span:last-child,
.review-insight-next > span:last-child {
  display: none;
}

.review-summary-stage .review-board-played-games {
  margin-top: auto;
  border: 1px solid var(--review-line);
  background: rgba(255, 253, 248, 0.58);
  padding: 9px 12px;
}

.review-active-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding: 14px 4px 0 0;
}

.review-move-insight {
  order: 10;
  display: grid;
  flex: 0 0 auto;
  gap: 8px;
  border: 1px solid var(--review-line);
  background: rgba(255, 253, 248, 0.78);
  padding: 10px;
}

.review-move-insight-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.review-move-insight-main img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.review-move-insight h2 {
  margin: 0;
  color: var(--review-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 1.7vw, 28px);
  line-height: 1.15;
  text-transform: none;
}

#review-move-insight-eval {
  min-width: 64px;
  border-radius: 4px;
  background: #eee9e1;
  color: var(--review-ink);
  padding: 7px 9px;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.review-insight-actions {
  display: grid;
  grid-template-columns: minmax(130px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
}

.review-insight-highlights,
.review-insight-next {
  min-height: 44px;
  font-family: inherit;
  font-size: 16px;
}

.review-insight-highlights {
  border-color: var(--review-line);
  background: transparent;
  color: var(--review-ink);
}

.review-insight-highlights:hover,
.review-insight-highlights:focus-visible {
  border-color: var(--review-accent);
  background: var(--review-accent-soft);
  color: var(--review-accent);
}

.review-screen.review-board-active .review-active-stage .review-position-controls {
  order: 20;
  flex: 0 0 auto;
}

.review-screen.review-board-active .review-active-stage .review-move-panel {
  order: 30;
  flex: 1 1 120px;
  min-height: 70px;
  border-color: var(--review-line);
  background: rgba(255, 253, 248, 0.62);
}

.review-screen.review-board-active .review-active-stage .review-analysis {
  order: 40;
  flex: 0 0 auto;
  max-height: 122px;
  border-color: var(--review-line);
  background: rgba(255, 253, 248, 0.62);
}

.review-screen.review-board-active .review-active-stage .review-analysis.review-analysis-lines-only {
  border: 1px solid var(--review-line);
  padding: 7px;
}

.review-screen.review-board-active .review-active-stage .review-eval-graph {
  order: 50;
  flex: 0 0 auto;
  border: 1px solid var(--review-line);
  border-radius: 0;
  background: #3c3934;
}

.review-screen.review-board-active .review-active-stage .review-playback-controls {
  order: 60;
}

.review-screen.review-board-active .review-active-stage .review-guided {
  order: 70;
  flex: 0 0 auto;
  max-height: 210px;
  overflow: auto;
  border-top: 1px solid var(--review-line);
  padding-top: 8px;
}

.review-active-stage .review-guided-heading,
.review-active-stage .review-guided-card > p {
  display: none;
}

.review-active-stage .review-guided-card {
  gap: 6px;
  border-width: 0 0 0 3px;
  border-radius: 0;
  background: transparent;
  padding: 4px 8px;
}

.review-active-stage .review-guided-details,
.review-active-stage .review-guided-story {
  display: none;
}

.review-screen.review-board-active .review-active-stage .review-view-controls {
  order: 80;
  flex: 0 0 auto;
}

.review-screen.review-board-active .review-active-stage .review-accuracy-timeline {
  order: 90;
  flex: 0 0 auto;
}

.review-screen.review-board-active .review-active-stage .review-final-report,
.review-screen.review-board-active .review-active-stage .review-analysis-board-live,
.review-screen.review-board-active .review-active-stage .review-analysis-board-actions {
  order: 100;
  flex: 0 0 auto;
}

.review-playback-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.review-playback-controls button {
  min-height: 46px;
  border: 1px solid var(--review-line);
  border-radius: 7px;
  background: var(--review-surface);
  color: var(--review-ink);
  padding: 0;
  font-size: 20px;
  font-weight: 900;
}

.review-playback-controls button.review-playback-primary {
  border-color: var(--review-accent);
  background: var(--review-accent);
  color: white;
}

.review-playback-controls button:disabled,
.review-insight-next:disabled,
.review-start-walkthrough:disabled {
  cursor: default;
  opacity: 0.4;
  transform: none;
}

.review-screen.review-board-active .review-move-button.current {
  background: var(--review-accent);
  color: white;
}

.review-screen.review-board-active .review-board-wrap {
  border-color: #34291f;
  box-shadow: 0 14px 32px rgba(47, 34, 23, 0.2);
}

.review-screen.review-board-active .review-board .square.light {
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.12), rgba(120, 83, 47, 0.03)), #ead7b6;
}

.review-screen.review-board-active .review-board .square.dark {
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.05), rgba(58, 37, 20, 0.08)), #8d6849;
}

.review-screen.review-board-active.review-summary-active .review-arrow-layer {
  display: none;
}

.review-screen.review-board-active.review-guided-active.review-step-active .review-board-area {
  --review-board-size: min(calc(100% - 38px), calc(100vh - 168px));
  grid-template-columns: 26px minmax(0, 1fr);
  grid-template-areas:
    ". review-top-player"
    "review-eval review-board"
    ". review-bottom-player";
}

.review-screen.review-board-active.review-guided-active.review-step-active .review-eval-bar {
  display: block;
}

.review-screen.review-board-active.review-guided-active.review-step-active .review-analysis,
.review-screen.review-board-active.review-guided-active.review-step-active .review-eval-graph,
.review-screen.review-board-active.review-guided-active.review-step-active .review-view-controls,
.review-screen.review-board-active.review-guided-active.review-step-active .review-accuracy-timeline {
  display: grid;
}

.review-screen.review-board-active.review-guided-active.review-step-active .review-move-panel {
  display: flex;
}

.review-screen.review-board-active.review-legend-open .review-label-legend {
  display: block !important;
  position: fixed;
  z-index: 80;
  top: 12vh;
  right: 8vw;
  left: 8vw;
  max-width: 720px;
  max-height: 76vh;
  overflow: auto;
  margin: auto;
  border: 1px solid #75695d;
  border-radius: 10px;
  background: var(--review-surface);
  padding: 18px;
  box-shadow: 0 24px 80px rgba(33, 29, 24, 0.32);
}

@media (max-width: 1120px) {
  .review-screen.review-board-active .review-game-layout {
    grid-template-columns: minmax(480px, 56vw) minmax(380px, 1fr);
  }

  .review-workspace-title h1 {
    font-size: 26px;
  }

  .review-screen.review-board-active .review-mode-switch {
    min-width: 230px;
  }
}

@media (max-width: 900px) {
  .review-screen.review-board-active .review-game-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .review-screen.review-board-active .review-board-panel,
  .review-screen.review-board-active .review-side-panel {
    max-height: none;
    overflow: visible;
  }

  .review-screen.review-board-active .review-side-panel {
    border-top: 1px solid var(--review-line);
    border-left: 0;
    padding: 14px 0 0;
  }

  .review-summary-stage,
  .review-active-stage {
    overflow: visible;
  }

  .review-active-stage .review-move-panel {
    flex-basis: auto;
  }

  .review-screen.review-board-active .review-move-list {
    max-height: 300px;
  }
}

@media (max-width: 620px) {
  .review-screen.review-board-active {
    padding: 8px;
  }

  .review-workspace-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .review-workspace-tools {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .review-recent-games-trigger {
    min-height: 44px;
    width: 100%;
  }

  .review-import-pgn-button {
    min-height: 44px;
    width: 100%;
  }

  .review-workspace-title h1 {
    font-size: 25px;
  }

  .review-screen.review-board-active .review-mode-switch {
    width: 100%;
    min-width: 0;
  }

  .review-summary-stage,
  .review-active-stage {
    padding-right: 0;
  }

  .review-summary-stage .review-accuracy {
    padding-inline: 0;
  }

  .review-quality-breakdown {
    --review-quality-columns: minmax(82px, 0.8fr) minmax(104px, 1fr) 34px minmax(104px, 1fr);
  }

  .review-summary-stage .review-accuracy-score {
    gap: 7px;
  }

  .review-summary-stage .review-accuracy-pawn {
    width: 36px;
    height: 36px;
    font-size: 26px;
  }

  .review-summary-stage .review-accuracy-copy > strong {
    font-size: 26px;
  }

  .review-summary-stage .review-accuracy-copy > span:first-child {
    font-size: 11px;
  }

  .review-start-walkthrough {
    position: static;
    min-height: 54px;
    font-size: 21px;
  }

  .review-move-insight-main {
    grid-template-columns: auto minmax(0, 1fr);
  }

  #review-move-insight-eval {
    grid-column: 2;
    justify-self: start;
  }

  .review-insight-actions {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  }

  .review-insight-highlights,
  .review-insight-next {
    min-height: 48px;
  }

  .review-screen.review-board-active .review-position-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-screen.review-board-active .review-position-controls strong {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .review-playback-controls button {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .review-start-walkthrough,
  .review-insight-highlights,
  .review-insight-next {
    transition: none;
  }
}
