@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/Inter-Variable-latin.woff2") format("woff2-variations"),
       url("fonts/Inter-Variable-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/Inter-Variable-latin-ext.woff2") format("woff2-variations"),
       url("fonts/Inter-Variable-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #050706;
  --surface: #0d1210;
  --surface-2: #141b18;
  --ink: #f2f5ef;
  --muted: #9aa79f;
  --line: #243028;
  --green: #5fbf89;
  --green-dark: #9bdcb7;
  --green-strong: #2f9e5c;
  --green-tint: #102118;
  --green-tint-border: #315b42;
  --amber: #e4b45c;
  --amber-tint: #2b2110;
  --red: #ed8174;
  --red-tint: #301817;
  --red-tint-border: #65312e;
  --blue: #8cc6f2;
  --blue-tint: #101f2c;
  --blue-tint-border: #2e526e;
  --board-light: #d5c099;
  --board-dark: #51764f;
  --board-frame: #080d09;
  --track: #202a24;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
  --focus-ring: 0 0 0 3px rgba(95, 191, 137, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #050706;
    --surface: #0d1210;
    --surface-2: #141b18;
    --ink: #f2f5ef;
    --muted: #9aa79f;
    --line: #243028;
    --green: #5fbf89;
    --green-dark: #9bdcb7;
    --green-strong: #2f9e5c;
    --green-tint: #102118;
    --green-tint-border: #315b42;
    --amber: #e4b45c;
    --amber-tint: #2b2110;
    --red: #ed8174;
    --red-tint: #301817;
    --red-tint-border: #65312e;
    --blue: #8cc6f2;
    --blue-tint: #101f2c;
    --blue-tint-border: #2e526e;
    --board-light: #d5c099;
    --board-dark: #51764f;
    --board-frame: #080d09;
    --track: #202a24;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
    --focus-ring: 0 0 0 3px rgba(95, 191, 137, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  transition: background-color 200ms ease, color 200ms ease;
}

a,
button,
input,
textarea,
select,
.icon-button,
  .move-token,
  .game-row,
  .status-pill,
  .stats-pill,
  .square {
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--green);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wordmark-icon {
  flex: 0 0 auto;
  border-radius: 7px;
  box-shadow: var(--shadow);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 750;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar p,
.game-header p,
.empty,
.section-heading span,
.metric-panel span,
.accuracy-details dt,
.accuracy-empty {
  color: var(--muted);
}

.status-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--green-tint-border);
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-tint);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.top-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.stats-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.status-pill.active,
.stats-pill.active {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-tint);
}

.stats-pill:hover,
.status-pill:hover {
  border-color: var(--green-dark);
  color: var(--green-dark);
}

.phase-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.phase-pills .stats-pill {
  min-width: 0;
}

.messages {
  display: grid;
  gap: 8px;
  padding: 16px 32px 0;
}

.message {
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.message.success {
  border-color: var(--green-tint-border);
  color: var(--green-dark);
}

.message.error {
  border-color: var(--red-tint-border);
  color: var(--red);
}

.message.info {
  border-color: var(--blue-tint-border);
  color: var(--blue);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px 32px 32px;
}

.sidebar,
.main-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

/* Without this, the sidebar's game list (unbounded, grows with every import) stretches
   the whole CSS Grid row -- including .main-panel -- to match its height by default, so
   short report-deck slides end up with a huge dead gap before the nav buttons. Capping
   the sidebar's own height and letting it scroll independently keeps it (and the rest of
   the layout) sane regardless of how many games are listed. */
.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.panel,
.metric-panel,
.board-section,
.accuracy-section,
.welcome-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.board-section,
.accuracy-section,
.welcome-panel {
  padding: 18px;
}

.panel-title-row,
.section-heading,
.game-header,
.analysis-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.import-panel form,
.analysis-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
textarea,
select,
button {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
}

input,
textarea,
select {
  padding: 9px 10px;
  color: var(--ink);
  background: var(--surface-2);
}

textarea {
  min-height: 168px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

select {
  cursor: pointer;
}

button {
  padding: 0 14px;
  border-color: var(--green-dark);
  color: #fff;
  background: var(--green);
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  background: var(--green-dark);
}

button:disabled,
button:disabled:hover {
  border-color: var(--line);
  color: var(--muted);
  background: var(--track);
  cursor: not-allowed;
}

.secondary-button {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-2);
}

.secondary-button:hover {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-tint);
}

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

.scope-tabs a {
  display: grid;
  gap: 2px;
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-2);
  text-decoration: none;
}

.scope-tabs a:hover,
.scope-tabs a.active {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-tint);
}

.scope-tabs span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.scope-tabs strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.game-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

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

.game-list-panel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 20px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.game-list-panel-chevron {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  transition: transform 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.game-list-panel-toggle:hover .game-list-panel-chevron,
.game-list-panel-toggle:focus-visible .game-list-panel-chevron {
  border-color: var(--green);
  color: var(--green-dark);
}

.game-list-panel-toggle[aria-expanded="true"] .game-list-panel-chevron {
  transform: rotate(90deg);
}

.game-list-toggle {
  margin-top: 2px;
}

.reference-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.game-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface-2);
}

/* Without this, the "See more" disclosure's hidden rows still render: .game-row's own
   display: grid (author-stylesheet origin) beats the browser's built-in
   [hidden] { display: none } rule (user-agent origin) at equal specificity --
   author styles always win over UA styles regardless of source order. Same pattern
   already used for .report-slide[hidden] / .error-review-popup[hidden] elsewhere in
   this file; this rule was missing here. */
.game-row[hidden] {
  display: none;
}

.game-row:hover {
  border-color: var(--green-tint-border);
}

.game-row.selected {
  border-color: var(--green);
  background: var(--green-tint);
}

.game-id {
  color: var(--muted);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.source-chip.chesscom {
  color: var(--amber);
  background: var(--amber-tint);
}

.source-chip.lichess {
  color: var(--blue);
  background: var(--blue-tint);
}

.source-chip.pgn {
  color: var(--muted);
  background: var(--track);
}

.game-names {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.game-meta {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.game-header {
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.puzzle-pool-note {
  color: var(--muted);
  font-size: 13px;
  margin: 2px 0 0;
}

.puzzle-reason-note {
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 0;
}

.puzzle-focus-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.puzzle-focus-list span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--green-tint-border);
  border-radius: 7px;
  color: var(--green-dark);
  background: var(--green-tint);
  font-size: 12px;
  font-weight: 800;
}

.puzzle-mode-tabs {
  margin-top: 0;
}

.puzzle-facet-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.puzzle-facet-group {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.puzzle-facet-group > strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.puzzle-facet-group .phase-pills {
  margin-top: 0;
}

.puzzle-facet-group .stats-pill {
  justify-content: flex-start;
  width: 100%;
}

.analysis-form {
  grid-template-columns: repeat(2, minmax(118px, 1fr));
  align-items: end;
}

.analysis-form button,
.analysis-upgrade-button {
  display: grid;
  gap: 2px;
  align-content: center;
  min-height: 52px;
  padding: 8px 12px;
  text-align: left;
}

.analysis-form button span,
.analysis-upgrade-button span {
  color: currentColor;
  font-size: 12px;
  font-weight: 650;
  opacity: 0.78;
}

.analysis-upgrade-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--green-dark);
  background: var(--green-tint);
  font-weight: 800;
  text-decoration: none;
}

.analysis-progress-popup {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  width: 280px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.analysis-progress-popup[hidden] {
  display: none;
}

.analysis-progress-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--track);
}

.analysis-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
  transition: width 0.3s ease;
}

.analysis-progress-message {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.analysis-progress-popup-error .analysis-progress-fill {
  background: var(--red);
}

.analysis-progress-popup-error .analysis-progress-message {
  color: var(--red);
}

.analysis-payoff-banner {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.analysis-payoff-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.metrics-grid,
.tables-grid {
  display: grid;
  gap: 18px;
}

.metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric-panel {
  min-height: 96px;
  padding: 16px;
}

.metric-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.report-deck {
  display: grid;
  gap: 16px;
}

/* The board stays visible next to every slide (not just Overview) -- most slides
   reference specific moves (tendency examples, critical moments, awards), so being
   able to see the position without flipping back to slide 1 matters more than the
   board being "part of" any one slide. */
.report-deck-body {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.report-board-column {
  position: sticky;
  top: 18px;
}

.report-content-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.report-deck-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.report-deck-header h2 {
  font-size: 24px;
}

.report-counter {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.report-deck-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.report-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(96px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.report-tab,
.report-nav-button {
  width: auto;
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-2);
}

.report-tab {
  min-height: 42px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.report-tab:hover,
.report-tab.active {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-tint);
}

.report-tab.active {
  box-shadow: inset 0 -3px 0 var(--green);
}

/* Opening/Middlegame/Endgame are a natural subgroup (game phases) distinct from the
   other four slide types -- tint them with the same blue already used for phase-badge
   and phase-eval-badge elsewhere, so the grouping reads as intentional rather than
   introducing a new color meaning. Lower specificity than .report-tab:hover/.active
   (one class vs two), so the active/hover states still take over correctly. */
.report-tab--phase {
  border-color: var(--blue-tint-border);
  background: var(--blue-tint);
}

.report-slides {
  /* Now that the board lives in its own persistent column, slide content ranges from
     ~240px (Overview) to 2000px+ (Details, full move list) -- no fixed reservation can
     unify that range, so this is just a light floor to keep a near-empty slide (e.g.
     "no tendencies recorded") from looking like a rendering glitch, not an attempt to
     match the board's height. */
  min-height: 200px;
}

.report-slide {
  display: grid;
  gap: 18px;
}

.report-slide[hidden] {
  display: none;
}

.report-slide-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.report-slide-heading h3 {
  font-size: 20px;
}

.report-slide-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-slide-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.phase-eval-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--blue-tint-border);
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-tint);
  font-size: 13px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.phase-eval-badge i {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.report-nav {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.report-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 116px;
  text-decoration: none;
}

.report-nav-button.primary {
  border-color: var(--green-dark);
  color: #fff;
  background: var(--green);
}

.report-nav-button:hover {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-tint);
}

.report-nav-button.primary:hover {
  border-color: var(--green-dark);
  color: #fff;
  background: var(--green-dark);
}

.report-nav-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  background: var(--track);
  cursor: not-allowed;
  opacity: 0.7;
}

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

.board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  width: min(100%, 420px);
  aspect-ratio: 1;
  margin-top: 14px;
  border: 2px solid var(--board-frame);
  border-radius: 6px;
  overflow: hidden;
  background: var(--board-dark);
}

.board-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.board-flip-button {
  width: 34px;
  min-height: 30px;
  font-size: 17px;
}

.square {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  line-height: 1;
}

.square::before,
.square::after {
  position: absolute;
  z-index: 1;
  font-size: clamp(9px, 1.8vw, 12px);
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.square.rank-label::before {
  content: attr(data-rank);
  top: 4px;
  left: 5px;
}

.square.file-label::after {
  right: 5px;
  bottom: 4px;
  content: attr(data-file);
}

.piece-symbol {
  position: relative;
  z-index: 2;
  width: 78%;
  height: 78%;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

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

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

.square.light::before,
.square.light::after {
  color: rgba(59, 76, 59, 0.72);
}

.square.dark::before,
.square.dark::after {
  color: rgba(247, 245, 239, 0.86);
}

.move-viewer {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.viewer-controls {
  display: grid;
  grid-template-columns: 42px 42px minmax(72px, 1fr) 42px 42px;
  align-items: center;
  gap: 8px;
}

.viewer-controls span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.icon-button {
  width: 42px;
  min-height: 36px;
  padding: 0;
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-2);
  font-weight: 800;
}

.icon-button:hover {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-tint);
}

.icon-button:disabled {
  color: var(--muted);
  background: var(--track);
  cursor: not-allowed;
  opacity: 0.6;
}

.move-detail {
  display: grid;
  gap: 3px;
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.move-detail strong {
  font-size: 15px;
}

.move-detail span,
.move-detail em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.eval-graph-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  cursor: pointer;
}

.eval-graph-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

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

.eval-graph-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.eval-graph-heading strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eval-graph {
  display: block;
  width: 100%;
  height: 86px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.eval-graph-white-zone {
  fill: #f5f2e8;
}

.eval-graph-black-zone {
  fill: #3f3b35;
}

.eval-graph-zero {
  stroke: rgba(13, 18, 16, 0.45);
  stroke-width: 1.4;
}

.eval-graph-line {
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.6;
  vector-effect: non-scaling-stroke;
}

.eval-graph-current-line {
  stroke: rgba(140, 198, 242, 0.8);
  stroke-dasharray: 3 3;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.eval-graph-current-dot {
  fill: var(--blue);
  stroke: var(--surface);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.eval-graph-card.is-empty .eval-graph-line,
.eval-graph-card.is-empty .eval-graph-current-line,
.eval-graph-card.is-empty .eval-graph-current-dot {
  opacity: 0;
}

.analysis-board-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.analysis-board-panel {
  display: grid;
  gap: 18px;
}

.analysis-board-layout {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}

.analysis-board-board-section {
  display: grid;
  gap: 12px;
}

.analysis-board-board {
  position: relative;
  width: min(100%, 520px);
  margin-top: 0;
}

.analysis-board-board-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: min(100%, 520px);
}

.analysis-board-step-button {
  width: 42px;
  height: 38px;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.analysis-board-board .square {
  cursor: pointer;
}

.analysis-board-board.is-busy .square {
  cursor: wait;
}

.analysis-board-board .square.selected {
  box-shadow: inset 0 0 0 4px var(--green);
}

.analysis-board-board .square.arrow-source {
  box-shadow: inset 0 0 0 4px #d59d12;
}

.analysis-board-arrows {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.analysis-board-arrows line {
  stroke: var(--green);
  stroke-linecap: round;
  stroke-width: 0.16;
  opacity: 0.55;
}

.analysis-board-arrows line[hidden] {
  display: none;
}

.analysis-board-arrows path {
  fill: var(--green);
  opacity: 0.55;
}

.analysis-board-arrows .analysis-board-user-arrow {
  stroke: #d59d12;
  stroke-linecap: round;
  stroke-width: 0.16;
  opacity: 0.88;
}

.analysis-board-arrows .analysis-board-user-arrow-head {
  fill: #d59d12;
}

.analysis-board-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.analysis-board-side-panel {
  align-content: start;
}

.analysis-board-side-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.analysis-board-side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.analysis-board-side-heading div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.analysis-board-side-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.analysis-board-side-heading strong {
  color: var(--ink);
  font-size: 15px;
}

.analysis-board-side-heading button,
.analysis-board-side-heading .module-link {
  flex: 0 0 auto;
  min-height: 34px;
}

.analysis-board-card label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.analysis-board-card textarea {
  min-height: 94px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.analysis-board-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.analysis-board-actions-single {
  grid-template-columns: minmax(0, 1fr);
}

.analysis-board-status {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.analysis-board-status.is-error {
  color: var(--red);
}

.analysis-board-status.is-success {
  color: var(--green-dark);
}

.analysis-board-history {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.analysis-board-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.analysis-board-history-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.analysis-board-history-heading strong {
  color: var(--ink);
  font-size: 12px;
}

.analysis-board-history ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.analysis-board-history li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.analysis-board-history li span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.analysis-board-history li strong {
  font-size: 13px;
}

.analysis-board-result {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.analysis-board-result[hidden] {
  display: none;
}

.analysis-board-eval,
.analysis-board-best {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.analysis-board-eval span,
.analysis-board-best span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.analysis-board-eval strong,
.analysis-board-best strong {
  font-size: 22px;
}

.analysis-board-lines {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.analysis-board-lines li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.analysis-board-lines li:last-child {
  border-bottom: 0;
}

.analysis-board-lines strong,
.analysis-board-lines span {
  display: inline-block;
  font-size: 13px;
}

.analysis-board-lines span {
  float: right;
  color: var(--muted);
  font-weight: 800;
}

.accuracy-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.accuracy-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.accuracy-row:last-child {
  border-bottom: 0;
}

.accuracy-row summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.accuracy-row summary::-webkit-details-marker {
  display: none;
}

.accuracy-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  flex-wrap: wrap;
}

.accuracy-main span {
  font-weight: 700;
}

.accuracy-main strong {
  min-width: 76px;
  text-align: right;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.estimated-rating {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.accuracy-row summary:hover .facet-more {
  border-color: var(--green);
  background: var(--surface);
}

.accuracy-row[open] .facet-more {
  transform: rotate(90deg);
}

.accuracy-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 14px;
  margin: 10px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
}

.accuracy-details div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.accuracy-details dt,
.accuracy-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.accuracy-details dd {
  margin: 0;
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.accuracy-empty {
  margin-top: 10px;
}

.accuracy-row.hero {
  margin: -2px -4px 4px;
  padding: 14px;
  border: 1px solid var(--green-tint-border);
  border-radius: 8px;
  background: var(--green-tint);
}

.accuracy-row.hero .accuracy-main span {
  color: var(--green-dark);
}

.accuracy-row.hero .accuracy-main strong {
  color: var(--green-dark);
  font-size: 30px;
}

.style-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.award-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.award-row {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--green-tint-border);
  border-radius: 8px;
  background: var(--green-tint);
}

.award-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.award-title strong {
  color: var(--green-dark);
  font-size: 16px;
}

.award-title span {
  flex: 0 0 auto;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.award-row p,
.award-row li {
  color: var(--muted);
  font-size: 13px;
}

.award-move {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 800;
}

.award-row ul {
  margin: 0;
  padding-left: 18px;
}

.style-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.style-row:last-child {
  border-bottom: 1px solid var(--line);
}

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

.style-row-header div:first-child {
  display: grid;
  gap: 3px;
}

.style-row-header strong {
  font-size: 16px;
}

.style-row-header span,
.style-quality span,
.style-row li {
  color: var(--muted);
  font-size: 13px;
}

.style-quality {
  display: grid;
  gap: 2px;
  min-width: 86px;
  text-align: right;
}

.style-quality strong {
  color: var(--ink);
}

.style-quality.good strong {
  color: var(--green-dark);
}

.style-quality.mid strong {
  color: var(--amber);
}

.style-quality.low strong {
  color: var(--red);
}

.style-row-white {
  border-color: #bfc5c1;
  color: #111;
  background: #dfe3e0;
}

.style-row-white .style-row-header span,
.style-row-white .style-quality span,
.style-row-white .style-row li,
.style-row-white .facet-label,
.style-row-white .facet-main em,
.style-row-white .facet-reasons li {
  color: #1f2933;
}

.style-row-white .style-quality strong,
.style-row-white .style-row-header strong {
  color: #111;
}

.style-row-white .facet-more {
  border-color: #b6bdb9;
  color: #111;
  background: #eef0ee;
}

.style-row-black {
  border-color: #303633;
  color: #fff;
  background: #262b28;
}

.style-row-black .style-row-header span,
.style-row-black .style-quality span,
.style-row-black .style-row li,
.style-row-black .facet-label,
.style-row-black .facet-main em,
.style-row-black .facet-reasons li {
  color: #f2f5ee;
}

.style-row-black .style-quality strong,
.style-row-black .style-row-header strong {
  color: #fff;
}

.style-row-black .facet-more {
  border-color: #4a524e;
  color: #fff;
  background: #333936;
}

.style-bars {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 8px 14px;
}

.facet-list {
  display: grid;
  /* auto-fit rather than a fixed repeat(3, ...): .facet-main below needs ~230px minimum
     to render its label/meter/value without overlapping (112-132px label + 80px+ meter +
     32px value + gaps), which a hardcoded 3-up layout can't guarantee once this panel's
     container gets narrower than ~700px -- as it now permanently is, sharing the report
     deck with the persistent board column. auto-fit reduces the column *count* instead of
     squeezing column *width* below what the content needs. */
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px 14px;
}

.facet-row {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.facet-row summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0;
  cursor: pointer;
  list-style: none;
}

.facet-row summary::-webkit-details-marker {
  display: none;
}

.facet-row[open] summary {
  border-bottom: 0;
}

.facet-main {
  display: grid;
  grid-template-columns: minmax(112px, 132px) minmax(80px, 1fr) 32px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.facet-label,
.facet-main em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.facet-main em {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.facet-more {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--green-dark);
  background: var(--surface-2);
  transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.facet-more::before {
  content: ">";
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.facet-row summary:hover .facet-more {
  border-color: var(--green);
  background: var(--surface);
}

.facet-row[open] .facet-more {
  transform: rotate(90deg);
}

.facet-reasons {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--line);
}

.facet-reasons li {
  color: var(--muted);
  font-size: 13px;
}

.facet-efficacy-detail {
  font-weight: 700;
}

.facet-error-trigger {
  justify-self: start;
  width: auto;
  min-height: 30px;
  padding: 0 10px;
  border-color: var(--line);
  color: var(--green-dark);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 750;
}

.facet-error-trigger:hover {
  border-color: var(--green);
  background: var(--surface);
}

.error-review-popup {
  display: grid;
  position: fixed;
  inset: 0;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.error-review-popup[hidden] {
  display: none;
}

.error-review-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.error-review-card {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(100%, 720px);
  max-height: min(100%, 760px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.error-review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.error-review-header strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
}

.error-review-body {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.error-review-board-wrap {
  display: grid;
  justify-items: center;
}

.error-review-board {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin-top: 0;
}

.error-review-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.error-review-arrow-line {
  stroke-width: 0.16;
  stroke-linecap: round;
  opacity: 0.85;
}

.error-review-arrow-line[hidden] {
  display: none;
}

.error-review-arrow-line--best {
  stroke: var(--green);
}

.error-review-arrow-line--played {
  stroke: var(--red);
}

.error-review-arrow-head {
  opacity: 0.85;
}

.error-review-arrow-head--best {
  fill: var(--green);
}

.error-review-arrow-head--played {
  fill: var(--red);
}

.error-review-detail {
  display: grid;
  gap: 8px;
  align-content: start;
}

.error-review-detail strong {
  font-size: 15px;
}

.error-review-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.error-review-nav {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 760px) {
  .error-review-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

.style-bar {
  display: grid;
  grid-template-columns: minmax(112px, 132px) minmax(80px, 1fr) 32px;
  align-items: center;
  gap: 8px;
}

.style-bar span,
.style-bar em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.style-bar em {
  text-align: right;
}

.style-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track);
}

.style-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.style-meter .aggression {
  background: #c55a3a;
}

.style-meter .passivity {
  background: #697386;
}

.style-meter .risk {
  background: #b44336;
}

.style-meter .materialism {
  background: #bd7b16;
}

.style-meter .technical {
  background: #2f6f4f;
}

.style-meter .tactical {
  background: #2d5d7c;
}

.style-row ul {
  margin: 0;
  padding-left: 18px;
}

.tendency-list {
  display: grid;
  gap: 18px;
  margin-top: 14px;
}

.tendency-phase {
  display: grid;
  gap: 0;
}

.tendency-phase-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
}

.tendency-phase-title h4 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.tendency-phase-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.tendency-row {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.tendency-row:last-child {
  border-bottom: 0;
}

.tendency-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tendency-title strong {
  font-size: 16px;
}

.tendency-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tendency-row p,
.tendency-row em,
.tendency-row li {
  color: var(--muted);
  font-size: 13px;
}

.tendency-row em {
  font-style: normal;
  font-weight: 650;
}

.tendency-row ul {
  margin: 0;
  padding-left: 18px;
}

.severity,
.side-badge,
.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.severity::before,
.side-badge::before,
.phase-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.side-badge {
  color: var(--green-dark);
  background: var(--green-tint);
}

.phase-badge {
  color: var(--blue);
  background: var(--blue-tint);
}

.severity.high {
  color: var(--red);
  background: var(--red-tint);
}

.severity.medium {
  color: var(--amber);
  background: var(--amber-tint);
}

.severity.low {
  color: var(--blue);
  background: var(--blue-tint);
}

table {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
  font-size: 13px;
}

.stats-table-wrap {
  width: 100%;
  margin-top: 14px;
  overflow-x: auto;
}

.stats-table {
  min-width: 1040px;
  margin-top: 0;
}

.stats-table th,
.stats-table td {
  white-space: nowrap;
}

.stats-table td {
  font-variant-numeric: tabular-nums;
}

.stats-table td:not(:first-child),
.stats-table th:not(:first-child) {
  text-align: right;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.move-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.move-token {
  width: auto;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.move-token:hover,
.move-token.active {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-tint);
}

.move-token.warn {
  border-color: var(--amber);
  background: var(--amber-tint);
}

.move-token.great {
  border-color: var(--green-tint-border);
  color: var(--green-dark);
  background: var(--green-tint);
}

.move-token.danger {
  border-color: var(--red-tint-border);
  background: var(--red-tint);
}

.welcome-panel {
  min-height: 320px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(47, 111, 79, 0.12), transparent 34%),
    var(--bg);
}

.login-shell,
.dashboard-shell,
.module-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 0;
}

.login-card {
  display: grid;
  gap: 28px;
  width: min(100%, 420px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand p {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-mode-tabs strong {
  font-size: 15px;
  font-variant-numeric: normal;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--bg);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.intro-overlay-done {
  opacity: 0;
}

.intro-canvas {
  position: absolute;
  inset: 0;
}

.intro-label {
  position: relative;
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 750;
  letter-spacing: 0.02em;
  color: var(--ink);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  margin-top: min(28vh, 220px);
}

.intro-label-visible {
  opacity: 1;
  transform: translateY(0);
}

.connect-form {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.snapshot-option {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.snapshot-option input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.snapshot-option strong,
.snapshot-option em {
  display: block;
}

.snapshot-option em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
}

.global-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.global-nav a,
.module-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.global-nav a:hover,
.global-nav a.active,
.module-link:hover {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-tint);
}

.dashboard-shell {
  display: grid;
  gap: 18px;
  padding: 24px 0 34px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 24px;
  align-items: end;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dashboard-hero h2 {
  margin-top: 4px;
  font-size: 28px;
}

.dashboard-onboarding,
.analysis-payoff-banner,
.trend-lock-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--green-tint-border);
  border-radius: 8px;
  background: var(--green-tint);
}

.dashboard-onboarding {
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.9fr) auto;
  align-items: center;
}

.dashboard-onboarding h2,
.analysis-payoff-banner h3,
.trend-lock-card h4 {
  text-transform: none;
}

.dashboard-onboarding p,
.dashboard-onboarding ol,
.analysis-payoff-banner p,
.trend-lock-card p {
  color: var(--muted);
}

.dashboard-onboarding ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  font-weight: 650;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.summary-strip div,
.profile-metrics div,
.rating-row div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.summary-strip span,
.profile-metrics span,
.rating-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.summary-strip strong,
.profile-metrics strong,
.rating-row strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.rating-row em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
}

.profile-metrics em,
.comparison-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
}

/* Percentile-band great/good/mid/low cue for each facet card -- same color language as
   .style-quality.good/mid/low on the per-game dashboard (green/amber/red), banded
   around the 50th percentile since these values are percentiles vs. reference peers,
   not raw 0-100 quality scores. "great" is a distinct, more saturated green from
   "good" so a top-tier facet stands out from a merely above-average one. */
.profile-metric-great {
  border-left: 3px solid var(--green-strong);
}

.profile-metric-great strong {
  color: var(--green-strong);
}

.profile-metric-good {
  border-left: 3px solid var(--green-dark);
}

.profile-metric-good strong {
  color: var(--green-dark);
}

.profile-metric-mid {
  border-left: 3px solid var(--amber);
}

.profile-metric-mid strong {
  color: var(--amber);
}

.profile-metric-low {
  border-left: 3px solid var(--red);
}

.profile-metric-low strong {
  color: var(--red);
}

.comparison-note {
  margin-top: -4px;
}

.profile-callout {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--green-tint-border);
  border-radius: 8px;
  background: var(--green-tint);
}

.profile-callout span {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-callout strong {
  color: var(--green-dark);
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.profile-callout p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.profile-phase-sections {
  display: grid;
  gap: 14px;
}

.phase-profile-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.phase-profile-section .profile-metrics div {
  background: var(--surface);
}

.dashboard-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.learn-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 360px));
  gap: 18px;
}

.feature-card {
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto;
  gap: 18px;
  min-height: 260px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--green);
}

.feature-card.primary {
  border-color: var(--green-tint-border);
  background: var(--green-tint);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--surface);
}

.feature-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature-card h3 {
  font-size: 17px;
  text-transform: none;
}

.feature-card p {
  margin-top: 8px;
  color: var(--muted);
}

.feature-card > strong {
  justify-self: start;
  color: var(--green-dark);
  font-size: 13px;
  text-transform: uppercase;
}

.dashboard-recent {
  max-width: 760px;
}

.connect-panel {
  max-width: 760px;
}

.friend-panel {
  max-width: 760px;
}

.connect-inline-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 92px minmax(180px, 1fr) 120px;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.friend-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.friend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.friend-row strong,
.friend-row span {
  display: block;
}

.friend-row span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.friend-actions,
.profile-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.friend-actions form,
.profile-actions form {
  margin: 0;
}

.friend-actions .module-link,
.profile-actions .module-link {
  min-width: 92px;
}

.friend-actions button,
.profile-actions button {
  min-width: 132px;
}

.module-link.compact {
  min-height: 40px;
  padding: 8px 10px;
}

.danger-button {
  border-color: var(--red-tint-border);
  color: var(--red);
  background: var(--red-tint);
}

.danger-button:hover {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
}

.recent-game-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.recent-game-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-2);
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.recent-game-list a:hover {
  border-color: var(--green);
  background: var(--green-tint);
}

.recent-game-list span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.module-shell {
  display: grid;
  gap: 18px;
  padding: 24px 0 34px;
}

.slide-placeholder,
.profile-panel {
  display: grid;
  gap: 18px;
  min-height: 520px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.slide-placeholder {
  align-content: center;
  justify-items: center;
  text-align: center;
}

.slide-placeholder h2 {
  font-size: 30px;
}

.slide-board {
  display: grid;
  grid-template-columns: repeat(4, 42px);
  grid-template-rows: repeat(4, 42px);
  overflow: hidden;
  border: 2px solid var(--board-frame);
  border-radius: 8px;
}

.slide-board span:nth-child(8n + 1),
.slide-board span:nth-child(8n + 3),
.slide-board span:nth-child(8n + 6),
.slide-board span:nth-child(8n + 8) {
  background: var(--board-light);
}

.slide-board span:nth-child(8n + 2),
.slide-board span:nth-child(8n + 4),
.slide-board span:nth-child(8n + 5),
.slide-board span:nth-child(8n + 7) {
  background: var(--board-dark);
}

.profile-panel {
  align-content: start;
}

.profile-title-row {
  align-items: flex-start;
}

.rating-card,
.comparison-card,
.profile-refresh-card,
.profile-chart-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.profile-update-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-chart-section {
  background: var(--surface-2);
}

.player-report {
  display: grid;
  gap: 14px;
}

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

.player-report-section,
.top-weakness-card,
.weakness-pattern-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.player-report-section {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.player-report-table-wrap {
  overflow-x: auto;
}

.player-report-table {
  min-width: 520px;
}

.player-report-table th,
.player-report-table td {
  white-space: nowrap;
}

.player-report-tendencies {
  gap: 0;
}

.top-weakness-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-color: var(--green-tint-border);
  background: var(--green-tint);
}

.top-weakness-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-weakness-card span,
.weakness-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.top-weakness-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.weakness-principle-summary {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.weakness-principle-why {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.weakness-checklist {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 13px;
}

.weakness-evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.weakness-evidence span {
  text-transform: none;
}

.weakness-trend {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.weakness-trend-improving {
  color: var(--green-dark);
}

.weakness-trend-worsening {
  color: var(--red);
}

.top-weakness-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-weakness-actions form {
  width: auto;
}

.top-weakness-actions button {
  width: auto;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.top-weakness-training-note {
  color: var(--green-dark);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.focus-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--green-tint-border);
  border-radius: 8px;
  background: var(--green-tint);
}

.focus-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.focus-card-header span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.focus-card-header strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.focus-card-header em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.focus-goal {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.focus-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.focus-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.focus-metrics strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  text-transform: capitalize;
}

.focus-trend-improving {
  color: var(--green-dark);
}

.focus-trend-worsening {
  color: var(--red);
}

.focus-progress {
  display: grid;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--green-tint-border);
}

.focus-progress p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.weakness-list {
  display: grid;
  gap: 8px;
}

.weakness-pattern-card {
  overflow: visible;
}

.weakness-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 8px 8px 0 0;
  color: var(--ink);
  font: inherit;
  text-align: left;
  background: transparent;
}

.weakness-row > div:last-child {
  text-align: right;
}

.weakness-review-button {
  width: auto;
  min-height: 30px;
  margin: 0 12px 12px;
  padding: 0 10px;
  font-size: 12px;
}

.trend-lock-card {
  background: var(--surface);
}

.locked-trend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.locked-trend-grid div {
  min-height: 78px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.locked-trend-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.locked-trend-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 22px;
}

.profile-toggle-card {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}

.profile-toggle-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  list-style: none;
}

.profile-toggle-card summary::-webkit-details-marker {
  display: none;
}

.profile-toggle-card summary::after {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  content: "+";
  font-size: 18px;
  line-height: 1;
}

.profile-toggle-card[open] summary {
  border-bottom: 1px solid var(--line);
}

.profile-toggle-card[open] summary::after {
  content: "-";
}

.profile-toggle-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.profile-toggle-body > .comparison-card,
.profile-toggle-body > .profile-chart-section {
  padding: 0;
  border: 0;
  background: transparent;
}

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

.plan-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.plan-card.active {
  border-color: var(--green);
  background: var(--green-tint);
}

.plan-card > strong {
  font-size: 22px;
}

.plan-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.chart-controls select {
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  text-transform: none;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

.progress-chart-wrap {
  position: relative;
}

.progress-chart {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
}

.progress-chart .chart-gridline {
  stroke: var(--line);
  stroke-width: 1;
}

.progress-chart .chart-axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.progress-chart .chart-line {
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.progress-chart .chart-point {
  fill: var(--green);
  stroke: var(--surface-2);
  stroke-width: 1.5;
}

.progress-chart .chart-point:hover,
.progress-chart .chart-point:focus {
  fill: var(--green-dark);
}

.progress-chart-tooltip {
  position: absolute;
  z-index: 1;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -100%);
  box-shadow: var(--shadow);
}

.milestone-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--green-tint-border);
  border-radius: 8px;
  background: var(--green-tint);
}

.milestone-banner p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.milestone-banner-seen {
  background: var(--surface-2);
  border-color: var(--line);
}

.milestone-rating-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.milestone-rating-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.milestone-rating-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.milestone-rating-card strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

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

.milestone-headline-column h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.milestone-metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.milestone-metric-row:first-of-type {
  border-top: none;
}

.milestone-metric-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.milestone-metric-row strong {
  font-variant-numeric: tabular-nums;
}

.milestone-all-metrics {
  margin-top: 10px;
}

.milestone-all-metrics-body {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.rating-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.rating-refresh-form,
.comparison-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px;
  gap: 12px;
  align-items: end;
}

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

.profile-accuracy-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.friend-games-panel {
  box-shadow: none;
}

.puzzle-panel {
  display: grid;
  gap: 18px;
}

.puzzle-trainer {
  display: grid;
  gap: 16px;
}

.puzzle-trainer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.puzzle-trainer-top div {
  display: grid;
  gap: 2px;
}

.puzzle-trainer-top span,
.puzzle-scoreline span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.puzzle-trainer-top strong {
  font-size: 22px;
}

.puzzle-restart {
  width: auto;
  min-width: 112px;
}

.puzzle-trainer-layout {
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(260px, 1fr);
  gap: 18px;
  align-items: start;
}

.puzzle-board-wrap {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.puzzle-trainer-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.puzzle-card-header,
.puzzle-source {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.puzzle-card-header span,
.puzzle-source,
.puzzle-solution span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.puzzle-card-header span,
.puzzle-solution span {
  text-transform: uppercase;
}

.puzzle-card-header strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
}

.puzzle-card-header em {
  flex: 0 0 auto;
  color: var(--green-dark);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.puzzle-board {
  width: min(100%, 460px);
  margin-top: 0;
}

.puzzle-board .square {
  cursor: pointer;
}

.puzzle-board .square.selected {
  box-shadow: inset 0 0 0 4px var(--amber);
}

.puzzle-board .square.correct {
  box-shadow: inset 0 0 0 4px var(--green);
}

.puzzle-board .square.wrong {
  box-shadow: inset 0 0 0 4px var(--red);
}

.puzzle-board .square.hint-source {
  outline: 4px solid var(--blue);
  outline-offset: -6px;
}

.puzzle-hint-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.puzzle-hint-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.puzzle-hint-top span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.puzzle-difficulty-control {
  display: inline-grid;
  grid-template-columns: 32px auto 32px;
  align-items: center;
  gap: 8px;
}

.puzzle-difficulty-arrow {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface-2);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.puzzle-difficulty-arrow:hover {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-tint);
}

.puzzle-difficulty-arrow:disabled,
.puzzle-difficulty-arrow:disabled:hover {
  color: var(--muted);
  background: var(--track);
  opacity: 0.52;
}

.puzzle-difficulty-track {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 52px;
}

.puzzle-difficulty-track span {
  width: 10px;
  height: 10px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--track);
}

.puzzle-difficulty-track span.active {
  border-color: var(--blue);
  background: var(--blue);
}

.puzzle-difficulty-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.puzzle-prompt {
  color: var(--muted);
  font-weight: 750;
}

.puzzle-source {
  flex-wrap: wrap;
}

.puzzle-scoreline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.puzzle-scoreline strong {
  font-size: 26px;
  line-height: 1;
}

.puzzle-feedback {
  width: min(100%, 460px);
  min-height: 42px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 750;
}

.puzzle-feedback.is-correct,
.puzzle-feedback.is-done {
  border-color: var(--green-tint-border);
  color: var(--green-dark);
  background: var(--green-tint);
}

.puzzle-feedback.is-wrong {
  border-color: var(--red-tint-border);
  color: var(--red);
  background: var(--red-tint);
}

.puzzle-solution {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--green-tint-border);
  border-radius: 8px;
  background: var(--green-tint);
}

.puzzle-solution[hidden] {
  display: none;
}

.puzzle-solution strong {
  font-size: 20px;
}

.puzzle-solution em,
.puzzle-solution small {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

@media (max-width: 980px) {
  .workspace,
  .tables-grid,
  .metrics-grid,
    .dashboard-hero,
    .dashboard-onboarding,
    .analysis-payoff-banner,
    .dashboard-options,
    .puzzle-trainer-layout,
    .puzzle-facet-groups,
    .analysis-board-layout,
    .player-report-grid,
    .profile-metrics,
    .profile-update-metrics,
    .rating-row,
    .locked-trend-grid,
  .plan-grid,
  .milestone-rating-grid,
  .milestone-headline-columns,
  .report-deck-body {
    grid-template-columns: 1fr;
  }

  .report-board-column {
    position: static;
  }

  /* .workspace stacks to a single column here, so the sidebar no longer shares a row
     with .main-panel -- sticky + internal scroll would just trap it at the top of the
     page above content the user can't otherwise reach. Let it flow normally instead. */
  .sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  .analysis-form {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .connect-inline-form {
    grid-template-columns: 1fr;
  }

  .rating-refresh-form,
  .comparison-form {
    grid-template-columns: 1fr;
  }

  .game-header {
    display: grid;
  }

  .report-tabs {
    grid-template-columns: repeat(7, minmax(112px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }
}

@media (max-width: 640px) {
  .topbar,
  .workspace,
  .messages {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar,
  .panel-title-row,
  .section-heading,
  .tendency-title,
  .style-row-header,
  .friend-row,
  .recent-game-list a {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .friend-actions,
  .profile-actions,
  .global-nav {
    justify-items: start;
    justify-content: flex-start;
  }

  .login-shell,
  .dashboard-shell,
  .module-shell {
    width: min(100% - 32px, 1120px);
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .friend-row {
    grid-template-columns: 1fr;
  }

  .top-weakness-card,
  .weakness-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .weakness-row > div:last-child {
    text-align: left;
  }

  .accuracy-main strong,
  .accuracy-details dd,
  .style-quality {
    min-width: 0;
    text-align: left;
  }

  .accuracy-main {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .accuracy-details {
    grid-template-columns: 1fr;
  }

  .style-bars {
    grid-template-columns: 1fr;
  }

  .facet-list {
    grid-template-columns: 1fr;
  }

  .facet-main {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .facet-main em {
    text-align: left;
  }

  .report-deck-header,
  .report-slide-heading,
  .report-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-nav,
  .report-nav-button {
    width: 100%;
  }

  .report-slide-meta {
    justify-content: flex-start;
  }
}
