:root {
  --bg: #121110;
  --panel: #1e1c1a;
  --card: #262421;
  --text: #ece8e1;
  --muted: #9e9a93;
  --accent: #81b64c;
  --accent-2: #c0a45c;
  --danger: #c44d4d;
  --light: #f0d9b5;
  --dark: #b58863;
  --last: rgba(186, 202, 68, 0.72);
  --selected: #829769;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #2a2418 0%, transparent 50%),
    var(--bg);
  color: var(--text);
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.site-top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px;
  background: #161512;
  border-bottom: 1px solid #000a;
  box-shadow: 0 2px 12px #0006;
  overflow: visible;
}

.site-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 6px 10px 6px 4px;
  flex: 0 0 auto;
  min-width: 0;
}

.site-logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
}

.site-profile {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.site-profile strong {
  color: var(--accent-2);
  font-weight: 650;
}

.app-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  flex: 1;
  min-height: 0;
}

.panel {
  background: var(--panel);
  padding: 18px 18px 24px;
  border-right: 1px solid #0008;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
}
.muted { color: var(--muted); margin: 6px 0 0; font-size: 13px; }
.hidden { display: none !important; }

.filters { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
input, select, button {
  font: inherit;
  color: var(--text);
}
input[type="number"],
input[type="text"],
input[type="password"],
input[type="search"],
select {
  background: #141312;
  border: 1px solid #3a3732;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
}
input::placeholder {
  color: #7a7670;
}
.rating-row { display: flex; align-items: center; gap: 8px; }
.rating-row input { width: 100%; }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; }

button {
  background: #3a3732;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { opacity: 0.45; cursor: default; }
.primary {
  background: var(--accent);
  color: #102008;
  font-weight: 700;
}
.mode-row {
  display: flex;
  gap: 8px;
}
.mode-row button { flex: 1; }
.climb-start {
  background: #4a3d1f;
  color: var(--accent-2);
  font-weight: 700;
}
.climb-panel {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.climb-panel .turn { margin: 0; }
.climb-panel button { width: 100%; }
.climb-last { margin: 0; font-size: 13px; }
.climb-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
}
.climb-bar strong { color: var(--accent); }

.woodpecker-bar {
  align-items: center;
  flex-wrap: wrap;
}
.woodpecker-bar .ghost-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 4px 8px;
}
.woodpecker-bar .ghost-btn:hover { color: var(--text); }
.woodpecker-bar #woodpecker-hall-btn {
  margin-left: auto;
}
.woodpecker-bar-timer {
  font-variant-numeric: tabular-nums;
}
.woodpecker-bar-timer strong {
  color: var(--accent-2);
}

.woodpecker-panel {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  flex: 1;
}
.woodpecker-panel-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.woodpecker-panel .turn {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.woodpecker-lead {
  margin: 0;
  line-height: 1.45;
  font-size: 14px;
}
.woodpecker-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.woodpecker-stat {
  min-width: 0;
  background: #1a1816;
  border: 1px solid #35312c;
  border-radius: 12px;
  padding: 12px 14px;
}
.woodpecker-stat-wide {
  grid-column: 1 / -1;
}
.woodpecker-stat span {
  display: block;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.woodpecker-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 750;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.woodpecker-auto-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.woodpecker-auto {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  background: #1a1816;
  border: 1px solid #35312c;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 750;
  font-size: 16px;
  color: var(--text);
}
.woodpecker-auto > span:first-child {
  flex: 1;
  min-width: 0;
}
.woodpecker-auto input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.woodpecker-auto input:checked + .growth-auto-track {
  background: var(--accent);
}
.woodpecker-auto input:checked + .growth-auto-track::after {
  transform: translateX(18px);
}
.woodpecker-auto:hover {
  border-color: #4a453d;
}
.woodpecker-auto:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 50%, #35312c);
}
.woodpecker-next {
  width: 100%;
  min-height: 46px;
  font-size: 16px;
  font-weight: 750;
  border-radius: 12px;
}
.woodpecker-stat-wide strong {
  font-size: 17px;
}

.woodpecker-timer-card {
  background: linear-gradient(165deg, #fff4c2 0%, #f0d56a 100%);
  border: 2px solid #d4b04a;
  border-radius: 14px;
  padding: 14px 16px 16px;
  color: #1a1608;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.woodpecker-timer-label {
  font-size: 14px;
  font-weight: 700;
  color: #5a4a18;
  letter-spacing: 0.02em;
}
.woodpecker-timer-value {
  margin-top: 4px;
  font-size: clamp(2.4rem, 4vw, 2.9rem);
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: #1a1a1a;
}
body.woodpecker-timer-paused .woodpecker-timer-value {
  opacity: 0.72;
}
.woodpecker-timer-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.woodpecker-timer-controls button {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid #c9a63a;
  background: rgba(255, 255, 255, 0.55);
  color: #1a1608;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.woodpecker-timer-controls button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.85);
}
.woodpecker-timer-controls button:disabled {
  opacity: 0.5;
  cursor: default;
}

.woodpecker-cycles {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
}
.woodpecker-cycles-title {
  margin: 0;
  font-size: 19px;
  font-weight: 750;
}
.woodpecker-cycles-scroll {
  width: 100%;
  overflow: hidden;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.woodpecker-cycle-head,
.woodpecker-cycle-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1.2fr) minmax(0, 1.1fr) minmax(0, 1.1fr) 36px;
  gap: 6px;
  align-items: center;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}
.woodpecker-cycle-head {
  background: #322f2b;
  border-radius: 10px;
  padding: 12px 10px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.woodpecker-cycles-list {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: none;
  flex: 1;
  min-height: 120px;
  padding-right: 4px;
}
.woodpecker-cycles-empty {
  margin: 16px 6px;
  font-size: 15px;
}
.woodpecker-cycle-row {
  padding: 14px 10px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: #1f1d1a;
  border: 2px solid #3a3530;
  font-weight: 750;
  font-size: 17px;
  color: var(--text);
}
.woodpecker-cycle-row:last-child {
  margin-bottom: 0;
}
.woodpecker-cycle-row.is-current {
  background: #3a3218;
  border-color: #c0a45c;
  color: #f0e2a8;
  box-shadow: inset 0 0 0 1px rgba(192, 164, 92, 0.25);
}
.woodpecker-cycle-row.is-done {
  background: #1e2a1a;
  border-color: #5a8a3a;
  color: #b7e08a;
}
.woodpecker-cycles-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  background: #2a2723;
  border-radius: 12px;
  padding: 14px 12px;
  color: var(--text);
}
.woodpecker-cycles-totals > div,
.woodpecker-compact-stats > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.woodpecker-cycles-totals .muted,
.woodpecker-compact-stats .muted {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.woodpecker-cycles-totals strong,
.woodpecker-compact-stats strong {
  font-size: 18px;
  font-weight: 750;
  line-height: 1.2;
}
.woodpecker-compact-stats {
  background: #232a32;
  border: 1px solid #2f3a46;
  border-radius: 12px;
  padding: 14px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
}
.woodpecker-smart-badge {
  font-weight: 650;
  font-size: 13px;
  color: var(--muted);
}
.woodpecker-mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 4px 0;
}
.woodpecker-mode-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  cursor: help;
  user-select: none;
}
.woodpecker-mode-label.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.woodpecker-mode-label input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
  cursor: inherit;
}
.woodpecker-smart-restore {
  margin-left: auto;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #3a4a3a;
  background: #1e2a1e;
  color: #cfe8c0;
  font-weight: 650;
  font-size: 13px;
  cursor: pointer;
}
.woodpecker-smart-restore:hover:not(:disabled) {
  border-color: var(--accent);
}
.woodpecker-smart-restore:disabled {
  opacity: 0.55;
  cursor: default;
}
.woodpecker-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}
.woodpecker-actions button {
  width: 100%;
  min-height: 46px;
  font-size: 15px;
  font-weight: 650;
  border-radius: 10px;
}

body.woodpecker-zen .woodpecker-zen-hide,
body.woodpecker-zen .woodpecker-stat-zen-hide {
  display: none !important;
}
body.woodpecker-zen .woodpecker-compact-stats {
  grid-template-columns: 1fr;
}
body.woodpecker-zen .woodpecker-stat-cycle {
  text-align: left;
  padding: 2px 4px;
}
body.woodpecker-zen .woodpecker-stat-cycle strong {
  font-size: 22px;
}

.woodpecker-inspect-btn {
  align-self: flex-start;
  margin-top: 2px;
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid #5a4a28;
  background: #2a2418;
  color: #e6d18a;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.woodpecker-inspect-btn:hover {
  border-color: var(--accent-2);
  color: #fff8e4;
}
.woodpecker-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 68vh;
}
.woodpecker-editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.woodpecker-editor-bar h3 {
  margin: 0;
  font-size: 18px;
}
.woodpecker-editor-search input {
  min-width: 220px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid #3a3228;
  background: #12100e;
  color: var(--text);
  font: inherit;
}
.woodpecker-editor-body {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.woodpecker-editor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(70vh, 720px);
  overflow: auto;
  border: 1px solid #3a3228;
  border-radius: 10px;
  background: #161410;
}
.wp-editor-task {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid #2a2622;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.wp-editor-task:hover,
.wp-editor-task.is-active {
  background: #2a2418;
  color: var(--accent-2);
}
.woodpecker-editor-side h3 {
  margin: 0 0 10px;
}
.woodpecker-editor-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 46rem;
}
.woodpecker-editor-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.woodpecker-editor-form input,
.woodpecker-editor-form textarea {
  font: inherit;
  color: var(--text);
  background: #12100e;
  border: 1px solid #3a3228;
  border-radius: 8px;
  padding: 8px 10px;
}
.woodpecker-editor-form textarea {
  min-height: 72px;
  resize: vertical;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}
.woodpecker-editor-form .wp-editor-moves {
  min-height: 160px;
}
.woodpecker-editor-note {
  margin: 0;
}
.woodpecker-editor-status {
  min-height: 1.2em;
  margin: 0;
}
.woodpecker-editor-status.is-ok {
  color: var(--accent);
}
.woodpecker-editor-status.is-bad {
  color: #f0b0b0;
}
@media (max-width: 720px) {
  .woodpecker-editor-body {
    grid-template-columns: 1fr;
  }
  .woodpecker-editor-list {
    max-height: 220px;
  }
}
.woodpecker-level-card {
  text-align: left;
  width: 100%;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid #3a3228;
  background: linear-gradient(165deg, #1c1915 0%, #141210 100%);
  color: inherit;
  font: inherit;
  border-radius: 12px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.woodpecker-level-main {
  text-align: left;
  cursor: pointer;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
}
.woodpecker-level-card::before {
  content: "";
  position: absolute;
  inset: auto -24px -36px auto;
  width: 110px;
  height: 110px;
  background: radial-gradient(circle, rgba(192, 164, 92, 0.22) 0%, transparent 70%);
  pointer-events: none;
}
.woodpecker-level-card.is-started {
  border-color: #4a4030;
}
.woodpecker-level-card:hover {
  border-color: var(--accent, #c9a63a);
  background: linear-gradient(165deg, #221e18 0%, #181410 100%);
}
.woodpecker-level-card:hover .woodpecker-level-go {
  color: var(--accent, #c9a63a);
  transform: translateX(2px);
}

.storm-panel {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.storm-panel .turn { margin: 0; }
.storm-panel button { width: 100%; }
.storm-panel .streak-cascade-toggle {
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}
.storm-play-pane {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.storm-play-lobby {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
}
.storm-play-lobby.hidden {
  display: none !important;
}
/* Storm cheatsheet: left lobby column under the usual storm UI. */
.storm-cascade-host {
  flex: 1 1 auto;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.storm-cascade-host.hidden {
  display: none !important;
}
.storm-cascade-host .streak-cascade {
  flex: 1 1 auto;
  min-height: 0;
}
.storm-cascade-host .streak-cascade-head {
  flex-wrap: nowrap;
  gap: 8px;
}
.storm-cascade-host .streak-cascade-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.storm-cascade-host .streak-cascade.is-collapsed .streak-cascade-head {
  flex-wrap: nowrap;
}
.storm-cascade-host .streak-cascade.is-collapsed .streak-cascade-toggle {
  flex: 0 0 auto;
  width: auto;
}
.storm-cascade-host .streak-cascade-list li {
  flex: 1 1 0;
  min-height: 1.95rem;
  font-size: 0.96rem;
  padding: 3px 5px;
  gap: 6px;
}
/* Live storm: keep the left column usable for lobby + cheatsheet. */
body.storm-live .app-body > .panel {
  overflow: auto;
}
body.storm-live .app-body > .panel > :not(#storm-panel) {
  display: none !important;
}
body.storm-live #storm-panel {
  flex: 1 1 auto;
  min-height: 0;
}
body.storm-live .storm-play-pane {
  flex: 1 1 auto;
  min-height: 0;
}
.storm-rules {
  margin: 0;
  padding-left: 1.1em;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.92rem;
}
.storm-skip-srs {
  margin-top: 2px;
  font-size: 0.92rem;
  align-items: flex-start;
}
.storm-skip-srs .growth-auto-track {
  margin-top: 1px;
}

/* Lichess-like Puzzle Storm HUD (puz-side) */
.storm-hud {
  --storm-brag: #d38d27;
  --storm-good: #629924;
  --storm-bar: #3c3934;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 2.2vh 1.2vw;
  margin: 0;
  background: var(--card);
  border-radius: 6px;
  min-height: min(560px, 72vh);
  align-self: stretch;
}
.storm-hud.hidden { display: none; }
.storm-hud-top {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.storm-hud-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  color: var(--storm-brag);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--storm-brag) 55%, transparent));
}
.storm-hud-icon img,
.storm-hud-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}
.storm-hud-start {
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.storm-hud.is-awaiting-start .storm-hud-start {
  display: flex;
}
.storm-hud.is-awaiting-start .storm-hud-score,
.storm-hud.is-awaiting-start .storm-pov {
  display: none;
}
.storm-hud-title {
  color: var(--storm-brag);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.15;
}
.storm-hud-start-text {
  margin: 0;
  max-width: 9.2em;
  color: var(--storm-brag);
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.25;
}
.storm-hud-score {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  font-size: clamp(3rem, 5.5vw, 4.6rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.04em;
  color: var(--storm-brag);
  text-shadow: 0 0 12px color-mix(in srgb, var(--storm-brag) 45%, transparent);
  font-variant-numeric: tabular-nums;
}
.storm-hud.storm-mod-puzzle .storm-hud-score {
  text-shadow: 0 0 16px #fff8, 0 0 12px color-mix(in srgb, var(--storm-brag) 55%, transparent);
}
.storm-clock-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: 1 1 auto;
  justify-content: center;
}
.storm-clock {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  font-size: clamp(2.8rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: color 0.3s;
}
.storm-clock.warn { color: #e6b35a; }
.storm-clock.danger { color: var(--danger, #e35d6a); }
body.storm-frozen .storm-clock-wrap {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 4px 8px 6px;
  border-radius: 12px;
  background: rgba(120, 190, 220, 0.1);
  box-shadow: 0 0 22px rgba(140, 210, 255, 0.28), inset 0 0 0 1px rgba(190, 230, 255, 0.4);
}
.storm-clock.is-frozen {
  color: #d7f3ff;
  text-shadow: 0 0 18px rgba(140, 210, 255, 0.9);
  animation: storm-clock-freeze 1.5s ease-in-out infinite;
}
@keyframes storm-clock-freeze {
  0%, 100% { text-shadow: 0 0 12px rgba(140, 210, 255, 0.55); }
  50% { text-shadow: 0 0 22px rgba(210, 240, 255, 1); }
}
.storm-freeze-label {
  margin: 2px 0 0;
  color: #9fd4f2;
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: 0.04em;
}
.storm-freeze-label.hidden { display: none; }
body.storm-frozen .storm-pov { display: none; }
.storm-mod {
  position: absolute;
  left: 58%;
  top: 0.1em;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
}
.storm-mod.bonus,
.storm-mod.malus {
  opacity: 1;
  animation: storm-mod-fade 1.1s ease-out forwards;
}
.storm-mod.bonus { color: var(--storm-good); }
.storm-mod.malus { color: var(--danger, #c33); }
@keyframes storm-mod-fade {
  from { transform: translateY(-6px); opacity: 1; }
  to { transform: translateY(-28px); opacity: 0; }
}
.storm-pov {
  margin: 0;
  color: var(--storm-brag);
  font-size: 0.95rem;
  line-height: 1.3;
  max-width: 18em;
}
.storm-hud.is-ticking .storm-pov { display: none; }

.storm-theme-hint {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
}
.storm-theme-hint.hidden { display: none; }
.storm-theme-hint-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: center;
}
.storm-theme-hint.is-revealed .storm-theme-hint-btn {
  cursor: default;
}
.storm-theme-hint-kicker {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--storm-brag) 88%, white);
}
.storm-theme-hint-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
}
.storm-theme-hint.is-blurred .storm-theme-hint-tags {
  filter: blur(8px);
  user-select: none;
  pointer-events: none;
}
.storm-theme-hint.is-blurred:hover .storm-theme-hint-tags,
.storm-theme-hint.is-blurred:focus-within .storm-theme-hint-tags {
  filter: blur(5px);
}
.storm-theme-tag {
  display: inline-flex;
  align-items: center;
  background: #2a241c;
  color: #f0d7a8;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--storm-brag) 35%, transparent);
}
.storm-theme-hint.is-blurred {
  /* Keep visible even if entrance animation fails to restart after display:none. */
  opacity: 1;
  animation: storm-theme-hint-in 0.28s ease-out;
}
@keyframes storm-theme-hint-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.storm-hud-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
}
.storm-controls {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.storm-ctrl {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #ffffff14;
  background: #ffffff0a;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.storm-ctrl svg { display: block; }
.storm-ctrl:hover { color: var(--text); background: #ffffff14; }
.storm-ctrl.active {
  color: var(--storm-brag);
  border-color: color-mix(in srgb, var(--storm-brag) 50%, transparent);
}

.storm-combo {
  display: flex;
  flex-flow: row nowrap;
  align-items: stretch;
  gap: 10px;
}
.storm-combo-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 2.6ch;
  transition: color 0.1s;
}
.storm-hud.storm-mod-move .storm-combo-counter { color: var(--storm-brag); }
.storm-combo-value {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 2rem;
  font-weight: 700;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}
.storm-combo-label {
  font-size: 0.72rem;
  letter-spacing: -0.02em;
  color: var(--muted);
  text-transform: uppercase;
}
.storm-combo-bars {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.storm-combo-bar {
  position: relative;
  height: 2rem;
  border-radius: 4px;
  background: var(--storm-bar);
  border: 1px solid #ffffff12;
  overflow: hidden;
}
.storm-combo-fill,
.storm-combo-full {
  position: absolute;
  inset-inline-start: 0;
  bottom: 0;
  height: 100%;
  border-radius: inherit;
}
.storm-combo-fill {
  width: 0%;
  background: var(--storm-brag);
  box-shadow: 0 0 14px color-mix(in srgb, var(--storm-brag) 70%, transparent);
  transition: width 0.45s ease-in-out, background 0.3s;
}
.storm-hud.storm-mod-malus-slow .storm-combo-fill {
  background: var(--danger, #c33);
  box-shadow: 0 0 12px #c33, 0 0 20px #c338;
}
.storm-hud.storm-mod-bonus-slow .storm-combo-fill { display: none; }
.storm-combo-full {
  width: 100%;
  display: none;
  background: #1b78d0;
  box-shadow: 0 0 10px #1b78d0, 0 0 20px #1b78d0;
  opacity: 0;
}
.storm-hud.storm-mod-bonus-slow .storm-combo-full {
  display: block;
  animation: storm-bar-full 0.9s ease-in-out;
}
@keyframes storm-bar-full {
  from { opacity: 1; }
  to { opacity: 0; }
}
.storm-combo-levels {
  display: flex;
  margin-top: 0.35rem;
  margin-inline-start: -0.35rem;
}
.storm-combo-level {
  flex: 0 0 21%;
  margin-inline-end: 4%;
  height: 1.45em;
  line-height: 1.45em;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  background: #2a2824;
  border: 1px solid #ffffff14;
  transform: skewX(-30deg);
}
.storm-combo-level span {
  display: block;
  transform: skewX(30deg);
}
.storm-combo-level.active {
  color: #fff;
  border-color: #1b78d0;
  box-shadow: 0 0 10px #1b78d088;
  background: color-mix(in srgb, #1b78d0 72%, #000);
}
.storm-combo-level.active:nth-child(2) { background: #1b78d0; }
.storm-combo-level.active:nth-child(3) { background: color-mix(in srgb, #1b78d0 70%, #fff); color: #111; }
.storm-combo-level.active:nth-child(4) { background: color-mix(in srgb, #1b78d0 45%, #fff); color: #111; }

.storm-history {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 0;
}
.storm-end {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 16px 14px;
  border-radius: 10px;
  background: #161512;
  border: 1px solid #ffffff12;
  box-sizing: border-box;
  align-self: stretch;
  max-height: var(--cg-height, 80vmin);
  overflow: auto;
}
.storm-end.hidden { display: none !important; }
.storm-end-high {
  padding: 10px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, #3d2e12, #2a2418);
  border: 1px solid #cfa23a55;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.storm-end-high strong {
  color: #e8c36a;
  font-size: 0.95rem;
}
.storm-end-high span {
  color: var(--muted);
  font-size: 0.8rem;
}
.storm-end-score {
  text-align: center;
  padding: 8px 0 4px;
}
.storm-end-score-number {
  display: block;
  font-size: clamp(2.8rem, 8vw, 4.2rem);
  font-weight: 800;
  line-height: 1;
  color: var(--storm-brag, #e8a838);
  letter-spacing: -0.03em;
}
.storm-end-score-label {
  margin: 6px 0 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}
.storm-end-stats {
  border-radius: 8px;
  background: #1c1a17;
  border: 1px solid #ffffff10;
  overflow: hidden;
}
.storm-end-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.storm-end-table th,
.storm-end-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #ffffff0c;
}
.storm-end-table tr:last-child th,
.storm-end-table tr:last-child td {
  border-bottom: 0;
}
.storm-end-table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
}
.storm-end-table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--text);
}
.storm-play-again {
  width: 100%;
}
.storm-end-history {
  margin-top: 2px;
}
.storm-result {
  margin: 6px 0 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--card);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "kicker kicker"
    "score actions"
    "meta actions";
  gap: 4px 14px;
  align-items: center;
}
.storm-result.hidden { display: none !important; }
.storm-result-kicker {
  grid-area: kicker;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: var(--muted);
}
.storm-result-score {
  grid-area: score;
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}
.storm-result .meta-grid {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
}
.storm-result .meta-grid > div {
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.storm-result .mode-row {
  grid-area: actions;
  margin: 0;
  display: flex;
  justify-content: flex-end;
}
.storm-result .mode-row button {
  min-width: 7.5rem;
  padding: 8px 14px;
}
body.storm-live .storm-hud {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--storm-brag) 35%, transparent);
}

.streak-hud-label {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
}
.streak-hud .storm-hud-score {
  color: #1b78d0;
  text-shadow: 0 0 12px #1b78d066;
  font-size: clamp(2.6rem, 5vw, 3.6rem);
  line-height: 1;
}
.streak-hud-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 auto;
  justify-content: flex-start;
  padding-top: 6px;
  min-height: 0;
}
.streak-hud-meta > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #1c1a17;
  border: 1px solid #ffffff0c;
}
.streak-hud-meta > div .muted {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.streak-hud-meta > div strong {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #e8e4dc;
  font-variant-numeric: tabular-nums;
}
.streak-hud-hint { margin: 0; line-height: 1.45; font-size: 0.86rem; }
.streak-skip-btn { width: 100%; }
.streak-skip-btn.used {
  opacity: 0.55;
  background: #ffffff14;
  color: var(--muted);
}
.streak-hud-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  flex: 0 0 auto;
}
.streak-cascade {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.streak-cascade.is-collapsed {
  flex: 0 0 auto;
}
.streak-cascade-card {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  padding: 14px 12px 12px;
  border-radius: 12px;
  background: #121612;
  border: 1px solid #8a7a4a66;
}
.streak-cascade.is-collapsed .streak-cascade-card {
  flex: 0 0 auto;
}
.streak-cascade-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.streak-cascade-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3d8bfd;
  box-shadow: 0 0 8px #3d8bfd99;
  flex: 0 0 auto;
}
.streak-cascade-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  color: #d7d2c8;
  line-height: 1.15;
}
.streak-cascade-toggle {
  flex: 0 0 auto;
  border: 1px solid #ffffff18;
  background: #ffffff10;
  color: #d7d2c8;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}
.streak-cascade-toggle:hover:not(:disabled) {
  background: #ffffff1c;
  color: #fff;
}
.streak-cascade-lead {
  margin: 8px 0 10px;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--muted);
  flex: 0 0 auto;
}
.streak-cascade.is-collapsed .streak-cascade-card {
  padding: 8px 10px;
}
.streak-cascade.is-collapsed .streak-cascade-head {
  flex-wrap: wrap;
  row-gap: 6px;
}
.streak-cascade.is-collapsed .streak-cascade-title {
  white-space: nowrap;
}
.streak-cascade.is-collapsed .streak-cascade-toggle {
  flex: 1 1 100%;
  text-align: center;
}
.streak-cascade-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.streak-cascade-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-height: 2.5rem;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 0.98rem;
  line-height: 1.2;
  color: #e8e4dc;
}
.streak-cascade-n {
  flex: 0 0 1.45rem;
  color: #9e9a93;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.streak-cascade-ico {
  flex: 0 0 1.2rem;
  width: 1.2rem;
  height: 1.2rem;
  display: flex;
}
.streak-cascade-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}
.streak-cascade-name {
  flex: 1 1 auto;
  min-width: 0;
}
@media (max-width: 900px) {
  .streak-cascade {
    flex: 0 1 auto;
    max-height: 70vh;
  }
  .streak-cascade-list li {
    flex: 0 0 auto;
  }
}
.streak-continue {
  margin-top: 10px;
  flex: 0 0 auto;
}
.streak-auto-live {
  margin: 4px 0 8px;
  align-self: stretch;
  width: 100%;
  box-sizing: border-box;
}
.streak-hud > .streak-auto-live {
  flex: 0 0 auto;
}
.streak-hud.storm-hud {
  /* Match the board height without stretching the grid row.
     stretch let the cheatsheet's min-content grow the row, and the board
     grid then painted a second height. */
  justify-content: flex-start;
  min-height: 0;
  height: var(--board-align-h, auto);
  max-height: var(--board-align-h, min(100%, 640px));
  align-self: start;
  box-sizing: border-box;
  overflow: hidden;
}
body.streak-live .streak-hud {
  box-shadow: inset 0 0 0 1px #1b78d055;
}
body.streak-live #meta {
  display: none !important;
}
body.streak-live #status,
body.storm-live #status {
  display: none !important;
}

/* Streak lobby: no leftover engine/moves column under the board. */
.play-main.is-streak:not(.is-streak-live):not(.is-streak-ended) .move-panel,
.play-main.is-streak:not(.is-streak-live):not(.is-streak-ended) #eval-bar,
.play-main.is-streak:not(.is-streak-live):not(.is-streak-ended) #review-panel {
  display: none !important;
}

@media (max-width: 900px) {
  .app-body {
    grid-template-columns: 1fr;
  }
  .site-top {
    flex-wrap: wrap;
    min-height: 0;
    padding-bottom: 4px;
  }
  .site-brand {
    width: 100%;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
  }
  .tabs {
    width: 100%;
    min-height: 42px;
  }
  .play-main.is-storm,
  .play-main.is-streak,
  .play-main.is-storm-srs,
  .play-main.is-exam {
    grid-template-columns: 1fr;
  }
  .storm-hud {
    min-height: 0;
    order: -1;
  }
  .storm-srs-rail {
    order: -1;
  }
}

.growth-panel {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-panel {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-panel .turn { margin: 0; }
.settings-fieldset {
  margin: 0;
  padding: 12px;
  border: 1px solid #3a342c;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-fieldset legend {
  padding: 0 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.settings-lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}
.settings-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border-radius: 8px;
  background: #12100e;
  cursor: pointer;
}
.settings-option:hover {
  background: #1a1714;
}
.settings-option input {
  margin-top: 3px;
}
.settings-option strong {
  display: block;
  font-size: 14px;
}
.settings-option small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.settings-danger-btn {
  width: 100%;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid #6a3030;
  border-radius: 8px;
  background: #2a1616;
  color: #f0c0c0;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.settings-danger-btn:hover:not(:disabled) {
  background: #3a1c1c;
  border-color: #8a4040;
  color: #ffe0e0;
}
.settings-danger-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}
.growth-panel .turn { margin: 0; }
.growth-panel button { width: 100%; }
.meta-tactics .blind-delta,
.meta-tactics-only .blind-delta {
  font-variant-numeric: tabular-nums;
}
/* Tactics + delta only in growth/warmup (replaces the old weaknesses tree). */
#meta:not(.is-tactics) .meta-tactics-only {
  display: none;
}
/* Rating on its own row; Тактика · Изменение side by side. */
#meta.is-tactics .meta-grid > div:first-child {
  grid-column: 1 / -1;
}
.blind-streak {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
    #1a1816;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, #3a3732);
  cursor: help;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}
.blind-streak:hover,
.blind-streak:focus-visible {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 48%, #3a3732),
    0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.blind-streak.is-idle {
  background: #1a1816;
  box-shadow: inset 0 0 0 1px #3a3732;
}
.blind-streak.is-hot {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    #1a1816;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 42%, #3a3732);
}
.blind-streak.is-locked {
  opacity: 0.78;
}
.blind-streak-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.blind-streak-label {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--accent) 72%, var(--text));
}
.blind-streak.is-idle .blind-streak-label {
  color: var(--muted);
}
.blind-streak-count {
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 750;
  color: var(--accent);
}
.blind-streak.is-idle .blind-streak-count {
  color: var(--muted);
}
.blind-streak-track {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
}
.blind-streak-seg {
  height: 7px;
  border-radius: 999px;
  background: #3a3732;
  transition: background 0.18s ease, transform 0.18s ease;
}
.blind-streak-seg.is-on {
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 45%, transparent);
}
.blind-streak.is-hot .blind-streak-seg.is-on {
  background: color-mix(in srgb, var(--accent) 82%, #d8ff9a);
}
.blind-lock-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 2px;
  cursor: pointer;
}
.blind-lock-row:hover .blind-lock-label {
  color: var(--accent, #c0a45c);
}
.growth-panel .blind-lock-row .ceval-switch {
  margin-top: 2px;
  width: 34px;
  flex: 0 0 auto;
}
.blind-lock-label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
  color: var(--text);
  font-size: 0.92rem;
}
.growth-bar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}
.growth-bar strong { color: var(--accent); }
.growth-bar .blind-delta {
  margin-left: 0.25em;
  font-variant-numeric: tabular-nums;
}
.growth-bar .blind-delta:empty { display: none; }
.rewind-bar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}
.rewind-bar strong { color: var(--accent); }
.rewind-panel .turn { margin: 0 0 4px; }
.move-san.board-ply {
  background: color-mix(in srgb, #3b82f6 55%, transparent);
  border-radius: 3px;
}
.move-san.mental-ply {
  outline: 1px solid color-mix(in srgb, #c4a574 80%, #fff 20%);
  outline-offset: 1px;
  border-radius: 3px;
}
.growth-fatigue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--card) 88%, #c4a574 12%);
  border: 1px solid color-mix(in srgb, transparent 70%, #c4a574);
  font-size: 12px;
  line-height: 1.35;
  color: color-mix(in srgb, var(--text) 78%, transparent);
  animation: growth-fatigue-in 0.45s ease-out;
}
.growth-fatigue.hidden { display: none; }
.growth-fatigue-text { flex: 1; min-width: 0; }
.growth-fatigue-dismiss {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  padding: 2px 4px;
  margin: 0;
  font: inherit;
  font-size: 12px;
  color: color-mix(in srgb, var(--text) 55%, transparent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.growth-fatigue-dismiss:hover {
  color: var(--text);
}
@keyframes growth-fatigue-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.theme-reveal {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.theme-reveal.is-blurred #growth-bar-theme {
  filter: blur(8px);
  user-select: none;
  pointer-events: none;
}
.theme-reveal.is-blurred:hover #growth-bar-theme {
  filter: blur(5px);
}
.sq.hint-from {
  box-shadow: inset 0 0 0 4px #e8c56a, 0 0 16px rgba(232, 197, 106, 0.55);
}
.sq.hint-from img.piece {
  filter: drop-shadow(0 0 8px #ffe08a);
}
.growth-tree { display: flex; flex-direction: column; gap: 8px; }
.growth-weak-rail {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.growth-weak-rail.hidden { display: none; }
/* Never show weak themes outside tactical growth/warmup. */
body:not(.growth-focus) #growth-weak-rail {
  display: none !important;
}
.growth-weak-rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.growth-weak-rail-title {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--muted, #9a9590);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.growth-weak-rail-all {
  border: 0;
  background: none;
  color: var(--accent-2, #c0a45c);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.growth-weak-rail-all:hover {
  color: var(--text, #eee);
}
.growth-tree-compact {
  gap: 7px;
  max-height: min(36vh, 300px);
  overflow: auto;
}
.growth-tree-compact .growth-tree-empty {
  margin: 0;
  font-size: 0.9rem;
}
.growth-tree-compact .growth-leaf {
  padding: 9px 11px;
  font-size: 14px;
  gap: 4px 8px;
  border-radius: 9px;
}
.growth-tree-compact .growth-leaf-meta { font-size: 12px; }
.growth-tree-compact .growth-leaf-bar { height: 5px; }
.growth-tree-open {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  background: #141312;
  text-align: left;
}
.growth-tree-open .muted { margin: 0; }
.growth-leaf {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  font-size: 13px;
  width: 100%;
  text-align: left;
  background: #141312;
  padding: 8px 10px;
}
.growth-leaf-name { color: var(--text); }
.exam-card-rating, .growth-leaf-meta { color: var(--muted); font-size: 12px; }
.growth-leaf-bar {
  grid-column: 1 / -1;
  height: 5px;
  background: #141312;
  border-radius: 99px;
  overflow: hidden;
}
.growth-leaf-fill {
  height: 100%;
  background: var(--accent-2);
}
.growth-leaf.weak .growth-leaf-fill { background: var(--danger); }
.growth-leaf.ok .growth-leaf-fill { background: var(--accent); }
.growth-auto {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--text);
  cursor: pointer;
}
.growth-auto input { position: absolute; opacity: 0; pointer-events: none; }
.growth-auto-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #3a3732;
  position: relative;
  flex-shrink: 0;
}
.growth-auto-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ece8e1;
  transition: transform 0.16s ease;
}
.growth-auto input:checked + .growth-auto-track {
  background: var(--accent);
}
.growth-auto input:checked + .growth-auto-track::after {
  transform: translateX(18px);
}
.growth-continue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.growth-continue .primary { min-width: 180px; }
/* Next to «Задача решена» in the moves panel — not under the board. */
.puzzle-session-continue {
  margin-top: 10px;
  width: 100%;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--ok, #81b64c) 12%, var(--card, #1c1a17));
  border: 1px solid color-mix(in srgb, var(--ok, #81b64c) 35%, transparent);
}
.puzzle-session-continue .primary {
  min-width: min(100%, 220px);
  width: 100%;
  max-width: 280px;
}
.puzzle-session-continue .muted {
  margin: 0;
  font-size: 0.85rem;
}
.puzzle-session.is-good + .puzzle-session-continue:not(.hidden) {
  margin-top: 8px;
}
.tree-sort {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 16px 0 0;
  max-width: 420px;
  padding: 4px;
  background: #141312;
  border-radius: 12px;
}
.tree-sort button {
  background: transparent;
  font-weight: 650;
  padding: 9px 10px;
}
.tree-sort button.active {
  background: #3a3732;
}
#tree-sort-weak.active {
  background: #4a2a2a;
  color: #f0c8c8;
}
#tree-sort-strong.active {
  background: #2a3a24;
  color: #cfe4b8;
}
.tree-map {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: min(100%, 980px);
}
.tree-rank {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.tree-branch h3 {
  margin: 0 0 10px;
  font-family: Georgia, serif;
}
.tree-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.tree-card {
  background: #181614;
  border: 1px solid #3a3228;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tree-card h3 { margin: 0; font-size: 16px; }
.tree-card p { margin: 0; font-size: 13px; }
.tree-card.weak { border-color: #c44d4d88; }
.tree-card.ok { border-color: #81b64c88; }
.tree-card.empty { opacity: 0.72; }
.tree-card.current { outline: 1px solid var(--accent-2); }
.tree-dots { display: flex; gap: 4px; min-height: 10px; align-items: center; }
.tree-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3a3732;
  display: inline-block;
}
.tree-dots i.ok { background: var(--accent); }
.tree-dots i.bad { background: var(--danger); }
.tree-train { width: 100%; }
.climb-fail {
  background: #3a2222;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.climb-fail-title {
  margin: 0;
  font-weight: 700;
  color: #f0a8a8;
}
.climb-fail .muted { margin: 0; }
.climb-fail .primary { min-width: 220px; }

.meta { background: var(--card); border-radius: 12px; padding: 14px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meta-grid span { display: block; font-size: 13px; }
#meta .meta-grid span { font-size: 13px; }
#meta .meta-grid strong {
  font-size: 1.2rem;
  line-height: 1.25;
  font-weight: 700;
}
.turn { margin: 12px 0 8px; font-weight: 650; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: #141312;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}
.links a { color: var(--accent-2); }

.board-col {
  display: block;
  width: 100%;
  padding: 8px 12px 16px;
  box-sizing: border-box;
}
.board-card {
  /* Board column width is driven by --cg-width (Lichess uniboard), not a fixed card cap. */
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}
.board-card.is-study,
.board-card.is-opening-train,
.board-card:has(.play-main.has-review),
.board-card:has(.play-main.is-storm),
.board-card:has(.play-main.is-streak),
.board-card:has(.play-main.is-storm-srs),
.board-card:has(.play-main.is-exam) {
  width: 100%;
  max-width: 100%;
}
.play-main {
  display: grid;
  /* Lichess-like: board column = --cg-width; moves column is comfortably wide. */
  grid-template-columns: var(--cg-width, min(72vmin, 100%)) minmax(300px, 380px);
  gap: 14px;
  justify-content: center;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}
/* Exam (mate + blind): notation column is wider so the move text can be larger. */
.play-main.is-exam {
  grid-template-columns:
    minmax(200px, 360px) var(--cg-width, min(72vmin, 100%)) minmax(280px, 400px);
  justify-content: stretch;
  width: 100%;
}
.play-main.is-exam .move-panel-title {
  font-size: 14px;
  margin-bottom: 10px;
}
.play-main.is-exam .move-list {
  font-size: 20px;
  line-height: 1.65;
}
.play-main.is-exam .move-san {
  padding: 4px 10px;
}
.play-main.is-exam .move-san-main {
  font-size: 22px;
}
.play-main.is-exam .move-n {
  font-size: 16px;
}
.play-main.is-exam .move-row {
  min-height: 2em;
  column-gap: 6px;
}
.play-main.is-exam > .exam-panel {
  order: 1;
  display: flex !important;
  width: 100%;
  min-width: 0;
  height: var(--board-align-h, auto);
  max-height: var(--board-align-h, min(100%, 640px));
  box-sizing: border-box;
  overflow: auto;
}
.play-main.is-exam > .board-stack {
  order: 2;
}
.play-main.is-exam > .move-panel {
  order: 3;
}
.play-main.is-exam #review-panel {
  display: none !important;
}
.play-main.is-storm {
  grid-template-columns: var(--cg-width, min(72vmin, 100%));
  width: 100%;
  justify-content: center;
}
.play-main.is-storm.is-storm-live,
.play-main.is-storm.is-storm-ended {
  grid-template-columns: var(--cg-width, min(72vmin, 100%)) minmax(240px, 300px);
}
.play-main.is-storm-live > .storm-hud,
.play-main.is-storm-ended > .storm-hud {
  align-self: start;
  height: var(--board-align-h, auto);
  max-height: var(--board-align-h, 100%);
  min-height: 0;
}
/* Puzzle Storm: never show Stockfish / move list (lobby, live, or results). */
.play-main.is-storm .move-panel,
.play-main.is-storm #review-panel,
.play-main.is-storm #eval-bar {
  display: none !important;
}
.play-main.is-streak {
  grid-template-columns: var(--cg-width, min(72vmin, 100%));
  width: 100%;
  justify-content: center;
}
/* Streak: wider left column so the cascade hint stays one line. */
.play-main.is-streak.is-streak-live {
  grid-template-columns:
    minmax(330px, 1fr) var(--cg-width, min(72vmin, 100%)) minmax(260px, 300px);
  justify-content: stretch;
  width: 100%;
}
.play-main.is-streak.is-streak-ended {
  grid-template-columns: var(--cg-width, min(72vmin, 100%)) minmax(280px, 320px);
}
.play-main.is-streak.is-streak-live > .board-stack {
  order: 2;
}
.play-main.is-streak.is-streak-live > .streak-hud {
  order: 1;
  width: 100%;
  min-width: 0;
  max-width: none;
}
.play-main.is-streak.is-streak-live > .move-panel {
  order: 3;
  display: flex !important;
}
.play-main.is-streak.is-streak-live #review-panel {
  display: none !important;
}

/* After solve: moves + ply nav get the column; feedback stays compact. */
.play-main.is-streak.is-streak-live .move-list {
  flex: 1 1 auto;
  min-height: 7.5rem;
}
.play-main.is-streak.is-streak-live .move-player:not(.hidden) {
  flex: 0 0 2.35rem;
  height: 2.35rem;
  min-height: 2.35rem;
  margin-top: 4px;
  border: 1px solid #ffffff10;
  background: #1a1815;
}
.play-main.is-streak.is-streak-live .puzzle-session {
  flex: 0 0 auto;
  min-height: 0;
  margin-top: 8px;
  padding: 1.25rem 1.2rem 1.3rem;
  gap: 0.9rem;
  border-radius: 10px;
}
.play-main.is-streak.is-streak-live .puzzle-session-player {
  gap: 14px;
}
.play-main.is-streak.is-streak-live:has(.streak-continue:not(.hidden)) .puzzle-session {
  border-radius: 8px 8px 0 0;
}
.play-main.is-streak.is-streak-live .puzzle-session-piece-wrap,
.play-main.is-streak.is-streak-live .puzzle-session-icon {
  flex: 0 0 78px;
  width: 78px;
  height: 78px;
  font-size: 58px;
  line-height: 78px;
}
.play-main.is-streak.is-streak-live .puzzle-session-title {
  font-size: 1.7rem;
  line-height: 1.15;
}
.play-main.is-streak.is-streak-live .puzzle-session-sub {
  font-size: 1.12rem;
  line-height: 1.35;
}
.play-main.is-streak.is-streak-live .streak-continue {
  margin-top: 0;
  padding: 0.65rem 0.85rem 0.85rem;
  border-radius: 0 0 8px 8px;
  background: #182218;
  border: 0;
  border-top: 1px solid #ffffff0c;
  gap: 6px;
  align-items: stretch;
}
.play-main.is-streak.is-streak-live .streak-continue .primary {
  min-width: 0;
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-weight: 700;
}
.play-main.is-streak.is-streak-live .streak-continue .muted {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
}
.play-main.is-study {
  grid-template-columns: minmax(300px, 370px) var(--cg-width, min(52vmin, 100%)) minmax(360px, 460px);
}
.play-main.is-opening-train {
  grid-template-columns: var(--cg-width, min(52vmin, 100%)) minmax(360px, 460px);
}
.board-stack {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  width: var(--cg-width, 100%);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.board-stack .board-frame {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
.eval-bar {
  position: relative;
  width: 24px;
  flex-shrink: 0;
  border-radius: 10px 0 0 10px;
  overflow: hidden;
  background: #111;
  border: 1px solid #ffffff12;
  border-right: 0;
}
.eval-bar.hidden { display: none; }
.eval-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50%;
  background: linear-gradient(180deg, #ececec, #f7f7f7);
  transition: height 0.25s ease;
}
.eval-label {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px #000a;
  pointer-events: none;
}
.analysis-panel {
  margin: 0 0 8px;
  padding: 6px 0 8px;
  border-top: 0;
  border-bottom: 1px solid #ffffff10;
  flex: 0 0 auto;
  max-height: 38%;
  overflow: visible;
  position: relative;
}
.analysis-panel.hidden { display: none; }
.analysis-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px 6px;
  font-size: 12px;
}
.analysis-infinite {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.analysis-infinite input {
  accent-color: var(--accent);
}
.analysis-lines {
  display: grid;
  gap: 4px;
  padding: 0 4px 4px;
  font-size: 13px;
  line-height: 1.35;
}
.analysis-line {
  padding: 4px 6px;
  border-radius: 6px;
  background: #ffffff06;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.analysis-line strong {
  color: var(--accent);
  margin-right: 6px;
}
.analysis-ply {
  color: var(--muted);
  font-weight: 650;
  margin-right: 1px;
}
.analysis-san {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 1px;
}
.analysis-san:hover {
  color: #7ec8ff;
  background: #4d9de033;
}
.analysis-line:hover {
  background: #ffffff0d;
}
.pv-board {
  position: absolute;
  left: 36px;
  top: calc(100% + 4px);
  width: min(240px, 85%);
  aspect-ratio: 1;
  z-index: 40;
  pointer-events: none;
}
.pv-board.hidden {
  display: none !important;
}
.pv-board-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 14px 32px #000c;
  border: 1px solid #ffffff18;
}
.pv-sq {
  position: relative;
  aspect-ratio: 1;
}
.pv-sq.light {
  background: var(--light);
}
.pv-sq.dark {
  background: var(--dark);
}
.pv-sq.last {
  box-shadow: inset 0 0 0 999px rgba(186, 202, 68, 0.55);
}
.pv-sq .piece {
  width: 92%;
  height: 92%;
  position: absolute;
  left: 4%;
  top: 4%;
  pointer-events: none;
}
.actions button.active {
  background: #ffffff18;
  box-shadow: inset 0 0 0 1px #ffffff22;
}
.sq.engine-best-from { box-shadow: inset 0 0 0 3px #7ecf7e99; }
.sq.engine-best-to { box-shadow: inset 0 0 0 4px #7ecf7e55; }

.move-panel {
  background: #161412;
  border-radius: 10px;
  padding: 10px 10px 8px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: var(--board-align-h, auto);
  max-height: var(--board-align-h, min(100%, 640px));
}

/* Woodpecker cheatsheet: right column (move-panel), above moves — no board layout changes. */
.woodpecker-cascade-host {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 8px;
}
.woodpecker-cascade-host.hidden {
  display: none !important;
}
.woodpecker-cascade-host .streak-cascade {
  flex: 1 1 auto;
  min-height: 0;
}
/* While the sheet is open, keep the move list compact so it stays usable below. */
.move-panel:has(> .woodpecker-cascade-host:not(.hidden)) > .move-panel-title,
.move-panel:has(> .woodpecker-cascade-host:not(.hidden)) > .move-list {
  flex: 0 1 auto;
  min-height: 0;
  max-height: 28%;
}
.move-panel:has(> .woodpecker-cascade-host:not(.hidden)) > .move-player,
.move-panel:has(> .woodpecker-cascade-host:not(.hidden)) > #ceval-bar,
.move-panel:has(> .woodpecker-cascade-host:not(.hidden)) > #ceval-settings-panel,
.move-panel:has(> .woodpecker-cascade-host:not(.hidden)) > #analysis-panel {
  flex: 0 0 auto;
}

/* Lichess puzzle__feedback: bottom of tools column. */
.puzzle-session {
  flex: 1 0 9rem;
  min-height: 9rem;
  margin: 0;
  margin-top: auto;
  padding: 1.5rem 1.1rem;
  border-radius: 0 0 8px 8px;
  border: 0;
  border-top: 1px solid #ffffff10;
  background: #1c1a17;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
  box-sizing: border-box;
}
.puzzle-session.hidden {
  display: none !important;
}
.puzzle-session-player {
  display: flex;
  align-items: center;
  gap: 10px;
}
.puzzle-session-piece-wrap {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
}
.puzzle-session-piece {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 1px #0008);
}
.puzzle-session-icon {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  font-size: 50px;
  line-height: 64px;
  text-align: center;
  font-weight: 700;
}
.puzzle-session-icon.hidden {
  display: none !important;
}
.puzzle-session.is-good .puzzle-session-icon {
  color: #81b64c;
}
.puzzle-session.is-bad .puzzle-session-icon {
  color: #fa412d;
}
.puzzle-session-instruction {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.puzzle-session-title {
  margin: 0;
  font-size: 1.35em;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.puzzle-session-sub {
  margin: 0;
  font-size: 0.95em;
  font-style: italic;
  line-height: 1.35;
  color: var(--muted);
  font-weight: 400;
}
.puzzle-session-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
}
.puzzle-session-tools.hidden {
  display: none !important;
}
.puzzle-session-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #769efc;
  cursor: pointer;
  text-align: center;
  opacity: 0.9;
}
.puzzle-session-link:hover:not(:disabled) {
  color: #9bb6ff;
  text-decoration: underline;
  opacity: 1;
}
.puzzle-session-link:disabled {
  color: #5a657a;
  cursor: default;
  opacity: 0.55;
}
.puzzle-session-reset {
  color: #8a847a;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
}
.puzzle-session-reset:hover:not(:disabled) {
  color: #c8c4bc;
}
.puzzle-session-streak-new {
  margin-top: 0.25rem;
}
.puzzle-session.is-good {
  background: #182218;
}
.puzzle-session.is-bad {
  background: #241616;
}
.streak-hud > .puzzle-session {
  margin-top: 12px;
  border-radius: 8px;
  border-top: 0;
  flex: 0 0 auto;
  min-height: 0;
}
.ceval-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #201d1a;
  border: 1px solid #ffffff10;
  flex: 0 0 auto;
}
.ceval-bar.is-off .ceval-score {
  color: var(--muted);
}
.ceval-bar.is-on {
  border-color: #81b64c55;
}
.ceval-switch {
  width: 34px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  background: #4a4640;
  position: relative;
  flex: 0 0 auto;
  border: 0;
}
.ceval-switch:disabled {
  opacity: 0.4;
}
.ceval-switch .ceval-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cfc8bc;
  transition: left 0.15s ease, background 0.15s ease;
  box-shadow: 0 1px 2px #0008;
}
.ceval-switch[aria-checked="true"] {
  background: #81b64c;
}
.ceval-switch[aria-checked="true"] .ceval-knob {
  left: 16px;
  background: #102008;
}
.ceval-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ceval-score {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  min-width: 2.4em;
}
.ceval-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.ceval-engine {
  font-size: 12px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
}
.ceval-nnue {
  color: #81b64c;
  font-style: normal;
  font-weight: 700;
}
.ceval-sub {
  font-size: 13px;
  font-weight: 650;
  color: #d8d2c8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ceval-gear {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.ceval-gear:hover {
  color: var(--text);
  background: #ffffff10;
  filter: none;
}
.ceval-settings-panel {
  margin: -2px 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #141210;
  border: 1px solid #ffffff10;
  display: grid;
  gap: 10px;
}
.ceval-settings-panel .analysis-infinite {
  margin: 0;
}
.ceval-threads {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}
.ceval-threads-title {
  color: var(--text);
  font-weight: 600;
}
.ceval-threads-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.ceval-threads-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.ceval-threads-row strong {
  min-width: 1.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.ceval-threads-hint {
  font-size: 0.75rem;
  line-height: 1.35;
}
.play-main.has-maia-clocks .move-panel {
  margin-top: var(--maia-clock-align, 0px);
}
.move-panel-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 8px 8px;
}
.move-panel-title-row .move-panel-title {
  margin: 0;
}
.move-panel-title {
  margin: 0 8px 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.strategy-moves-turn {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: none;
  white-space: nowrap;
}
.strategy-moves-turn[data-side="w"] {
  color: #e8e4dc;
}
.strategy-moves-turn[data-side="b"] {
  color: #b8c0cc;
}
.move-list {
  overflow-x: hidden;
  overflow-y: auto;
  flex: 2 1 auto;
  min-height: 0;
  font-size: 16px;
  line-height: 1.7;
  color: #f0ebe3;
}
.game-end-result {
  flex: 0 0 auto;
  margin: 8px 0 4px;
  padding: 14px 12px 16px;
  border-radius: 6px;
  background: #0e0d0c;
  text-align: center;
}
.game-end-result.hidden {
  display: none;
}
.game-end-score {
  display: block;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #f7f4ef;
  font-variant-numeric: tabular-nums;
}
.game-end-status {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.35;
  color: #d5cfc6;
}
.move-comment {
  display: block;
  width: 100%;
  margin: 2px 0 8px;
  padding: 2px 6px 2px 0.4em;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: #c4b8a8;
  white-space: pre-wrap;
  box-sizing: border-box;
  border-left: 2px solid #5a6f48;
}
.move-var-comment {
  color: #a89f92;
  font-style: italic;
  font-weight: 400;
  font-size: 0.92em;
}
.move-row {
  display: grid;
  grid-template-columns: 2.75em minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  column-gap: 4px;
  border-radius: 3px;
  min-height: 2em;
}
.move-row:hover {
  background: #ffffff06;
}
.move-n {
  color: #9a9184;
  text-align: right;
  padding-right: 6px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
}
.move-n::after {
  content: ".";
}
.move-san {
  padding: 3px 12px;
  border-radius: 3px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.move-san-main {
  color: #f3efe8;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
}
.move-san.empty {
  color: #6a645c;
  font-weight: 400;
}
.move-san.current {
  background: #3d5c80;
  color: #fff;
}
.move-san-main.current {
  background: #46916a;
  color: #fff;
}
.move-san.puzzle-good:not(.current),
.move-san.puzzle-win:not(.current) {
  color: #81b64c;
}
.move-puzzle-glyph {
  margin-left: 3px;
  font-weight: 800;
  font-size: 0.92em;
  vertical-align: 0.05em;
}
.move-san.puzzle-good:not(.current) .move-puzzle-glyph,
.move-san.puzzle-win:not(.current) .move-puzzle-glyph {
  color: #81b64c;
}
.move-san.puzzle-fail .move-puzzle-glyph {
  color: #e5534b;
}
.move-san.current .move-puzzle-glyph {
  color: #fff;
}
.move-row-fail .move-san {
  color: #a8a29a;
  font-weight: 600;
}
.move-row-fail .move-n {
  color: #7a746c;
}
.move-san:hover:not(.empty):not(.current) {
  background: #2a2620;
}
.move-san[data-path] { cursor: pointer; }
.move-shape-glyph {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-left: 4px;
  border: 1.6px solid #15781B;
  border-radius: 50%;
  vertical-align: 0.05em;
  box-sizing: border-box;
  flex-shrink: 0;
}
/* On the selected move, use a light ring so it stays visible on green/blue highlights. */
.move-san.current .move-shape-glyph {
  border-color: #fff;
}
.move-var {
  margin: 3px 0 6px;
  padding: 5px 10px 5px calc(12px + (var(--var-depth, 1) - 1) * 14px);
  border-left: 2px solid #5a5348;
  background: #0e0c0a;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  line-height: 1.75;
  color: #9a9184;
  font-weight: 400;
}
.move-var .move-san,
.move-san-var {
  display: inline;
  padding: 1px 4px;
  color: #a89f92;
  font-weight: 500;
  font-size: 13px;
}
.move-var .move-san.current,
.move-san-var.current {
  background: #3d5c80;
  color: #fff;
  font-weight: 600;
}
.move-var-num {
  color: #6e675c;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  margin-right: 1px;
}
.move-var-paren {
  color: #6e675c;
  font-weight: 700;
  font-size: 13px;
}
.move-context {
  position: fixed;
  z-index: 80;
  min-width: 220px;
  background: #1c1a17;
  border: 1px solid #3a342c;
  border-radius: 8px;
  box-shadow: 0 10px 28px #000a;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.move-context.hidden,
.move-context[hidden] {
  display: none !important;
}
.move-context button {
  text-align: left;
  background: transparent;
  border: 0;
  color: #e7e2da;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.move-context button:hover:not(:disabled) {
  background: #2a2620;
}
.move-context button:disabled {
  opacity: 0.35;
  cursor: default;
}
.move-context button.danger {
  color: #f0a8a8;
}
.maia-review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  flex: 0 0 auto;
  align-items: stretch;
  position: relative;
  z-index: 1;
}
.maia-review-actions.hidden {
  display: none !important;
}
.maia-review-live {
  width: 100%;
  margin: 0;
  background: #2a3420;
  color: #d7e8c4;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, #3a3732);
  font-weight: 650;
}
.maia-review-live.hidden {
  display: none !important;
}
.maia-review-actions:has(.maia-review-live.hidden) {
  grid-template-columns: 1fr;
}
.maia-review-live:hover:not(:disabled) {
  filter: none;
  background: #324028;
  border-color: color-mix(in srgb, var(--accent) 55%, #3a3732);
}
.maia-play-again {
  width: 100%;
  margin: 0;
  flex: 0 0 auto;
}
.maia-live-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  flex: 0 0 auto;
}
.maia-live-actions.maia-live-actions--resign-only {
  grid-template-columns: 1fr;
}
.maia-live-actions .maia-game-btn {
  width: 100%;
  margin: 0;
}
.maia-practice-live {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #201d1a;
  border: 1px solid #ffffff12;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 0.9rem;
  flex: 0 0 auto;
}
.maia-practice-live input {
  width: auto;
  accent-color: #1b78d0;
}
.move-player {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0;
  flex: 0 0 2.5rem;
  height: 2.5rem;
  min-height: 2.5rem;
  margin-top: 6px;
  background: #161512;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  z-index: 2;
}
.move-player button.fbt,
.move-player button {
  flex: 1 1 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #bababa;
  box-shadow: none;
  filter: none;
  line-height: 0;
  cursor: pointer;
}
.move-player button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  filter: none;
}
.move-player button:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.move-player button:disabled {
  opacity: 1;
  color: #4d4a45;
  cursor: default;
  background: transparent;
}
.move-player button svg {
  width: 1.55rem;
  height: 1.55rem;
  fill: currentColor;
  display: block;
  pointer-events: none;
}
.banner {
  min-height: 44px;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--card);
  border-radius: 10px;
  padding: 10px;
}
.banner.ok { color: var(--accent); }
.banner.bad { color: #f0a8a8; }

.board-frame {
  width: 100%;
  display: flex;
  justify-content: center;
}
.board-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  overflow: visible;
  box-sizing: border-box;
  container-type: inline-size;
}
/* Coordinates inside edge squares (Lichess coords-in). */
.board-coords {
  position: absolute;
  display: flex;
  pointer-events: none;
  user-select: none;
  z-index: 4;
  font-family: "Noto Sans", "Segoe UI", sans-serif;
  font-size: clamp(9px, 1.7cqw, 12px);
  font-weight: 700;
  line-height: 1;
}
.board-coords.files {
  left: 0;
  right: 0;
  bottom: 0;
  height: 12.5%;
  flex-flow: row nowrap;
  text-transform: lowercase;
}
.board-coords.files.black {
  flex-flow: row-reverse nowrap;
}
.board-coords.ranks {
  top: 0;
  right: 0;
  bottom: 0;
  width: 12.5%;
  flex-flow: column-reverse nowrap;
}
.board-coords.ranks.black {
  flex-flow: column nowrap;
}
.board-coords coord {
  flex: 1 1 0;
  display: flex;
  min-width: 0;
  min-height: 0;
}
.board-coords.files coord {
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 0 2px 3px;
}
.board-coords.ranks coord {
  align-items: flex-start;
  justify-content: flex-end;
  padding: 2px 3px 0 0;
}
/* Contrast vs light/dark squares (a1 dark). */
.board-coords.files:not(.black) coord:nth-child(odd),
.board-coords.files.black coord:nth-child(even),
.board-coords.ranks coord:nth-child(odd) {
  color: rgba(255, 255, 255, 0.92);
}
.board-coords.files:not(.black) coord:nth-child(even),
.board-coords.files.black coord:nth-child(odd),
.board-coords.ranks coord:nth-child(even) {
  color: rgba(0, 0, 0, 0.55);
}
.board-resize {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 0 0 8px 0;
  background:
    linear-gradient(135deg, transparent 42%, #00000055 43%, #00000055 48%, transparent 49%),
    linear-gradient(135deg, transparent 56%, #00000055 57%, #00000055 62%, transparent 63%),
    linear-gradient(135deg, transparent 70%, #00000066 71%, #00000066 76%, transparent 77%);
  background-color: transparent;
  cursor: nwse-resize;
  z-index: 8;
  touch-action: none;
  appearance: none;
  -webkit-appearance: none;
}
.board-resize:hover,
.board-resize:focus-visible {
  background:
    linear-gradient(135deg, transparent 42%, #00000088 43%, #00000088 48%, transparent 49%),
    linear-gradient(135deg, transparent 56%, #00000088 57%, #00000088 62%, transparent 63%),
    linear-gradient(135deg, transparent 70%, #00000099 71%, #00000099 76%, transparent 77%);
  outline: none;
}
body.board-resizing,
body.board-resizing * {
  cursor: nwse-resize !important;
  user-select: none !important;
}
.board-shapes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}

/* Lichess-style session result strip under the board (rewind / warmup / growth). */
.session-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 22px;
  margin-top: 4px;
  padding: 0 1px;
  box-sizing: border-box;
}
.session-strip.hidden {
  display: none;
}
.session-strip-progress {
  flex: 0 0 auto;
  margin-right: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted, #aaa);
  letter-spacing: 0.02em;
}
.session-dot {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  box-sizing: border-box;
  position: relative;
}
.session-dot.clickable {
  cursor: pointer;
}
.session-dot.clickable:hover {
  filter: brightness(1.12);
}
.session-dot.clickable:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}
.session-dot.is-active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(255, 255, 255, 0.35);
}
.session-dot.ok {
  background: #629924;
}
.session-dot.fail {
  background: #c33;
}
.session-dot.hard {
  background: #e07b20;
}
.session-dot.current {
  background: #cab432;
}
.session-dot.ok::after,
.session-dot.hard::after,
.session-dot.fail::after {
  content: "";
  position: absolute;
  inset: 0;
  background: center / 12px 12px no-repeat;
}
.session-dot.ok::after,
.session-dot.hard::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M4.7 9.2 1.6 6.1l1.1-1.1 2 2 4.6-4.6 1.1 1.1z'/%3E%3C/svg%3E");
}
.session-dot.fail::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M3.2 2.1 6 4.9l2.8-2.8 1.1 1.1L7.1 6l2.8 2.8-1.1 1.1L6 7.1 3.2 9.9 2.1 8.8 4.9 6 2.1 3.2z'/%3E%3C/svg%3E");
}

.blind-delta.up {
  color: #629924;
}
.blind-delta.down {
  color: #c33;
}

.maia-practice-toast {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  max-width: min(220px, calc(100% - 16px));
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: practice-toast-in 0.18s ease-out;
}
.maia-practice-toast.hidden {
  display: none;
}
@keyframes practice-toast-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.sq.practice-flash {
  background-color: var(--practice-color, #81b64c) !important;
  box-shadow: none;
  transition: background-color 0.15s ease;
}
.sq.practice-cls-brilliant { --practice-color: #9c6dff; }
.sq.practice-cls-great { --practice-color: #4fc3f7; }
.sq.practice-cls-good { --practice-color: #81b64c; }
.sq.practice-cls-inaccuracy { --practice-color: #e6c35c; }
.sq.practice-cls-mistake { --practice-color: #f0a04b; }
.sq.practice-cls-blunder { --practice-color: #fa412d; }
.maia-practice-toast.practice-cls-brilliant { background: #9c6dff; }
.maia-practice-toast.practice-cls-great { background: #4fc3f7; color: #083344; }
.maia-practice-toast.practice-cls-good { background: #81b64c; }
.maia-practice-toast.practice-cls-inaccuracy { background: #e6c35c; color: #1a1400; }
.maia-practice-toast.practice-cls-mistake { background: #f0a04b; color: #1a1000; }
.maia-practice-toast.practice-cls-blunder { background: #fa412d; }

/* Lichess puzzle feedback glyph (✓ on destination square). */
.sq .puzzle-glyph {
  position: absolute;
  top: 1%;
  right: 1%;
  width: 42%;
  height: 42%;
  z-index: 6;
  pointer-events: none;
  line-height: 0;
  animation: puzzle-glyph-in 0.16s ease-out;
}
.sq .puzzle-glyph svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.sq .end-glyph {
  position: absolute;
  top: 1%;
  right: 1%;
  width: 42%;
  height: 42%;
  z-index: 6;
  pointer-events: none;
  line-height: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}
.sq .end-glyph svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
@keyframes puzzle-glyph-in {
  from { opacity: 0; transform: scale(0.55); }
  to { opacity: 1; transform: scale(1); }
}

.sq.promotion-target { box-shadow: inset 0 0 0 4px var(--accent); }

.promotion-picker {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 28px #000a;
  pointer-events: auto;
}
.promotion-picker.hidden { display: none; }
.promotion-choice {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  background: var(--light);
  cursor: pointer;
}
.promotion-choice:hover,
.promotion-choice:focus-visible {
  background: var(--selected);
  outline: none;
}
.promotion-choice img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.board {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 50px #0008;
  user-select: none;
  touch-action: none;
  position: relative;
  z-index: 1;
}
.board.dragging,
.board.dragging .sq {
  cursor: grabbing;
}
.sq {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: default;
}
.sq.movable { cursor: grab; }
.sq.light { background: var(--light); }
.sq.dark { background: var(--dark); }
.sq.last { box-shadow: inset 0 0 0 4px var(--last); }
.sq.selected { background: var(--selected); }
.sq.check,
.sq.end-loss {
  background: radial-gradient(
    ellipse at center,
    rgba(255, 0, 0, 1) 0%,
    rgba(231, 0, 0, 1) 25%,
    rgba(169, 0, 0, 0) 89%,
    rgba(158, 0, 0, 0) 100%
  );
}
.sq.end-win {
  background-image: linear-gradient(rgba(169, 210, 60, 0.55), rgba(169, 210, 60, 0.55));
}
.sq.check-flash {
  animation: check-king-flash 0.55s ease-out;
}
@keyframes check-king-flash {
  0% {
    filter: brightness(1.35);
    box-shadow: inset 0 0 0 3px rgba(255, 40, 40, 0.95);
  }
  45% {
    filter: brightness(1.15);
    box-shadow: inset 0 0 0 5px rgba(255, 0, 0, 0.75);
  }
  100% {
    filter: none;
    box-shadow: none;
  }
}
.sq.premove {
  box-shadow: inset 0 0 0 4px #c23b22;
  background: #c23b2244 !important;
}
.sq.premove.selected {
  background: #c23b2266 !important;
}
.sq.hover { box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.28); }
.sq.legal::after {
  content: "";
  position: absolute;
  inset: 33%;
  border-radius: 50%;
  background: #0004;
  pointer-events: none;
  z-index: 1;
}
.sq.legal.occupied::after {
  inset: 0;
  background: transparent;
  border: 7px solid rgba(0, 0, 0, 0.18);
  border-radius: 50%;
}
.piece {
  position: absolute;
  inset: 3%;
  width: auto;
  height: auto;
  display: block;
  pointer-events: none;
  object-fit: contain;
  -webkit-user-drag: none;
}
.piece.hidden-drag { opacity: 0; }
.piece-ghost {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 1000;
  object-fit: contain;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 10px 14px #0005);
}

.actions { display: flex; gap: 8px; }
.actions button { flex: 1; }
/* Hint / solution live in the Lichess-style side panel now. */
.board-card > .actions {
  display: none !important;
}

/* Lichess puzzle__feedback votes: compact icons pinned to the right of the tools column. */
.move-panel > .puzzle-feedback {
  flex: 0 0 auto;
  margin-top: 4px;
}
.puzzle-feedback {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 4px 6px 8px;
  min-height: 0;
}
.puzzle-feedback.hidden { display: none; }
.puzzle-feedback-label {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.2;
  white-space: nowrap;
}
.puzzle-vote {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 5px;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.puzzle-vote svg {
  display: block;
  width: 18px;
  height: 18px;
}
.puzzle-vote-like {
  color: #629924;
}
.puzzle-vote-like:hover {
  color: #7af778;
  background: #ffffff0c;
}
.puzzle-vote-like.active-like {
  color: #9eef92;
  background: #62992433;
}
.puzzle-vote-dislike {
  color: #c33;
}
.puzzle-vote-dislike:hover {
  color: #f08080;
  background: #ffffff0c;
}
.puzzle-vote-dislike.active-dislike {
  color: #ff9e9e;
  background: #c333;
}

.san-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  min-height: 1.5em;
}

.setup {
  background: #3a2a12;
  border-radius: 10px;
  padding: 12px;
}

.tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: 1;
  min-width: 0;
  overflow: visible;
  padding: 0;
  background: transparent;
  border-radius: 0;
  position: relative;
  z-index: 20;
}
.tab {
  background: transparent;
  border: 0;
  border-radius: 0;
  font-weight: 700;
  padding: 0 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #bababa;
  min-width: 0;
  height: 100%;
  white-space: nowrap;
  position: relative;
}
.tab:hover {
  background: #ffffff08;
  color: #fff;
  filter: none;
}
.tab.active {
  background: transparent;
  color: #fff;
}
.tab.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 3px;
  background: #4d9de0;
  border-radius: 2px 2px 0 0;
}

.tab-menu {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
}
.tab-menu-trigger {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tab-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.65;
  flex: 0 0 auto;
}
.tab-menu.is-open .tab-menu-trigger,
.tab-menu:hover .tab-menu-trigger {
  background: #ffffff08;
  color: #fff;
}
.tab-menu.is-open .tab-caret {
  transform: rotate(180deg);
}
.tab-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  padding: 6px 0;
  background: #262421;
  border: 1px solid #0006;
  border-left: 3px solid #4d9de0;
  border-radius: 0 0 6px 0;
  box-shadow: 0 14px 32px #000c;
  display: flex;
  flex-direction: column;
  overflow: visible;
  z-index: 100;
}
.tab-dropdown[hidden] {
  display: none !important;
}
.tab-drop-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #eae6df;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  padding: 10px 16px;
  cursor: pointer;
}
.nav-due-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e53935;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  flex: 0 0 auto;
}
.tab-menu-trigger .nav-due-alert {
  font-size: 13px;
  margin: 0 -2px;
}
.nav-due-alert.hidden {
  display: none !important;
}
.tab-drop-item:hover {
  background: #ffffff10;
  color: #fff;
  filter: none;
}
.tab-drop-item.is-head.is-active {
  background: #1b78d0;
  color: #fff;
}
.tab-drop-item.is-head.is-active:hover {
  background: #2a86da;
}
.tab-drop-item.is-active:not(.is-head) {
  background: #2a3a48;
  color: #fff;
}

.elo-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
}
.tactics-nn-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tactics-nn-rank {
  margin: 6px 0 10px;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent-2);
}
.tactics-form {
  margin: 16px 0 0;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--accent-2) 28%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 4%, transparent);
}
.tactics-form-kicker {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.tactics-form-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 650;
  color: #f3efe6;
  line-height: 1.25;
}
.tactics-form-message {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  color: color-mix(in srgb, #f3efe6 88%, transparent);
}
.tactics-form-meta {
  margin: 10px 0 0;
  font-size: 0.88rem;
}
.tactics-form--excellent {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.tactics-form--excellent .tactics-form-title {
  color: var(--accent);
}
.tactics-form--good {
  border-color: color-mix(in srgb, var(--accent-2) 45%, transparent);
}
.tactics-form--good .tactics-form-title {
  color: var(--accent-2);
}
.tactics-form--soft {
  border-color: color-mix(in srgb, #d4a017 40%, transparent);
}
.tactics-form--soft .tactics-form-title {
  color: #e0b84a;
}
.tactics-form--weak {
  border-color: color-mix(in srgb, #d4834a 50%, transparent);
}
.tactics-form--weak .tactics-form-title {
  color: #e0945c;
}
.tactics-form--critical {
  border-color: color-mix(in srgb, #c35b5b 55%, transparent);
}
.tactics-form--critical .tactics-form-title {
  color: #e07070;
}
.tactics-form--empty {
  border-color: color-mix(in srgb, #888 25%, transparent);
}
.tactics-form--empty .tactics-form-title {
  color: color-mix(in srgb, #f3efe6 70%, transparent);
}
.tactics-form-diag-btn {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 45%, transparent);
  background: color-mix(in srgb, var(--accent-2) 14%, transparent);
  color: #f3efe6;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.tactics-form-diag-btn:hover {
  background: color-mix(in srgb, var(--accent-2) 24%, transparent);
  border-color: color-mix(in srgb, var(--accent-2) 70%, transparent);
}
.elo-puzzle-title {
  margin-top: 28px;
}
.elo-puzzle-hint {
  margin: 0 0 12px;
}
.elo-puzzle-meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.elo-puzzle-meta-row .control-record {
  margin: 10px 0 0;
}
.elo-puzzle-meta-row .elo-trend-check {
  margin-top: 10px;
}
.control-record {
  margin: 10px 0 0;
  font-size: 0.98rem;
  color: var(--accent-2) !important;
  font-weight: 600;
}
.control-record strong {
  color: var(--text);
}
.control-record.hidden {
  display: none !important;
}
.elo-stats div,
.elo-stats div { display: flex; flex-direction: column; gap: 4px; }
.elo-chart-wrap {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  min-height: 220px;
}
.elo-side-chart {
  margin-top: 28px;
}
.elo-side-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.elo-side-chart-head .elo-side-title {
  margin: 0;
}
.elo-side-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.elo-trend-check {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  user-select: none;
}
.elo-trend-check:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}
.elo-chart {
  width: 100%;
  height: 280px;
  display: block;
}
.elo-chart.storm-chart,
.elo-chart.streak-chart {
  height: 240px;
}
.elo-chart .grid { stroke: #3a3732; stroke-width: 1; }
.elo-chart .line { fill: none; stroke: var(--accent); stroke-width: 3; }
.elo-chart .fill { fill: rgba(129, 182, 76, 0.12); }
.elo-chart .dot { fill: var(--accent); }
.elo-chart .label { fill: var(--muted); font-size: 12px; }
.elo-chart .ghost-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-opacity: 0.28;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.elo-chart .trend-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-dasharray: 8 6;
  stroke-opacity: 0.9;
  stroke-linecap: round;
}
.storm-chart {
  color: #d4a017;
}
.storm-chart .dot { fill: #d4a017; }
.storm-chart .dot.best { fill: #f0c040; stroke: #fff3; stroke-width: 2; }
.streak-chart {
  color: #4aa3c7;
}
.streak-chart .dot { fill: #4aa3c7; }
.streak-chart .dot.best { fill: #7ec8e3; stroke: #fff3; stroke-width: 2; }

.maia-colors {
  border: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.maia-colors legend {
  padding: 0;
  margin-bottom: 4px;
}

.maia-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.maia-bar.hidden {
  display: none;
}

.maia-game-controls {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.maia-game-controls.hidden {
  display: none;
}

.maia-game-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #ffffff18;
  background: #ffffff08;
  color: #e8e4dc;
  font-size: 13px;
  cursor: pointer;
}

.maia-game-btn:hover:not(:disabled) {
  background: #ffffff14;
}

.maia-game-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.maia-game-btn-danger.is-armed,
.maia-game-btn.maia-game-btn-danger.is-armed {
  background: #c43c3c;
  border-color: #ff8080;
  color: #fff;
}

.adaptive-game-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px;
}

.adaptive-game-actions button.is-armed {
  background: #c43c3c;
  border-color: #ff8080;
  color: #fff;
}

.maia-opening {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 4px;
}

.maia-opening > span {
  font-size: 13px;
  color: var(--muted);
}

.maia-opening-picker {
  position: relative;
}

.maia-opening-toggle {
  width: 100%;
  text-align: left;
  background: #141312;
  border: 1px solid #3a3732;
  border-radius: 8px;
  padding: 8px 10px;
}

.maia-opening-menu {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: #1c1b18;
  border: 1px solid #3a3732;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.maia-opening-menu.hidden {
  display: none;
}

.maia-opening-list {
  overflow-y: auto;
  max-height: 260px;
}

.maia-opening-group {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 8px 4px;
  background: #1c1b18;
  color: #9a958c;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.maia-opening-option {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 7px 8px;
}

.maia-opening-option:hover,
.maia-opening-option.is-selected {
  background: #2b4a6e;
}

.maia-opening.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.maia-fen-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.maia-fen-wrap .muted {
  margin: 0;
  font-size: 12px;
}

.maia-fen-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.maia-fen-bar.hidden {
  display: none;
}

.maia-fen-bar-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.maia-fen-bar .maia-fen-row {
  flex: 1;
  min-width: 0;
}

.maia-fen-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #141312;
  border: 1px solid #3a3732;
  border-radius: 8px;
  overflow: hidden;
}

.maia-fen-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 8px 10px;
}

.maia-fen-load {
  flex: 0 0 auto;
  width: 40px !important;
  min-width: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid #3a3732;
  border-radius: 0;
  background: #1c1b18;
  color: #9bc27a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.maia-fen-load:hover {
  background: #2a4030;
  color: #c8e6a8;
}

.maia-time {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 12px;
}

.board-frame {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.maia-clock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.maia-clock-row.hidden {
  display: none;
}

.maia-player-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.maia-player-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  line-height: 1.2;
}

/* Elo next to the name: don't inherit .muted's top margin (looks crooked). */
.maia-player-info #maia-top-elo,
.maia-player-info #maia-bottom-elo {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: inherit;
  align-self: center;
}

/* Stockfish fun: only "Вы", no personal rating under the board. */
body.is-maia-play:has(#sf-panel:not(.hidden)) #maia-bottom-elo {
  display: none !important;
}

/* Lichess material difference under the player name (mono piece icons + score). */
.material {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  pointer-events: none;
  min-height: 20px;
  line-height: 0;
  white-space: nowrap;
  min-width: 0;
}
/* Keep the material strip's layout box even when empty so clock-row height
   (and thus board fit / --maia-clock-align) does not flap while browsing plies. */
.material.is-empty,
.material[hidden] {
  visibility: hidden;
  pointer-events: none;
}
.material-group {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 8px;
}
.material-group:first-child {
  margin-inline-start: 0;
}
img.mpiece {
  display: block;
  width: 20px;
  height: 20px;
  margin: 0;
  margin-inline-start: -8px;
  padding: 0;
  border: 0;
  object-fit: contain;
  /* Monochrome silhouette like Lichess mono pieces */
  filter: brightness(0) invert(78%);
  flex: 0 0 auto;
}
.material-group img.mpiece:first-child {
  margin-inline-start: 0;
}
.material-group-pawn img.mpiece {
  margin-inline-start: -12px;
}
.material-group-pawn img.mpiece:first-child {
  margin-inline-start: 0;
}
.material-score {
  font-family: "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: #c8c4bc;
  margin-inline-start: 4px;
  vertical-align: top;
}

.maia-player-info strong {
  font-weight: 600;
}

.maia-player-info.has-bot-avatar .maia-online-dot {
  display: none;
}

.bot-avatar-wrap {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.bot-avatar-wrap.hidden {
  display: none;
}

.bot-avatar,
.bot-chat-avatar {
  display: block;
  border-radius: 50%;
  overflow: hidden;
  background: #2a241c;
}

.bot-avatar {
  width: 42px;
  height: 42px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.88);
}

.bot-avatar svg,
.bot-chat-avatar svg {
  display: block;
  height: auto;
  pointer-events: none;
}

.bot-avatar svg {
  width: 136px;
  margin: -46px 0 0 -47px;
}

.bot-avatar.is-classic svg {
  width: 136px;
  margin: -58px 0 0 -47px;
}

.bot-avatar.has-hat svg {
  margin-top: -34px;
}

.bot-avatar.is-img img,
.bot-chat-avatar.is-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 12%;
  pointer-events: none;
}

.bot-chat {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 0 0 auto;
  margin: 0 2px 10px;
  min-width: 0;
}

.bot-chat.hidden {
  display: none;
}

.bot-chat-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.bot-chat-avatar svg {
  width: 168px;
  margin: -57px 0 0 -58px;
}

.bot-chat-avatar.is-classic svg {
  width: 168px;
  margin: -72px 0 0 -58px;
}

.bot-chat-avatar.has-hat svg {
  margin-top: -38px;
}

.bot-quip {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin: 6px 0 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: #f7f4ee;
  color: #1c1916;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.35;
}

.bot-quip.hidden {
  display: none;
}

.bot-quip.is-in {
  animation: bot-quip-in 0.18s ease-out;
}

.bot-quip-caret {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  margin-left: 2px;
  vertical-align: -0.08em;
  background: currentColor;
  opacity: 0;
}

.bot-quip.is-streaming .bot-quip-caret {
  animation: bot-quip-caret 0.72s steps(1) infinite;
}

.bot-quip::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 14px;
  border-width: 7px 7px 7px 0;
  border-style: solid;
  border-color: transparent #f7f4ee transparent transparent;
}

@keyframes bot-quip-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes bot-quip-caret {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bot-quip-caret {
    display: none;
  }
}

.maia-online-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #8a8680;
  flex-shrink: 0;
}

.maia-online-dot.is-you {
  background: #81b64c;
  border-color: #81b64c;
}

.maia-clock-box {
  min-width: 5.8em;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.88);
  color: #d8d4cc;
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.maia-clock-box.is-emergency {
  min-width: 6.4em;
  font-size: 26px;
}

.maia-clock-box.is-active {
  background: rgba(129, 182, 76, 0.18);
  color: #e8f5d8;
  box-shadow: inset 0 0 0 1px rgba(129, 182, 76, 0.45);
}

.maia-clock-box.is-low {
  background: rgba(196, 48, 48, 0.92);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 150, 150, 0.55);
}

.maia-clock-box.is-low.is-active {
  background: rgba(220, 55, 55, 0.98);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 180, 180, 0.7);
}

.maia-game-result {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: min(82%, 300px);
  padding: 22px 24px 18px;
  border-radius: 4px;
  background: rgba(22, 20, 18, 0.94);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  text-align: center;
  pointer-events: auto;
}

.maia-game-result.hidden {
  display: none;
}

.maia-start-countdown {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid #3a3228;
  background: #1a1815;
}

.maia-start-countdown.hidden {
  display: none;
}

.maia-start-countdown-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #f3efe8;
  font-variant-numeric: tabular-nums;
  min-width: 1.4em;
}

.maia-start-countdown-sub {
  font-size: 13px;
  font-style: italic;
  font-weight: 400;
  color: #cfc8bc;
}

.maia-game-result-score {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #f3efe8;
}

.maia-game-result-sub {
  font-size: 15px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.35;
  color: #d8d0c4;
  margin: 0;
}

.maia-game-result-review {
  margin-top: 10px;
  padding: 10px 0 0;
  width: 100%;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #e8e2d8;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease;
}

.maia-game-result-review:hover:not(:disabled) {
  color: #fff;
}

.maia-game-result-review:disabled {
  opacity: 0.45;
  cursor: default;
}

.maia-game-result-review.hidden {
  display: none;
}

.maia-game-result.ok .maia-game-result-score {
  color: #b7e08a;
}

.maia-game-result.bad .maia-game-result-score {
  color: #ffb4b4;
}

.named-result {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: rgba(10, 8, 7, 0.62);
  backdrop-filter: blur(4px);
}

.named-result.hidden {
  display: none;
}

.named-result-card {
  width: min(100%, 320px);
  max-height: 100%;
  overflow: auto;
  padding: 16px 18px 12px;
  border-radius: 18px;
  text-align: center;
  color: #f3efe8;
  background:
    radial-gradient(120% 70% at 50% -20%, var(--named-glow, rgba(129, 182, 76, 0.4)), transparent 58%),
    #1c1916;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  animation: named-result-in 0.28s ease;
}

.named-result.is-win { --named-glow: rgba(155, 199, 0, 0.55); }
.named-result.is-draw { --named-glow: rgba(230, 195, 92, 0.5); }
.named-result.is-loss { --named-glow: rgba(224, 112, 112, 0.5); }

@keyframes named-result-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.named-result-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b7aea2;
}

.named-result-title {
  margin: 4px 0 0;
  font-size: clamp(30px, 7cqw, 38px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
}

.named-result.is-win .named-result-title { color: #d4f0a8; }
.named-result.is-draw .named-result-title { color: #f3dc9a; }
.named-result.is-loss .named-result-title { color: #f3b8b8; }

.named-result-reason {
  margin: 8px 0 0;
  font-size: 15px;
  color: #e4dcd2;
}

.named-result-versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 10px;
  margin-top: 12px;
}

.named-result-side {
  min-width: 0;
}

.named-result-who {
  display: block;
  font-size: 14px;
  color: #e8e0d6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.named-result-side strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: #f7f3ec;
}

.named-result-vs {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8d857a;
}

.named-result-avatar {
  width: 46px;
  height: 46px;
  margin: 0 auto 4px;
  border-radius: 50%;
  overflow: hidden;
  display: block;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.named-result-avatar:empty {
  display: none;
}

.named-result-avatar svg,
.named-result-avatar img {
  width: 100%;
  height: 100%;
  display: block;
}
.named-result-avatar img {
  object-fit: cover;
  object-position: center 12%;
}

.named-result-rating {
  margin-top: 12px;
  padding: 10px 10px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.named-result-rating.hidden {
  display: none;
}

.named-result-delta {
  display: block;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.named-result-delta.is-up { color: #b6e36a; }
.named-result-delta.is-down { color: #f0a0a0; }
.named-result-delta.is-flat { color: #e4dcd2; }

.named-result-path {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: #c9c0b4;
  font-variant-numeric: tabular-nums;
}

.named-result-analysis {
  margin-top: 10px;
}

.named-result-analysis-bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

#named-result-analysis-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: #e7d7b5;
  transition: width 0.2s ease;
}

.named-result-analysis-text {
  margin: 7px 0 0;
  font-size: 12px;
  color: #b7aea2;
}

.named-result-close {
  margin-top: 10px;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 9px 12px;
  background: #f3efe8;
  color: #1c1916;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
}

.named-result-close:hover {
  background: #fff;
}

.brand-profile {
  margin: 4px 0 0;
  font-size: 12px;
}
.brand-profile strong {
  color: var(--accent-2);
  font-weight: 650;
}
.profile-badge {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--accent-2);
  font-weight: 650;
}
.profiles-tabs {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.profiles-tab {
  border: 1px solid #3a3732;
  background: #1a1816;
  color: #cfc8bc;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
}
.profiles-tab.is-active {
  border-color: #759900;
  color: #e8f2c8;
  background: #243014;
}
.profiles-manage {
  margin-top: 8px;
}
.maia-games-panel {
  margin-top: 4px;
}
.maia-games-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 58rem;
}
.mgames-empty {
  background: var(--card);
  border-radius: 12px;
  padding: 28px 22px;
  font-size: 1.05rem;
}
.mgames-row {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 18px;
  align-items: stretch;
  background: #161512;
  border: 1px solid #2e2b27;
  border-radius: 4px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  min-height: 168px;
}
.mgames-row:hover {
  border-color: #4a463e;
  background: #1c1a18;
}
.mgames-row:focus-visible {
  outline: 2px solid #759900;
  outline-offset: 2px;
}
.mgames-board {
  width: 168px;
  height: 168px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 10px 24px #0007;
  flex-shrink: 0;
}
.mgames-sq {
  position: relative;
  min-width: 0;
  min-height: 0;
}
.mgames-sq.light { background: #f0d9b5; }
.mgames-sq.dark { background: #b58863; }
.mgames-sq.is-last { box-shadow: inset 0 0 0 999px rgba(155, 199, 0, 0.41); }
.mgames-sq img {
  position: absolute;
  inset: 3%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}
.mgames-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  justify-content: center;
  padding: 2px 0;
}
.mgames-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.mgames-meta {
  color: #cfc8bc;
  letter-spacing: 0.04em;
  font-size: 0.92rem;
  font-weight: 650;
  text-transform: uppercase;
}
.mgames-when {
  font-size: 0.9rem;
}
.mgames-players {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 4px;
}
.mgames-player {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.mgames-player strong {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.15;
  color: #fff;
}
.mgames-elo {
  font-size: 1.05rem;
  color: #b7b1a6;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mgames-avg {
  font-size: 0.82rem;
}
.mgames-vs {
  font-size: 1.25rem;
  opacity: 0.55;
  color: #6f6a62;
}
.mgames-delta.up { color: #759900; }
.mgames-delta.down { color: #e07070; }
.mgames-result {
  margin: 4px 0 0;
  font-size: 1.05rem;
  font-weight: 650;
  color: #759900;
}
.mgames-reviewed {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #cfe6a0;
  background: #2a4018;
  border: 1px solid #5a7a30;
  vertical-align: middle;
}
.mgames-row.is-loss .mgames-result { color: #e07070; }
.mgames-row.is-draw .mgames-result { color: #cfc8bc; }
.mgames-opening {
  margin: 2px 0 0;
  font-size: 1rem;
  color: #d8d2c6;
}
.mgames-pgn {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-games-hall .exam-intro h2 {
  font-size: 1.65rem;
}
@media (max-width: 720px) {
  .mgames-row {
    grid-template-columns: 120px 1fr;
    gap: 12px;
    min-height: 120px;
    padding: 10px;
  }
  .mgames-board {
    width: 120px;
    height: 120px;
  }
  .mgames-player strong {
    font-size: 1.1rem;
  }
}

.diag-maia-local {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(192, 164, 92, 0.07) 0%, transparent 42%),
    var(--card);
  border: 1px solid #35312c;
  border-radius: 14px;
  padding: 18px;
  margin: 0 0 16px;
}
.diag-maia-local::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent-2), transparent 85%);
  opacity: 0.85;
}
.diag-maia-local-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.diag-maia-kicker {
  margin: 0;
  font-size: 11px;
  color: #9a948a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.diag-maia-local h3 {
  margin: 6px 0 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.diag-maia-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.diag-maia-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(18, 17, 16, 0.55);
  border: 1px solid #2f2c28;
  border-radius: 10px;
  padding: 11px 12px;
}
.diag-maia-stats strong {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.diag-maia-note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.45;
}
@media (max-width: 720px) {
  .diag-maia-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .diag-maia-local-head {
    flex-direction: column;
    align-items: stretch;
  }
  .diag-maia-local-head .diag-btn {
    align-self: flex-start;
  }
}
.profile-create {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
  max-width: 44rem;
  align-items: center;
}
.profile-create input {
  flex: 1;
  min-width: 10rem;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #3a3228;
  background: #141210;
  color: var(--text);
}
.profile-create #profile-create-admin-key {
  flex: 0.85;
  min-width: 9rem;
}
.profile-admin-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
  color: #1a1608;
  background: linear-gradient(165deg, #f0d56a, #c9a63a);
}
.profile-card.is-admin {
  border-color: #c0a45c;
}
body:not(.is-content-admin) [data-admin-only] {
  display: none !important;
}
.woodpecker-hall-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}
#woodpecker-hall .exam-intro {
  max-width: 40rem;
}
#woodpecker-grid.exam-grid,
.woodpecker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  width: 100%;
}
.woodpecker-level-wrap {
  position: relative;
  display: flex;
  height: 100%;
  min-height: 0;
}
.woodpecker-level-wrap.is-editable {
  cursor: grab;
}
.woodpecker-level-wrap.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}
.woodpecker-level-wrap.is-drop-target > .woodpecker-level-card {
  outline: 1px dashed var(--accent, #c9a63a);
  outline-offset: 2px;
}
.woodpecker-level-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.woodpecker-level-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border-radius: 7px;
  border: 1px solid #3a3228;
  background: #1c1915;
  color: #b8b0a4;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.woodpecker-level-drag {
  letter-spacing: -2px;
  font-size: 12px;
  color: #7a746c;
  cursor: grab;
}
.woodpecker-level-rename:hover {
  border-color: #5a4a28;
  color: #e6d18a;
  background: #2a2418;
}
.woodpecker-level-delete {
  border-color: #5a2222 !important;
  background: #2a1414 !important;
  color: #f0b0b0 !important;
  font-size: 18px !important;
  font-weight: 600;
}
.woodpecker-level-delete:hover {
  border-color: var(--danger) !important;
  color: #fff !important;
}
.woodpecker-card-tags {
  margin-top: 4px;
}
.woodpecker-underboard .study-new-tag-menu {
  z-index: 6;
}
.woodpecker-level-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1;
  padding-right: 36px;
}
.woodpecker-level-icon {
  flex-shrink: 0;
  display: inline-flex;
  width: 44px;
  height: 44px;
  z-index: 1;
}
.woodpecker-level-icon svg {
  width: 44px;
  height: 44px;
  display: block;
}
.woodpecker-level-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: calc(1.3em * 2);
}
.woodpecker-level-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.woodpecker-level-go {
  flex-shrink: 0;
  color: #7a746c;
  font-size: 18px;
  line-height: 1.2;
  transition: transform 0.15s ease, color 0.15s ease;
}
.woodpecker-level-status {
  font-size: 12px;
  line-height: 1.3;
}
.woodpecker-level-bar {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #2a2622;
  overflow: hidden;
}
.woodpecker-level-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8a7340, #c9a63a);
  min-width: 0;
  transition: width 0.2s ease;
}
.woodpecker-level-card.is-started .woodpecker-level-bar-fill {
  background: linear-gradient(90deg, #6a8a40, #a3c96a);
}
.woodpecker-level-meta {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  margin-top: auto;
}
.woodpecker-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #24201c;
  border: 1px solid #3a3228;
  color: #b8b0a4;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.woodpecker-chip-accent {
  color: #e6d18a;
  border-color: #5a4a28;
  background: #2a2418;
}
.woodpecker-level-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 20px 18px;
  border: 1px dashed #3a3228;
  border-radius: 12px;
  background: #161410;
}
.woodpecker-level-empty h3 {
  margin: 0;
  font-size: 16px;
}
.woodpecker-level-empty p {
  margin: 0;
  max-width: 36rem;
}
.profiles-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 44rem;
}
.profile-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #3a3228;
  background: #181614;
}
.profile-card.is-active {
  outline: 1px solid #81b64c88;
}
.profile-card-name {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}
.profile-card-meta {
  margin: 0;
  font-size: 13px;
}
.profile-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.profile-card-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}
.exam-hall {
  width: min(100%, 980px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.exam-intro h2 {
  margin: 8px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.exam-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.exam-section-title {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}
.exam-section-lead {
  margin: -12px 0 0;
  max-width: 52rem;
}
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  align-items: stretch;
}

/* Endgame exams — Chess.com-style stacked menu */
.endgame-exam-hall .endgame-exam-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
}
.endgame-exam-hall .endgame-menu-stack {
  max-width: 420px;
}
.endgame-back-btn {
  align-self: flex-start;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 4px 0;
  cursor: pointer;
  font-size: 14px;
}
.endgame-back-btn:hover { color: var(--text); }
.endgame-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 1100px;
}
.endgame-level-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(20, 24, 32, 0.65);
}
.endgame-level-chip strong {
  font-size: 15px;
}
.endgame-hall-error {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #8a3a3a;
  background: rgba(80, 20, 20, 0.55);
  color: #ffc9c9;
  font-size: 14px;
}
.endgame-hall-error.hidden { display: none; }
.endgame-menu-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.endgame-menu-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.endgame-menu-meta .exam-card-seal {
  cursor: pointer;
}
.endgame-menu-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: rgba(12, 12, 14, 0.72);
  color: #f4f4f4;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.endgame-menu-item:hover {
  background: rgba(28, 28, 32, 0.85);
  border-color: rgba(255, 255, 255, 0.22);
}
.endgame-menu-item.is-admin-start-armed,
.endgame-menu-meta .exam-card-seal.is-admin-start-armed {
  outline: 2px solid #c9a45c;
  outline-offset: 2px;
  box-shadow: 0 0 0 1px rgba(201, 164, 92, 0.35);
}
.endgame-menu-item.is-passed {
  border-color: rgba(120, 200, 120, 0.45);
}
.endgame-menu-label { flex: 1; text-align: center; }
.endgame-menu-seal {
  width: 22px;
  height: 22px;
  color: #7dcea0;
  flex: 0 0 auto;
}
.endgame-menu-seal svg { display: block; width: 22px; height: 22px; }
.endgame-menu-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: -2px 0 8px;
  padding: 0 4px 8px;
}
.endgame-menu-meta .exam-card-seal { margin-top: 0; }
.endgame-admin-edit,
.endgame-admin-delete-exam,
.endgame-admin-add-exam,
.endgame-admin-edit-rating,
.endgame-admin-edit-goal {
  align-self: flex-start;
  font-size: 13px;
}
.endgame-level-card-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 12px;
}
.endgame-level-admin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 4px 0 12px;
}
.endgame-admin-exam-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.endgame-admin-delete-exam {
  border-color: #5a3030;
  color: #e0a0a0;
  background: #1a1212;
}
.endgame-admin-delete-exam:hover {
  border-color: #8a4040;
  background: #241616;
}
.study-modal-card.study-chapter-modal-card.endgame-admin-card,
.endgame-admin-card {
  width: min(1120px, calc(100vw - 32px));
  max-width: min(1120px, calc(100vw - 32px));
  max-height: min(94vh, 920px);
  padding: 22px 24px 18px;
}
.endgame-admin-card .study-modal-head h3 {
  font-size: 22px;
}
.endgame-admin-card .study-modal-head .muted {
  font-size: 14px;
  max-width: 56ch;
}
.endgame-admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 8px 0 0;
}
.endgame-admin-add-pos {
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid #4a4034;
  background: #1c1916;
  color: #d8c8a8;
  cursor: pointer;
}
.endgame-admin-add-pos:hover {
  border-color: #7a6a4a;
  background: #242018;
}
.endgame-admin-count { font-size: 13px; }
.endgame-admin-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  gap: 20px;
  align-items: start;
  margin: 12px 0;
  flex: 1 1 auto;
  min-height: 0;
}
@media (max-width: 860px) {
  .endgame-admin-body {
    grid-template-columns: 1fr;
  }
  .endgame-admin-fen-preview {
    justify-self: center;
    width: min(280px, 100%);
  }
}
.endgame-admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  min-width: 0;
  max-height: min(68vh, 640px);
  overflow: auto;
  padding-right: 6px;
}
.endgame-admin-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}
.endgame-admin-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.endgame-admin-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.endgame-admin-idx { color: var(--muted); font-size: 13px; }
.endgame-admin-seconds-label,
.endgame-admin-goal-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.endgame-admin-goal {
  min-width: 5.5rem;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border, #3a3a3a);
  background: var(--panel, #1a1a1a);
  color: inherit;
  font: inherit;
  font-size: 13px;
}
.endgame-admin-seconds {
  width: 72px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #3a3228;
  background: #121110;
  color: var(--text);
}
.endgame-admin-edit-board,
.endgame-admin-remove-pos {
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #4a4034;
  background: #1c1916;
  color: #d8c8a8;
  cursor: pointer;
}
.endgame-admin-edit-board:hover,
.endgame-admin-remove-pos:hover {
  border-color: #7a6a4a;
  background: #242018;
}
.endgame-admin-remove-pos:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.endgame-admin-fen {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #3a3228;
  background: #121110;
  color: var(--text);
}
.endgame-admin-fen:hover,
.endgame-admin-fen:focus {
  border-color: #6a5a3a;
  outline: none;
}
.endgame-admin-saved {
  margin: 0 0 8px;
  font-size: 13px;
  color: #8fbf7a;
}
.endgame-board-editor-card {
  max-width: 720px;
  width: min(720px, 96vw);
}
.endgame-board-editor-body {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 220px);
  gap: 16px;
  align-items: start;
  margin: 12px 0;
}
@media (max-width: 640px) {
  .endgame-board-editor-body {
    grid-template-columns: 1fr;
  }
}
.endgame-board-editor-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 50px #0008;
  justify-self: center;
  user-select: none;
  background: var(--dark, #b58863);
}
/* Reset global `button` styles so squares stay flat 1:1 cells. */
button.endgame-board-editor-sq,
.endgame-board-editor-sq {
  position: relative;
  display: block;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  overflow: hidden;
  filter: none;
  appearance: none;
  -webkit-appearance: none;
}
.endgame-board-editor-sq.light { background: var(--light, #f0d9b5); }
.endgame-board-editor-sq.dark { background: var(--dark, #b58863); }
.endgame-board-editor-sq:hover {
  filter: none;
  box-shadow: inset 0 0 0 999px rgba(255, 255, 180, 0.22);
}
.endgame-board-editor-sq:focus-visible {
  outline: 2px solid #c9a45c;
  outline-offset: -2px;
  z-index: 1;
}
.endgame-board-editor-sq.is-piece {
  cursor: grab;
}
.endgame-board-editor-sq.is-drag-source {
  opacity: 0.35;
}
.endgame-board-editor-sq.is-drop-target {
  box-shadow: inset 0 0 0 999px rgba(201, 164, 92, 0.32);
}
body.endgame-board-dragging,
body.endgame-board-dragging .endgame-board-editor-sq {
  cursor: grabbing !important;
  user-select: none;
}
.endgame-board-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  width: 56px;
  height: 56px;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}
.endgame-board-drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.endgame-board-editor-sq img,
.endgame-board-editor-piece-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  padding: 4%;
  box-sizing: border-box;
}
.endgame-board-editor-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.endgame-board-editor-tray {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.endgame-board-editor-piece {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid #3a3228;
  background: #181614;
  cursor: pointer;
}
.endgame-board-editor-piece img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  pointer-events: none;
}
.endgame-board-editor-piece.is-active,
.endgame-board-editor-turn-btn.is-active,
.endgame-board-editor-tool-btn.is-active {
  border-color: #c9a45c;
  box-shadow: 0 0 0 1px #c9a45c inset;
  background: #2a2418;
}
.endgame-board-editor-turn {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.endgame-board-editor-turn-btn,
.endgame-board-editor-tool-btn {
  font-size: 12px;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid #3a3228;
  background: #181614;
  color: var(--text);
  cursor: pointer;
}
.endgame-board-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.endgame-board-editor-fen {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  word-break: break-all;
  line-height: 1.35;
}
.endgame-admin-fen-preview {
  position: sticky;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #3a3228;
  background: #141210;
}
.endgame-admin-fen-preview.hidden { display: none; }
.endgame-admin-fen-preview.is-invalid {
  border-color: #6a3a3a;
}
.endgame-admin-fen-preview-label {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}
.endgame-admin-fen-preview-board {
  width: 100%;
}
.endgame-admin-mini-board {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.endgame-level-card { max-width: 280px; }
.exam-card {
  position: relative;
  text-align: left;
  background: #181614;
  border: 1px solid #3a3228;
  overflow: hidden;
  min-height: 168px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.exam-card-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  box-sizing: border-box;
  padding: 16px 16px 12px;
  background: transparent;
  text-align: left;
  border-radius: 0;
}
.exam-card-main:disabled { opacity: 0.45; }
.exam-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: var(--tone, var(--accent-2));
}
.exam-card::before {
  content: "";
  position: absolute;
  inset: auto -20px -40px auto;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--tone, #c0a45c) 0%, transparent 70%);
  opacity: 0.28;
  pointer-events: none;
}
.exam-card-main:hover:not(:disabled) {
  filter: brightness(1.08);
}
.exam-card-head,
.exam-card-roman,
.exam-card-name,
.exam-card-task,
.exam-card-rating,
.exam-card-status,
.exam-card-seal,
.exam-card-passed-pill,
.exam-more,
.exam-details {
  position: relative;
  z-index: 1;
}
.exam-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 1.2em;
}
.exam-card-roman {
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--ink);
  opacity: 0.7;
}
.exam-card-passed-pill {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #d7f0c0;
  background: #2a3d24;
  border: 1px solid #81b64c77;
  box-shadow: 0 0 10px #81b64c33;
}
.exam-card-passed-pill.is-locked {
  letter-spacing: 0.06em;
  color: #efe8df;
  background: #2e2a26;
  border-color: #8a8176aa;
  box-shadow: 0 0 10px #0005;
}
.exam-card-passed-pill.is-miss {
  letter-spacing: 0.08em;
  color: #f6e7c4;
  background: #3a3018;
  border-color: #c0a45c99;
  box-shadow: 0 0 10px #c0a45c33;
}
.exam-card-name {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}
.exam-card-task,
.exam-card-rating,
.exam-card-status {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.exam-card-rating {
  color: var(--accent-2);
  font-weight: 650;
}
.exam-card-status,
.exam-card-seal {
  margin-top: auto;
  flex: 0 0 auto;
}
.exam-card-status.is-open {
  color: #d2cbc0;
  font-weight: 650;
}
.exam-card-status.is-locked {
  color: #7f776e;
}
.exam-card-status.is-warn {
  color: #e0a090;
  font-weight: 650;
}
.exam-card.passed {
  border-color: #4f7340;
  box-shadow:
    inset 0 0 0 1px #81b64c33,
    0 0 0 1px #81b64c18,
    0 10px 26px #0007;
}
.exam-card.passed::after {
  height: 5px;
  background: linear-gradient(90deg, #81b64c, var(--tone, #81b64c));
  box-shadow: 0 0 12px #81b64c55;
}
.exam-card.passed::before {
  opacity: 0.4;
  background: radial-gradient(circle, #81b64ccc 0%, transparent 72%);
}
.exam-card-seal {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 10px 12px;
  border-radius: 9px;
  background:
    linear-gradient(145deg, #24361f 0%, #1a2718 48%, #152014 100%);
  border: 1px solid #6a985088;
  box-shadow:
    inset 0 1px 0 #ffffff12,
    0 0 18px #81b64c22;
}
.exam-card-seal-mark {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9fd46a, #81b64c 55%, #5f8f38);
  color: #10180e;
  box-shadow:
    0 0 0 1px #c8e8a855,
    0 0 14px #81b64c66;
}
.exam-card-seal-mark svg {
  display: block;
}
.exam-card-seal-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.exam-card-seal-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c5eb9a;
  line-height: 1.1;
}
.exam-card-seal-meta {
  font-size: 12px;
  line-height: 1.3;
  color: #d5deca;
  font-variant-numeric: tabular-nums;
}
.exam-card-seal.is-locked {
  background: linear-gradient(145deg, #322e2a 0%, #24211e 52%, #1a1816 100%);
  border-color: #7d756caa;
  box-shadow:
    inset 0 1px 0 #ffffff14,
    0 0 16px #0005;
}
.exam-card-seal.is-locked .exam-card-seal-mark {
  background: radial-gradient(circle at 35% 30%, #b7aea4, #7d756c 55%, #4e4944);
  color: #f7f3ee;
  box-shadow:
    0 0 0 1px #e6dfd655,
    0 0 12px #0006;
}
.exam-card-seal.is-locked .exam-card-seal-title {
  letter-spacing: 0.08em;
  font-size: 11px;
  color: #f0eae3;
}
.exam-card-seal.is-locked .exam-card-seal-meta {
  color: #c9c2b8;
}
.exam-card-seal.is-miss {
  background: linear-gradient(145deg, #3d3118 0%, #2b2414 52%, #1e1a12 100%);
  border-color: #c0a45caa;
  box-shadow:
    inset 0 1px 0 #ffffff14,
    0 0 16px #c0a45c28;
}
.exam-card-seal.is-miss .exam-card-seal-mark {
  background: radial-gradient(circle at 35% 30%, #f0dd9e, #c0a45c 55%, #8a7038);
  color: #1c150c;
  box-shadow:
    0 0 0 1px #f6e7c255,
    0 0 14px #c0a45c66;
}
.exam-card-seal.is-miss .exam-card-seal-title {
  letter-spacing: 0.1em;
  color: #f6e7c4;
}
.exam-card-seal.is-miss .exam-card-seal-meta {
  color: #e4d7b8;
}
.exam-card.is-locked .exam-card-main {
  opacity: 0.9;
}
.exam-gate-chips {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 2px 0 4px;
  flex: 1 1 auto;
  position: relative;
  z-index: 1;
}
.exam-gate-chip {
  font-size: 11px;
  line-height: 1.25;
  color: var(--muted);
}
.exam-gate-chip.is-ok {
  color: #8fd18f;
}
.exam-gate-chip.is-miss {
  color: #e0a090;
}
.exam-gate-card {
  max-width: 440px;
}
.exam-gate-lead {
  margin: 0 0 12px;
  color: var(--text);
}
.exam-gate-reqs {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.exam-gate-reqs li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #3a3228;
  background: #141210;
}
.exam-gate-reqs li.is-ok {
  border-color: #3d5c3d;
}
.exam-gate-reqs li.is-miss {
  border-color: #6a3a30;
}
.exam-gate-reqs li strong {
  color: var(--text);
  font-size: 14px;
}
.exam-gate-reqs li span {
  color: var(--muted);
  font-size: 12px;
}
.exam-gate-hint {
  margin: 0 0 16px;
  font-size: 13px;
}
.exam-more {
  margin-top: auto;
  padding: 10px 16px;
  background: #221c18;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 0;
  border-top: 1px solid #3a3228;
}
.exam-more:hover { filter: brightness(1.12); }
.exam-details {
  padding: 12px 16px 14px;
  background: #120f0d;
  border-top: 1px solid #3a3228;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.exam-details-kicker {
  font-size: 11px !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2) !important;
}
.exam-details p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.exam-details strong { color: var(--text); }

.exam-panel {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.exam-panel.exam-rail {
  background: #161412;
  border: 1px solid #3a3228;
  box-shadow: inset 0 0 0 1px #ffffff08;
  padding: 16px 18px;
  gap: 14px;
}
.exam-panel.exam-rail > .meta {
  margin-top: auto;
  padding: 12px;
  border-radius: 10px;
  background: #1c1a17;
  border: 1px solid #ffffff0c;
}
.exam-panel.exam-rail > .meta .meta-grid {
  margin-bottom: 8px;
}
.exam-panel.exam-rail > .meta .turn {
  margin: 0 0 4px;
  font-weight: 700;
}
.exam-panel-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.exam-panel-name {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 32px;
  line-height: 1.15;
}
.exam-panel.exam-rail .exam-panel-rules,
.exam-panel.exam-rail > .muted {
  font-size: 14px;
  line-height: 1.45;
}
.exam-panel.exam-rail > .meta-grid span {
  font-size: 13px;
}
.exam-panel.exam-rail > .meta-grid strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.exam-panel.exam-rail .meta-grid strong.warn {
  color: #ff8a3a;
}
.exam-panel.exam-rail .meta-grid strong.danger {
  color: #ff3b3b;
}
.exam-panel.exam-rail > button {
  font-size: 15px;
  padding: 12px 14px;
}

.exam-hud {
  background: #140e0c;
  border: 1px solid #3a2418;
  border-radius: 12px;
  padding: 12px 14px 10px;
  box-shadow: inset 0 0 40px #0008;
}
.exam-hud-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.exam-hud-rank,
.exam-hud-step {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.exam-hud-step { text-align: right; }
.exam-clock {
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #e7c36a;
  text-shadow: 0 0 18px rgba(196, 77, 77, 0.35);
  text-align: center;
  line-height: 1;
}
.exam-clock.warn {
  color: #ff8a3a;
  animation: exam-tick 1s ease-in-out infinite;
}
.exam-clock.danger {
  color: #ff3b3b;
  animation: exam-tick 0.45s ease-in-out infinite;
  text-shadow: 0 0 22px rgba(255, 40, 40, 0.55);
}
@keyframes exam-tick {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(1.25); }
}
.exam-fuse {
  margin-top: 10px;
  height: 6px;
  background: #2a1814;
  border-radius: 999px;
  overflow: hidden;
}
.exam-fuse-rail {
  margin-top: 0;
}
.exam-fuse-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #c44d4d, #e7c36a);
  transform-origin: left;
  transform: scaleX(1);
}
.exam-dots {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.exam-dots-rail {
  margin-top: 0;
}
.exam-dot {
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: #2a221c;
}
.exam-dot.done { background: var(--accent); }
.exam-dot.current { background: var(--accent-2); box-shadow: 0 0 8px #c0a45c88; }

.exam-result-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.58);
}
.exam-result-modal.hidden {
  display: none !important;
}
.storm-attention-card {
  max-width: 420px;
  border-color: #8ec8e6;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(180, 225, 245, 0.35);
}
.storm-attention-text {
  margin: 0 0 8px;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--text);
}
.exam-result-card {
  width: min(420px, 100%);
  background: #1a1410;
  border: 1px solid #3a2418;
  border-radius: 12px;
  padding: 22px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.exam-result-modal.pass .exam-result-card {
  border-color: #2e5a22;
  background: #142014;
}
.exam-result-modal.fail .exam-result-card {
  border-color: #5a2222;
  background: #221414;
}
.exam-result-title {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 28px;
}
.exam-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}
.exam-result-actions button { flex: 1 1 calc(50% - 4px); }
.exam-result-actions #exam-tasks-btn { flex: 1 1 100%; }

.storm-played-round.is-selected {
  outline: 1px solid #759900;
  outline-offset: 1px;
}
.exam-played .storm-played-title {
  margin: 0;
}

body.exam-live {
  background:
    radial-gradient(900px 480px at 50% -10%, #3a1810 0%, transparent 55%),
    var(--bg);
}
body.exam-live::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  box-shadow: inset 0 0 140px #000a;
  z-index: 2;
}
body.exam-danger::after {
  box-shadow: inset 0 0 180px rgba(90, 0, 0, 0.55);
}
body.exam-live .actions,
body.exam-live .puzzle-feedback,
body.exam-live .links,
body.exam-live #p-themes,
body.exam-live .puzzle-session-tools,
body.exam-live #status { display: none !important; }

/* Warmup / learning zone: turn is already in the side meta — free height for the board. */
body.growth-focus #status { display: none !important; }
/* Blind: turn + D live in the left panel / session card — free height for the board. */
body.blind-focus #status { display: none !important; }

/* Exam: hide left settings column — rail sits next to the board (like Streak). */
body.exam-live .app-body {
  grid-template-columns: 1fr;
}
body.exam-live .app-body > .panel {
  display: none !important;
}

/* No Stockfish chrome for the entire exam session (live + result). */
body.exam-live #ceval-bar,
body.exam-live #ceval-settings,
body.exam-live #ceval-settings-panel,
body.exam-live #analysis-panel,
body.exam-live #eval-bar,
body.exam-live #analysis-btn {
  display: none !important;
}

body.puzzle-session-on .board-card > .actions {
  display: none !important;
}

/* Maia / adaptive / TM / blindfold play: puzzle action bar is irrelevant. */
body.is-maia-play .board-card > .actions,
.board-card.is-maia-play > .actions,
body.is-maia-play .puzzle-feedback {
  display: none !important;
}

/* During a live/finished Maia session: drop left settings column → Lichess-sized board. */
body.maia-board-focus .app-body {
  grid-template-columns: 1fr;
}
body.maia-board-focus .app-body > .panel {
  display: none !important;
}
body.maia-game-live #status,
body.maia-analysis-ready #status,
body.maia-analysis-ready #maia-review-actions {
  display: none !important;
}
/* Stockfish fun mode: status banner off — board uses the freed height. */
body.is-maia-play:has(#sf-panel:not(.hidden)) #status {
  display: none !important;
}
/* Named-bot board: drop the puzzle status strip so the board can grow. */
body.maia-board-focus #status,
body.is-maia-play:has(#bots-back-btn:not(.hidden)) #status {
  display: none !important;
}

/* Woodpecker training: desktop left rail for cycle history. */
body.woodpecker-focus .app-body {
  grid-template-columns: minmax(360px, 420px) 1fr;
}
body.woodpecker-focus .app-body > .panel {
  display: flex !important;
  padding: 20px 18px 22px;
  width: auto;
  min-width: 0;
}
body.woodpecker-focus .app-body > .panel > :not(#woodpecker-panel) {
  display: none !important;
}
body.woodpecker-focus #woodpecker-panel {
  flex: 1;
  min-height: 0;
  height: 100%;
}
body.woodpecker-focus #status,
body.woodpecker-focus #woodpecker-bar {
  display: none !important;
}
@media (max-width: 1100px) {
  body.woodpecker-focus .app-body {
    grid-template-columns: minmax(320px, 360px) 1fr;
  }
}
@media (max-width: 900px) {
  body.woodpecker-focus .app-body {
    grid-template-columns: 1fr;
  }
  body.woodpecker-focus .app-body > .panel {
    max-height: 46vh;
    border-right: 0;
    border-bottom: 1px solid #0008;
    padding: 14px;
  }
  body.woodpecker-focus .woodpecker-panel {
    gap: 12px;
    padding: 14px;
  }
  body.woodpecker-focus .woodpecker-panel .turn {
    font-size: 18px;
  }
  body.woodpecker-focus .woodpecker-cycle-row {
    font-size: 15px;
    padding: 10px 8px;
  }
  body.woodpecker-focus .woodpecker-cycles-list {
    min-height: 96px;
    max-height: 140px;
    flex: 0 1 auto;
  }
}

/* Engine UI only after the game ends (review). Before/during: completely gone. */
body.is-maia-play:not(.maia-game-review) #ceval-bar,
body.is-maia-play:not(.maia-game-review) #ceval-settings,
body.is-maia-play:not(.maia-game-review) #ceval-settings-panel,
body.is-maia-play:not(.maia-game-review) #analysis-panel,
body.is-maia-play:not(.maia-game-review) #eval-bar {
  display: none !important;
}

/* Puzzle Storm: no Stockfish chrome (same idea as exams). */
.play-main.is-storm #ceval-bar,
.play-main.is-storm #ceval-settings,
.play-main.is-storm #ceval-settings-panel,
.play-main.is-storm #analysis-panel,
.play-main.is-storm #eval-bar,
body.storm-live #ceval-bar,
body.storm-live #ceval-settings,
body.storm-live #ceval-settings-panel,
body.storm-live #analysis-panel,
body.storm-live #eval-bar,
body.storm-ended #ceval-bar,
body.storm-ended #ceval-settings,
body.storm-ended #ceval-settings-panel,
body.storm-ended #analysis-panel,
body.storm-ended #eval-bar {
  display: none !important;
}

body.streak-hide-engine #ceval-bar,
body.streak-hide-engine #ceval-settings,
body.streak-hide-engine #ceval-settings-panel,
body.streak-hide-engine #analysis-panel,
body.streak-hide-engine #eval-bar,
body.woodpecker-hide-engine #ceval-bar,
body.woodpecker-hide-engine #ceval-settings,
body.woodpecker-hide-engine #ceval-settings-panel,
body.woodpecker-hide-engine #analysis-panel,
body.woodpecker-hide-engine #eval-bar,
body.woodpecker-hide-engine #analysis-btn,
body.strategy-session-focus #status {
  display: none !important;
}
body.strategy-hide-engine #ceval-bar,
body.strategy-hide-engine #ceval-settings,
body.strategy-hide-engine #ceval-settings-panel,
body.strategy-hide-engine #analysis-panel,
body.strategy-hide-engine #eval-bar,
body.strategy-hide-engine #analysis-btn {
  display: none !important;
}

body.storm-live .board-card > .actions,
body.storm-ended .board-card > .actions,
body.streak-live .board-card > .actions,
body.storm-live .puzzle-feedback,
body.storm-ended .puzzle-feedback,
body.streak-live .puzzle-feedback,
body.storm-live .move-panel,
body.storm-ended .move-panel,
body.storm-live #review-panel,
body.storm-ended #review-panel,
body.streak-live #review-panel,
body.storm-live #maia-fen-bar,
body.storm-ended #maia-fen-bar,
body.storm-ended #eval-bar,
.board-card:has(.play-main.is-storm-live) > .actions,
.board-card:has(.play-main.is-storm-ended) > .actions,
.board-card:has(.play-main.is-streak-live) > .actions,
.board-card:has(.play-main.is-storm-live) .puzzle-feedback,
.board-card:has(.play-main.is-storm-ended) .puzzle-feedback,
.board-card:has(.play-main.is-streak-live) .puzzle-feedback {
  display: none !important;
}

/* —— Studies (Lichess-style) —— */
.studies-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 4px;
}
.studies-search-wrap {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 360px;
}
.studies-search-wrap input {
  width: 100%;
  box-sizing: border-box;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.studies-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0 2px;
}
.studies-topics.hidden {
  display: none;
}
.studies-tags-manage {
  margin-top: 4px;
}
.studies-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.study-topic-chip {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
}
.study-topic-pill,
.study-topic-chip .study-topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #1c242c;
  color: #6aa9d8;
  border: 0;
  border-radius: 3px;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.25;
  text-align: left;
}
.study-topic-chip .study-topic-pill {
  border-radius: 3px 0 0 3px;
}
.study-topic-pill.is-active,
.study-topic-chip.is-active .study-topic-pill,
.study-topic-all.is-active {
  background: #2a455c;
  color: #c5e4f7;
  box-shadow: inset 0 0 0 1px #4a90b8;
}
.study-topic-pill:hover {
  background: #243440;
  color: #9fd0ef;
}
.study-topic-del {
  background: #1c242c;
  color: #7a9aaa;
  border: 0;
  border-radius: 0 3px 3px 0;
  border-left: 1px solid #2a3844;
  padding: 0 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.study-topic-del:hover {
  background: #3a2020;
  color: #f88;
}
.studies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.study-empty {
  grid-column: 1 / -1;
  padding: 28px 8px;
  color: var(--muted);
}
.study-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #181614;
  border: 1px solid #3a3228;
  overflow: visible;
}
.study-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.study-card-main {
  flex: 0 0 auto;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 16px 16px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  width: 100%;
  border-radius: 0;
}
.study-card-main:hover {
  background: #221e1a;
}
.study-card-flair {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  font-size: 52px;
  line-height: 1;
  text-align: center;
  border-radius: 8px;
  background: #12100e;
  border: 1px solid #2c2824;
  box-sizing: border-box;
  overflow: hidden;
}
.study-card-flair--board {
  font-size: 0;
  padding: 0;
}
.study-card-flair .study-board-preview {
  width: 100%;
  height: 100%;
  display: block;
}
.study-card-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding-top: 6px;
}
.study-card-name {
  font-size: 18px;
  font-weight: 700;
  color: #6ba4d8;
  word-break: break-word;
  line-height: 1.25;
}
.study-card-meta {
  font-size: 12px;
}
.study-card-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 4px 14px 12px;
  position: relative;
}
.study-tag-owned {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
}
.study-tag-owned .study-tag-filter {
  display: inline-flex;
  align-items: center;
  background: #1c242c;
  color: #6aa9d8;
  border: 0;
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.25;
}
.study-tag-owned:has(.study-tag-remove) .study-tag-filter {
  border-radius: 3px 0 0 3px;
}
.study-tag-owned .study-tag-filter:hover {
  background: #243440;
  color: #9fd0ef;
}
.study-tag-remove {
  background: #1c242c;
  color: #7a9aaa;
  border: 0;
  border-radius: 0 3px 3px 0;
  border-left: 1px solid #2a3844;
  padding: 0 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.study-tag-remove:hover {
  background: #3a2020;
  color: #f88;
}
.study-new-tag {
  position: relative;
  display: inline-flex;
}
.study-new-tag-btn {
  background: #22201c !important;
  border: 1px solid #3a3732 !important;
  border-radius: 3px !important;
  color: #c8c4bc !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  filter: none !important;
}
.study-new-tag-btn:hover {
  background: #2c2824 !important;
  color: #eee !important;
}
.study-new-tag-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 20;
  width: min(240px, 70vw);
  background: #1a1714;
  border: 1px solid #3a3228;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.study-new-tag-menu.hidden {
  display: none;
}
.study-new-tag-input {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}
.study-new-tag-suggest {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  max-height: 160px;
  overflow: auto;
}
.study-new-tag-suggest.hidden {
  display: none;
}
.study-new-tag-suggest button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #6aa9d8;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
}
.study-new-tag-suggest button:hover {
  background: #243848;
}
.study-card-actions {
  display: flex;
  flex-direction: column;
  border-left: 1px solid #3a3228;
}
.study-card-actions button {
  flex: 1;
  min-width: 36px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.study-card-actions button:hover {
  background: #2a2520;
  color: #eee;
}
.study-card-delete:hover {
  color: #f88 !important;
}
.study-underboard {
  margin-top: 8px;
  padding: 10px 4px 4px;
  border-top: 1px solid #2c2824;
  width: 100%;
  box-sizing: border-box;
}
.study-underboard.hidden {
  display: none !important;
}
.study-underboard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 8px;
}
.study-underboard-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.study-underboard-manage {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: #6aa9d8 !important;
  padding: 0 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer;
  filter: none !important;
  width: auto !important;
}
.study-underboard-manage:hover {
  color: #9fd0ef !important;
  text-decoration: underline;
}
.study-underboard .study-topics {
  margin: 0;
}
.study-underboard .study-card-tags {
  padding: 0;
}
.study-underboard .study-new-tag-menu {
  bottom: auto;
  top: calc(100% + 6px);
}
.study-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  min-height: 0;
}
.study-topics-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #2c2824;
}
.study-topics-footer .study-card-tags {
  padding: 0;
}
.study-topics-modal-card {
  width: min(480px, 100%);
}
.study-tagify {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 10px;
  background: #12100e;
  border: 1px solid #3a3228;
  cursor: text;
}
.study-tagify-chips {
  display: contents;
}
.study-tagify-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #1c242c;
  color: #6aa9d8;
  border-radius: 3px;
  padding: 4px 6px 4px 8px;
  font-size: 13px;
  font-weight: 600;
}
.study-tagify-remove {
  background: transparent;
  border: 0;
  color: #7a9aaa;
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}
.study-tagify-remove:hover {
  color: #f88;
}
.study-tagify input {
  flex: 1 1 120px;
  min-width: 100px;
  border: 0 !important;
  background: transparent !important;
  padding: 4px 2px !important;
  outline: none;
  box-shadow: none !important;
}
.study-tagify-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #1a1714;
  border: 1px solid #3a3228;
  max-height: 200px;
  overflow: auto;
}
.study-tagify-suggest.hidden {
  display: none;
}
.study-tagify-suggest button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #6aa9d8;
  padding: 8px 12px;
  cursor: pointer;
}
.study-tagify-suggest button:hover {
  background: #243848;
}

/* —— Opening studio —— */
.openings-hall .exam-intro {
  max-width: 720px;
}
.opening-detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 12px;
}
.opening-detail-actions #opening-detail-add {
  min-width: auto;
}
.opening-simplify-wrap {
  position: relative;
  display: inline-flex;
}
.opening-simplify-wrap #opening-detail-simplify {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.opening-simplify-caret {
  font-size: 0.75em;
  opacity: 0.75;
}
.opening-simplify-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 100%;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: var(--panel, #1c1b19);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.opening-simplify-menu[hidden] {
  display: none;
}
.opening-simplify-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text, #eee);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.opening-simplify-item:hover,
.opening-simplify-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}
#opening-detail-error {
  margin-top: 10px;
  max-width: 720px;
}
.opening-card-due {
  font-size: 12px;
  color: var(--accent);
}
.opening-card .opening-card-train:hover {
  color: var(--accent);
}
.opening-stats {
  margin-top: 14px;
}
.opening-line-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 920px;
  margin-top: 8px;
}
.opening-line-more {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 6px 10px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #3a342c;
  border-radius: 0;
  background: #1c1916;
  color: #e8e2d6;
  font-size: 13px;
  cursor: pointer;
}
.opening-line-more:hover {
  border-color: #5a9a4a;
  background: #222018;
}
.opening-line-more .muted {
  margin: 0;
  font-size: 12px;
}
.opening-line-row {
  display: grid;
  grid-template-columns: 36px 1fr auto minmax(80px, 180px) 32px;
  gap: 10px;
  align-items: center;
  padding: 8px 6px 8px 10px;
  background: #181614;
  border: 1px solid #2e2820;
  border-left-width: 3px;
  font-size: 13px;
}
.opening-line-row.opening-line-main {
  border-left-color: #5a9a4a;
}
.opening-line-row.opening-line-side {
  border-left-color: #c45a5a;
}
.opening-line-num {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.opening-line-san {
  font-family: "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.01em;
}
.opening-line-kind {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.opening-line-main .opening-line-kind {
  color: #7ec86a;
}
.opening-line-side .opening-line-kind {
  color: #e07a7a;
}
.opening-line-main .opening-line-san {
  color: #d8ecd0;
}
.opening-line-side .opening-line-san {
  color: #ecd0d0;
}
.opening-line-ch {
  text-align: right;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.opening-line-delete {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #a39e94;
  cursor: pointer;
  opacity: 0.85;
  font-size: 18px;
  line-height: 1;
}
.opening-line-row:hover .opening-line-delete {
  opacity: 1;
}
.opening-line-delete:hover {
  background: #2a2520;
  color: #f88;
}
.opening-bar {
  gap: 12px;
  align-items: center;
}
.opening-bar .opening-exit-btn {
  margin-left: auto;
}
.opening-hud {
  border-color: #3d5a2e;
  background: linear-gradient(180deg, #1a2216 0%, #141812 100%);
}
.opening-hud-copy {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.opening-hud-comment {
  display: none !important;
}
.opening-import-error {
  margin: 0 0 4px;
  padding: 8px 10px;
  color: #f4b4b4;
  background: #2a1616;
  border: 1px solid #5a3030;
  font-size: 13px;
  line-height: 1.35;
}
#play-area.is-opening-train #status,
.play-area.is-opening-train #status {
  display: none;
}
@media (max-width: 720px) {
  .opening-line-row {
    grid-template-columns: 28px 1fr auto 32px;
  }
  .opening-line-ch {
    display: none;
  }
  .opening-line-delete {
    opacity: 0.85;
  }
}

.study-panel .study-back {
  width: 100%;
  margin-bottom: 4px;
}
.study-panel .study-toolbar button {
  width: 100%;
}
.study-panel .study-name-row button {
  width: auto;
  min-width: 36px;
  flex-shrink: 0;
}
.study-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.study-name {
  margin: 0;
  flex: 1;
  font-size: 18px;
  line-height: 1.25;
  word-break: break-word;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}
.study-hint {
  margin: 0 0 10px;
  font-size: 12px;
}
.study-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

/* Lichess-like chapters rail beside the board */
.study-chapters-rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #161512;
  border: 1px solid #2c2824;
  overflow: hidden;
}
.study-chapters-rail.hidden {
  display: none;
}
.study-chapters-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #2c2824;
}
.study-chapters-count {
  color: #d0642f;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.study-chapters-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.study-rail-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #9a9590;
  cursor: pointer;
}
.study-rail-menu-btn:hover {
  background: #2a2622;
  color: #eee;
}
.study-rail-menu-btn.hidden {
  display: none;
}
.study-name-flair,
.study-underboard-flair {
  margin-right: 0.35em;
  font-size: 1.15em;
  line-height: 1;
  vertical-align: -0.05em;
}
.study-settings-modal-card {
  width: min(520px, 94vw);
  max-height: min(88vh, 720px);
  overflow: auto;
}
.study-settings-identity {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}
.study-settings-flair-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.study-settings-label {
  font-size: 12px;
  color: var(--muted);
}
.study-settings-flair-btn {
  width: 72px;
  height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #3a3228;
  border-radius: 8px;
  background: #12100e;
  color: #c8c4bc;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}
.study-settings-flair-btn:hover,
.study-settings-flair-btn[aria-expanded="true"] {
  border-color: #3692e7;
  background: #1a1816;
}
.study-settings-flair-preview {
  font-size: 22px;
  line-height: 1;
  color: #888;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.study-settings-flair-preview.has-flair {
  color: inherit;
  font-size: 44px;
}
.study-settings-flair-preview.is-board {
  font-size: 0;
}
.study-settings-flair-preview .study-board-preview {
  width: 100%;
  height: 100%;
  display: block;
}
.study-settings-flair-clear {
  position: absolute;
  top: 18px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #3a3228;
  background: #2a2622;
  color: #ccc;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.study-settings-flair-clear:hover {
  background: #403830;
  color: #fff;
}
.study-settings-name-wrap {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.study-flair-picker {
  margin: 0 0 14px;
  padding: 10px;
  border: 1px solid #3a3228;
  border-radius: 8px;
  background: #12100e;
}
.study-flair-picker.hidden {
  display: none;
}
.study-flair-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2c2824;
}
.study-flair-cat {
  width: 36px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 4px 4px 0 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
}
.study-flair-cat:hover {
  background: #1f1c18;
}
.study-flair-cat.is-active {
  border-bottom-color: #3692e7;
  background: #1a222c;
}
.study-flair-search-wrap {
  display: block;
  margin-bottom: 8px;
}
.study-flair-search-wrap input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #3a3228;
  border-radius: 6px;
  background: #1a1816;
  color: inherit;
}
.study-flair-section {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.study-flair-grid {
  max-height: 240px;
  overflow: auto;
}
.study-flair-emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 2px;
}
.study-flair-emoji {
  width: 100%;
  aspect-ratio: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.study-flair-emoji:hover {
  background: #2a2622;
}
.study-flair-emoji.is-selected {
  background: #1a3a55;
  outline: 1px solid #3692e7;
}
.study-flair-hint {
  margin: 10px 0 0;
  font-size: 12px;
}
.study-flair-empty {
  margin: 12px 0;
  text-align: center;
}
.study-chapters {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: auto;
  min-height: 160px;
  max-height: var(--study-chapters-max, min(58vh, 560px));
}
.study-chapters-resize {
  flex-shrink: 0;
  width: 100%;
  height: 14px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  border-top: 1px solid #2c2824;
  cursor: ns-resize;
  touch-action: none;
  filter: none;
  background:
    linear-gradient(#5a534a, #5a534a) center / 42px 2px no-repeat,
    #161512;
}
.study-chapters-resize:hover,
body.study-chapters-resizing .study-chapters-resize {
  background:
    linear-gradient(#d0642f, #d0642f) center / 56px 2px no-repeat,
    #1f1c18;
}
body.study-chapters-resizing,
body.study-chapters-resizing * {
  cursor: ns-resize !important;
  user-select: none !important;
}
.study-add-chapter-btn {
  flex-shrink: 0;
  width: 100% !important;
  display: flex !important;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  background: transparent !important;
  border: 0 !important;
  border-top: 1px solid #2c2824 !important;
  border-radius: 0 !important;
  color: #c8c4bc;
  padding: 12px 12px !important;
  font-size: 13px;
  font-weight: 600;
  filter: none !important;
  cursor: pointer;
}
.study-add-chapter-btn:hover {
  background: #1f1c18 !important;
  color: #eee;
  filter: none !important;
}
.study-add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #3692e7;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.study-chapter {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 0;
  border-bottom: 1px solid #ffffff08;
  background: transparent;
  color: #c8c4bc;
}
.study-chapter.is-active {
  background: #1c1a17;
  box-shadow: inset 0 0 0 1px #ffffff55;
}
.study-chapter-main {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  text-align: left;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: inherit;
  padding: 8px 6px 8px 10px;
  cursor: pointer;
  filter: none !important;
}
.study-chapter-main:hover {
  background: #1f1c18 !important;
  filter: none !important;
}
.study-chapter-num {
  flex: 0 0 auto;
  color: #6c9eff;
  font-size: 13px;
  font-weight: 700;
  min-width: 1.2em;
  line-height: 1.35;
}
.study-chapter-title {
  flex: 1 1 auto;
  min-width: 0;
  color: #d8d4cc;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.study-chapter.is-active .study-chapter-title {
  color: #6c9eff;
  font-weight: 650;
}
.study-chapter-mode {
  flex: 0 0 auto;
  color: #d0642f;
  font-size: 12px;
  align-self: baseline;
}
.study-chapter-settings,
.study-chapter-delete {
  flex: 0 0 auto;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  min-width: 28px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #7a756c;
  cursor: pointer;
  opacity: 0.35;
  filter: none !important;
  font-size: 14px;
  line-height: 1;
}
.study-chapter:hover .study-chapter-settings,
.study-chapter:hover .study-chapter-delete,
.study-chapter.is-active .study-chapter-settings,
.study-chapter.is-active .study-chapter-delete {
  opacity: 1;
}
.study-chapter-settings:hover,
.study-chapter-delete:hover {
  background: #2a2520 !important;
  color: #eee;
  filter: none !important;
}
.study-chapter-delete:hover {
  color: #f88 !important;
}
.study-chapter-edit-card {
  width: min(420px, 100%);
}
.study-modal-label select {
  width: 100%;
  font: inherit;
  padding: 10px;
  background: #12100e;
  border: 1px solid #3a3228;
  color: #eee;
  border-radius: 0;
}
.tm-play-level {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}
.tm-hall .tm-intro h2 {
  background: linear-gradient(120deg, #f4efe6 0%, #c9b896 55%, #e8dcc4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tm-rating-strip {
  margin: 14px 0 4px;
  gap: 10px 12px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.tm-rating-strip strong {
  display: block;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}
.tm-stat {
  padding: 10px 14px;
  border: 1px solid #3a3228;
  border-radius: 10px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.04), transparent 55%),
    #161310;
  min-width: 0;
}
.tm-stat .muted {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tm-grid {
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
}
.tm-card {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.035), transparent 42%),
    #141210;
  border-color: color-mix(in srgb, var(--tone, #c0a45c) 38%, #3a3228);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  min-height: 236px;
}
.tm-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--tone, #c0a45c) 62%, #5a4c38);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
}
.tm-card.passed {
  outline: none;
  border-color: color-mix(in srgb, #81b64c 55%, #3a3228);
}
.tm-card .exam-card-main {
  flex: 1;
  gap: 7px;
  padding: 18px 16px 14px;
  min-height: 100%;
}
.tm-card .exam-card-name {
  color: #f3efe7;
  font-size: 25px;
  line-height: 1.15;
}
.tm-card .exam-card-task {
  color: #b9b0a4;
  line-height: 1.35;
}
.tm-card .exam-card-status {
  color: #8f877c;
}
.tm-card.passed .exam-card-status {
  color: #8fd18f;
}
.exam-card-match {
  margin: 2px 0 0;
  font-size: 12px;
}
.tm-card-score {
  display: block;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1;
  position: relative;
  z-index: 1;
}
.tm-card-score.is-win {
  color: #6cbf4a;
  text-shadow: 0 0 18px rgba(108, 191, 74, 0.28);
}
.tm-card-score.is-loss {
  color: #e05c5c;
  text-shadow: 0 0 18px rgba(224, 92, 92, 0.22);
}
.tm-card-score.is-draw {
  color: #9a948c;
}
.tm-card-score.is-empty {
  color: #7a736a;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.tm-play-result {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #3a3228;
  background: #1a1815;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tm-play-result.ok {
  border-color: #2f9e44;
}
.tm-play-result.bad {
  border-color: #e03131;
}
.tm-play-result.hidden {
  display: none;
}
.tm-play-result p {
  margin: 0;
}
.tm-play-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.tm-play-result-actions button {
  margin: 0;
}
.tm-bar-label {
  margin-left: auto;
  color: #d0642f;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tm-bar-label.hidden {
  display: none;
}

/* Blindfold play */
.bf-card.is-locked {
  filter: grayscale(1) brightness(0.72);
  opacity: 0.72;
}
.bf-card.is-locked .exam-card-main:disabled {
  cursor: not-allowed;
}
.bf-memorize {
  margin: 10px 0 14px;
  padding: 14px 12px;
  border: 1px solid #3a3228;
  background: linear-gradient(180deg, #241e18, #171410);
  text-align: center;
}
.bf-memorize.hidden { display: none; }
.bf-memorize-title {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.bf-memorize-sec {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bf-memorize-sec strong { color: var(--text); }
#board.blindfold-empty img.piece,
body.blindfold-play-hide #board img.piece,
body.blindfold-play-hide #board img.piece.hidden-drag {
  opacity: 0 !important;
  visibility: hidden !important;
}
/* Drag ghost is appended to document.body — must stay invisible in blindfold. */
body.blindfold-play-hide .piece-ghost {
  opacity: 0 !important;
  visibility: hidden !important;
  filter: none !important;
}
body.blindfold-play-hide #board .sq.last {
  box-shadow: inset 0 0 0 5px #f0c040;
  background-color: rgba(240, 192, 64, 0.35);
}
.bf-bar {
  background: #1d1814;
}
.tm-card .exam-card-roman {
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
  letter-spacing: 0.08em;
}
#study-bar {
  display: none !important;
}
/* Studio title used to sit in a bar above the board and shrink the squares. */
#play-area.is-study #status {
  display: none !important;
}
.study-flip-btn {
  width: auto;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: #2a2520;
  border: 1px solid #4a4034;
  color: #ddd;
  filter: none;
  border-radius: 6px;
}
.study-flip-btn:hover {
  background: #353028;
  color: #fff;
  filter: none;
}
.study-interactive-badge {
  color: #d0642f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.study-lesson-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #1a1815;
  border: 1px solid #3a3228;
}
.study-lesson-hud.hidden {
  display: none;
}
.study-lesson-text {
  margin: 0;
  flex: 1;
  min-width: 180px;
  font-size: 14px;
}
.study-lesson-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.study-lesson-actions button {
  width: auto;
  padding: 8px 12px;
  font-size: 13px;
}
.study-source-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #3a3228;
}
.study-source-tab {
  flex: 1;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  border-bottom: 2px solid transparent !important;
  color: var(--muted);
  padding: 10px 8px !important;
  filter: none !important;
}
.study-source-tab.is-active {
  color: #d0642f;
  border-bottom-color: #d0642f !important;
  font-weight: 700;
}
.study-source-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.study-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.study-mode-help {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}
.study-chapter-modal-card {
  width: min(560px, 100%);
}
.study-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
.study-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}
.study-modal.hidden {
  display: none;
}
.study-modal-card {
  width: min(640px, 100%);
  max-height: min(90vh, 760px);
  overflow: auto;
  background: #1a1714;
  border: 1px solid #3a3228;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.study-modal-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
}
.study-modal-head .muted {
  margin: 0;
  font-size: 13px;
}
.study-modal-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.study-modal-label input,
.study-modal-label textarea {
  width: 100%;
  font: inherit;
  padding: 10px;
  background: #12100e;
  border: 1px solid #3a3228;
  color: #eee;
  resize: vertical;
}
.study-pgn-file-label input[type="file"] {
  padding: 8px;
  cursor: pointer;
}
.study-pgn-file-name {
  font-size: 12px;
}
.study-modal-label textarea {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
}
.study-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .exam-clock { font-size: 34px; }
  .exam-intro h2 { font-size: 26px; }
  .play-main,
  .play-main.is-study,
  .play-main.is-opening-train,
  .play-main.is-storm,
  .play-main.is-streak,
  .play-main.is-exam,
  .play-main.has-review,
  .play-main.has-review.is-study {
    grid-template-columns: 1fr;
  }
  .board-stack {
    width: min(var(--cg-width, 100%), 100%);
    margin-inline: auto;
  }
  .study-chapters {
    max-height: var(--study-chapters-max, 220px);
  }
  .move-panel {
    max-height: 180px;
    height: auto;
  }
  .move-panel:has(.bot-chat:not(.hidden)) {
    max-height: 320px;
  }
  .play-main.is-streak.is-streak-live .move-panel {
    max-height: none;
  }
  .play-main.has-maia-clocks .move-panel {
    margin-top: 0;
  }
  .elo-stats { grid-template-columns: 1fr 1fr; }
}

/* —— Game review —— */
.play-main.has-review {
  grid-template-columns: var(--cg-width, min(52vmin, 100%)) minmax(320px, 400px) var(--review-col, 380px);
}
.play-main.has-review.is-study {
  grid-template-columns: minmax(280px, 340px) var(--cg-width, min(44vmin, 100%)) minmax(320px, 400px) var(--review-col, 380px);
}
.review-panel {
  position: relative;
  background: #161412;
  border-radius: 10px;
  padding: 14px 14px 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  height: var(--board-align-h, auto);
  max-height: var(--board-align-h, min(100%, 640px));
  overflow: auto;
}
.review-resize {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px 0 0 10px;
  background: transparent;
  cursor: ew-resize;
  z-index: 2;
  touch-action: none;
}
.review-resize:hover,
body.review-resizing .review-resize {
  background: linear-gradient(90deg, #81b64c88, transparent);
}
body.review-resizing,
body.review-resizing * {
  cursor: ew-resize !important;
  user-select: none !important;
}
.play-main.has-maia-clocks .review-panel {
  margin-top: var(--maia-clock-align, 0px);
}
.review-panel.hidden { display: none; }
.review-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 18px;
}
.review-panel-head strong {
  font-size: 20px;
}
.review-panel-head .muted,
.review-eval-row .muted {
  font-size: 15px;
}
.review-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.review-progress.hidden { display: none; }
.review-progress-bar {
  height: 8px;
  border-radius: 4px;
  background: #2a2622;
  overflow: hidden;
}
.review-progress-fill,
#review-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #81b64c, #c5e17a);
  transition: width 0.2s ease;
}
.review-body.hidden { display: none; }
.review-eval-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.review-eval {
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f0ebe3;
}
.review-accuracy,
.review-ratings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.review-acc-box,
.review-rating-box {
  background: #1c1916;
  border-radius: 8px;
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.review-acc-box .muted,
.review-rating-box .muted {
  font-size: 15px;
}
.review-acc-box strong,
.review-rating-box strong {
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.review-counts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 17px;
}
.review-count-row {
  display: grid;
  grid-template-columns: 2.4em 1fr 2.4em 2.4em;
  gap: 8px;
  align-items: center;
  color: #d8d4cc;
}
.review-count-sym {
  font-weight: 800;
  text-align: center;
  border-radius: 4px;
  font-size: 15px;
  line-height: 1.7;
}
.review-count-row .n {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #f0ebe3;
}
.review-disclaimer {
  font-size: 13px;
  margin: 0;
  line-height: 1.4;
}
.review-graph-wrap {
  position: relative;
  margin-top: 10px;
  background: #161512;
  border-radius: 4px;
  overflow: hidden;
  cursor: crosshair;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.review-graph-wrap.hidden { display: none; }
#review-graph {
  width: 100%;
  height: 148px;
  display: block;
}
.review-graph-tip {
  position: absolute;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 4;
  min-width: 120px;
  padding: 7px 10px;
  border-radius: 6px;
  background: rgba(20, 18, 16, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f3efe8;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.review-graph-tip strong {
  display: block;
  font-size: 13px;
}
.review-graph-tip span {
  color: #cfc7bb;
}
.review-graph-tip.hidden { display: none; }
.move-san.review-cls-brilliant { background: #1baca655; border-radius: 3px; padding: 0 2px; }
.move-san.review-cls-great { background: #5c9fd655; border-radius: 3px; padding: 0 2px; }
.move-san.review-cls-best { color: #c8f0c0; }
.move-san.review-cls-excellent { color: #d4efc8; }
.move-san.review-cls-good { color: #e0e8d0; }
.move-san.review-cls-book { color: #b0bec5; }
.move-san.review-cls-inaccuracy { background: #ffd54f66; border-radius: 3px; padding: 0 3px; color: #ffe082; }
.move-san.review-cls-mistake { background: #ffb74d55; border-radius: 3px; padding: 0 2px; }
.move-san.review-cls-blunder { background: #e5737355; border-radius: 3px; padding: 0 2px; }
.move-review-glyph {
  display: inline;
  font-size: 0.95em;
  font-weight: 800;
  margin-left: 1px;
  letter-spacing: -0.04em;
  vertical-align: baseline;
  line-height: 1;
}
.move-sf-elo {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
  color: #9ec5e8;
  background: #2a3a4a88;
  vertical-align: baseline;
}
.move-sf-drop {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
  color: #f0c070;
  background: #4a3a2088;
  vertical-align: baseline;
}
.sq.review-badge {
  position: relative;
}
.sq.review-badge::after {
  content: attr(data-review-glyph);
  position: absolute;
  right: 4px;
  top: 3px;
  z-index: 3;
  min-width: 1.6em;
  min-height: 1.6em;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.6em;
  padding: 0 6px;
  border-radius: 999px;
  background: #7c4dff;
  color: #fff;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.sq.review-badge.review-cls-inaccuracy::after { background: #f0c030; color: #222; }
.sq.review-badge.review-cls-mistake::after { background: #ef9a3f; color: #222; }
.sq.review-badge.review-cls-blunder::after { background: #d64545; }
.sq.review-badge.review-cls-great::after { background: #5c9fd6; }
.sq.review-badge.review-cls-brilliant::after {
  content: "";
  background: #1baca6;
  border-radius: 3px;
  min-width: 16px;
  min-height: 16px;
  width: 16px;
  height: 16px;
  padding: 0;
  line-height: 0;
  transform: rotate(45deg);
  top: 8px;
  right: 10px;
}

/* —— Diagnosis —— */
.diagnosis-hall {
  width: min(100%, 1040px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.diagnosis-hall > .exam-intro {
  margin-bottom: 0;
}
.diagnosis-hall.is-ox-mode {
  width: min(100%, 1280px);
}
.diagnosis-hall.is-ox-mode > :not(.diag-openings-view) {
  display: none !important;
}
.diagnosis-hall.is-axis-games-mode {
  width: min(100%, 58rem);
}
.diagnosis-hall.is-axis-games-mode > :not(.diag-axis-games) {
  display: none !important;
}
.diagnosis-hall.is-facets-mode {
  width: min(100%, 58rem);
}
.diagnosis-hall.is-facets-mode > :not(.diag-facets) {
  display: none !important;
}
.diagnosis-hall.is-play-rating-mode {
  width: min(100%, 58rem);
}
.diagnosis-hall.is-play-rating-mode > :not(.diag-play-rating) {
  display: none !important;
}
.diagnosis-hall.is-snapshots-mode {
  width: min(100%, 58rem);
}
.diagnosis-hall.is-snapshots-mode > :not(.diag-snapshots-view) {
  display: none !important;
}
.diag-play-rating {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}
.diag-play-rating.hidden {
  display: none !important;
}
.diag-snapshots-view {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}
.diag-snapshots-view.hidden {
  display: none !important;
}
.diag-snap-view-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.diag-snap-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.diag-snap-picker-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.diag-snap-picker-label {
  margin: 0;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.diag-snap-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 16rem;
  overflow: auto;
  padding-right: 2px;
}
.diag-snap-pick {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: var(--card);
  color: inherit;
  font: inherit;
  padding: 12px 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.diag-snap-pick:hover {
  border-color: rgba(255, 255, 255, 0.18);
}
.diag-snap-pick.is-selected {
  border-color: color-mix(in srgb, var(--accent) 55%, #35312c);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--card) 88%, var(--accent) 12%);
}
.diag-snap-pick.is-live.is-selected {
  border-color: color-mix(in srgb, var(--accent-2) 55%, #35312c);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-2) 35%, transparent);
}
.diag-snap-pick-date {
  font-weight: 750;
}
.diag-snap-pick-rating {
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
  justify-self: end;
}
.diag-snap-pick-meta {
  grid-column: 1 / -1;
  font-size: 12px;
  margin: 0;
}
.diag-snap-compare-stage {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 18px;
  align-items: start;
}
.diag-snap-radar-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.diag-snap-radar {
  width: 100%;
  max-width: 320px;
}
.diag-snap-area-base {
  fill: rgba(192, 164, 92, 0.16);
}
.diag-snap-outline-base {
  fill: none;
  stroke: #c0a45c;
  stroke-width: 2;
  stroke-dasharray: 5 4;
}
.diag-snap-area-focus {
  fill: rgba(129, 182, 76, 0.2);
}
.diag-snap-outline-focus {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
}
.diag-snap-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}
.diag-snap-legend-base::before,
.diag-snap-legend-focus::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 3px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 2px;
}
.diag-snap-legend-base::before {
  background: #c0a45c;
}
.diag-snap-legend-focus::before {
  background: var(--accent);
}
.diag-snap-compare-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.diag-snap-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.diag-snap-hero-stat {
  padding: 14px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid #35312c;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.diag-snap-hero-stat strong {
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.diag-snap-hero-stat.is-up strong { color: var(--accent); }
.diag-snap-hero-stat.is-down strong { color: #e07070; }
.diag-snap-hero-stat.is-flat strong { color: var(--muted); }
.diag-snap-axis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.diag-snap-axis-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid #35312c;
  border-left: 3px solid #666;
}
.diag-snap-axis-card.is-up { border-left-color: var(--accent); }
.diag-snap-axis-card.is-down { border-left-color: #e07070; }
.diag-snap-axis-card.is-flat { border-left-color: #666; }
.diag-snap-axis-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 6px;
}
.diag-snap-axis-card h3 {
  margin: 0;
  font-size: 0.95rem;
}
.diag-snap-axis-card em {
  font-style: normal;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.diag-snap-axis-card.is-up em { color: var(--accent); }
.diag-snap-axis-card.is-down em { color: #e07070; }
.diag-snap-axis-card.is-flat em { color: var(--muted); }
.diag-snap-axis-path {
  margin: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
}
.diag-snap-axis-arrow {
  color: rgba(255, 255, 255, 0.35);
}
.diag-snap-view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.diag-snap-mini-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.diag-snap-mini {
  appearance: none;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  color: inherit;
  font: inherit;
  padding: 9px 11px;
  cursor: pointer;
}
.diag-snap-mini:hover {
  border-color: rgba(255, 255, 255, 0.18);
}
.diag-snap-open-hall {
  width: 100%;
}
@media (max-width: 820px) {
  .diag-snap-pickers,
  .diag-snap-compare-stage {
    grid-template-columns: 1fr;
  }
  .diag-snap-hero {
    grid-template-columns: 1fr;
  }
}
.diag-card-play-hint {
  margin: 6px 0 0;
  font-size: 13px;
}
#diag-play-delta.up {
  color: #9bc700;
}
#diag-play-delta.down {
  color: #e07070;
}
.diag-openings-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}
.diag-openings-view.hidden {
  display: none !important;
}
.diag-ox-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 20px;
}
.diag-ox-back-main {
  flex: 0 0 auto;
  margin-top: 4px;
}
.diag-ox-page-titles {
  flex: 1 1 220px;
  min-width: 0;
}
.diag-ox-page-titles .exam-kicker {
  margin: 0 0 4px;
}
.diag-ox-page-titles h2 {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
}
.diag-ox-page-titles .muted {
  margin: 0;
  max-width: 42rem;
}

/* Shared diagnosis buttons */
.diag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  background: #322f2b;
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease,
    filter 0.16s ease;
}
.diag-btn:hover:not(:disabled) {
  filter: none;
  background: #3c3934;
  border-color: #4a463f;
}
.diag-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.diag-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, white);
  outline-offset: 2px;
}
.diag-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.diag-btn-arrow {
  opacity: 0.7;
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.diag-btn:hover:not(:disabled) .diag-btn-arrow {
  transform: translateX(2px);
  opacity: 1;
}
.diag-btn-primary,
.diag-btn-secondary {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 148px;
  padding: 11px 16px 10px;
  text-align: left;
}
.diag-btn-label {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}
.diag-btn-hint {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.72;
}
.diag-btn-primary {
  background: linear-gradient(180deg, #93c45c 0%, var(--accent) 100%);
  color: #102008;
  border-color: #6fa040;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.diag-btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #a0cd6a 0%, #8fbf55 100%);
  border-color: #7aaf48;
  filter: none;
}
.diag-btn-primary .diag-btn-hint {
  color: #1c3a0e;
  opacity: 0.75;
}
.diag-btn-secondary {
  background: linear-gradient(180deg, #3a3428 0%, #2c281f 100%);
  color: #e8d7a8;
  border-color: #5a4e32;
}
.diag-btn-secondary:hover:not(:disabled) {
  background: linear-gradient(180deg, #453e2f 0%, #342f25 100%);
  border-color: #7a6a42;
  color: #f0e2b8;
}
.diag-btn-secondary .diag-btn-hint {
  color: var(--accent-2);
  opacity: 0.85;
}
.diag-btn-ghost {
  background: transparent;
  border-color: #3f3b35;
  color: #e6e1d8;
  padding: 8px 14px;
  white-space: nowrap;
}
.diag-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  border-color: #5a554c;
}
.diag-btn-train {
  gap: 10px;
  padding: 8px 12px 8px 14px;
  background: color-mix(in srgb, var(--accent) 14%, #1c1a17);
  border-color: color-mix(in srgb, var(--accent) 35%, #3a3732);
  color: #d7e8c4;
}
.diag-btn-train:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 22%, #22201c);
  border-color: color-mix(in srgb, var(--accent) 55%, #3a3732);
  color: #eaf6d8;
}
.diag-btn-meta {
  margin-left: 2px;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.diag-btn-train::after {
  content: "→";
  opacity: 0.65;
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.diag-btn-train:hover:not(:disabled)::after {
  transform: translateX(2px);
  opacity: 1;
}

.diag-form {
  display: grid;
  grid-template-columns: 1.4fr 0.5fr auto;
  gap: 14px 16px;
  align-items: end;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 40%),
    var(--card);
  border: 1px solid #35312c;
  border-radius: 14px;
  padding: 18px;
}
.diag-date-range {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 14px;
}
.diag-date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.86rem;
  margin: 0;
}
.diag-date-field input[type="date"] {
  min-width: 10.5rem;
  color-scheme: dark;
}
.diag-dates-clear {
  align-self: end;
  padding: 8px 12px;
}
.diag-dates-hint {
  grid-column: 1 / -1;
  margin: -4px 0 0;
  font-size: 0.86rem;
  line-height: 1.4;
}
.diag-platform {
  grid-column: 1 / -1;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  width: min(100%, 320px);
  padding: 3px;
  gap: 3px;
  border-radius: 12px;
  background: #1a1816;
  border: 1px solid #3a3732;
  box-sizing: border-box;
}
.diag-platform-btn {
  appearance: none;
  margin: 0;
  border: 0;
  border-radius: 9px;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #9a958c;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.diag-platform-btn:hover {
  color: #ece8e1;
}
.diag-platform-btn.is-active {
  color: #141210;
  background: linear-gradient(180deg, #d7e8c8, #b6d7a8);
}
.diag-platform-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, #fff);
  outline-offset: 1px;
}
.diag-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  font-size: 0.86rem;
}
.diag-form .diag-max .diag-analysis-count {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin-top: 2px;
  min-height: 1.35em;
  line-height: 1.25;
}
.diag-form .diag-max .diag-analysis-count.hidden {
  display: none;
}
.diag-form .diag-max .diag-analysis-label {
  flex: 1 0 100%;
  font-size: 0.72rem;
  font-weight: 550;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a857c;
}
.diag-form .diag-max .diag-analysis-frac {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--accent, #9acd32);
}
.diag-form .diag-max .diag-analysis-eta {
  font-size: 0.78rem;
  font-weight: 500;
  color: #9a958c;
  letter-spacing: 0.01em;
}
.diag-form .diag-max .diag-analysis-eta:not(:empty)::before {
  content: "·";
  margin-right: 8px;
  opacity: 0.45;
  font-weight: 400;
}
.diag-form input {
  width: 100%;
  box-sizing: border-box;
  background: #141312;
  border: 1px solid #3a3732;
  border-radius: 10px;
  padding: 10px 12px;
  color: #ece8e1;
  caret-color: #ece8e1;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.diag-form input:hover {
  border-color: #4a463f;
}
.diag-form input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, #3a3732);
  background: #161412;
}
.diag-form input::placeholder {
  color: #7a7670;
}
.diag-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: stretch;
}
.diag-form .diag-dev {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #a8a49c;
}
.diag-form .diag-dev input {
  width: auto;
  margin: 0;
}
.diag-progress {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
}
.diag-progress.hidden {
  display: none;
}
.diag-progress-track {
  height: 10px;
  border-radius: 999px;
  background: #2a2723;
  overflow: hidden;
  border: 1px solid #3a3732;
}
.diag-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6aa84f, #b6d7a8);
  transition: width 0.25s ease;
}
.diag-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  align-items: baseline;
}
.diag-progress-right {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
}
.diag-progress-meta strong {
  color: #d7e8c8;
  font-variant-numeric: tabular-nums;
}
.diag-progress-eta {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.diag-form .diag-status {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 1.2em;
}
.diag-status[data-kind="err"] { color: #e07070; }
.diag-status[data-kind="ok"] { color: var(--accent); }
.diag-status[data-kind="busy"] { color: var(--accent-2); }
.diag-empty {
  background: var(--card);
  border: 1px solid #35312c;
  border-radius: 14px;
  padding: 22px 20px;
  line-height: 1.5;
}
.diag-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 18px;
  margin: 0 0 16px;
}
.diag-result-titles {
  min-width: min(100%, 16rem);
  flex: 1 1 16rem;
}
.diag-meta { margin: 0 0 6px; }
.diag-headline {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}
.diag-view-games {
  flex: 0 0 auto;
  margin-bottom: 1px;
}
.diag-view-games .diag-btn-meta:empty {
  display: none;
}
.diag-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 18px;
  align-items: start;
}
.diag-layout-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.diag-radar {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1;
  background: var(--card);
  border: 1px solid #35312c;
  border-radius: 14px;
  padding: 8px;
  box-sizing: border-box;
}
.diag-ring {
  fill: none;
  stroke: #3a3732;
  stroke-width: 1;
}
.diag-spoke {
  stroke: #3a3732;
  stroke-width: 1;
}
.diag-area {
  fill: rgba(129, 182, 76, 0.22);
}
.diag-outline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
}
.diag-label {
  fill: var(--muted);
  font-size: 11px;
}
.diag-score {
  fill: #ddd;
  font-size: 11px;
  font-weight: 700;
}
.diag-cards {
  display: grid;
  gap: 10px;
}
.diag-card {
  background: var(--card);
  border: 1px solid #35312c;
  border-radius: 14px;
  padding: 14px 16px;
  border-left: 3px solid #666;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.diag-card.diag-weak { border-left-color: #d64545; }
.diag-card.diag-mid { border-left-color: #ef9a3f; }
.diag-card.diag-strong { border-left-color: var(--accent); }
.diag-card.zone-excellent,
.diag-card.zone-good { border-left-color: #759900; }
.diag-card.zone-working { border-left-color: #ef9a3f; }
.diag-card.zone-critical { border-left-color: #d64545; }
.diag-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.diag-card h3 {
  margin: 0;
  font-size: 1rem;
}
.diag-card strong {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.diag-card-elo {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.diag-facets {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0 0 24px;
}
.diag-facets.hidden {
  display: none !important;
}
.diag-facets-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.diag-facets-party-head {
  margin: 4px 0 2px;
}
.diag-facets-party-head .exam-kicker {
  margin: 0 0 6px;
}
.diag-facets-party-title {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.diag-facets-party-head .muted {
  margin: 0;
}
.diag-facets-tactics-nn {
  margin: 0 0 22px;
  padding: 16px 16px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 92%, #000);
  border: 1px solid color-mix(in srgb, var(--accent-2) 22%, transparent);
}
.diag-facets-tactics-nn .diag-facets-section {
  margin-top: 0;
}
.diag-facets-nn-lead {
  margin: 0 0 12px;
}
.diag-facets-nn-stats {
  margin: 0 0 8px;
}
.diag-facets-nn-actions {
  margin-top: 14px;
}
.diag-facets-tactics-nn .tactics-form {
  margin-top: 12px;
}
.diag-facets-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.diag-facets-elo {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.diag-facets-elo-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.diag-facets-section {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.diag-facet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.diag-facet-row {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--card, #262421) 88%, transparent),
      color-mix(in srgb, var(--panel, #1e1c1a) 92%, transparent)
    );
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 4%, transparent);
  font-size: 0.92rem;
}
.diag-facet-row.is-secondary {
  padding: 10px 12px;
  opacity: 0.92;
  background: color-mix(in srgb, var(--bg, #121110) 55%, var(--panel, #1e1c1a));
}
.diag-facet-row.is-weak {
  border-color: color-mix(in srgb, #e07070 28%, transparent);
}
.diag-facet-row.is-mid {
  border-color: color-mix(in srgb, var(--accent-2, #c0a45c) 22%, transparent);
}
.diag-facet-row.is-strong {
  border-color: color-mix(in srgb, var(--accent, #81b64c) 30%, transparent);
}
.diag-facet-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.diag-facet-name {
  font-weight: 650;
  line-height: 1.3;
  min-width: 0;
}
.diag-facet-row.is-secondary .diag-facet-name {
  font-weight: 550;
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
}
.diag-facet-elo {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.diag-facet-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.diag-facet-bar {
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  overflow: hidden;
}
.diag-facet-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: color-mix(in srgb, var(--accent-2, #c0a45c) 75%, #fff);
}
.diag-facet-row.is-weak .diag-facet-bar > i {
  background: color-mix(in srgb, #e07070 80%, #fff);
}
.diag-facet-row.is-strong .diag-facet-bar > i {
  background: color-mix(in srgb, var(--accent, #81b64c) 82%, #fff);
}
.diag-facet-meta {
  color: var(--muted);
  text-align: right;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.diag-facet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.diag-facet-actions .diag-btn.is-active {
  border-color: var(--accent, #759900);
  color: var(--accent, #9acd32);
}
.diag-facets-games {
  margin-top: 8px;
}
.diag-facets-date-range {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 14px;
  margin: 4px 0 2px;
}
.diag-facets-date-range.hidden {
  display: none !important;
}
.diag-facets-date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.86rem;
}
.diag-facets-date-field input[type="date"],
.diag-facets-date-field input[type="number"] {
  min-width: 10.5rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border, #333);
  background: color-mix(in srgb, var(--panel, #161616) 88%, #000);
  color: inherit;
  color-scheme: dark;
  font: inherit;
}
.diag-facets-bad-range .diag-facets-date-field input[type="number"] {
  min-width: 5.5rem;
  width: 5.5rem;
}
.diag-card-rate.zone-excellent,
.diag-card-rate.zone-good { color: #9acd32; }
.diag-card-rate.zone-working { color: #ef9a3f; }
.diag-card-rate.zone-critical { color: #e07070; }
.diag-card-zone {
  margin: -4px 0 12px;
  font-size: 0.86rem;
  font-weight: 650;
}
.diag-card-zone.zone-excellent,
.diag-card-zone.zone-good { color: #9acd32; }
.diag-card-zone.zone-working { color: #ef9a3f; }
.diag-card-zone.zone-critical { color: #e07070; }
.diag-snap-delta {
  margin: -2px 0 8px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.diag-snap-delta.is-up,
.diag-snap-rating-delta.is-up,
.diag-snap-compare-list .is-up em { color: var(--accent); }
.diag-snap-delta.is-down,
.diag-snap-rating-delta.is-down,
.diag-snap-compare-list .is-down em { color: #e07070; }
.diag-snap-delta.is-flat,
.diag-snap-rating-delta.is-flat,
.diag-snap-compare-list .is-flat em { color: var(--muted); }
.diag-snapshots {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid #35312c;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  box-sizing: border-box;
}
.diag-snap-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.diag-snap-title {
  margin: 0;
  font-size: 1.02rem;
}
.diag-snap-lead,
.diag-snap-hint {
  margin: 4px 0 0;
  font-size: 12px;
}
.diag-snap-head .diag-btn {
  width: 100%;
}
.diag-snap-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.diag-snap-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.diag-snap-select-wrap select {
  width: 100%;
}
.diag-snap-rating-delta {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}
.diag-snap-compare-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.diag-snap-compare-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 12px;
}
.diag-snap-compare-list li strong {
  grid-column: 1 / -1;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--muted);
}
.diag-snap-compare-list li em {
  font-style: normal;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  justify-self: end;
}
.diag-stat-zone {
  font-weight: 650;
}
.diag-stat-zone.zone-excellent,
.diag-stat-zone.zone-good { color: #9acd32; }
.diag-stat-zone.zone-working { color: #ef9a3f; }
.diag-stat-zone.zone-critical { color: #e07070; }
.diag-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.diag-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.diag-card-actions .diag-btn {
  font-size: 0.88rem;
}
.diag-axis-games {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
}
.diag-axis-games.hidden {
  display: none !important;
}
.diag-axis-games-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: flex-start;
}
.diag-axis-games-titles h2 {
  margin: 2px 0 4px;
  font-size: 1.45rem;
}
.diag-axis-games-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.diag-axis-filter {
  border: 1px solid #3f3b35;
  background: transparent;
  color: #e6e1d8;
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.diag-axis-filter:hover {
  border-color: #5a554c;
  background: rgba(255, 255, 255, 0.04);
}
.diag-axis-filter.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, #3a3732);
  background: color-mix(in srgb, var(--accent) 18%, #1c1a17);
  color: #eaf6d8;
}
.diag-axis-games-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 58rem;
}
.diag-games-row.mgames-row {
  grid-template-columns: 1fr;
  text-decoration: none;
  min-height: 0;
}
.diag-games-body {
  width: 100%;
}
.diag-tc-ladder {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin: 4px 0 14px;
}
.diag-facets .diag-tc-ladder,
.diag-facets-tc-ladder {
  margin: 0;
}
.diag-game-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.diag-game-bar .diag-game-analyze {
  margin-left: auto;
}
.diag-game-ext {
  font-size: 0.85rem;
}
.diag-games-row.mgames-row {
  cursor: pointer;
}
.diag-games-row .mgames-ext {
  margin: 4px 0 0;
  font-size: 0.85rem;
}
.mgames-top-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.diag-games-bad {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #cfc8bc;
  background: color-mix(in srgb, var(--bg, #1a1a1a) 40%, #2e2b27);
  border: 1px solid #3a3630;
}
.diag-games-bad.is-warm {
  color: #e8c070;
  border-color: color-mix(in srgb, #e8c070 35%, #3a3630);
}
.diag-games-bad.is-hot {
  color: #e07070;
  border-color: color-mix(in srgb, #e07070 40%, #3a3630);
}
.diag-ox-game-btn {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.diag-ox-game-btn:hover {
  color: var(--accent, #9acd32);
}
.diag-analysis-progress {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent, #7a9a3a) 12%, transparent);
}
.diag-analysis-progress.hidden {
  display: none;
}
.diag-tc-ladder h3 {
  margin: 0 0 10px;
}
.diag-tc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.diag-tc-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg, #1a1a1a) 55%, transparent);
  border: 1px solid transparent;
}
.diag-tc-item.is-current {
  border-color: var(--accent);
}
.diag-tc-item.is-done {
  opacity: 0.92;
}
.diag-tc-item.is-locked {
  opacity: 0.45;
}
.diag-tc-row {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 6px;
}
.diag-tc-ctrl {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.diag-tc-band {
  color: var(--muted);
  font-size: 0.9rem;
}
.diag-tc-count {
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
  text-align: right;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.diag-tc-check {
  color: #5cb85c;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
}
.diag-tc-bar {
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 25%, transparent);
  overflow: hidden;
}
.diag-tc-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.diag-tc-item.is-done .diag-tc-bar i {
  background: #5cb85c;
}
.diag-tc-foot {
  margin: 10px 0 0;
  font-size: 0.85rem;
}
.diag-openings-wrap {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
}
.diag-openings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.diag-openings-wrap h3 {
  margin: 0;
}
.diag-ox-openings {
  margin-top: 14px;
  max-height: 280px;
  overflow: auto;
}
.diag-ox-openings.is-collapsed {
  max-height: none;
  overflow: visible;
}
.diag-ox-openings.is-collapsed #diag-openings {
  display: none;
}
.diag-ox-openings.is-collapsed .diag-openings-head {
  margin-bottom: 0;
}
.diag-table .is-low {
  color: #d35f5f;
  font-weight: 700;
}
.diag-table .is-high {
  color: #5cb85c;
  font-weight: 700;
}
.diag-opening-explorer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--muted) 28%, transparent);
}
.diag-ox-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.diag-ox-colors {
  display: inline-flex;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--muted) 35%, transparent);
}
.diag-ox-color {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  cursor: pointer;
  font: inherit;
}
.diag-ox-color.is-active {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text, #eee);
  font-weight: 600;
}
.diag-ox-filter {
  margin: 0;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.diag-ox-filter-label {
  color: var(--muted, #9a9590);
}
.diag-ox-filter-label strong {
  color: var(--text, #eee);
  font-weight: 600;
}
.diag-ox-clear-filter {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent, #c0a45c) 55%, #666);
  background: color-mix(in srgb, var(--accent, #c0a45c) 18%, transparent);
  color: var(--text, #eee);
  text-decoration: none;
}
.diag-ox-clear-filter:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent, #c0a45c) 32%, transparent);
  border-color: color-mix(in srgb, var(--accent, #c0a45c) 75%, #888);
}
.diag-ox-filter-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 4px 0 8px;
}
.diag-ox-filter-empty p {
  margin: 0;
  color: var(--muted, #9a9590);
  line-height: 1.45;
}
.diag-ox-filter-empty strong {
  color: var(--text, #eee);
}
.diag-ox-layout {
  display: grid;
  grid-template-columns:
    minmax(148px, 200px)
    minmax(360px, min(58vw, 620px))
    minmax(260px, 1fr);
  gap: 18px;
  align-items: start;
}
.diag-ox-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.diag-ox-notation {
  min-width: 0;
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  max-height: min(72vh, 620px);
  overflow: auto;
}
.diag-ox-not-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.diag-ox-not-step {
  border: 0;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  color: inherit;
  border-radius: 6px;
  min-width: 34px;
  height: 30px;
  cursor: pointer;
  font: inherit;
}
.diag-ox-not-step:disabled {
  opacity: 0.35;
  cursor: default;
}
.diag-ox-not-title {
  margin: 0 0 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  word-break: break-word;
}
.diag-ox-not-start,
.diag-ox-not-move {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
  padding: 4px 8px;
}
.diag-ox-not-start {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  color: var(--muted);
}
.diag-ox-not-start:hover,
.diag-ox-not-move:hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.diag-ox-not-start.is-active,
.diag-ox-not-move.is-active {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  font-weight: 700;
  color: var(--text, #eee);
}
.diag-ox-not-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.diag-ox-not-row {
  display: grid;
  grid-template-columns: 2rem 1fr 1fr;
  gap: 2px;
  align-items: center;
}
.diag-ox-not-num {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  padding-left: 2px;
}
.diag-ox-not-move {
  width: 100%;
}
.diag-ox-not-empty {
  min-height: 1em;
}
.diag-ox-not-empty-hint {
  margin: 8px 0 0;
  font-size: 0.82rem;
}
.diag-ox-board-wrap {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  overflow: visible;
  box-sizing: border-box;
}
.diag-ox-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--muted) 30%, transparent);
  background: #779556;
  touch-action: none;
  user-select: none;
  cursor: pointer;
}
.diag-ox-board.is-dragging {
  cursor: grabbing;
}
.diag-ox-sq {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.diag-ox-sq.light {
  background: #ebecd0;
}
.diag-ox-sq.dark {
  background: #779556;
}
.diag-ox-sq.is-last {
  box-shadow: inset 0 0 0 999px rgba(155, 199, 0, 0.35);
}
.diag-ox-sq.is-selected {
  box-shadow: inset 0 0 0 999px rgba(20, 85, 30, 0.45);
}
.diag-ox-sq.is-dest::after {
  content: "";
  position: absolute;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.diag-ox-sq.is-dest.is-occ::after {
  width: auto;
  height: auto;
  inset: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 0 0 3px rgba(20, 85, 30, 0.45);
}
.diag-ox-piece {
  display: block;
  width: 92%;
  height: 92%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.diag-ox-piece.is-hidden {
  opacity: 0;
}
.diag-ox-ghost {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}
.diag-ox-panel {
  min-width: 0;
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px 16px;
}
.diag-ox-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  min-height: 1.4em;
}
.diag-ox-path {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  margin: 0;
  font-size: 1rem;
}
.diag-ox-settings {
  position: relative;
  flex: 0 0 auto;
}
.diag-ox-gear {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--muted) 50%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 1;
  flex: 0 0 auto;
}
.diag-ox-gear:hover,
.diag-ox-gear[aria-expanded="true"],
.diag-ox-gear.is-filtered {
  color: var(--text);
  background: color-mix(in srgb, var(--muted) 28%, transparent);
  border-color: color-mix(in srgb, var(--muted) 70%, transparent);
}
.diag-ox-gear.is-filtered {
  color: var(--accent, #c9a227);
  border-color: color-mix(in srgb, var(--accent, #c9a227) 65%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, #c9a227) 35%, transparent);
}
.diag-ox-settings-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card, #1a1814);
  border: 1px solid color-mix(in srgb, var(--muted) 35%, transparent);
  box-shadow: 0 8px 24px #00000055;
  display: grid;
  gap: 6px;
}
.diag-ox-settings-panel.hidden {
  display: none;
}
.diag-ox-settings-title {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.diag-ox-speed {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.diag-ox-speed input {
  margin: 0;
  flex: 0 0 auto;
  order: 2;
}
.diag-ox-speed-name {
  flex: 1 1 auto;
  order: 1;
}
.diag-ox-back {
  border: 0;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  color: inherit;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font: inherit;
}
.diag-ox-pos {
  margin: 0 0 12px;
  font-size: 0.92rem;
}
.diag-ox-pos .is-low,
.diag-ox-table .is-low {
  color: #d35f5f;
}
.diag-ox-pos .is-high {
  color: #5cb85c;
}
.diag-ox-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.diag-ox-table th,
.diag-ox-table td {
  padding: 8px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 22%, transparent);
  text-align: left;
  vertical-align: middle;
}
.diag-ox-table th {
  color: var(--muted);
  font-weight: 600;
}
.diag-ox-row {
  cursor: pointer;
}
.diag-ox-row:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.diag-ox-row.is-weak td:first-child strong {
  color: #d35f5f;
}
.diag-ox-results {
  min-width: 140px;
}
.diag-ox-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  margin-bottom: 2px;
}
.diag-ox-bar i {
  display: block;
  height: 100%;
}
.diag-ox-bar .is-white {
  background: #eee;
}
.diag-ox-bar .is-draw {
  background: #888;
}
.diag-ox-bar .is-black {
  background: #333;
}
.diag-ox-bar-nums {
  font-size: 0.78rem;
}
.diag-ox-game {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 0.85rem;
}
.diag-ox-samples {
  margin: 6px 0 0;
  padding-left: 18px;
}
.diag-ox-foot {
  margin: 12px 0 0;
  font-size: 0.85rem;
}
@media (max-width: 980px) {
  .diag-ox-layout {
    grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
  }
  .diag-ox-panel {
    grid-column: 1 / -1;
  }
}
@media (max-width: 720px) {
  .diag-ox-layout {
    grid-template-columns: 1fr;
  }
  .diag-ox-main {
    order: -1;
  }
  .diag-ox-board-wrap {
    max-width: min(100%, 480px);
    margin: 0 auto;
  }
}
.diag-activity-wrap {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 16px;
}
.diag-activity-wrap h3 {
  margin: 0 0 10px;
}
.diag-activity-total {
  margin: 0 0 12px;
}
.diag-activity-total strong {
  color: var(--text);
}
.diag-activity-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.diag-activity-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.diag-activity-item strong {
  font-size: 1.35rem;
}
.diag-activity-pct {
  color: var(--accent-2);
  font-size: 0.9rem;
}
.diag-activity-bar {
  height: 6px;
  border-radius: 999px;
  background: #3a3732;
  overflow: hidden;
  margin-top: 4px;
}
.diag-activity-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.diag-activity-item.is-low .diag-activity-bar i { background: #d35f5f; }
.diag-activity-item.is-high .diag-activity-bar i { background: #d4a017; }
.diag-activity-item.is-ok .diag-activity-bar i { background: var(--accent); }
.diag-volume-alerts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.diag-volume-alert {
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid #3a3732;
  background: #2a2824;
}
.diag-volume-alert strong {
  display: block;
  margin-bottom: 4px;
}
.diag-volume-alert p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}
.diag-volume-alert.is-ok {
  border-color: rgba(129, 182, 76, 0.45);
  background: rgba(129, 182, 76, 0.08);
}
.diag-volume-alert.is-ok strong { color: var(--accent); }
.diag-volume-alert.is-warn {
  border-color: rgba(212, 160, 23, 0.5);
  background: rgba(212, 160, 23, 0.1);
}
.diag-volume-alert.is-warn strong { color: #f0c040; }
.diag-volume-alert.is-critical {
  border-color: rgba(211, 95, 95, 0.55);
  background: rgba(211, 95, 95, 0.12);
}
.diag-volume-alert.is-critical strong { color: #f08080; }
.diag-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
@media (max-width: 900px) {
  .diag-activity-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.diag-table th,
.diag-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #3a3732;
}
.diag-table th {
  color: var(--muted);
  font-weight: 500;
}

@media (max-width: 900px) {
  .diag-form {
    grid-template-columns: 1fr 1fr;
  }
  .diag-platform {
    width: 100%;
  }
  .diag-actions {
    grid-column: 1 / -1;
  }
  .diag-actions .diag-btn-primary,
  .diag-actions .diag-btn-secondary {
    flex: 1;
    min-width: 0;
  }
  .diag-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .play-main.has-review,
  .play-main.has-review.is-study {
    grid-template-columns: 1fr;
  }
  .review-panel {
    height: auto;
    max-height: none;
    margin-top: 0 !important;
  }
  .review-resize {
    display: none;
  }
}

/* Puzzle Storm records (under-board strip + dashboard) — Lichess-like */
.storm-records {
  width: 100%;
  margin-top: 10px;
  padding: 10px 4px 4px;
  box-sizing: border-box;
}
.storm-records.hidden {
  display: none !important;
}
.storm-records-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.storm-records-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e8e6e1;
}
.storm-records-link {
  border: 0;
  background: transparent;
  color: #7eb6ff;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
.storm-records-link:hover {
  color: #b3d4ff;
  text-decoration: underline;
}
.storm-records-grid,
.storm-dash-records {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.storm-record-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 72px;
  padding: 10px 8px;
  border-radius: 6px;
  background: rgba(20, 20, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ddd;
  text-align: center;
}
.storm-record-card span {
  font-size: 0.78rem;
  color: #b7b3aa;
}
.storm-record-score {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1;
}
.storm-record-card.is-all {
  background: #d64f00;
  border-color: transparent;
  color: #fff;
}
.storm-record-card.is-all span {
  color: rgba(255, 255, 255, 0.88);
}
.storm-dashboard-hall {
  max-width: 960px;
}
.storm-dash-intro {
  margin-bottom: 8px;
}
.storm-dash-records {
  margin: 12px 0 16px;
}
.storm-dashboard-play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  margin: 0 0 18px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.storm-dashboard-play img {
  opacity: 0.95;
  filter: brightness(0) invert(1);
}
.storm-dash-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.storm-dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.storm-dash-table th,
.storm-dash-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}
.storm-dash-table th {
  color: #9a968c;
  font-weight: 500;
}
.storm-dash-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}
.storm-dash-score {
  color: #ff8a3d;
  font-weight: 700;
}
.storm-dash-empty td {
  color: #9a968c;
  text-align: center;
  padding: 24px 12px;
}
@media (max-width: 700px) {
  .storm-records-grid,
  .storm-dash-records {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .storm-records-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .storm-record-score {
    font-size: 1.55rem;
  }
}

.storm-mode-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 12px;
  padding: 4px;
  border-radius: 10px;
  background: #141210;
  border: 1px solid #ffffff10;
}
.storm-mode-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a8a49c;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 10px;
  cursor: pointer;
}
.storm-mode-tab:hover {
  color: #eee;
}
.storm-mode-tab.is-active {
  background: #2a2723;
  color: #fff;
  box-shadow: inset 0 0 0 1px #ffffff14;
}
.storm-srs-due-badge {
  display: inline-flex;
  min-width: 1.35rem;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: #d64f00;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.35;
}
.storm-srs-due-badge.hidden {
  display: none !important;
}
.storm-end-srs-btn {
  width: 100%;
  margin-top: 4px;
}
.storm-end-srs-btn.hidden {
  display: none !important;
}
.storm-srs-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid #ffffff12;
}
.storm-srs-rail.hidden {
  display: none !important;
}
.storm-srs-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1c1a17;
  border: 1px solid #ffffff12;
  font-size: 0.92rem;
}
.storm-srs-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.storm-srs-bar-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
#storm-srs-bar-rating {
  color: #f0ece4;
  font-weight: 700;
}
.storm-srs-bar-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
}
.storm-srs-bar.hidden {
  display: none !important;
}
.storm-srs-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--accent, #81b64c);
  line-height: 1.1;
}
.storm-srs-clock.is-warn {
  color: #e8a838;
}
.storm-srs-clock.is-over {
  color: #d35f5f;
}
.storm-srs-delete-btn {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #d35f5f55;
  background: #d35f5f18;
  color: #e8a0a0;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
}
.storm-srs-delete-btn:hover {
  background: #d35f5f28;
}
.storm-srs-delete-btn.hidden {
  display: none !important;
}
.storm-srs-continue .storm-srs-delete-btn {
  width: 100%;
}
.storm-srs-exit-btn {
  margin-left: 0;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #ffffff22;
  background: #ffffff0a;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.storm-srs-exit-btn:hover {
  background: #ffffff14;
}
.storm-srs-continue {
  margin-top: 0;
  align-items: stretch;
  text-align: left;
}
.storm-srs-continue .primary {
  width: 100%;
  min-width: 0;
}
.storm-srs-continue .muted {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
}
.storm-srs-auto-live {
  justify-content: flex-start;
  width: 100%;
}
.storm-srs-history {
  width: 100%;
  margin: 8px 0 0;
  padding: 0 1px;
  gap: 5px;
  box-sizing: border-box;
}
.storm-srs-history .session-dot {
  width: 22px;
  height: 22px;
  border-radius: 4px;
}
.storm-srs-history .session-dot.ok::after,
.storm-srs-history .session-dot.hard::after,
.storm-srs-history .session-dot.fail::after {
  background-size: 14px 14px;
}
.storm-srs-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
}
.storm-srs-score {
  width: 100%;
  margin-top: 6px;
  font-weight: 700;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: #f0ece4;
}
.storm-srs-history.hidden {
  display: none !important;
}
body.storm-srs-live #status {
  display: none !important;
}
.play-main.is-storm-srs {
  grid-template-columns:
    minmax(240px, 280px) var(--cg-width, min(72vmin, 100%)) minmax(360px, 480px);
  justify-content: stretch;
  width: 100%;
}
.play-main.is-storm-srs > .storm-srs-rail {
  order: 1;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  align-self: start;
}
/* Repeats copy: scroll inside the card. Do not stretch the board row. */
.storm-srs-rail .streak-cascade {
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(100vh - 280px);
  overflow: hidden;
}
.storm-srs-rail .streak-cascade-card {
  flex: 0 1 auto;
  max-height: 100%;
  overflow: auto;
}
.storm-srs-rail .streak-cascade-list li {
  flex: 0 0 auto;
  min-height: 0;
  font-size: 1.08rem;
}
.storm-srs-rail .streak-cascade-ico {
  flex-basis: 1.35rem;
  width: 1.35rem;
  height: 1.35rem;
}
.storm-srs-rail .streak-cascade-title {
  font-size: 0.92rem;
}
.storm-srs-rail .streak-cascade-lead {
  font-size: 1.02rem;
}
.play-main.is-storm-srs > .board-stack {
  order: 2;
}
.play-main.is-storm-srs > .move-panel {
  order: 3;
}
.play-main.is-storm-srs .move-list {
  flex: 1 1 auto;
  min-height: 10rem;
}
.play-main.is-storm-srs .move-row-fail .move-san {
  font-size: 15.5px;
}
.play-main.is-storm-srs .move-row-fail {
  min-height: 2.15em;
}
@media (max-width: 900px) {
  .play-main.is-storm-srs {
    grid-template-columns: 1fr;
  }
  .play-main.is-storm-srs > .storm-srs-rail {
    order: -1;
  }
}
.storm-srs-result .storm-result-score {
  font-size: 1.1rem;
}
.storm-srs-summary {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 16px;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(211, 141, 39, 0.22), transparent 52%),
    rgba(8, 7, 6, 0.74);
  backdrop-filter: blur(7px);
}
.storm-srs-summary.hidden {
  display: none !important;
}
.storm-srs-summary-card {
  width: min(460px, 100%);
  max-height: min(92vh, 820px);
  overflow: auto;
  box-sizing: border-box;
  padding: 26px 22px 18px;
  border-radius: 18px;
  border: 1px solid rgba(232, 196, 122, 0.32);
  background:
    linear-gradient(180deg, rgba(232, 196, 122, 0.08), transparent 28%),
    linear-gradient(180deg, #2c261e 0%, #1b1814 46%, #141210 100%);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.storm-srs-summary-kicker {
  margin: 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  color: #e8c36a;
}
.storm-srs-summary-title {
  margin: 4px 0 0;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f6f1e7;
}
.storm-srs-summary-lead {
  margin: 2px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}
.storm-srs-summary-score {
  margin: 8px 0 0;
  text-align: center;
  font-size: clamp(3rem, 9vw, 4.2rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: #e8a838;
  font-variant-numeric: tabular-nums;
}
.storm-srs-summary-score-label {
  margin: 6px 0 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted);
}
.storm-srs-summary-bar {
  display: flex;
  height: 8px;
  margin-top: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #2a2622;
  gap: 3px;
}
.storm-srs-summary-bar span {
  min-width: 8px;
  border-radius: 999px;
}
.storm-srs-summary-bar .is-good { background: #629924; }
.storm-srs-summary-bar .is-hard { background: #e07b20; }
.storm-srs-summary-bar .is-wrong { background: #c4453c; }
.storm-srs-summary-grades {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.storm-srs-summary-grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px 8px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.storm-srs-summary-grade strong {
  font-size: 1.55rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.storm-srs-summary-grade span {
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.storm-srs-summary-grade.is-good strong { color: #8fce4a; }
.storm-srs-summary-grade.is-hard strong { color: #f0a04b; }
.storm-srs-summary-grade.is-wrong strong { color: #ef6d64; }
.storm-srs-summary-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 12px;
  min-height: 18px;
}
.storm-srs-summary-dots .session-dot {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}
.storm-srs-summary-stats {
  margin-top: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.storm-srs-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.92rem;
}
.storm-srs-summary-row:last-child {
  border-bottom: 0;
}
.storm-srs-summary-row span {
  color: var(--muted);
}
.storm-srs-summary-row strong {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #f3efe7;
}
.storm-srs-summary-note {
  margin: 12px 0 0;
  text-align: center;
  color: #d9d2c6;
  font-size: 0.92rem;
  line-height: 1.45;
}
.storm-srs-summary-card > .primary {
  width: 100%;
  margin-top: 2px;
  padding: 12px 16px;
  font-size: 1rem;
}
.storm-played {
  width: 100%;
  margin-top: 16px;
  padding: 14px 12px 16px;
  border-radius: 10px;
  background: rgba(18, 18, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-sizing: border-box;
}
.storm-played.hidden {
  display: none !important;
}
.storm-played-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.storm-played-title {
  margin: 0;
  justify-self: start;
  font-size: 1.05rem;
  font-weight: 700;
  color: #e8e6e1;
}
.storm-played-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-self: center;
  justify-content: center;
}
.storm-played-filter {
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: #2a2723;
  color: #f0eee8;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 20px;
  min-width: 7.5rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}
.storm-played-filter:hover {
  border-color: rgba(255, 255, 255, 0.7);
  background: #35322c;
  color: #fff;
}
.storm-played-filter.active {
  background: #629924;
  border-color: #7ab82e;
  color: #fff;
  box-shadow: 0 0 0 1px #62992455;
}
@media (max-width: 640px) {
  .storm-played-head {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .storm-played-title {
    justify-self: center;
  }
}
.storm-played-rounds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  align-content: start;
}
.storm-played-empty {
  margin: 8px 0 0;
  grid-column: 1 / -1;
}
.storm-played-round {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.storm-played-round:hover {
  background: rgba(255, 255, 255, 0.04);
}
.storm-played-round:hover .storm-played-id {
  visibility: visible;
  color: #ddd;
}
.storm-played-board {
  display: block;
  border-radius: 6px;
  overflow: hidden;
  outline: 3px solid transparent;
}
.storm-played-board.is-good {
  outline-color: #629924;
}
.storm-played-board.is-bad {
  outline-color: #c33;
}
.storm-mini-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1;
  background: #b58863;
}
.storm-mini-board-empty {
  min-height: 120px;
  background: #2a2824;
}
.storm-mini-sq {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  height: 0;
}
.storm-mini-sq.light { background: #f0d9b5; }
.storm-mini-sq.dark { background: #b58863; }
.storm-mini-sq.is-last { box-shadow: inset 0 0 0 999px rgba(155, 199, 0, 0.41); }
.storm-mini-sq img {
  position: absolute;
  inset: 4%;
  width: 92%;
  height: 92%;
  object-fit: contain;
  pointer-events: none;
}
.storm-played-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 2px;
  font-size: 0.85rem;
}
.storm-played-result {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.storm-played-result.good { color: #759900; }
.storm-played-result.bad { color: #dc5037; }
.storm-played-result.good::before {
  content: "✓";
  font-size: 0.8em;
}
.storm-played-result.bad::before {
  content: "✕";
  font-size: 0.8em;
}
.storm-played-rating {
  color: #9a968c;
  font-weight: 500;
  font-size: 0.9em;
}
.storm-played-id {
  visibility: hidden;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  color: #9a968c;
}

/* —— Flashcards —— */
.flashcards-hall {
  width: min(100%, 1200px);
}
.flashcards-hall.is-session {
  width: min(100%, 960px);
  margin: 0 auto;
}
.flashcards-hall.is-session > .exam-intro {
  display: none !important;
}
/* Full-width session: left filter column off, board can use the viewport. */
body.fc-session-focus .app-body {
  grid-template-columns: 1fr;
}
body.fc-session-focus .app-body > .panel {
  display: none !important;
}
body.fc-session-focus .board-col {
  width: 100%;
  max-width: 100%;
  padding: 10px 16px 20px;
}
.flashcards-hall .exam-intro h2 {
  margin-bottom: 4px;
}
.fc-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin: 12px 0 16px;
}
.fc-stats > div,
.fc-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 7rem;
}
.fc-stats strong {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
/* Anki-style counts: due=red, in deck=blue, graduated=green */
.fc-stat-due strong {
  color: #ef5350;
}
.fc-stat-active strong {
  color: #42a5f5;
}
.fc-stat-grad strong {
  color: #66bb6a;
}
.fc-lobby-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.fc-auto {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: #b0aba0;
}
.fc-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 40rem;
}
.fc-empty {
  padding: 18px 0;
}
.fc-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #161512;
  border: 1px solid #2e2b27;
  border-radius: 4px;
}
.fc-list-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fc-list-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-list-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
}
.fc-list-edit,
.fc-list-del {
  border: none;
  background: transparent;
  color: #9a968c;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.fc-list-edit:hover {
  color: #d0c4a8;
}
.fc-list-del:hover {
  color: #dc5037;
}
.fc-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.fc-session-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fc-session-board-host {
  position: relative;
  width: var(--fc-board-size, min(86vmin, 720px));
  height: var(--fc-board-size, min(86vmin, 720px));
  max-width: 100%;
  margin: 0 auto 16px;
}
.fc-session-board {
  width: 100%;
}
.fc-session-board-host .board-resize {
  z-index: 6;
}
.study-modal.fc-editor-docked {
  align-items: flex-start;
  justify-content: flex-end;
  background: transparent;
  pointer-events: none;
  padding: 64px 14px 18px;
}
.study-modal.fc-editor-docked .fc-editor-card {
  pointer-events: auto;
  width: min(380px, calc(100vw - 28px));
  max-height: calc(100vh - 80px);
  box-shadow: 0 16px 48px #000c;
  border-color: #4a4034;
}
.fc-editor-back-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.fc-editor-back-actions.hidden {
  display: none !important;
}
.fc-editor-back-actions button {
  flex: 1 1 140px;
}
.fc-editor-board {
  width: min(360px, 100%);
  margin: 0 auto 14px;
}
.fc-editor-text-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
  font-size: 13px;
}
.fc-editor-text-block .study-modal-label-text {
  color: #b8b0a2;
  font-weight: 600;
}
.fc-editor-text-block textarea,
.fc-tpl-edit-row input {
  width: 100%;
  font: inherit;
  padding: 10px;
  background: #12100e;
  border: 1px solid #3a3228;
  color: #eee;
  resize: vertical;
  box-sizing: border-box;
}
.fc-front-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
  align-items: center;
}
.fc-front-templates.hidden {
  display: none !important;
}
.fc-tpl-chip {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  border: 1px solid #3a3630;
  background: #1c1a17;
  border-radius: 999px;
  overflow: hidden;
}
.fc-tpl-chip .fc-tpl-btn {
  border: 0;
  border-radius: 0;
  background: transparent;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-tpl-chip.is-managing {
  border-color: #5a5348;
  background: #221f1b;
}
.fc-tpl-btn,
.fc-tpl-edit {
  border: 1px solid #3a3630;
  background: #1c1a17;
  color: #e8e2d6;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}
.fc-tpl-btn:hover,
.fc-tpl-edit:hover {
  background: #2a2621;
  border-color: #5a5348;
  color: #fff;
  filter: none;
}
.fc-tpl-chip .fc-tpl-btn:hover {
  background: #2a2621;
}
.fc-tpl-remove {
  border: 0;
  border-left: 1px solid #3a3630;
  background: transparent;
  color: #9a948a;
  padding: 0 8px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}
.fc-tpl-remove:hover {
  background: #4a2018;
  color: #f0d0c8;
  filter: none;
}
.fc-tpl-edit {
  color: #b8b0a2;
  font-weight: 500;
}
.fc-tpl-edit.is-active {
  background: #2a3a48;
  border-color: #4d9de0;
  color: #fff;
}
.fc-tpl-edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
}
.fc-tpl-edit-row.hidden {
  display: none !important;
}
.fc-tpl-edit-row input {
  flex: 1 1 180px;
  min-width: 0;
}
.diag-card-local-elo {
  margin: 8px 0 0;
  font-size: 13px;
}
.diag-card-local-elo strong {
  color: #f0ebe3;
  font-variant-numeric: tabular-nums;
}
.fc-session-text {
  text-align: center;
  font-size: 1.05rem;
  margin: 0 0 16px;
  min-height: 1.4em;
  white-space: pre-wrap;
}
.fc-session-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.fc-session-grade {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.fc-grade {
  min-width: 7.5rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 14px;
  line-height: 1.15;
}
.fc-grade-title {
  font-weight: 650;
}
.fc-grade-iv {
  font-size: 0.82rem;
  opacity: 0.88;
  font-weight: 500;
}
.fc-grade-again {
  background: #4a2018;
  border-color: #7a3a2e;
  color: #f0d0c8;
}
.fc-grade-hard {
  background: #4a3a14;
  border-color: #7a6420;
  color: #f0e6c0;
}
.fc-grade-good {
  background: #2a4018;
  border-color: #5a7a30;
}
.fc-editor-board-empty {
  margin: 0;
  padding: 28px 12px;
  text-align: center;
  border: 1px dashed #3a3228;
  border-radius: 4px;
  background: #141210;
}
.fc-pick-bar {
  /* Sit in the analysis column — do not cover the chessboard. */
  position: fixed;
  top: 64px;
  right: 14px;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 70;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  width: min(380px, calc(100vw - 28px));
  padding: 12px 14px;
  background: #1a1714;
  border: 1px solid #3a3228;
  border-radius: 8px;
  box-shadow: 0 12px 40px #000a;
}
.fc-pick-bar.hidden {
  display: none;
}
.fc-pick-bar-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fc-pick-bar-text strong {
  font-size: 0.98rem;
}
.fc-pick-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.fc-pick-bar-actions button {
  flex: 1 1 auto;
}
@media (max-width: 900px) {
  .fc-pick-bar {
    top: 56px;
    right: 12px;
    left: 12px;
    bottom: auto;
    width: auto;
  }
}
.fc-board-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #3a3228;
  border-radius: 4px;
  overflow: hidden;
  background: #b58863;
  line-height: 0;
}
.fc-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}
.fc-sq {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
.fc-sq.light {
  background: #f0d9b5;
}
.fc-sq.dark {
  background: #b58863;
}
.fc-sq.last {
  box-shadow: inset 0 0 0 999px rgba(155, 199, 0, 0.35);
}
.fc-piece {
  position: absolute;
  inset: 3%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.fc-board-shapes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}
.fc-board-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: #9a968c;
  border: 1px dashed #3a3228;
}
.flashcards-hall kbd,
.fc-empty kbd {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85em;
  padding: 1px 5px;
  border: 1px solid #4a463e;
  border-radius: 3px;
  background: #1c1a18;
}

.training-log-hall {
  max-width: 760px;
}
.tl-calendar {
  margin: 12px 0 4px;
}
.tl-cal {
  padding: 14px 14px 12px;
  border-radius: 16px;
  background:
    linear-gradient(165deg, rgba(129, 182, 76, 0.08), transparent 42%),
    var(--card);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.tl-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.tl-cal-month {
  font-size: 1.05rem;
  font-weight: 750;
  text-transform: capitalize;
}
.tl-cal-nav-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #1a1816;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.tl-cal-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.tl-cal-weekdays,
.tl-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.tl-cal-weekdays {
  margin-bottom: 6px;
}
.tl-cal-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.tl-cal-pad {
  min-height: 36px;
}
.tl-cal-day {
  position: relative;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #2a2825;
  color: #b9b4ab;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.tl-cal-day:hover:not(:disabled) {
  filter: brightness(1.12);
  transform: translateY(-1px);
}
.tl-cal-day:disabled,
.tl-cal-day.is-future {
  opacity: 0.38;
  cursor: default;
}
.tl-cal-day.is-today {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}
.tl-cal-day.is-selected {
  outline: 2px solid #ffb347;
  outline-offset: 1px;
  color: #fff;
  z-index: 1;
}
.tl-cal-day.is-exam-pass::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e2c56a;
  box-shadow: 0 0 6px rgba(226, 197, 106, 0.7);
}
/* Calendar heat: intensity = volume, hue = accuracy. */
.tl-cal-day.is-vol-1.is-neutral,
.tl-cal-swatch.is-vol-1.is-neutral { background: #3a4a38; color: #d7e0d4; }
.tl-cal-day.is-vol-2.is-neutral { background: #456344; color: #e8f0e6; }
.tl-cal-day.is-vol-3.is-neutral { background: #547a52; color: #f2f8f1; }
.tl-cal-day.is-vol-4.is-neutral { background: #689a64; color: #fff; }

.tl-cal-day.is-vol-1.is-good,
.tl-cal-swatch.is-vol-1.is-good { background: #3f6b3c; color: #e7f5e5; }
.tl-cal-day.is-vol-2.is-good,
.tl-cal-swatch.is-vol-2.is-good { background: #4f8f48; color: #f3fbef; }
.tl-cal-day.is-vol-3.is-good,
.tl-cal-swatch.is-vol-3.is-good { background: #62b24f; color: #fff; }
.tl-cal-day.is-vol-4.is-good,
.tl-cal-swatch.is-vol-4.is-good { background: #81b64c; color: #fff; }

.tl-cal-day.is-vol-1.is-mixed,
.tl-cal-swatch.is-vol-1.is-mixed { background: #5a5230; color: #efe8cf; }
.tl-cal-day.is-vol-2.is-mixed,
.tl-cal-swatch.is-vol-2.is-mixed { background: #7a6d34; color: #f7f0d4; }
.tl-cal-day.is-vol-3.is-mixed { background: #9a8638; color: #fff8e6; }
.tl-cal-day.is-vol-4.is-mixed { background: #c0a45c; color: #1a1610; }

.tl-cal-day.is-vol-1.is-bad { background: #5a3030; color: #f0d4d4; }
.tl-cal-day.is-vol-2.is-bad { background: #7a3838; color: #f8e0e0; }
.tl-cal-day.is-vol-3.is-bad,
.tl-cal-swatch.is-vol-3.is-bad { background: #a34444; color: #ffe8e8; }
.tl-cal-day.is-vol-4.is-bad { background: #c44d4d; color: #fff; }

.tl-cal-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
}
.tl-cal-legend-sep {
  margin: 0 2px;
  opacity: 0.6;
}
.tl-cal-legend-note {
  margin-right: 4px;
}
.tl-cal-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
@media (max-width: 520px) {
  .tl-cal-day {
    min-height: 32px;
    font-size: 12px;
  }
  .tl-cal-pad { min-height: 32px; }
  .tl-cal-grid,
  .tl-cal-weekdays { gap: 4px; }
}
.tl-day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 4px;
}
.tl-day-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.35rem;
  line-height: 1;
  background: var(--card);
  color: inherit;
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.tl-day-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.tl-day-current {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.tl-day-current strong {
  font-size: 1.15rem;
  font-weight: 750;
  text-transform: capitalize;
}
.tl-today-link {
  border: 0;
  background: transparent;
  color: #ff9600;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  padding: 0;
}
.tl-time-card {
  margin: 14px 0 12px;
  padding: 20px 22px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 150, 0, 0.22), transparent 42%),
    radial-gradient(circle at 90% 100%, rgba(129, 182, 76, 0.14), transparent 40%),
    var(--card);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.tl-time-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.tl-time-value {
  margin: 6px 0 4px;
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #ffb347;
}
.tl-time-hint {
  margin: 0;
  font-size: 13px;
}
.tl-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.tl-stat {
  padding: 12px 12px 14px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.tl-stat span {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}
.tl-stat strong {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.tl-stat .tl-ok { color: #81b64c; }
.tl-stat .tl-bad { color: #e35d5d; }
.tl-stat .tl-wr { color: #ffb347; }
.tl-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.tl-section-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}
.tl-puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.tl-puzzle-card {
  padding: 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 94%, #fff 2%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.tl-puzzle-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.tl-puzzle-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.tl-puzzle-card strong {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.tl-puzzle-card p {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.tl-card-time {
  color: #ffb347 !important;
  font-weight: 650;
}
.tl-bar {
  display: flex;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
}
.tl-bar > span {
  display: block;
  height: 100%;
}
.tl-bar .ok { background: linear-gradient(90deg, #6ea344, #c6ef8a); }
.tl-bar .fail { background: linear-gradient(90deg, #c33, #e88); }
.tl-puzzle-card.tone-warm strong { color: #ff9600; }
.tl-puzzle-card.tone-green strong { color: #81b64c; }
.tl-puzzle-card.tone-violet strong { color: #b59cff; }
.tl-puzzle-card.tone-blue strong { color: #7eb6ff; }
.tl-puzzle-card.tone-orange strong { color: #ffb347; }
.tl-puzzle-card.tone-gold strong { color: #c0a45c; }
.tl-puzzle-card.tone-teal strong { color: #5ecfc0; }
.tl-puzzle-card.tone-pink strong { color: #e89ad4; }
.tl-game-list,
.tl-exam-list,
.tl-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tl-game-row,
.tl-exam-list li,
.tl-timeline-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.tl-exam-list li {
  justify-content: space-between;
}
.tl-game-row .tl-game-open {
  margin-left: 4px;
}
.tl-bot-avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #1a1816;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.tl-bot-avatar.is-fallback {
  font-size: 14px;
  font-weight: 800;
  color: #9aa89a;
  letter-spacing: 0.02em;
}
.tl-bot-avatar svg,
.tl-bot-avatar img {
  width: 100%;
  height: 100%;
  display: block;
}
.tl-bot-avatar.is-img img {
  object-fit: cover;
  object-position: center 14%;
}
.tl-game-main,
.tl-timeline-main {
  flex: 1;
  min-width: 0;
}
.tl-game-open {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, #5ecfc0 18%, #1a1816);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #5ecfc0 40%, transparent);
  color: #9be7dc;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tl-game-row.is-clickable:hover .tl-game-open,
.tl-timeline-item.is-clickable:hover .tl-game-open {
  background: color-mix(in srgb, #5ecfc0 28%, #1a1816);
  color: #d7fff8;
}
.tl-exam-row.is-pass {
  background:
    linear-gradient(120deg, color-mix(in srgb, #c0a45c 16%, transparent), transparent 55%),
    var(--card);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #c0a45c 35%, rgba(255, 255, 255, 0.03));
}
.tl-exam-row.is-fail {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #e35d5d 28%, rgba(255, 255, 255, 0.03));
}
.tl-exam-title {
  min-width: 0;
  line-height: 1.35;
}
.tl-exam-mark {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 0 0 auto;
  text-align: right;
}
.tl-exam-badge {
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.tl-exam-row.is-pass .tl-exam-badge {
  color: #e2c56a;
  text-shadow: 0 0 12px color-mix(in srgb, #c0a45c 45%, transparent);
}
.tl-exam-row.is-fail .tl-exam-badge {
  color: #e35d5d;
}
.tl-exam-row.is-try .tl-exam-badge {
  color: var(--muted);
}
.tl-timeline-item.is-exam-pass {
  background:
    linear-gradient(120deg, color-mix(in srgb, #c0a45c 12%, transparent), transparent 50%),
    var(--card);
}
.tl-timeline-item.is-exam-pass strong {
  color: #e2c56a;
}
.tl-game-row p,
.tl-exam-list .muted,
.tl-timeline-item p {
  margin: 2px 0 0;
  font-size: 12px;
}
.tl-game-result {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.tl-game-row.is-win .tl-game-result { color: #81b64c; }
.tl-game-row.is-loss .tl-game-result { color: #e35d5d; }
.tl-game-row.is-draw .tl-game-result { color: #c0a45c; }
.tl-game-row.is-clickable,
.tl-timeline-item.is-clickable {
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease;
}
.tl-game-row.is-clickable:hover,
.tl-timeline-item.is-clickable:hover {
  filter: brightness(1.08);
}
.tl-game-row.is-clickable:focus-visible,
.tl-timeline-item.is-clickable:focus-visible {
  outline: 2px solid #5ecfc0;
  outline-offset: 2px;
}
.tl-timeline-item {
  justify-content: flex-start;
  align-items: center;
}
.tl-timeline-time {
  flex: 0 0 3.2rem;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.tl-timeline-item .tl-bot-avatar {
  width: 36px;
  height: 36px;
}
.tl-timeline-item .tl-game-open {
  margin-left: auto;
}
.tl-game-row .tl-game-result {
  margin-left: auto;
}
.tl-timeline-item.tone-warm { box-shadow: inset 3px 0 0 #ff9600; }
.tl-timeline-item.tone-green { box-shadow: inset 3px 0 0 #81b64c; }
.tl-timeline-item.tone-violet { box-shadow: inset 3px 0 0 #b59cff; }
.tl-timeline-item.tone-blue { box-shadow: inset 3px 0 0 #7eb6ff; }
.tl-timeline-item.tone-orange { box-shadow: inset 3px 0 0 #ffb347; }
.tl-timeline-item.tone-gold { box-shadow: inset 3px 0 0 #c0a45c; }
.tl-timeline-item.tone-teal { box-shadow: inset 3px 0 0 #5ecfc0; }
.tl-timeline-item.tone-pink { box-shadow: inset 3px 0 0 #e89ad4; }
.tl-empty {
  margin: 0;
  padding: 16px;
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
}
.tl-hero-empty {
  padding: 28px 20px;
  text-align: center;
  border-radius: 18px;
  background:
    linear-gradient(165deg, rgba(255, 150, 60, 0.08), transparent 50%),
    var(--card);
}
.tl-hero-empty-title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 800;
}
@media (max-width: 640px) {
  .tl-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.path-hall {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 40rem;
}
.training-hub-pane.path-hall {
  max-width: 40rem;
}
.path-part {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.path-part-label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.path-part-road .path-intro {
  margin: 0;
}
.path-intro .path-cta {
  margin-top: 12px;
}
.path-cta-btn {
  min-width: 10rem;
}
.path-ladder {
  padding: 4px 0 2px;
}
.path-ladder-track {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 6px 2px 10px;
  scrollbar-width: thin;
}
.path-ladder-node {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 4.4rem;
  padding: 0 2px;
  position: relative;
}
.path-ladder-node:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 15px;
  left: calc(50% + 12px);
  width: calc(100% - 24px);
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}
.path-ladder-node.is-passed:not(:last-child)::after {
  background: rgba(129, 182, 76, 0.45);
}
.path-ladder-dot {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  z-index: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}
.path-ladder-node.is-passed .path-ladder-dot {
  background: rgba(129, 182, 76, 0.22);
  color: #c6ef8a;
  box-shadow: inset 0 0 0 1px rgba(129, 182, 76, 0.35);
}
.path-ladder-node.is-current .path-ladder-dot,
.path-ladder-node.is-open .path-ladder-dot {
  background: rgba(129, 182, 76, 0.35);
  color: #f4f1ea;
  box-shadow:
    0 0 0 3px rgba(129, 182, 76, 0.18),
    inset 0 0 0 1px rgba(198, 239, 138, 0.55);
}
.path-ladder-node.is-locked {
  cursor: default;
  opacity: 0.72;
}
.path-ladder-name {
  font-size: 11px;
  font-weight: 650;
  text-align: center;
  line-height: 1.25;
  max-width: 4.6rem;
  color: var(--muted);
}
.path-ladder-node.is-passed .path-ladder-name,
.path-ladder-node.is-current .path-ladder-name,
.path-ladder-node.is-open .path-ladder-name {
  color: inherit;
}
.path-ladder-meta {
  margin: 0;
  font-size: 12px;
}
.path-rewards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.path-rewards-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.path-rewards-head strong {
  font-size: 13px;
}
.path-rewards-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 6px;
  scrollbar-width: thin;
}
.path-reward {
  flex: 0 0 auto;
  width: 4.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.path-reward.is-locked {
  opacity: 0.45;
  filter: grayscale(0.35);
}
.path-reward-mark {
  font-size: 1.25rem;
  line-height: 1;
}
.path-reward-title {
  font-size: 10px;
  font-weight: 650;
  text-align: center;
  line-height: 1.2;
  color: var(--muted);
}
.path-reward.is-earned .path-reward-title {
  color: inherit;
}
.path-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 4px 4px;
}
.path-chart-svg {
  display: block;
  width: 100%;
  height: auto;
}
.path-chart-line {
  stroke: #81b64c;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.path-chart-dot {
  fill: #c6ef8a;
}
.path-chart-goal {
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.path-chart-goal-label {
  fill: var(--muted);
  font-size: 10px;
}
.path-chart-hint {
  margin: 0;
  font-size: 13px;
}
.path-today {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.path-today-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.path-today-row p {
  margin: 4px 0 0;
}
.path-roads {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.path-road {
  appearance: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.path-road:hover {
  background: rgba(255, 255, 255, 0.055);
}
.path-road-label {
  font-size: 13px;
  font-weight: 700;
}
.path-road-detail {
  font-size: 12px;
  color: var(--muted);
}
.path-toast-host {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 80;
  width: min(22rem, calc(100vw - 24px));
  pointer-events: none;
}
.path-toast {
  pointer-events: auto;
  width: 100%;
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #f4f1ea;
  background: #2a2723;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.path-toast-ok {
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.35),
    inset 3px 0 0 #81b64c,
    inset 0 0 0 1px rgba(129, 182, 76, 0.2);
}
.path-toast-title {
  font-weight: 700;
  font-size: 0.95rem;
}
.path-toast-detail {
  font-size: 12px;
  color: var(--muted);
}
.training-hub-hall {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.training-hub-intro {
  margin-bottom: 0;
}
.training-hub-switch {
  display: flex;
  gap: 4px;
  margin: 14px 0 0;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-width: 36rem;
}
.training-hub-tab {
  flex: 1;
  appearance: none;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  padding: 9px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.training-hub-tab:hover {
  color: var(--text);
}
.training-hub-tab.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.training-hub-tab-due {
  display: inline-flex;
  min-width: 1.1rem;
  height: 1.1rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #c23b22;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}
.training-hub-tab-due.hidden {
  display: none;
}
.training-hub-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.training-hub-pane[hidden],
.training-hub-pane.hidden {
  display: none !important;
}
.training-pane-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.training-pane-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.daily-quests-hall {
  max-width: 720px;
}
.daily-quests-streak {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 8px 0 14px;
  padding: 16px 16px 18px;
  border-radius: 16px;
  background:
    linear-gradient(165deg, rgba(255, 150, 60, 0.1), transparent 42%),
    color-mix(in srgb, var(--card) 92%, #1a1614);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.dq-streak-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}
.dq-flame {
  position: relative;
  flex: 0 0 auto;
  width: 72px;
  height: 88px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 8px 18px rgba(255, 120, 30, 0.35));
}
.dq-flame-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.dq-flame-outer {
  fill: #ff9600;
}
.dq-flame-inner {
  fill: #ffc800;
}
.dq-flame-num {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 0 rgba(120, 40, 0, 0.35);
}
.daily-quests-streak.is-idle .dq-flame {
  filter: none;
  opacity: 0.72;
}
.daily-quests-streak.is-idle .dq-flame-outer {
  fill: #5a5550;
}
.daily-quests-streak.is-idle .dq-flame-inner {
  fill: #7a746c;
}
.daily-quests-streak.is-idle .dq-flame-num {
  color: #d4d0ca;
  text-shadow: none;
}
.dq-streak-copy {
  min-width: 0;
}
.dq-streak-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ff9600;
}
.daily-quests-streak.is-idle .dq-streak-title {
  color: var(--muted);
}
.dq-streak-text,
.daily-quests-streak-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
}
.dq-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}
.dq-week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.dq-week-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.dq-week-day.is-today .dq-week-label {
  color: #ff9600;
}
.dq-week-day.is-done .dq-week-label {
  color: #ffb347;
}
.dq-week-dot {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #3a3632;
  color: transparent;
  box-shadow: inset 0 0 0 2px #4a4540;
}
.dq-week-day.is-done .dq-week-dot {
  background: linear-gradient(160deg, #ffb347, #ff9600 55%, #e07000);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 3px rgba(255, 150, 0, 0.18);
}
.dq-week-day.is-pending .dq-week-dot {
  background: transparent;
  box-shadow: inset 0 0 0 2.5px #ff9600;
}
.dq-week-day.is-future .dq-week-dot {
  background: #2c2926;
  box-shadow: inset 0 0 0 2px #3a3632;
}
.dq-week-day.is-miss .dq-week-dot {
  background: #2c2926;
  box-shadow: inset 0 0 0 2px #3a3632;
  opacity: 0.7;
}
.dq-week-dot svg {
  display: block;
}
.daily-quests-note {
  max-width: 42rem;
  margin: 0;
}
.daily-quests-gates {
  margin: 0;
}
.daily-quests-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.daily-quest {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.daily-quest.is-done {
  background:
    linear-gradient(180deg, rgba(129, 182, 76, 0.12), transparent 46%),
    var(--card);
  box-shadow:
    inset 3px 0 0 #81b64c,
    inset 0 0 0 1px rgba(129, 182, 76, 0.12);
}
.daily-quest.is-done .daily-quest-meter > span {
  background: linear-gradient(90deg, #6ea344, #c6ef8a);
}
.daily-quests-gate-block + .daily-quests-gate-block {
  margin-top: 10px;
}
.daily-quests-gate-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.training-plan-hall .plan-budget-wrap {
  margin: 0 0 16px;
}
.plan-budget {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
}
.plan-budget-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plan-budget-chip {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}
.plan-budget-chip.is-active {
  background: rgba(129, 182, 76, 0.22);
  box-shadow: inset 0 0 0 1px rgba(129, 182, 76, 0.45);
}
.plan-budget-custom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.plan-budget-custom input {
  width: 4.5rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font: inherit;
}
.plan-budget-apply {
  margin-left: auto;
}
.plan-block-mins {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
}
.plan-block.is-active {
  box-shadow:
    inset 3px 0 0 #6a9fb5,
    inset 0 0 0 1px rgba(106, 159, 181, 0.2);
}
.daily-quest-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 72px;
}
.daily-quest-seal-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #e7ffc4 0%, #9ed85f 36%, #6aaa38 70%, #3f6e22 100%);
  color: #10200c;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 4px rgba(129, 182, 76, 0.16),
    0 8px 16px rgba(80, 140, 40, 0.28);
}
.daily-quest-seal-mark svg {
  display: block;
}
.daily-quest-seal-mark path {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  animation: daily-check-draw 0.45s ease forwards;
}
.daily-quest-seal-label {
  font-size: 12px;
  font-weight: 650;
  color: #b7e48a;
}
@keyframes daily-check-draw {
  to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .daily-quest-seal-mark path {
    animation: none;
    stroke-dashoffset: 0;
  }
}
.daily-quest-title {
  font-weight: 650;
}
.daily-quest-detail {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}
.daily-quest-meter {
  height: 8px;
  margin-top: 12px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 99px;
  overflow: hidden;
}
.daily-quest-meter > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #ff9600, #ffc800);
}
.daily-quest-count {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.daily-quest-action button:disabled {
  opacity: 0.7;
  cursor: default;
}
@media (max-width: 640px) {
  .dq-streak-hero {
    gap: 12px;
  }
  .dq-flame {
    width: 60px;
    height: 74px;
  }
  .dq-flame-num {
    font-size: 24px;
    margin-top: 14px;
  }
  .dq-week-dot {
    width: 26px;
    height: 26px;
  }
  .daily-quest {
    grid-template-columns: 1fr;
  }
  .daily-quest-seal {
    flex-direction: row;
    justify-content: flex-start;
    min-width: 0;
  }
}

.bots-hall {
  width: min(100%, 1040px);
}
.bots-hall .exam-intro h2 {
  margin-bottom: 4px;
}
#bots-engine.is-bad {
  color: var(--danger);
}
.bots-play-rating {
  margin: 6px 0 0;
}
.bots-play-rating strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.bots-tier {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bots-tier h3 {
  margin: 8px 0 0;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.bots-tier > .muted {
  margin: 0;
}
.bots-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.bots-tier.is-boss .bots-grid {
  grid-template-columns: minmax(0, 280px);
}
.bots-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: var(--card);
  border: 1px solid #0006;
  border-radius: 16px;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.bots-card:hover,
.bots-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent-2);
  outline: none;
}
.bots-card.is-boss {
  border-color: #e6c36a;
  box-shadow: 0 0 0 1px #e6c36a55;
}
.bots-card-art {
  display: block;
  aspect-ratio: 1 / 1.05;
  background: #111;
}
.bots-portrait {
  display: block;
  width: 100%;
  height: 100%;
}
.bots-portrait-img {
  object-fit: cover;
  object-position: center 14%;
}
.bots-modal-art .bots-portrait-img,
.named-result-avatar .bots-portrait-img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}
.bots-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
}
.bots-card-name {
  font-size: 16px;
  font-weight: 700;
}
.bots-card-rating {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bots-card.is-boss .bots-card-rating {
  color: #e6c36a;
}
.bots-card-score,
.bots-modal-score {
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.bots-card-score { font-size: 15px; }
.bots-modal-score { font-size: 18px; }
.bots-modal-score-row { margin: 0; }
.bots-card-score-label {
  margin-right: 6px;
  font-size: 0.78em;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.bots-card-score.is-even,
.bots-modal-score.is-even { color: var(--muted); }
.bots-card-score.is-up,
.bots-modal-score.is-up { color: var(--accent); }
.bots-card-score.is-down,
.bots-modal-score.is-down { color: #e15d5d; }
.bots-card-role {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.bots-live {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 16%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.bots-live p {
  margin: 0;
}
.bots-live-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.bots-live-abort {
  margin: 0;
}
.bots-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #000a;
}
.bots-modal-card {
  display: flex;
  flex-direction: column;
  width: min(100%, 760px);
  max-height: calc(100vh - 32px);
  background: #2b2a28;
  border-radius: 12px;
  overflow: auto;
  border: 1px solid #0008;
  position: relative;
}
.bots-modal-top {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  align-items: start;
}
.bots-modal-art {
  aspect-ratio: 1 / 1.05;
  background: #111;
}
.bots-modal-art .bots-portrait {
  height: 100%;
}
.bots-modal-copy {
  padding: 22px 44px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bots-modal-copy h3 {
  margin: 0;
  font-size: 28px;
}
.bots-kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.bots-modal-role,
.bots-modal-bio {
  margin: 0;
  color: var(--muted);
}
.bots-modal-elo {
  margin: 4px 0;
  font-weight: 700;
  color: var(--accent);
}
.bots-setup {
  margin: 0 16px 8px;
  padding: 14px 16px 16px;
  border-radius: 10px;
  background: #1a1917;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bots-setup-caption {
  margin: 6px 0 0;
  text-align: center;
  font-size: 15px;
  color: var(--text);
}
.bots-colors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-radius: 8px;
  overflow: hidden;
  background: #3c3b39;
}
.bots-color-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-weight: 650;
  padding: 12px 8px;
}
.bots-color-btn + .bots-color-btn {
  box-shadow: inset 1px 0 0 #0006;
}
.bots-color-btn.is-on {
  background: #629924;
  color: #fff;
}
.bots-color-btn span {
  font-size: 18px;
  line-height: 1;
}
.bots-tc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}
.bots-tc-side {
  gap: 8px;
  color: #d7d3cc;
  font-size: 13px;
  text-align: center;
}
.bots-tc-side > span:first-child {
  min-height: 2.4em;
}
.bots-tc-track {
  position: relative;
  display: block;
}
.bots-tc-track strong {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  text-shadow: 0 1px 2px #000a;
}
.bots-tc-track input[type="range"] {
  --fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #629924 var(--fill), #4a4946 var(--fill));
  cursor: pointer;
}
.bots-tc-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 0;
  background: #f2f2f2;
  box-shadow: 0 0 0 1px #0006;
}
.bots-tc-track input[type="range"]::-moz-range-track {
  height: 22px;
  border: 0;
  background: transparent;
}
.bots-tc-track input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: #f2f2f2;
}
.bots-tc-plus {
  padding-bottom: 1px;
  color: #fff;
  font-size: 18px;
  font-weight: 650;
}
.bots-presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
.bots-preset {
  border: 0;
  border-radius: 999px;
  background: #3c3b39;
  color: #fff;
  padding: 6px 12px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.bots-preset.is-on {
  background: #629924;
  color: #fff;
  font-weight: 700;
}
.bots-fen {
  gap: 6px;
}
.bots-fen .bots-setup-caption {
  margin-bottom: 2px;
}
.bots-fen input {
  width: 100%;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}
.bots-fen input[aria-invalid="true"] {
  border-color: var(--danger);
}
.bots-fen-msg {
  min-height: 1.2em;
  color: var(--muted);
  font-size: 12px;
}
.bots-fen-msg.is-bad {
  color: var(--danger);
}
.bots-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 16px 16px;
}
.bots-play {
  width: 100%;
  margin: 0;
}
.bots-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #0006;
  color: #fff;
  cursor: pointer;
}
.bots-modal-close svg {
  display: block;
  width: 14px;
  height: 14px;
}
.bots-back {
  align-self: flex-start;
  margin: 0 0 8px;
}
@media (max-width: 900px) {
  .bots-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bots-modal-top {
    grid-template-columns: 1fr;
  }
  .bots-modal-art {
    aspect-ratio: auto;
    min-height: 200px;
    max-height: 240px;
  }
  .bots-live {
    flex-direction: column;
    align-items: stretch;
  }
}
@media (max-width: 560px) {
  .bots-tc {
    grid-template-columns: 1fr;
  }
  .bots-tc-plus {
    display: none;
  }
}

/* Strategy exams */
.strategy-exam-hall {
  width: min(100%, 1280px);
}
.play-main.is-strategy {
  grid-template-columns:
    minmax(280px, 420px) var(--cg-width, min(72vmin, 100%)) minmax(260px, 380px);
  justify-content: stretch;
  width: 100%;
}
@media (max-width: 980px) {
  .play-main.is-strategy {
    grid-template-columns: minmax(0, 1fr);
  }
  .play-main.is-strategy > .strategy-play-panel {
    order: 2;
    max-height: none;
    height: auto;
  }
  .play-main.is-strategy > .board-stack {
    order: 1;
  }
  .play-main.is-strategy > .move-panel {
    order: 3;
  }
}
.play-main.is-strategy > .strategy-play-panel {
  order: 1;
  display: flex !important;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 0;
  height: var(--board-align-h, auto);
  max-height: var(--board-align-h, min(100%, 720px));
  box-sizing: border-box;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(16, 18, 22, 0.72);
}
.play-main.is-strategy > .board-stack {
  order: 2;
}
.play-main.is-strategy > .move-panel {
  order: 3;
}
.play-main.is-strategy #review-panel {
  display: none !important;
}
.play-main.is-strategy .move-panel-title-row {
  margin-top: 4px;
}
.strategy-session-turn {
  margin: 0 0 8px;
  font-size: 13px;
}
.strategy-session-turn[data-side="w"] {
  color: #e8e4dc;
}
.strategy-session-turn[data-side="b"] {
  color: #b8c0cc;
}
.strategy-play-panel.hidden {
  display: none !important;
}
.strategy-engine-hint {
  margin: 0;
  font-size: 13px;
}
.strategy-diff-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 18px;
}
.strategy-diff-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.strategy-diff-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.strategy-diff-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 24, 32, 0.55);
  color: inherit;
  font-size: 13px;
  cursor: pointer;
}
.strategy-diff-chip .muted {
  font-size: 12px;
}
.strategy-diff-chip:hover {
  border-color: rgba(255, 255, 255, 0.28);
}
.strategy-diff-chip.is-active {
  border-color: rgba(127, 176, 105, 0.55);
  background: rgba(91, 140, 81, 0.22);
}
.strategy-diff-chip.strategy-diff-easy.is-active {
  border-color: rgba(110, 180, 120, 0.6);
  background: rgba(70, 140, 90, 0.25);
}
.strategy-diff-chip.strategy-diff-mid.is-active {
  border-color: rgba(200, 170, 80, 0.55);
  background: rgba(160, 130, 40, 0.22);
}
.strategy-diff-chip.strategy-diff-hard.is-active {
  border-color: rgba(210, 120, 70, 0.55);
  background: rgba(170, 90, 40, 0.22);
}
.strategy-diff-chip.strategy-diff-expert.is-active {
  border-color: rgba(200, 90, 100, 0.6);
  background: rgba(150, 50, 60, 0.25);
}
.strategy-session-diff {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.strategy-session-diff.strategy-diff-easy { color: #8fce8a; }
.strategy-session-diff.strategy-diff-mid { color: #d4c07a; }
.strategy-session-diff.strategy-diff-hard { color: #e0a070; }
.strategy-session-diff.strategy-diff-expert { color: #e09098; }
.strategy-exam-grid {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.strategy-topic-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.strategy-topic-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.strategy-topic-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(20, 24, 32, 0.55);
  color: inherit;
  cursor: pointer;
}
.strategy-topic-card:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(28, 34, 44, 0.8);
}
.strategy-topic-card strong {
  font-size: 15px;
}
.strategy-topic-mix {
  max-width: 320px;
  border-color: rgba(91, 140, 81, 0.45);
  background: linear-gradient(145deg, rgba(91, 140, 81, 0.18), rgba(20, 24, 32, 0.55));
}
.strategy-topic-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2, #7fb069);
}
.strategy-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.strategy-session-question {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
  font-weight: 600;
}
.strategy-answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.strategy-answer-label {
  font-size: 13px;
  color: var(--muted);
}
.strategy-mic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(20, 24, 32, 0.7);
  color: inherit;
  cursor: pointer;
  font-size: 13px;
}
.strategy-mic-btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
}
.strategy-mic-btn.is-listening {
  border-color: rgba(200, 70, 70, 0.55);
  background: rgba(160, 40, 40, 0.35);
  animation: strategy-mic-pulse 1.2s ease-in-out infinite;
}
@keyframes strategy-mic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(200, 70, 70, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(200, 70, 70, 0);
  }
}
.strategy-mic-status {
  margin: 0;
  font-size: 13px;
}
.strategy-session-answer {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 14, 18, 0.7);
  color: inherit;
  resize: vertical;
  min-height: 120px;
}
.strategy-session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.strategy-session-feedback {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(16, 18, 22, 0.65);
}
.strategy-score {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
}
.strategy-score strong {
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}
.strategy-score-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.strategy-score-good {
  background: rgba(91, 140, 81, 0.22);
  border: 1px solid rgba(91, 140, 81, 0.4);
}
.strategy-score-mid {
  background: rgba(200, 160, 60, 0.18);
  border: 1px solid rgba(200, 160, 60, 0.35);
}
.strategy-score-bad {
  background: rgba(180, 70, 70, 0.18);
  border: 1px solid rgba(180, 70, 70, 0.35);
}
.strategy-score-hero {
  margin-bottom: 16px;
}
.strategy-score-inline.strategy-score-good { color: #8dce7a; }
.strategy-score-inline.strategy-score-mid { color: #e0b85a; }
.strategy-score-inline.strategy-score-bad { color: #e08a8a; }
.strategy-feedback-comment {
  margin: 0;
  line-height: 1.45;
}
.strategy-feedback-block h4 {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.strategy-feedback-block p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}
.strategy-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.strategy-summary-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.strategy-summary-row {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(20, 24, 32, 0.45);
}
.strategy-summary-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.strategy-summary-q {
  margin: 0 0 4px;
  font-weight: 600;
}
.strategy-summary-comment {
  margin: 0;
  font-size: 14px;
}

/* Skill Path (Training > Path tab), independent of Path home */
.skill-path-hall {
  max-width: 720px;
  gap: 18px;
}
.sp-overall-card {
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.sp-overall-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sp-overall-value {
  display: block;
  margin: 6px 0 12px;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
}
.sp-overall-bar {
  margin-bottom: 10px;
}
.sp-overall-hint {
  margin: 0;
  font-size: 12px;
}
.sp-skills {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sp-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sp-group-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.sp-group-skills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sp-skill {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: var(--card);
  color: inherit;
  font: inherit;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sp-skill:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: color-mix(in srgb, var(--card) 88%, #fff 12%);
}
.sp-skill.is-pending {
  opacity: 0.78;
}
.sp-skill-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.sp-skill-label {
  font-weight: 700;
  font-size: 0.98rem;
}
.sp-skill-rating {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}
.sp-skill.is-pending .sp-skill-rating {
  color: var(--muted);
}
.sp-skill-bar {
  margin-top: 8px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.sp-skill-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6f9e42, var(--accent));
  transition: width 0.25s ease;
}
.sp-skill-detail {
  margin: 8px 0 0;
  font-size: 12px;
}

/* —— Deploy auth gate + admin —— */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 9, 8, 0.92);
  backdrop-filter: blur(6px);
}
.auth-gate.hidden { display: none !important; }
.app.auth-locked {
  pointer-events: none;
  filter: grayscale(0.2) brightness(0.55);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--card, #1a1714);
  border: 1px solid #3a342c;
  border-radius: 14px;
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.auth-title {
  margin: 0;
  font-size: 1.35rem;
}
.auth-lead { margin: 0; font-size: 13px; line-height: 1.4; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.auth-tab {
  border: 1px solid #3a342c;
  background: #12100e;
  color: inherit;
  font: inherit;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.auth-tab.active {
  border-color: var(--accent, #c9a227);
  background: #221e18;
}
.auth-pane { display: flex; flex-direction: column; gap: 10px; }
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted, #9a9080);
}
.auth-field input {
  font: inherit;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid #3a342c;
  background: #0e0c0a;
  color: inherit;
}
.auth-submit { width: 100%; margin-top: 4px; }
.auth-msg {
  min-height: 1.2em;
  margin: 0;
  font-size: 13px;
}
.auth-msg.is-bad { color: #e08080; }
.auth-msg.is-ok { color: #8fbf6a; }
.auth-user-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
  font-size: 13px;
}
.auth-logout-btn {
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #3a342c;
  background: #12100e;
  color: inherit;
  cursor: pointer;
}
.admin-hall {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px;
}
.admin-hall-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.admin-block {
  background: var(--card, #1a1714);
  border: 1px solid #3a342c;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-block h3 { margin: 0; font-size: 15px; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid #2e2923;
  vertical-align: middle;
}
.admin-invite-code {
  font-size: 12px;
  user-select: all;
}

/* Deploy stubs: endgame / strategy WIP */
.section-wip-card {
  margin: 8px 0 0;
  padding: 18px 16px;
  border: 1px dashed #4a4338;
  border-radius: 12px;
  background: #14120f;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 420px;
}
.section-wip-card strong {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.section-wip-card p {
  margin: 0;
  line-height: 1.45;
}
