/* World Chess Championship 2024 pages: chessAI's oak (dark, default) and oakLight schemes (src/schemes.ts). */
:root {
  --bg: #121315;
  --panel: #1a1b1e;
  --raised: #232428;
  --hairline: #2f3136;
  --edge: #6c7078;
  --text: #dcd6cc;
  --muted: #a8a39a;
  --dim: #938e86;
  --accent: #ff7a2f;
  --fill: #ff7a2f;
  --on-fill: #1a0b03;
  --eval-w: #e6e1d8;
  --eval-b: #2a2c30;
  --mk-ring: #121315;
  --sq-l: #e4cda6;
  --sq-d: #71777f;
  --coord: #000000;
  --hl: rgba(255,122,47,0.4);
  --arrow: #ff7a2f;
  --arrow-halo: #121315;
  --g-inaccuracy: #e9c24b;
  --g-mistake: #f2a33a;
  --g-blunder: #f45a75;
  --g-only: #6cc6e0;
  --zebra: rgba(255,255,255,0.025);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #ecebe7;
    --panel: #faf9f7;
    --raised: #f2f1ed;
    --hairline: #dedbd5;
    --edge: #7d8086;
    --text: #34363a;
    --muted: #5a5c61;
    --dim: #64666b;
    --accent: #b83e0b;
    --fill: #b83e0b;
    --on-fill: #ffffff;
    --eval-w: #ffffff;
    --eval-b: #8e949b;
    --mk-ring: #34363a;
    --sq-l: #efdfc2;
    --sq-d: #8e949b;
    --coord: #000000;
    --hl: rgba(255,122,47,0.4);
    --arrow: #b83e0b;
    --arrow-halo: #ffffff;
    --g-inaccuracy: #8a6000;
    --g-mistake: #9c4c08;
    --g-blunder: #bb2446;
    --g-only: #0e6f9a;
    --zebra: rgba(0,0,0,0.03);
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, .scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--fill); color: var(--on-fill); padding: 8px 12px; border-radius: 8px; z-index: 2; }
.skip:focus { top: 8px; }
.top { max-width: 760px; margin: 0 auto; padding: 12px 16px 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; padding: 6px 0; }
.brand:hover { color: var(--accent); }
.crumbs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: 15px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 4px; color: var(--dim); }
.crumbs a { display: inline-block; padding: 6px 0; }
main { max-width: 760px; margin: 0 auto; padding: 8px 16px 48px; }
h1 { font-size: 30px; line-height: 1.2; margin: 16px 0 8px; }
h2 { font-size: 22px; line-height: 1.3; margin: 36px 0 10px; }
h3 { font-size: 18px; line-height: 1.35; margin: 24px 0 6px; }
p { margin: 0 0 14px; }
.lede { font-size: 18px; color: var(--text); }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 15px; }
.card { background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; padding: 16px; margin: 16px 0; }
.game-head dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 6px; }
.game-head dl div { display: grid; grid-template-columns: 112px 1fr; gap: 8px; }
.game-head dt { color: var(--muted); }
.game-head dd { margin: 0; }
.game-head .engine { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 15px; }

/* Evaluation graph (the app's EvalGraph: light area = White's winning chances). */
.graph-card { margin: 0; }
.graph { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 150px auto; gap: 4px 8px; }
.yl { display: flex; flex-direction: column; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 2px 0; }
.plot { position: relative; border: 1px solid var(--edge); border-radius: 6px; overflow: hidden; }
.plot svg { display: block; width: 100%; height: 100%; }
.plot .gb { fill: var(--eval-b); }
.plot .gw { fill: var(--eval-w); }
.plot .mid { stroke: var(--edge); stroke-width: 1; }
.xl { grid-column: 2; position: relative; height: 20px; font-size: 13px; color: var(--muted); }
.xl .tk { position: absolute; top: 0; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.mk { position: absolute; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.mk .dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--mk-ring); }
.mk:hover .dot, .mk:focus-visible .dot { width: 15px; height: 15px; }
.mk:focus-visible { outline-offset: -2px; border-radius: 50%; }
.mk .tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--raised); color: var(--text); border: 1px solid var(--edge); border-radius: 6px; padding: 2px 6px; font-size: 13px; display: none; pointer-events: none; }
.mk:hover .tip, .mk:focus-visible .tip { display: block; }
.mk.below .tip { bottom: auto; top: 100%; }
.graph-card figcaption { color: var(--muted); font-size: 15px; margin-top: 4px; }

/* Grades: the word always shows; the dot repeats it in colour. */
.g-inaccuracy { --g: var(--g-inaccuracy); }
.g-mistake { --g: var(--g-mistake); }
.g-blunder { --g: var(--g-blunder); }
.g-only { --g: var(--g-only); }
.g-key { --g: var(--accent); }
.mk .dot { background: var(--g, var(--accent)); }
.gr { white-space: nowrap; }
.gd { display: none; width: 9px; height: 9px; border-radius: 50%; background: var(--g); margin-right: 5px; vertical-align: 1px; }
.g-inaccuracy .gd, .g-mistake .gd, .g-blunder .gd, .g-only .gd { display: inline-block; }

/* Key moments */
.moment { border-top: 1px solid var(--hairline); padding-top: 4px; margin-top: 20px; }
.moment h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.moment h3 .gr, .moment h3 .who { font-size: 15px; font-weight: 400; color: var(--muted); }
.moment h3 .gr { color: var(--text); }
.facts { margin: 0 0 8px; padding: 12px 12px 12px 30px; background: var(--panel); border: 1px solid var(--hairline); border-radius: 10px; font-size: 15px; color: var(--text); }
.facts li + li { margin-top: 4px; }
.diagram { margin: 8px 0 14px; max-width: 360px; }
.diagram figcaption { color: var(--muted); font-size: 15px; margin-top: 6px; }
.bd { display: block; width: 100%; height: auto; border-radius: 4px; }
.bd .l { fill: var(--sq-l); }
.bd .d { fill: var(--sq-d); }
.bd .hl { fill: var(--hl); }
.bd .co { fill: var(--coord); font: 700 10.5px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.bd .ah { stroke: var(--arrow-halo); stroke-width: 11; fill: var(--arrow-halo); stroke-linejoin: round; }
.bd .af { stroke: var(--arrow); stroke-width: 7; fill: var(--arrow); stroke-linejoin: round; }
.bd polygon.ah { stroke-width: 4; }
.bd polygon.af { stroke-width: 0; }
.bd .ar { opacity: 0.92; }

.takeaway { background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; padding: 4px 16px 4px; margin-top: 32px; }
.takeaway h2 { margin-top: 14px; font-size: 19px; }

.cta { margin: 32px 0; padding: 18px 16px; border-radius: 12px; background: var(--raised); border: 1px solid var(--edge); }
.cta p { margin: 0 0 12px; }
.button { display: inline-block; background: var(--fill); color: var(--on-fill); font-weight: 700; text-decoration: none; padding: 12px 18px; border-radius: 10px; min-height: 44px; }
.button:hover { text-decoration: underline; }

/* Move list */
table { border-collapse: collapse; width: 100%; }
.moves { font-size: 15px; font-variant-numeric: tabular-nums; }
.moves caption, .score caption { text-align: left; color: var(--muted); font-size: 15px; padding-bottom: 8px; }
.moves th, .moves td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.moves thead th { color: var(--muted); font-weight: 600; }
.moves tbody th { color: var(--muted); font-weight: 400; width: 3.2em; }
.moves tbody tr:nth-child(even) { background: var(--zebra); }
.moves .san { font-weight: 700; }
.moves .ev { color: var(--text); margin-left: 4px; }
.moves .gr { display: block; color: var(--muted); font-size: 14px; }
.moves .g-inaccuracy .gr, .moves .g-mistake .gr, .moves .g-blunder .gr, .moves .g-only .gr { color: var(--text); font-weight: 600; }
.moves .nl { font-size: 14px; margin-left: 6px; }
.moves td:target, .moment:target { outline: 2px solid var(--accent); outline-offset: -2px; }
.moment:target { outline-offset: 4px; border-radius: 4px; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.pager a { display: inline-block; padding: 10px 0; min-height: 44px; }

/* Index */
.games { list-style: none; margin: 0; padding: 0; }
.game h2 { font-size: 19px; margin: 0 0 4px; }
.game .meta { color: var(--muted); font-size: 15px; margin-bottom: 8px; }
.game p:last-child { margin-bottom: 0; }
.scroll { overflow-x: auto; margin: 16px 0; }
.score { font-size: 15px; font-variant-numeric: tabular-nums; min-width: 560px; }
.score th, .score td { padding: 6px 6px; border-bottom: 1px solid var(--hairline); text-align: center; }
.score tbody th { text-align: left; font-weight: 400; color: var(--muted); white-space: nowrap; }
.score thead th { color: var(--muted); font-weight: 600; }
.score thead a { display: inline-block; min-width: 24px; padding: 2px 0; }

.foot { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; color: var(--muted); font-size: 14px; }
.foot p { margin: 0 0 6px; }

@media (min-width: 640px) {
  h1 { font-size: 34px; }
  .game-head dl { grid-template-columns: 1fr 1fr; column-gap: 24px; }
  .graph { grid-template-rows: 180px auto; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (forced-colors: active) { .mk .dot, .gd { forced-color-adjust: none; } }
