/* ═══════════════════════════════════════════════════════
   Design tokens
   ═══════════════════════════════════════════════════════ */
:root {
  color-scheme: light;
  --bg:          #f4f6f8;
  --text:        #18212f;
  --muted:       #667085;
  --panel:       #ffffff;
  --line:        #d7dde5;
  --accent:      #1f7a5c;
  --accent-dark: #145c45;
  --light-sq:    #d6d9df;
  --dark-sq:     #6d7f91;
  --selected:    #f5c542;
  --target:      #2d9cdb;
  --nav-bg:      #18212f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }

h1, h2, p { margin: 0; }

h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 16px; margin-bottom: 12px; }

.muted { color: var(--muted); }

/* ═══════════════════════════════════════════════════════
   Global navigation bar
   ═══════════════════════════════════════════════════════ */
.main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--nav-bg);
  padding: 0 20px;
  height: 52px;
}

.nav-brand {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  text-decoration: none;
  margin-right: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 2px;
  flex: 1;
}

.nav-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 14px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  gap: 1px;
  transition: background 0.1s, color 0.1s;
}

.nav-link:hover {
  background: rgba(255,255,255,0.10);
  color: #fff;
}

.nav-link--active {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

.nav-subtitle {
  font-size: 10px;
  font-weight: 400;
  color: rgba(255,255,255,0.45);
}

.nav-link--active .nav-subtitle { color: rgba(255,255,255,0.70); }
.nav-link:hover     .nav-subtitle { color: rgba(255,255,255,0.60); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-size: 13px;
  color: rgba(255,255,255,0.80);
}

.nav-username { font-weight: 600; }

.nav-rating {
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.nav-change-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.85);
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.nav-change-btn:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════
   Page shell
   ═══════════════════════════════════════════════════════ */
.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

/* ═══════════════════════════════════════════════════════
   Page topbar (per-page heading + 1-2 actions)
   ═══════════════════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar > div:first-child { flex: 1; }

/* ═══════════════════════════════════════════════════════
   Notices
   ═══════════════════════════════════════════════════════ */
.notice {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.notice.error { border-color: #e38282; color: #8a1f1f; }

.wip-notice {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #78350f;
}

/* ═══════════════════════════════════════════════════════
   Buttons & links
   ═══════════════════════════════════════════════════════ */
button, .link-button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

.secondary-button { background: #334155; }
.secondary-button:hover { background: #1f2937; }
button:hover, .link-button:hover { background: var(--accent-dark); }
button:disabled, input:disabled { cursor: not-allowed; opacity: 0.6; }

/* ═══════════════════════════════════════════════════════
   Forms
   ═══════════════════════════════════════════════════════ */
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 0; }
legend   { padding: 0 4px; color: var(--muted); font-size: 13px; }

.segmented-field       { display: flex; gap: 16px; align-items: center; }
.segmented-field label { display: inline-flex; gap: 6px; align-items: center; }
.conditional-field     { display: grid; gap: 10px; }
.conditional-field[hidden] { display: none; }
.compact, .new-game-form   { display: grid; gap: 10px; margin-top: 12px; }

.panel-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.user-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.user-picker-form { margin: 0; }

.user-picker-card {
  width: 100%;
  min-height: 72px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 14px 16px;
  background: #f8fafc;
  color: var(--text);
  border: 1px solid var(--line);
  text-align: left;
}

.user-picker-card:hover {
  background: #eef2ff;
  border-color: var(--accent);
  color: var(--text);
}

.user-picker-name {
  font-size: 16px;
  font-weight: 600;
}

.user-picker-rating {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

input, select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}
input { flex: 1; }

/* ═══════════════════════════════════════════════════════
   Panels
   ═══════════════════════════════════════════════════════ */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

/* ═══════════════════════════════════════════════════════
   Dashboard
   ═══════════════════════════════════════════════════════ */
.dash-header { margin-bottom: 20px; }

.dash-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 22px;
  text-align: center;
  min-width: 110px;
}

.stat-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.focus-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.focus-card--active { border-left: 4px solid var(--accent); }

.focus-card--wip { border-left: 4px solid #fbbf24; }

.focus-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.focus-card-title { font-size: 18px; font-weight: 700; margin: 0; }

.focus-card-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.focus-card-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.wip-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 11px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  border-radius: 20px;
  padding: 2px 9px;
}

/* ═══════════════════════════════════════════════════════
   Focus B / C — WIP pages
   ═══════════════════════════════════════════════════════ */
.wip-page { display: grid; gap: 28px; }

.wip-section h2 { font-size: 18px; margin-bottom: 16px; }

.wip-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.wip-feature {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 6px;
}

.wip-feature-icon {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.wip-feature h3 { font-size: 14px; font-weight: 700; margin: 0; }

.wip-feature p { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; }

.wip-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 16px 16px 32px;
  margin: 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
  line-height: 1.5;
}

/* Focus B — post-game review */
.fb-archive, .fb-empty-review { display: grid; gap: 16px; }
.fb-section-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.fb-section-heading h2 { margin-bottom: 4px; }
.fb-game-list { display: grid; gap: 8px; }
.fb-game-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: inherit; text-decoration: none;
}
.fb-game-row:hover { border-color: var(--accent); background: #f8fafc; }
.fb-game-row small { display: block; margin-top: 3px; color: var(--muted); }
.fb-game-number { color: var(--muted); font-weight: 700; }
.fb-status { padding: 4px 9px; border-radius: 999px; background: #eef2f6; color: #475569; font-size: 12px; font-weight: 700; text-transform: capitalize; }
.fb-status--complete { background: #dcfce7; color: #166534; }
.fb-status--failed { background: #fee2e2; color: #991b1b; }
.fb-status--running { background: #fef3c7; color: #92400e; }
.fb-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.fb-summary-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.fb-summary-card { min-width: 0; }
.fb-summary-card p { line-height: 1.55; }
.fb-count-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.fb-count-grid span { display: flex; justify-content: space-between; gap: 6px; padding: 7px 8px; border-radius: 6px; background: #f8fafc; color: var(--muted); font-size: 12px; text-transform: capitalize; }
.fb-count-grid strong { color: var(--text); }
.fb-count-grid--phases { grid-template-columns: 1fr; }
.fb-theme-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.fb-theme-list span { padding: 3px 8px; border-radius: 999px; background: #e8f3ef; color: var(--accent-dark); font-size: 11px; font-weight: 700; }
.fb-chart-panel { margin-bottom: 14px; }
.fb-chart { min-height: 150px; margin-top: 8px; }
.fb-chart svg { display: block; width: 100%; height: 180px; overflow: visible; }
.fb-chart-midline { stroke: #cbd5e1; stroke-width: 1; stroke-dasharray: 5 5; }
.fb-chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }
.fb-chart-point { fill: #fff; stroke: var(--accent); stroke-width: 3; cursor: pointer; }
.fb-chart-point.is-turning { fill: #ef4444; stroke: #991b1b; }
.fb-chart-label { fill: var(--muted); font-size: 10px; }
.fb-review-layout { display: grid; grid-template-columns: minmax(380px, 1.25fr) minmax(210px, .7fr) minmax(260px, .9fr); gap: 14px; align-items: start; }
.fb-board-column { display: grid; gap: 10px; justify-items: center; min-width: 0; }
.fb-board-column .focus-a-board-card { width: min(100%, 620px); }
.fb-board { display: grid; grid-template-columns: repeat(8, 1fr); width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 10px; }
.fb-board .square { position: relative; display: grid; place-items: center; aspect-ratio: 1; }
.fb-board .square.light { background: #e8ece9; }
.fb-board .square.dark { background: #7c927b; }
.fb-board .piece { position: relative; z-index: 1; font-size: clamp(28px, 5vw, 58px); line-height: 1; user-select: none; }
.fb-board .white-piece { color: #fbfdff; text-shadow: 0 1px 2px #0f172a, 0 0 1px #0f172a; }
.fb-board .black-piece { color: #111827; text-shadow: 0 1px 1px rgba(255,255,255,.55); }
.fb-board .coord { position: absolute; z-index: 2; font-size: 9px; font-weight: 700; color: rgba(255,255,255,.65); }
.fb-board .light .coord { color: rgba(24,33,47,.48); }
.fb-board .coord.file { left: 5px; bottom: 3px; }
.fb-board .coord.rank { right: 5px; top: 3px; }
.fb-board-controls { display: grid; grid-template-columns: auto minmax(100px, 1fr) auto; align-items: center; gap: 8px; width: min(100%, 620px); text-align: center; }
.fb-move-timeline, .fb-move-detail { min-width: 0; }
.fb-move-list { display: grid; gap: 5px; max-height: 610px; overflow: auto; }
.fb-move-button { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; gap: 6px; align-items: center; width: 100%; min-height: 34px; padding: 5px 7px; background: #f8fafc; color: var(--text); text-align: left; }
.fb-move-button:hover, .fb-move-button.is-selected { background: #dbeae5; }
.fb-move-button > span { color: var(--muted); font-size: 11px; }
.fb-move-button > b { color: #dc2626; }
.fb-classification { display: inline-flex; padding: 2px 6px; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: 10px; font-style: normal; font-weight: 700; text-transform: capitalize; }
.fb-classification--best, .fb-classification--excellent { background: #dcfce7; color: #166534; }
.fb-classification--good { background: #dbeafe; color: #1e40af; }
.fb-classification--inaccuracy { background: #fef3c7; color: #92400e; }
.fb-classification--mistake, .fb-classification--blunder { background: #fee2e2; color: #991b1b; }
.fb-detail-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fb-turning-label { margin: 8px 0; color: #b91c1c; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.fb-detail-stats { display: grid; gap: 0; margin: 10px 0 0; }
.fb-detail-stats div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); }
.fb-detail-stats dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.fb-detail-stats dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; }
.fb-commentary { margin-top: 12px; padding: 10px; border-left: 3px solid var(--accent); background: #f0f7f4; line-height: 1.5; }
.fb-move-detail h3 { margin: 16px 0 8px; font-size: 13px; }
.fb-candidate-list { display: grid; gap: 8px; margin: 0; padding-left: 20px; }
.fb-candidate-list li { font-size: 12px; }
.fb-candidate-list div { display: flex; justify-content: space-between; gap: 6px; }
.fb-candidate-list small, .fb-candidate-list code { display: block; margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 1050px) {
  .fb-summary-grid { grid-template-columns: 1fr 1fr; }
  .fb-summary-card--wide { grid-column: 1 / -1; }
  .fb-review-layout { grid-template-columns: minmax(360px, 1.2fr) minmax(230px, .8fr); }
  .fb-move-detail { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .fb-summary-grid, .fb-review-layout { grid-template-columns: 1fr; }
  .fb-summary-card--wide, .fb-move-detail { grid-column: auto; }
  .fb-game-row { grid-template-columns: auto 1fr; }
  .fb-game-row .fb-status { grid-column: 2; justify-self: start; }
}

/* ═══════════════════════════════════════════════════════
   Focus A — Game layout and board
   ═══════════════════════════════════════════════════════ */
.focus-a-game-layout {
  display: grid;
  grid-template-columns: minmax(230px, 260px) minmax(420px, 1fr) minmax(250px, 280px);
  gap: 18px;
  align-items: start;
  justify-content: center;
}

.focus-a-left-column,
.focus-a-board-column,
.focus-a-right-column {
  min-width: 0;
}

.focus-a-left-column,
.focus-a-right-column {
  display: grid;
  gap: 14px;
}

.focus-a-left-column .panel,
.focus-a-right-column .panel {
  box-shadow: 0 1px 2px rgba(24, 33, 47, 0.04);
}

.focus-a-board-column {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.focus-a-board-status {
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 11px 13px;
  background: #ffffff;
  border: 1px solid rgba(215, 221, 229, 0.95);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(24, 33, 47, 0.06), 0 1px 2px rgba(24, 33, 47, 0.04);
}

.focus-a-status-main,
.focus-a-status-result {
  min-width: 0;
}

.focus-a-status-main {
  display: grid;
  gap: 2px;
}

.focus-a-status-main strong {
  font-size: 16px;
  line-height: 1.25;
}

.focus-a-status-result {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: #334155;
}

.focus-a-status-result strong {
  font-size: 14px;
}

.focus-a-status-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.focus-a-status-pill {
  justify-self: end;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(31, 122, 92, 0.10);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.focus-a-status-pill--finished {
  background: #fef3c7;
  color: #92400e;
}

.focus-a-board-card {
  width: min(100%, 620px);
  padding: clamp(8px, 1.2vw, 14px);
  background: #ffffff;
  border: 1px solid rgba(215, 221, 229, 0.95);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(24, 33, 47, 0.08), 0 1px 2px rgba(24, 33, 47, 0.06);
}

.focus-a-game-layout .board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(82, 96, 112, 0.22);
  border-radius: 10px;
  background: #eef2f4;
}

.focus-a-game-layout .square {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border: 0;
  padding: 0;
  cursor: pointer;
  aspect-ratio: 1;
  transition: box-shadow 0.12s ease, filter 0.12s ease;
}

.focus-a-game-layout .square.light {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.28), rgba(255,255,255,0)),
    #e8ece9;
}

.focus-a-game-layout .square.dark {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.12), rgba(0,0,0,0.04)),
    #7c927b;
}

.focus-a-game-layout .square:hover {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.focus-a-game-layout .square.selected {
  outline: 0;
  box-shadow:
    inset 0 0 0 3px rgba(31, 122, 92, 0.82),
    inset 0 0 0 999px rgba(31, 122, 92, 0.10);
}

.focus-a-game-layout .square.target {
  box-shadow: inset 0 0 0 3px rgba(31, 122, 92, 0.34);
}

.focus-a-game-layout .square.target::after {
  content: "";
  position: absolute;
  z-index: 0;
  width: 27%;
  aspect-ratio: 1;
  border: 2px solid rgba(20, 92, 69, 0.66);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
  box-shadow: 0 1px 3px rgba(24, 33, 47, 0.16);
}

.focus-a-game-layout .piece {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(30px, 5vw, 60px);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  transform: translateY(-1px);
}

.focus-a-game-layout .white-piece {
  color: #fbfdff;
  text-shadow:
    0 1px 2px rgba(15, 23, 42, 0.58),
    0 0 1px rgba(15, 23, 42, 0.84);
}

.focus-a-game-layout .black-piece {
  color: #111827;
  text-shadow:
    0 1px 1px rgba(255, 255, 255, 0.55),
    0 0 1px rgba(255, 255, 255, 0.55);
}

.focus-a-game-layout .coord {
  position: absolute;
  z-index: 2;
  font-size: 10px;
  font-weight: 700;
  color: rgba(248, 250, 252, 0.58);
  pointer-events: none;
}

.focus-a-game-layout .light .coord { color: rgba(24, 33, 47, 0.48); }
.focus-a-game-layout .coord.file   { left: 6px; bottom: 4px; }
.focus-a-game-layout .coord.rank   { right: 6px; top: 4px; }

/* ═══════════════════════════════════════════════════════
   Focus A — Side panels
   ═══════════════════════════════════════════════════════ */
.focus-a-game-panel {
  display: grid;
  gap: 12px;
}

.focus-a-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.focus-a-panel-heading h2 {
  margin: 0;
}

.focus-a-game-id {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.focus-a-game-meta {
  display: grid;
  gap: 0;
  margin: 0;
}

.focus-a-game-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid rgba(215, 221, 229, 0.72);
}

.focus-a-game-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.focus-a-game-row:last-child {
  padding-bottom: 0;
}

.focus-a-game-row dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.focus-a-game-row dd {
  margin: 0;
  min-width: 0;
  color: #273244;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.focus-a-inline-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid rgba(215, 221, 229, 0.9);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.meta {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 6px 10px;
  margin: 0 0 12px;
}

.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

.moves {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding-left: 22px;
}

.moves li  { line-height: 1.6; }
.ply, .uci, .actor { color: var(--muted); font-size: 13px; }
.san { font-weight: 700; margin: 0 6px; }

.games     { display: grid; gap: 8px; }

.game-link {
  width: 100%;
  justify-content: flex-start;
  background: #334155;
}

/* ═══════════════════════════════════════════════════════
   Focus A — Commentary panel
   ═══════════════════════════════════════════════════════ */
.focus-a-panel {
  align-self: start;
}

.focus-a-panel h2 {
  margin-bottom: 10px;
}

.focus-a-actions {
  display: grid;
  gap: 8px;
}

.focus-a-actions button {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(51, 65, 85, 0.16);
  background: #334155;
  line-height: 1.25;
}

.focus-a-actions button:hover {
  background: #243244;
}

.focus-a-output {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(215, 221, 229, 0.8);
  font-size: 14px;
}

.focus-a-summary {
  display: grid;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.focus-a-summary div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(215, 221, 229, 0.9);
  border-radius: 7px;
  background: #f8fafc;
}

.focus-a-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.focus-a-summary strong {
  font-size: 15px;
}

.focus-a-commentary {
  line-height: 1.55;
  color: #273244;
}

.focus-a-candidates {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: focus-a-candidate;
}

.focus-a-candidates li {
  position: relative;
  display: grid;
  gap: 3px;
  padding: 10px 12px 10px 40px;
  border: 1px solid rgba(215, 221, 229, 0.9);
  border-radius: 7px;
  background: #ffffff;
  line-height: 1.4;
  counter-increment: focus-a-candidate;
}

.focus-a-candidates li::before {
  content: counter(focus-a-candidate);
  position: absolute;
  top: 10px;
  left: 12px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(31, 122, 92, 0.10);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.focus-a-candidates strong {
  font-size: 15px;
}

.focus-a-candidates .uci {
  font-size: 12px;
  color: var(--muted);
}

.focus-a-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #f0b4b4;
  border-radius: 7px;
  background: #fff7f7;
  color: #8a1f1f;
  line-height: 1.45;
}

@media (min-width: 981px) {
  .focus-a-panel {
    position: sticky;
    top: 72px;
  }

  .focus-a-output {
    max-height: calc(100vh - 235px);
    overflow: auto;
    padding-right: 2px;
  }
}

/* ═══════════════════════════════════════════════════════
   Focus D — Repertoire Advisor
   ═══════════════════════════════════════════════════════ */

/* Section wrapper */
.fd-section { margin-bottom: 32px; }

.fd-section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.fd-section-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

/* ── Playstyle card ─────────────────────────────────── */
.fd-playstyle-card {
  display: flex;
  gap: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 10px;
  padding: 16px 20px;
  flex-wrap: wrap;
}

.fd-playstyle--sharp    { border-left-color: #f59e0b; }
.fd-playstyle--solid    { border-left-color: var(--accent); }
.fd-playstyle--balanced { border-left-color: #3b82f6; }

.fd-ps-left {
  flex: 1;
  min-width: 180px;
  display: grid;
  gap: 6px;
}

.fd-ps-label {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.fd-ps-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 480px;
}

.fd-ps-right {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 200px;
}

.fd-ps-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.fd-ps-stat-label {
  color: var(--muted);
  width: 72px;
  flex-shrink: 0;
}

.fd-ps-eco {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  font-family: "Courier New", ui-monospace, monospace;
}

/* ── Your Openings grid ─────────────────────────────── */
.fd-played-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.fd-played-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
}

.fd-played--white { border-left-color: #d6d9df; }
.fd-played--black { border-left-color: #6d7f91; }

.fd-played-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

/* W/D/L record row */
.fd-wdl-record {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}

.fd-wdl-win  { color: #16a34a; }
.fd-wdl-draw { color: var(--muted); }
.fd-wdl-loss { color: #dc2626; }
.fd-wdl-sep  { color: var(--line); }
.fd-wdl-total { font-weight: 400; font-size: 12px; margin-left: 4px; }

/* ── Info bar (recommendations sub-header) ──────────── */
.fd-info-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}

.fd-info-note { color: var(--muted); }

.fd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.fd-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.fd-card--white { border-left-color: #d6d9df; }
.fd-card--black { border-left-color: #6d7f91; }

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

.fd-card-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.fd-eco {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

.fd-name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.fd-score { font-size: 20px; font-weight: 700; color: var(--accent); white-space: nowrap; flex-shrink: 0; }

.fd-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.fd-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.fd-badge--white    { background: #e8eaed; color: #374151; }
.fd-badge--black    { background: #4b5563; color: #f9fafb; }
.fd-badge--solid    { background: #d1fae5; color: #065f46; }
.fd-badge--balanced { background: #dbeafe; color: #1e40af; }
.fd-badge--sharp    { background: #fef3c7; color: #92400e; }
.fd-badge--family   { background: #f3f4f6; color: #6b7280; border: 1px dashed #d1d5db; }

.fd-uci {
  font-size: 12px;
  font-family: "Courier New", ui-monospace, monospace;
  word-break: break-all;
}

.fd-reasons {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.fd-reasons li { line-height: 1.4; }

.fd-signals { display: grid; gap: 5px; }

.fd-signal {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.fd-signal-label { color: var(--muted); white-space: nowrap; }
.fd-signal-value { text-align: right; font-weight: 600; font-size: 11px; }

.fd-bar-track {
  height: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.fd-bar { height: 100%; border-radius: 4px; min-width: 2px; }
.fd-bar--gap        { background: #ef4444; }
.fd-bar--freq       { background: var(--accent); }
.fd-bar--complexity { background: #f59e0b; }
.fd-bar--transp     { background: #3b82f6; }

.fd-legend {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0 4px;
}

/* ═══════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════ */
/* Focus C - Personalized Puzzle Trainer */
.fc-section { margin-bottom: 30px; }
.fc-trainer[hidden], .fc-review[hidden], #fc-complete[hidden], #fc-next[hidden] { display: none !important; }
.fc-analysis-notice { margin-bottom: 20px; }
.fc-section--compact { opacity: .72; }
.fc-setup { display: flex; justify-content: space-between; gap: 18px; align-items: center; flex-wrap: wrap; }
.fc-setup p { margin: 5px 0 0; }
.fc-setup > code { padding: 8px 10px; border-radius: 6px; background: rgba(255,255,255,.65); }
.fc-weakness-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 14px; }
.fc-weakness-card { display: grid; gap: 10px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid #ef4444; border-radius: 8px; }
.fc-weakness-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fc-theme { font-size: 16px; font-weight: 800; text-transform: capitalize; }
.fc-error-count { display: flex; align-items: baseline; gap: 7px; }
.fc-error-count strong { font-size: 25px; color: #dc2626; }
.fc-error-count span { color: var(--muted); font-size: 12px; }
.fc-evidence { font-size: 12px; line-height: 1.4; margin: 0; }
.fc-trainer { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(380px, 1.35fr) minmax(220px, .7fr); gap: 18px; align-items: start; margin-top: 20px; }
.fc-context, .fc-actions-panel { position: sticky; top: 72px; }
.fc-context { display: grid; gap: 13px; }
.fc-context h2 { margin: 0; text-transform: capitalize; }
.fc-progress-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.fc-progress-dots { display: grid; grid-template-columns: repeat(10, minmax(20px, 1fr)); gap: 5px; }
.fc-progress-dot { display: grid; place-items: center; aspect-ratio: 1; max-width: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: 10px; font-weight: 700; }
.fc-progress-dot--current { border: 2px solid #3b82f6; color: #1e40af; background: #eff6ff; }
.fc-progress-dot--perfect { border-color: #16a34a; color: #fff; background: #16a34a; }
.fc-progress-dot--error { border-color: #dc2626; color: #fff; background: #dc2626; }
.fc-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.fc-reason { font-size: 14px; line-height: 1.5; margin: 0; }
.fc-context .link-button { text-align: center; justify-content: center; }
.fc-review-button { width: 100%; }
.fc-review-button:disabled { cursor: not-allowed; opacity: .62; }
.fc-review-note { margin: -6px 0 0; font-size: 11px; line-height: 1.4; }
.fc-actions-panel { display: grid; gap: 12px; }
.fc-actions-panel h2, .fc-actions-panel p { margin: 0; }
.fc-feedback { min-height: 46px; padding: 11px 12px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); font-size: 13px; line-height: 1.45; }
.fc-feedback--success { color: #065f46; border-color: #86d3b4; background: #ecfdf5; }
.fc-feedback--error { color: #991b1b; border-color: #f0b4b4; background: #fff7f7; }
.fc-feedback--warning { color: #92400e; border-color: #f5cc82; background: #fffbeb; word-break: break-word; }
.fc-feedback--loading { color: #1e40af; border-color: #aac4ee; background: #eff6ff; }
.fc-actions { display: grid; gap: 8px; }
.fc-actions button { width: 100%; }
.fc-board-column { min-width: 0; }
#fc-board .square[draggable="true"] { cursor: grab; }
#fc-board .square[draggable="true"]:active { cursor: grabbing; }
#fc-board.fc-board--locked { opacity: .48; filter: grayscale(.35); pointer-events: none; transition: opacity .2s ease, filter .2s ease; }
.fc-review { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 28px; padding: 18px; scroll-margin-top: 68px; }
.fc-review-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.fc-review-header h2 { margin: 4px 0; font-size: 20px; text-transform: capitalize; }
.fc-review-body { display: grid; gap: 14px; justify-items: center; }
.fc-review-nav { width: min(100%, 620px); display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; text-align: center; }
.fc-review-nav button:last-child { justify-self: end; }
.fc-review-stage { width: min(100%, 520px); display: grid; gap: 10px; }
.fc-review-board-card { width: 100%; }
.fc-review-caption { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.fc-review-caption code { color: var(--accent-dark); font-weight: 700; }
.fc-review-sequence { width: min(100%, 620px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fc-review-step { display: flex; align-items: center; justify-content: center; padding: 9px 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 12px; text-align: center; }
.fc-review-step--active { border-color: var(--accent); background: #ecfdf5; color: var(--accent-dark); }
.focus-a-game-layout .square.fc-review-from { box-shadow: inset 0 0 0 4px rgba(245, 197, 66, .9); }
.focus-a-game-layout .square.fc-review-to { box-shadow: inset 0 0 0 4px rgba(220, 38, 38, .82); }

@media (max-width: 980px) {
  .focus-a-game-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .focus-a-board-column { order: 1; }
  .focus-a-left-column  { order: 2; }
  .focus-a-right-column { order: 3; }

  .focus-a-board-card {
    width: min(100%, 640px);
  }

  .focus-a-panel {
    position: static;
  }

  .focus-a-output {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
  .fc-trainer { grid-template-columns: 1fr; }
  .fc-board-column { order: 1; }
  .fc-context { order: 2; }
  .fc-actions-panel { order: 3; }
  .fc-context, .fc-actions-panel { position: static; }
  .fc-review-header { flex-direction: column; }
}

@media (max-width: 860px) {
  .shell  { width: min(100vw - 20px, 680px); padding: 14px 0; }

  .main-nav { padding: 0 12px; }
  .nav-subtitle { display: none; }

  .focus-grid    { grid-template-columns: 1fr; }
  .fd-grid       { grid-template-columns: 1fr; }
  .fd-played-grid { grid-template-columns: 1fr; }
  .fd-playstyle-card { flex-direction: column; }
  .fc-weakness-grid { grid-template-columns: 1fr; }
  .fc-review-sequence { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .fc-review-nav { grid-template-columns: 1fr 1fr; }
  .fc-review-nav strong { grid-column: 1 / -1; grid-row: 1; }
  .focus-a-board-status {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .focus-a-status-pill {
    justify-self: start;
  }

  .focus-a-board-card {
    padding: 6px;
    border-radius: 10px;
  }

  .focus-a-game-layout .board {
    border-radius: 8px;
  }

  .focus-a-game-layout .piece {
    font-size: clamp(27px, 9vw, 42px);
  }

  .focus-a-game-layout .coord {
    font-size: 9px;
  }

  .focus-a-game-layout .coord.file { left: 4px; bottom: 3px; }
  .focus-a-game-layout .coord.rank { right: 4px; top: 3px; }

  .focus-a-actions button {
    min-height: 42px;
  }
}
