@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #f5eef2;
  --muted: #c5bac7;
  --accent: #e7bf87;
  --accent-ink: #2b2014;
  --action-hover: #f3d2a3;
  --edge: #3b3742;
  --control-edge: #786f82;
  --paper: #17161a;
  --chrome: #1e1c22;
  --surface: #26232b;
  --selection: #3d3136;
  --board-light: #c2d2ec;
  --board-dark: #527cb8;
  --board-coordinates: #070f18;
  --positive: #a3d5b9;
  --negative: #f3aba2;
  --display-font: "Newsreader", Georgia, serif;
  font-family: "Segoe UI", system-ui, sans-serif;
  line-height: 1.45;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .56; cursor: default; }
a { color: var(--accent); text-underline-offset: .18em; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #e1b878;
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
.shell { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--edge); background: var(--paper); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; }
.wordmark { color: var(--ink); text-decoration: none; font: 600 clamp(1.17rem, 3.2vw, 1.52rem)/1.08 var(--display-font); letter-spacing: -.025em; }
.site-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0 22px; font-size: .9rem; font-weight: 650; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.site-nav a[aria-current] { color: var(--accent); }
.site-nav a:hover, .site-nav a[aria-current] { text-decoration: underline; text-underline-offset: 5px; }

.account-page { padding-block: clamp(30px, 6vw, 64px); }
.account-panel { width: min(100%, 33rem); margin-inline: auto; padding: clamp(20px, 5vw, 35px); border: 1px solid var(--edge); border-radius: 15px; background: var(--surface); }
.account-panel h1 { font-size: clamp(1.85rem, 5vw, 2.55rem); }
.account-panel p { margin: 12px 0 18px; color: var(--muted); overflow-wrap: anywhere; }
.account-panel form { display: grid; gap: 13px; justify-items: start; margin-block-start: 18px; }
.account-panel .field { width: 100%; }
.account-panel input:is([type="email"], [type="password"]) { width: 100%; min-height: 46px; padding: 8px 11px; border: 1px solid var(--control-edge); border-radius: 8px; background: var(--chrome); color: var(--ink); font-size: 1rem; }
.account-panel [role="status"]:empty { display: none; }
.account-panel .account-error { color: var(--negative); }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.account-panel > .account-actions, .account-panel > form + a { margin-top: 18px; }

.review-form { padding: 38px 0 29px; }
.intro { margin-bottom: 23px; }
h1 { font: 600 clamp(2.12rem, 4.3vw, 3.15rem)/1.07 var(--display-font); letter-spacing: -.025em; }
.intro p { color: var(--muted); margin-top: 9px; font-size: 1.06rem; }
#profile-form { display: flex; align-items: end; gap: 12px; }
.field { display: grid; gap: 6px; font-size: .89rem; font-weight: 650; }
.profile-field { max-width: 490px; flex: 1; }
input[type="text"], input[type="number"] { width: 100%; min-height: 47px; border: 1px solid var(--control-edge); border-radius: 9px; padding: 8px 12px; background: var(--chrome); color: var(--ink); font-weight: 450; font-size: 1rem; }
.primary, .secondary { min-height: 44px; padding: 9px 15px; border-radius: 9px; font-weight: 660; border: 1px solid transparent; }
.primary { min-height: 47px; background: var(--accent); color: var(--accent-ink); }
.primary:hover { background: var(--action-hover); }
.secondary { background: var(--surface); color: var(--accent); border-color: var(--control-edge); }
.secondary:hover { background: var(--selection); }
.text-button { padding: 5px 0; border: 0; background: transparent; color: var(--accent); font-size: .9rem; font-weight: 670; }
.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.form-tools { display: flex; gap: 18px; margin-top: 10px; }
.status { color: var(--muted); margin-top: 11px; font-size: .94rem; }
.status[data-error] { color: var(--negative); }
progress { display: block; accent-color: var(--accent); width: min(100%, 488px); margin-top: 8px; }

.empty { min-height: 245px; display: flex; align-items: center; justify-content: space-between; gap: 20px; overflow: hidden; border: 1px solid var(--edge); border-radius: 17px; padding: 29px 35px; background: var(--surface); }
.empty h2 { font-size: 1.65rem; letter-spacing: -.035em; }
.empty p { max-width: 369px; margin-top: 5px; color: var(--muted); }
.empty-board { flex: 0 0 190px; height: 190px; border-radius: 16px; position: relative; transform: rotate(-10deg); background: conic-gradient(var(--board-dark) 25%, var(--board-light) 0 50%, var(--board-dark) 0 75%, var(--board-light) 0) 0 0 / 76px 76px; border: 8px solid var(--edge); box-shadow: 0 12px 26px #0005; }
.empty-board img { position: absolute; }
.empty-board img:first-child { left: 28px; top: 24px; }
.empty-board img:last-child { left: 82px; top: 80px; }

.report { background: var(--surface); border: 1px solid var(--edge); border-top: 4px solid var(--accent); border-radius: 15px; padding: 23px 25px 17px; }
.report-name { font-size: .94rem; color: var(--muted); font-weight: 660; }
.report h2 { font-size: clamp(1.55rem, 3vw, 2.15rem); letter-spacing: -.055em; line-height: 1.15; margin: 4px 0 6px; }
.coverage { margin-top: 8px; color: var(--muted); font-size: .95rem; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 14px 0 0; padding: 15px 0; border-block: 1px solid var(--edge); }
.metrics > div { padding: 0 12px; border-inline-start: 1px solid var(--edge); }
.metrics > div:first-child { border: 0; padding-inline-start: 0; }
.metrics dt { color: var(--muted); font-size: .88rem; font-weight: 660; }
.metrics dd { margin: 0; font-variant-numeric: tabular-nums; }
.metrics .value { color: var(--accent); font-size: clamp(1.3rem, 3vw, 1.85rem); font-weight: 770; letter-spacing: -.055em; }
.metrics .denominator { color: var(--muted); font-size: .86rem; }
.practice { padding-block: 20px 6px; }
.practice h3 { font-size: 1.3rem; letter-spacing: -.035em; }
.practice-summary { color: var(--muted); margin-top: 4px; }
.practice-list { display: grid; gap: 16px; }
.practice-list:not(:empty) { margin-top: 13px; }
.practice-card { border: 1px solid var(--edge); border-radius: 11px; background: var(--paper); padding: 15px; }
.practice-card h4 { font-size: 1.15rem; line-height: 1.3; margin: 0; }
.practice-count { color: var(--muted); font-size: .9rem; margin-block: 4px 8px; }
.practice-examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; margin-top: 13px; }
.practice-example { min-width: 0; border: 1px solid var(--edge); background: var(--surface); border-radius: 10px; padding: 12px; }
.practice-example h5 { margin: 0 0 9px; font-size: .99rem; overflow-wrap: anywhere; }
.practice-example .cell-button { display: block; margin-top: 12px; font-size: .92rem; }
.example-time { color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.board-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.board-comparison figure { display: grid; grid-template-rows: subgrid; grid-row: span 3; align-content: start; gap: 6px; margin: 0; }
.board-comparison figcaption { font-size: .9rem; line-height: 1.35; }
.board-comparison figcaption > * { display: block; }
.board-comparison figcaption span { color: var(--muted); }
.board-comparison figure p { font-size: .92rem; }

.games { margin-top: 26px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.section-heading h2 { font-size: 1.36rem; letter-spacing: -.035em; }
.score-notice { margin-bottom: 8px; font-size: .92rem; color: var(--muted); }
.table-scroll { overflow: auto; background: var(--surface); border: 1px solid var(--edge); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; text-align: left; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 13px; white-space: nowrap; font-size: .9rem; }
th { color: var(--muted); background: var(--chrome); font-weight: 660; }
td { border-top: 1px solid var(--edge); }
tbody tr:hover { background: var(--chrome); }
.cell-button { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: .18em; font-weight: 645; }
.score-edit { margin-inline-start: 8px; font-size: .85rem; }
.score-provenance { margin-inline-start: 5px; color: var(--muted); font-size: .83rem; }
.dim { color: var(--muted); }
.footer { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--edge); margin-top: 28px; margin-bottom: 23px; padding-top: 13px; font-size: .87rem; color: var(--muted); }
.footer a { margin-inline-end: 11px; }

.panel { width: min(700px, calc(100% - 30px)); color: var(--ink); border: 1px solid var(--edge); border-radius: 15px; padding: 20px; max-height: calc(100% - 34px); background: var(--surface); box-shadow: 0 24px 72px #0007; }
.panel::backdrop { background: #08090bcc; }
.panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.panel h2 { letter-spacing: -.045em; font-size: 1.55rem; }
.panel section p { margin-block: 5px 13px; }
.panel h3 { margin-top: 14px; font-size: 1.02rem; }
.score-panel { width: min(500px, calc(100% - 30px)); }
.score-hint { margin: 7px 0 12px; color: var(--muted); }
.source-link { display: inline-flex; align-items: center; text-decoration: none; }
.score-field { max-width: 200px; margin-top: 16px; }
.score-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; margin-top: 12px; }
.game-panel { width: min(1040px, calc(100% - 30px)); }
.game-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 12px; }
#game-summary { color: var(--muted); }
#game-source { flex-shrink: 0; }
.game-layout { display: grid; grid-template-columns: minmax(265px, .95fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.board { aspect-ratio: 1; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); overflow: hidden; border-radius: 8px; container-type: inline-size; }
.square { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; background: var(--board-light); color: var(--board-coordinates); }
.review-piece { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.square.dark { background: var(--board-dark); }
.square.highlight { box-shadow: inset 0 0 0 clamp(2px, .7cqi, 3px) #7c501a; }
.mistake-board .square.highlight { background: #d8ae9a; box-shadow: inset 0 0 0 2px #9d4c2b; }
.better-board .square.highlight { background: #acc7b2; box-shadow: inset 0 0 0 2px #356842; }
.board-rank, .board-file { position: absolute; pointer-events: none; font: 660 min(.72rem, 5.6cqi)/1 "Segoe UI", sans-serif; }
.board-rank { inset: 1px auto auto 2px; }
.board-file { inset: auto 2px 1px auto; }
.move-caption { color: var(--muted); font-size: .9rem; margin-top: 7px; }
.move-lines { background: var(--paper); border-radius: 8px; padding: 11px 12px; margin-top: 12px; font-size: .95rem; }
.game-panel .move-lines p { margin: 3px 0 9px; }
.move-lines summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.board-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.board-controls [aria-pressed="true"] { background: var(--selection); border-color: var(--board-dark); }
.move-scroll { max-height: 485px; }
.move-scroll th, .move-scroll td { padding: 8px 9px; }
.move-scroll thead th { position: sticky; top: 0; }
.move-scroll tr.selected { background: var(--selection); }
.move-scroll tr.mistake td:nth-child(4) { color: var(--negative); font-weight: 650; }
.license-page { padding-block: 30px; }
.license-page p { margin: 12px 0; max-width: 72ch; }

@media (max-width: 780px) {
  .shell { width: calc(100% - 32px); }
  .practice-examples { grid-template-columns: minmax(0, 1fr); }
  .game-layout { grid-template-columns: 1fr; }
  .game-panel .board { max-width: 460px; }
  .move-scroll { max-height: 330px; }
}
@media (max-width: 540px) {
  .topbar-inner { min-height: 54px; }
  .site-nav { gap: 0 13px; font-size: .85rem; }
  .review-form { padding-top: 28px; }
  #profile-form { flex-wrap: wrap; }
  .profile-field { flex: 0 0 100%; }
  .empty { padding: 20px; min-height: 175px; }
  .empty-board { display: none; }
  .report { padding: 17px 15px; }
  .metrics > div { padding-inline: 7px; }
  .practice-card { padding: 11px; }
  .practice-example { padding: 9px; }
  .board-comparison { gap: 8px; }
  .footer { flex-direction: column; }
  .panel { padding: 13px; }
}
