/* Kibitz. Serif (Newsreader) = the coach talking. Sans (Hanken Grotesk) = the app. */

:root {
  --page: #e8ebee;
  --surface: #f5f6f8;
  --ink: #17212e;
  --muted: #5b6878;
  --rule: #c9d0d8;
  --hover: rgba(23, 33, 46, 0.06);
  --sq-light: #d3dbe3;
  --sq-dark: #6e8397;
  --sq-light-last: #b7c8d8;
  --sq-dark-last: #577590;
  --dot: rgba(23, 33, 46, 0.26);
  --eval-white: #fbfcfd;
  --eval-black: #2a3442;

  /* Verdict colours: the only colour with meaning. ≥ 4.5:1 on --page. */
  --v-brilliant: #157386;
  --v-best: #2d774b;
  --v-good: #5c704d;
  --v-inaccuracy: #87650d;
  --v-mistake: #a85122;
  --v-blunder: #be3434;
  --v-book: var(--muted);
  --on-verdict: #ffffff;

  --sans: 'Hanken Grotesk', 'Noto Sans Symbols 2', 'Noto Sans Math', system-ui, sans-serif;
  --serif: 'Newsreader', 'Noto Sans Symbols 2', 'Noto Sans Math', Georgia, serif;
  --top-h: 64px;
  --controls-h: 56px;
  --board: min(calc(100vh - var(--top-h) - var(--controls-h) - 32px), 58vw);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #121821;
    --surface: #1a222d;
    --ink: #e5eaf0;
    --muted: #93a0b0;
    --rule: #2c3744;
    --hover: rgba(229, 234, 240, 0.06);
    --sq-light: #a3b1bf;
    --sq-dark: #50657a;
    --sq-light-last: #8fa6bc;
    --sq-dark-last: #3f5d7a;
    --dot: rgba(18, 24, 33, 0.38);
    --eval-white: #dfe5ec;
    --eval-black: #0b1016;

    --v-brilliant: #4cc3da;
    --v-best: #5dba82;
    --v-good: #a3bc8c;
    --v-inaccuracy: #ddb04a;
    --v-mistake: #ec8a55;
    --v-blunder: #ee6a6a;
    --on-verdict: #121821;
    color-scheme: dark;
  }
}

/* Verdict classes set --vc; marks use it, small text uses it only next to a glyph. */
.v-book { --vc: var(--v-book); }
.v-brilliant, .v-great { --vc: var(--v-brilliant); }
.v-best, .v-excellent { --vc: var(--v-best); }
.v-good { --vc: var(--v-good); }
.v-inaccuracy { --vc: var(--v-inaccuracy); }
.v-mistake, .v-miss { --vc: var(--v-mistake); }
.v-blunder { --vc: var(--v-blunder); }

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--page);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.sheet-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.4;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 3px;
}

code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

.error {
  color: var(--v-blunder);
}

/* ---------- buttons ---------- */

.link {
  background: none;
  border: 0;
  padding: 6px 0;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.link:hover:not(:disabled) {
  text-decoration-color: currentColor;
}

.link.strong {
  font-weight: 600;
}

.link.danger {
  color: var(--v-blunder);
  text-decoration-color: currentColor;
  font-weight: 600;
}

.quiet {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 7px 14px;
}

.quiet:hover:not(:disabled) {
  border-color: var(--muted);
}

.primary {
  background: var(--ink);
  color: var(--page);
  border: 0;
  border-radius: 6px;
  padding: 12px 22px;
  font-weight: 600;
}

.primary:hover {
  opacity: 0.88;
}

/* ---------- top line ---------- */

.top {
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
}

.wordmark {
  font: 600 26px/1 var(--serif);
  letter-spacing: -0.01em;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

.stat {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
}

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

.stat-label.narrow {
  display: none;
}

.stat-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- play layout ---------- */

.play {
  display: grid;
  grid-template-columns: auto minmax(340px, 460px);
  justify-content: center;
  gap: 64px;
  padding: 8px 40px 24px;
}

.board-area {
  display: grid;
  grid-template-columns: 10px var(--board);
  grid-template-rows: var(--board) var(--controls-h);
  column-gap: 14px;
}

#board {
  grid-column: 2;
  grid-row: 1;
}

.controls {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 28px;
  color: var(--ink);
}

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

/* eval bar: the bottom part is the side at the bottom of the board */
.evalbar {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  background: var(--eval-white);
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px var(--rule);
}

.eval-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--share, 50%);
  background: var(--eval-black);
  border-radius: 0 0 5px 5px;
  transition: height 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.evalbar.bottom-white {
  background: var(--eval-black);
}

.evalbar.bottom-white .eval-fill {
  background: var(--eval-white);
}

.evalbar.empty .eval-fill {
  height: 50%;
}

.eval-label {
  position: absolute;
  right: calc(100% + 8px);
  bottom: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.eval-label.at-top {
  bottom: auto;
  top: 0;
}

/* ---------- board ---------- */

.board {
  position: relative;
  width: var(--board);
  aspect-ratio: 1;
  container-type: inline-size;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.board:focus-visible {
  outline-offset: 3px;
}

.squares {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
}

.sq {
  position: relative;
}

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

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

.sq.light.last,
.sq.light.sel {
  background: var(--sq-light-last);
}

.sq.dark.last,
.sq.dark.sel {
  background: var(--sq-dark-last);
}

.sq.check {
  background-image: radial-gradient(circle, color-mix(in srgb, var(--v-blunder) 75%, transparent) 0%, transparent 70%);
}

.sq.ring {
  box-shadow: inset 0 0 0 0.45cqi var(--v-best);
}

.sq.cursor {
  box-shadow: inset 0 0 0 0.4cqi var(--ink);
}

.sq.hover {
  box-shadow: inset 0 0 0 0.45cqi var(--surface);
}

.sq.dot::after {
  content: '';
  position: absolute;
  inset: 37%;
  border-radius: 50%;
  background: var(--dot);
  pointer-events: none;
}

.sq.capture::after {
  content: '';
  position: absolute;
  inset: 3%;
  border-radius: 50%;
  border: 0.75cqi solid var(--dot);
  pointer-events: none;
}

.piece {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.piece.lifted {
  opacity: 0.3;
}

.coord {
  position: absolute;
  font: 600 2.1cqi/1 var(--sans);
  pointer-events: none;
}

.coord.rank {
  top: 4%;
  left: 5%;
}

.coord.file {
  bottom: 4%;
  right: 6%;
}

.sq.light .coord {
  color: var(--sq-dark);
}

.sq.dark .coord {
  color: var(--sq-light);
}

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  pointer-events: none;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25));
}

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

.arrow line {
  stroke-width: 15;
  stroke-linecap: round;
}

.arrow.best,
.arrow.counter,
.arrow.hint {
  stroke: var(--v-best);
  fill: var(--v-best);
  opacity: 0.85;
}

.arrow.threat {
  stroke: var(--v-blunder);
  fill: var(--v-blunder);
  opacity: 0.85;
}

.arrow.played {
  stroke: var(--ink);
  fill: var(--ink);
  opacity: 0.3;
}

.stamp {
  position: absolute;
  z-index: 3;
  width: max(4.6%, 20px);
  aspect-ratio: 1;
  transform: translate(-72%, -28%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--vc);
  color: var(--on-verdict);
  font: 600 max(2.5cqi, 11px)/1 var(--serif);
  letter-spacing: -0.04em;
  box-shadow: 0 0 0 0.3cqi var(--page);
  pointer-events: none;
}

.promo-shade {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: color-mix(in srgb, var(--page) 55%, transparent);
}

.promo {
  position: absolute;
  z-index: 5;
  width: 12.5%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.promo button {
  aspect-ratio: 1;
  border: 0;
  background: none;
  padding: 6%;
}

.promo button:hover {
  background: var(--hover);
}

.promo img {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- coach column ---------- */

.coach {
  height: calc(var(--board) + var(--controls-h));
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.coach-main {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-bottom: 28px;
}

.verdict {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 22px;
  align-items: start;
  min-height: 104px;
}

.verdict > p {
  grid-column: 1 / -1;
  align-self: center;
}

.glyph {
  font: 600 92px/1 var(--serif);
  font-variation-settings: 'opsz' 72;
  letter-spacing: -0.04em;
  color: var(--vc);
  min-width: 64px;
}

.glyph.v-book {
  font-weight: 400;
  font-synthesis: none;
}

.glyph.enter {
  animation: glyph-in 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.2);
}

@keyframes glyph-in {
  from {
    opacity: 0;
    transform: scale(1.35);
  }
}

.verdict-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.verdict-name {
  font-weight: 600;
  font-size: 19px;
}

.verdict-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  align-items: baseline;
  font-size: 14px;
}

.meter {
  margin: 10px 0 4px;
  max-width: 300px;
}

.meter-track {
  position: relative;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
}

.meter-tick {
  position: absolute;
  top: -3px;
  width: 1px;
  height: 10px;
  background: var(--muted);
  opacity: 0.6;
}

.meter-mark {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--vc);
  box-shadow: 0 0 0 2px var(--page);
  transform: translate(-50%, -50%);
}

.meter-zones {
  position: relative;
  height: 18px;
  margin-top: 6px;
  font: 600 12px/1 var(--serif);
  color: var(--muted);
}

.meter-zones span {
  position: absolute;
  text-align: center;
}

.coach-text {
  font: 400 19px/1.6 var(--serif);
  font-variation-settings: 'opsz' 18;
  max-width: 38em;
}

.coach-wait,
.coach-off {
  font: 400 17px/1.5 var(--serif);
  color: var(--muted);
}

.coach-ask {
  font-size: 15px;
}

.details {
  font-size: 15px;
}

.details summary {
  cursor: pointer;
  width: max-content;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.details summary::before {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.details[open] summary::before {
  transform: rotate(45deg);
}

.details[open] > :not(summary) {
  margin-top: 14px;
}

.facts-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
}

.facts-list dt {
  color: var(--muted);
}

.facts-list dd {
  margin: 0;
}

.alts {
  border-collapse: collapse;
  width: 100%;
}

.alts caption {
  text-align: left;
  color: var(--muted);
  padding-bottom: 4px;
}

.alts td {
  padding: 3px 12px 3px 0;
  vertical-align: baseline;
}

.alts td.num {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.alts td.num:last-child {
  text-align: right;
  padding-right: 0;
}

.alts tr.played td {
  font-weight: 600;
  color: var(--ink);
}

.facts {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 15px;
}

.facts li::marker {
  color: var(--muted);
}

.opponent {
  border-top: 1px solid var(--rule);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.opening .eco {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.callout {
  border-left: 3px solid var(--vc);
  padding: 2px 0 2px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.callout.trap {
  --vc: var(--v-mistake);
}

.callout.threat {
  --vc: var(--v-blunder);
}

.callout-title {
  font-weight: 600;
}

.counter {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: baseline;
}

.counter .link {
  font-size: 15px;
}

.choose {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.choose-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.over {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.over-rating {
  font-variant-numeric: tabular-nums;
}

.stuck {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: baseline;
}

.watch {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.over-result {
  font: 600 30px/1.2 var(--serif);
}

.notice {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notice-title {
  font: 600 26px/1.2 var(--serif);
}

/* scoresheet */
.scoresheet {
  flex: 0 0 auto;
  max-height: 34%;
  overflow-y: auto;
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  display: grid;
  grid-template-columns: 2.4em 1fr 1fr;
  align-content: start;
  row-gap: 1px;
  background: var(--surface);
  border-radius: 6px;
  font-size: 15px;
}

.scoresheet.empty {
  display: none;
}

.mv-no {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 3px 0;
  text-align: right;
  padding-right: 10px;
}

.mv button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 4px;
  padding: 3px 8px;
}

.mv button:hover {
  background: var(--hover);
}

.mv button[aria-current='true'] {
  background: var(--ink);
  color: var(--page);
}

.mv-glyph {
  margin-left: 3px;
  font: 600 1em/1 var(--serif);
  color: var(--vc);
}

.mv button[aria-current='true'] .mv-glyph {
  color: inherit;
}

/* ---------- screens: onboarding, fatal ---------- */

.screen {
  padding: 10vh 40px 80px;
  max-width: 760px;
  margin: 0 auto;
}

.serif-title {
  font: 600 44px/1.1 var(--serif);
  letter-spacing: -0.015em;
  margin: 0;
}

.serif-title.small {
  font-size: 30px;
}

.lede {
  margin-top: 14px;
  color: var(--muted);
  font-size: 17px;
}

.levels {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
}

.level {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: baseline;
  text-align: left;
  background: none;
  border: 0;
  border-top: 1px solid var(--rule);
  padding: 18px 12px;
}

.level:last-child {
  border-bottom: 1px solid var(--rule);
}

.level:hover {
  background: var(--hover);
}

.level-num {
  font: 600 38px/1 var(--serif);
  font-variant-numeric: lining-nums;
}

.level-name {
  font-size: 19px;
}

.levels + .error {
  margin-top: 16px;
}

.fatal p {
  margin-top: 16px;
  font-size: 18px;
}

/* ---------- sheet: review and progress ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--page);
  overflow-y: auto;
}

.sheet-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 40px 96px;
}

.sheet-bar {
  display: flex;
  justify-content: flex-end;
  height: 48px;
  align-items: center;
}

.review-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 48px;
  max-width: 720px;
}

.review-headline {
  font: 400 23px/1.45 var(--serif);
}

.review-head .opening {
  color: var(--ink);
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  column-gap: 72px;
  row-gap: 48px;
  align-items: start;
}

.review-grid > :not(.review-side) {
  grid-column: 1;
  min-width: 0;
}

.review-main {
  display: flex;
  flex-direction: column;
  gap: 48px;
  min-width: 0;
}

.review-side {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: start;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-board {
  width: 100%;
}

.mini-board {
  aspect-ratio: 1;
}

.mini-caption {
  font-size: 15px;
}

.figures {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 64px;
  align-items: flex-end;
}

.figure {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.big-num {
  font: 600 80px/0.9 var(--serif);
  font-variation-settings: 'opsz' 72;
  letter-spacing: -0.02em;
}

.fig-value {
  font: 600 28px/1.1 var(--serif);
}

.fig-label {
  color: var(--muted);
  font-size: 14px;
}

.up {
  color: var(--v-best);
}

.down {
  color: var(--v-blunder);
}

.review-sec h2 {
  font: 600 17px/1.3 var(--sans);
  margin: 0 0 14px;
}

.counts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
}

.counts li {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.count-glyph {
  font: 600 22px/1 var(--serif);
  color: var(--vc);
  min-width: 1.2em;
}

.count-num {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

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

.moments {
  list-style: none;
  margin: 0;
  padding: 0;
}

.moments button {
  width: 100%;
  display: grid;
  grid-template-columns: 9em 1fr;
  gap: 16px;
  text-align: left;
  background: none;
  border: 0;
  border-top: 1px solid var(--rule);
  padding: 12px 8px;
}

.moments li:last-child button {
  border-bottom: 1px solid var(--rule);
}

.moments button:hover {
  background: var(--hover);
}

.moment-move {
  font-weight: 600;
}

.lessons {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font: 400 19px/1.55 var(--serif);
  max-width: 36em;
}

.lessons li::marker {
  color: var(--muted);
}

.cta {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* charts */
.chart {
  margin: 0;
}

.chart-title {
  font-weight: 600;
  margin-bottom: 12px;
}

.chart-plot {
  position: relative;
  width: 100%;
}

.chart svg {
  display: block;
  overflow: visible;
}

.chart .grid {
  stroke: var(--rule);
  stroke-width: 1;
}

.chart .grid.mid {
  stroke: var(--muted);
  stroke-opacity: 0.5;
}

.chart .axis {
  fill: var(--muted);
  font: 12px var(--sans);
  font-variant-numeric: tabular-nums;
}

.chart .series {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .dot {
  fill: var(--vc);
  stroke: var(--page);
  stroke-width: 2;
}

.chart .end-dot {
  fill: var(--ink);
  stroke: var(--page);
  stroke-width: 2;
}

.chart .end-label {
  fill: var(--ink);
  font: 600 14px var(--sans);
}

.chart .cross {
  stroke: var(--muted);
  stroke-width: 1;
}

.chart .sel-line {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-opacity: 0.5;
}

.chart .hover-dot {
  fill: var(--ink);
  stroke: var(--page);
  stroke-width: 2;
  pointer-events: none;
}

.tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  z-index: 2;
}

.tip strong {
  font-size: 15px;
}

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

.tip-note {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tip .key {
  display: inline-block;
  width: 10px;
  height: 2px;
  background: var(--vc);
}

.weak {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 520px;
}

.weak li {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-top: 1px solid var(--rule);
}

.weak li:last-child {
  border-bottom: 1px solid var(--rule);
}

.num {
  font-variant-numeric: tabular-nums;
}


.progress {
  display: flex;
  flex-direction: column;
  gap: 48px;
  max-width: 820px;
}

.progress .review-head {
  margin-bottom: 0;
}


/* ---------- login ---------- */

body.bare .top {
  display: none;
}

.login {
  max-width: 360px;
  margin: 14vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-mark {
  font: 600 60px/1 var(--serif);
  letter-spacing: -0.02em;
  margin-bottom: 40px;
}

.login label {
  color: var(--muted);
  font-size: 15px;
}

.login input {
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  height: 50px;
  padding: 0 14px;
}

.login input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.login .primary {
  margin-top: 10px;
  height: 50px;
}

.login .error {
  min-height: 1.5em;
}

/* ---------- game history list ---------- */

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.list-head h2 {
  margin: 0 0 14px;
}

.list-head .muted {
  font-size: 13px;
  order: -1;
  width: 64px;
  display: none;
}

.game-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.game-row {
  width: 100%;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  text-align: left;
  background: none;
  border: 0;
  border-top: 1px solid var(--rule);
  padding: 16px 8px;
}

.game-list li:last-child .game-row {
  border-bottom: 1px solid var(--rule);
}

.game-row:hover {
  background: var(--hover);
}

.game-row[aria-busy='true'] {
  opacity: 0.6;
}

.gr-acc {
  font: 600 38px/1 var(--serif);
  font-variation-settings: 'opsz' 48;
  letter-spacing: -0.02em;
}

.gr-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.gr-title {
  font-weight: 600;
}

.gr-sub {
  color: var(--muted);
  font-size: 15px;
}

.gr-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: 15px;
  white-space: nowrap;
}

.gr-delta {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bad-counts {
  display: flex;
  gap: 14px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.bad-count .mv-glyph {
  margin-left: 2px;
}

.signout {
  padding-top: 8px;
}

/* ---------- review extras ---------- */

.mini-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- replay ---------- */

.replay-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 28px;
}

.replay-grid {
  display: grid;
  grid-template-columns: auto minmax(320px, 440px);
  gap: 56px;
  align-items: start;
}

.replay-board {
  --board: min(calc(100vh - 250px), 52vw);
}

.replay-side {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

.replay-stats {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.replay-stats .verdict {
  min-height: 0;
}

.replay-stats .verdict-meta + .verdict-meta {
  margin-top: -2px;
}

.score {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bot-move {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.replay-sheet .scoresheet {
  max-height: 220px;
}

.replay-controls {
  gap: 6px;
}

.icon-btn {
  width: 44px;
  height: 40px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
}

.icon-btn:hover:not(:disabled) {
  background: var(--hover);
}

.replay .chart-title {
  font-weight: 400;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 6px;
}

/* ---------- mobile ---------- */

@media (max-width: 999px) {
  :root {
    --top-h: 56px;
    --board: calc(100vw - 32px);
  }

  .top {
    padding: 0 16px;
  }

  .top-right {
    gap: 16px;
    font-size: 14px;
  }

  .stat:nth-child(2),
  .stat-label.wide {
    display: none;
  }

  .stat-label.narrow {
    display: inline;
  }

  .top-right button {
    white-space: nowrap;
  }

  .play {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 0 16px 40px;
  }

  .board-area {
    grid-template-columns: var(--board);
    grid-template-rows: 26px var(--board) var(--controls-h);
  }

  .evalbar {
    grid-column: 1;
    grid-row: 1;
    height: 6px;
    align-self: end;
    margin-bottom: 8px;
    border-radius: 3px;
  }

  .eval-fill {
    top: 0;
    bottom: 0;
    height: auto;
    width: var(--share, 50%);
    border-radius: 3px 0 0 3px;
    transition-property: width;
  }

  .evalbar.empty .eval-fill {
    height: auto;
    width: 50%;
  }

  .eval-label,
  .eval-label.at-top {
    right: auto;
    left: 0;
    top: auto;
    bottom: calc(100% + 4px);
  }

  #board,
  .controls {
    grid-column: 1;
  }

  #board {
    grid-row: 2;
  }

  .controls {
    grid-row: 3;
    gap: 22px;
  }

  .coach {
    height: auto;
  }

  .coach-main {
    overflow: visible;
    padding-right: 0;
  }

  .scoresheet {
    max-height: 260px;
  }

  .glyph {
    font-size: 72px;
  }

  .screen {
    padding: 6vh 20px 60px;
  }

  .serif-title {
    font-size: 36px;
  }

  .level {
    grid-template-columns: 100px 1fr;
  }

  .level-num {
    font-size: 32px;
  }

  .sheet-inner {
    padding: 8px 20px 72px;
  }

  .review-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .review-grid {
    row-gap: 40px;
  }

  .review-side {
    grid-column: 1;
    grid-row: auto;
    position: static;
  }

  .big-num {
    font-size: 64px;
  }

  .moments button {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .replay-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .replay-board {
    --board: calc(100vw - 40px);
  }

  .replay-controls {
    justify-content: space-between;
  }

  .replay-stats {
    min-height: 0;
  }

  .game-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 14px;
  }

  .gr-acc {
    font-size: 32px;
  }

  .login {
    margin-top: 10vh;
    padding: 0 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

.verdict > span:empty {
  display: none;
}

.coach-main > * {
  flex-shrink: 0;
}

.coach-main + .scoresheet {
  margin-top: 8px;
}
