/* 5D Chess Lab. A calm, flat look after lichess and infinitechess.org: warm neutral surfaces,
   one blue accent, 8 px radii, a 4/8 px spacing scale and Inter at a 14 px
   base. Light and dark come from html[data-theme]; board square colours from html[data-board].
   The canvas reads the --mv-* variables. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, 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-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, 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 {
  --font: "Inter", -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --r: 8px;
  --r-sm: 6px;
  --header-h: 52px;
  --side-w: 360px;
  --row-h: 28px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #161512;
  --panel: #262421;
  --inset: #302e2c;
  --zebra: #2b2926;
  --hover: rgba(255, 255, 255, .06);
  --border: #3c3a37;
  --border-strong: #55524e;
  --text: #bababa;
  --strong: #e3e3e3;
  --muted: #8a8784;
  --faint: #66625e;
  --accent: #3692e7;
  --accent-hover: #4aa0ec;
  --accent-text: #4aa0ec;
  --accent-soft: rgba(54, 146, 231, .28);
  --good: #629924;
  --bad: #cc3333;
  --warn: #c68a32;
  --shadow: 0 2px 8px rgba(0, 0, 0, .45);
  --gauge-white: #e6e6e6;
  --gauge-black: #3a3836;

  --mv-bg: #161512;
  --mv-lane: rgba(255, 255, 255, .022);
  --mv-text: #6f6b67;
  --mv-text-strong: #bababa;
  --mv-frame-w: #c9c5c0;
  --mv-frame-b: #0b0a09;
  --mv-outline: rgba(255, 255, 255, .10);
  --mv-present: rgba(54, 146, 231, .06);
  --mv-present-edge: rgba(80, 160, 235, .75);
  --mv-branch: rgba(186, 186, 186, .28);
  --mv-inactive: .45;
}

/* Light: an off-white page with white panels lifted by soft shadows (elevation is shadow, not
   tint, in light mode); near-black text; secondary text at about 5.5:1 on white; the accent, good,
   bad and warn colours all clear 4.5:1 on white and on the insets. Warm, low-chroma neutrals,
   in tune with the wooden board. */
html[data-theme="light"] {
  color-scheme: light;
  --page: #f2f1ef;
  --panel: #ffffff;
  --inset: #f5f4f2;
  --zebra: #faf9f8;
  --hover: rgba(28, 25, 23, .045);
  --border: #e3e1dd;
  --border-strong: #c9c5c0;
  --text: #33312e;
  --strong: #161514;
  --muted: #6b6762;
  --faint: #a19c96;
  --accent: #1a6fc2;
  --accent-hover: #155ea6;
  --accent-text: #1a6fc2;
  --accent-soft: rgba(26, 111, 194, .12);
  --good: #3d7a0e;
  --bad: #c42b2b;
  --warn: #9a6512;
  --shadow: 0 1px 2px rgba(28, 25, 23, .06), 0 4px 14px rgba(28, 25, 23, .08);
  --gauge-white: #ffffff;
  --gauge-black: #3a3734;

  --mv-bg: #e8e6e2;
  --mv-lane: rgba(28, 25, 23, .025);
  --mv-text: #8c8781;
  --mv-text-strong: #33312e;
  --mv-frame-w: #ffffff;
  --mv-frame-b: #2b2826;
  --mv-outline: rgba(28, 25, 23, .14);
  --mv-present: rgba(26, 111, 194, .08);
  --mv-present-edge: rgba(26, 111, 194, .7);
  --mv-branch: rgba(60, 56, 52, .25);
  --mv-inactive: .5;
}

/* Board squares (lichess themes) and highlights. */
html { --sq-light: #f0d9b5; --sq-dark: #b58863; }
html[data-board="blue"] { --sq-light: #dee3e6; --sq-dark: #8ca2ad; }
html[data-board="green"] { --sq-light: #ffffdd; --sq-dark: #86a666; }
html {
  --hl-last: rgba(155, 199, 0, .41);
  --hl-select: rgba(20, 85, 30, .5);
  --hl-target: rgba(20, 85, 30, .45);
  --hl-draft: rgba(54, 146, 231, .45);
  --hl-peek: rgba(200, 70, 40, .5);
  --hl-peek-select: rgba(200, 70, 40, .38);
  --hl-check: #e22;
  --ar-move: rgba(21, 120, 27, .78);
  --ar-check: rgba(170, 30, 30, .82);
  --ar-pv: rgba(0, 48, 136, .7);
  --ar-draft: rgba(54, 146, 231, .8);
}
html[data-theme="dark"] { --ar-pv: rgba(70, 130, 220, .8); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
.clock, .fg-clock, .og-clock, output, .num { font-variant-numeric: tabular-nums; }
code, kbd { font-family: var(--mono); font-size: .9em; }
kbd { padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--r-sm); background: var(--inset); color: var(--strong); }
h1, h2, h3 { letter-spacing: -.01em; }
h2 { font-weight: 650; }
svg { width: 18px; height: 18px; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.fine { font-size: 12px; color: var(--muted); margin: var(--s2) 0 0; text-align: center; }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.grow { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ------------------------------------------------------------ header */
.site-header {
  position: relative; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s3) 0 var(--s4);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.site-logo { font-weight: 700; color: var(--strong); text-decoration: none; letter-spacing: -.02em; }
.build { font: 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--muted); text-decoration: none; margin-left: 10px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border, currentColor); opacity: .75; align-self: center; }
.build:hover { opacity: 1; }
.site-logo { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
/* The "5D" in the logo: the header's strong silver, a touch bolder than the name (as
   infinitechess.org's omega beside its wordmark). */
.site-logo .logo-5d { font-size: 19px; font-weight: 900; letter-spacing: -.03em; color: var(--strong); }
.site-logo .logo-name { font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.site-nav { display: flex; height: 100%; }
/* Sections in two groups (Learn, Tools), each a dropdown that opens on hover or focus. */
.nav-group { position: relative; display: flex; }
.nav-top, .nav-link {
  display: flex; align-items: center; gap: 4px; padding: 0 var(--s3); border: 0; background: none; cursor: default;
  color: var(--muted); font: inherit; font-weight: 550; font-size: 14px; text-decoration: none;
  border-bottom: 2px solid transparent; border-top: 2px solid transparent;
}
.nav-link { cursor: pointer; }
.nav-caret { width: 14px; height: 14px; opacity: .7; }
.nav-link:hover, .nav-group:hover .nav-top, .nav-group:has(:focus-visible) .nav-top { color: var(--strong); }
.nav-link.on, .nav-group.on .nav-top { color: var(--strong); border-bottom-color: var(--accent); }
.nav-drop {
  position: absolute; top: calc(100% - 4px); left: 4px; min-width: 190px; z-index: 120;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .12s, transform .12s;
}
/* Open while hovered, or while the keyboard is in it (a mouse click leaves no focus ring, so it
   closes as the pointer leaves). */
.nav-group:hover .nav-drop, .nav-group:has(:focus-visible) .nav-drop { opacity: 1; transform: none; pointer-events: auto; }
.nav-drop a { padding: 8px 12px; border-radius: var(--r-sm); white-space: nowrap; color: var(--text); text-decoration: none; font-size: 14px; }
.nav-drop a:hover { background: var(--hover); color: var(--strong); }
.nav-drop a.on { color: var(--strong); background: var(--accent-soft); }
.site-actions { margin-left: auto; display: flex; gap: 2px; }
html[data-theme="light"] .only-dark, html[data-theme="dark"] .only-light { display: none; }

.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border: 0; border-radius: var(--r); background: none; color: var(--muted);
}
.icon-btn:hover { color: var(--strong); background: var(--hover); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  height: 32px; padding: 0 var(--s3); border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--inset); color: var(--strong);
  font-weight: 600; font-size: 13px; white-space: nowrap;
}
.btn:hover { background: var(--hover); border-color: var(--faint); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.primary.danger { background: var(--bad); border-color: var(--bad); }
.btn.sm { height: 28px; padding: 0 var(--s2); font-size: 12.5px; }
.btn.block { width: 100%; height: 40px; font-size: 14px; }
.input, select, textarea {
  height: 32px; padding: 0 var(--s2); border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--inset); color: var(--strong); outline: none;
}
select { padding-right: var(--s1); }
.input.sm, select { height: 30px; font-size: 13px; }
.input.num { width: 104px; }
.input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { width: 100%; height: 180px; padding: var(--s2); font: 12.5px/1.5 var(--mono); resize: vertical; }
.field { display: flex; flex-direction: column; gap: var(--s1); margin-bottom: var(--s3); }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.field.book-row { flex-direction: row; align-items: center; gap: var(--s2); }
.field-heading { position: relative; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field-help { display: inline-flex; }
.help-dot { display: grid; place-items: center; width: 16px; height: 16px; padding: 0; border: 1px solid var(--border-strong); border-radius: 50%; background: none; color: var(--muted); font-size: 11px; line-height: 1; cursor: help; }
.help-dot:hover, .help-dot:focus-visible { color: var(--strong); border-color: var(--text); }
.help-tip { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: 280px; max-width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--panel); box-shadow: var(--shadow); color: var(--text); font-size: 12px; font-weight: 400; line-height: 1.5; opacity: 0; visibility: hidden; pointer-events: none; }
.field-help:hover .help-tip, .field-help:focus-within .help-tip { opacity: 1; visibility: visible; }
.book-hint { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 6px 10px; border-top: 1px solid var(--border); font-size: 13px; }
.book-hint .book-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.book-hint .book-move { cursor: pointer; }
.book-hint .book-move:hover { text-decoration: underline; }
.book-hint .book-move.know { color: var(--muted); text-decoration: line-through; }
.opening-label { display: flex; align-items: flex-start; gap: 8px; flex: 0 0 auto; padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--strong); font-size: 13px; line-height: 1.5; }
.opening-label svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; }
.opening-title { font-weight: 600; overflow-wrap: anywhere; }
.variant-cell .opening-name { display: block; margin-top: 4px; max-width: 260px; color: var(--muted); font-size: 12px; white-space: normal; }
.error { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); padding: var(--s2); border-radius: var(--r-sm); font-size: 13px; white-space: pre-wrap; margin-top: var(--s2); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; margin-bottom: var(--s2); }
.seg button { border: 0; background: var(--inset); padding: var(--s1) var(--s3); font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent); color: #fff; }

.switch { position: relative; width: 34px; height: 18px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 9px; background: var(--border-strong); transition: background .15s; pointer-events: none; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.panel { background: var(--panel); border-radius: var(--r); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.panel-title { font-size: 15px; margin: 0 0 var(--s3); color: var(--strong); }

/* ------------------------------------------------------------ workspace */
#app { height: calc(100% - var(--header-h)); }
/* Hidden until the page the address names is shown (index.html, page.js): no flash of another page. */
html[data-boot] #app { visibility: hidden; }
.workspace { display: flex; height: 100%; gap: 0; }
.board-area { position: relative; flex: 1; min-width: 0; background: var(--mv-bg); overflow: hidden; }
#board { display: block; width: 100%; height: 100%; touch-action: none; outline: none; cursor: grab; }
#board.dragging { cursor: grabbing; }
#board.pointing { cursor: pointer; }

.eval-gauge { position: relative; flex: 0 0 12px; background: var(--gauge-white); overflow: hidden; border-left: 1px solid var(--border); }
.gauge-black { position: absolute; left: 0; right: 0; top: 0; height: 50%; background: var(--gauge-black); transition: height .4s ease; }
.gauge-tick { position: absolute; left: 0; right: 0; height: 1px; background: rgba(128, 128, 128, .45); }
.gauge-tick.zero { height: 2px; margin-top: -1px; background: var(--warn); opacity: .8; }
.eval-gauge.flipped { transform: rotate(180deg); }

.side {
  width: var(--side-w); flex: none; min-height: 0; overflow-y: auto;
  background: var(--page); padding: var(--s2);
}
.side-view { display: flex; flex-direction: column; gap: var(--s2); height: 100%; }
.side-view > * { flex: none; }

.board-tools {
  position: absolute; right: var(--s2); top: var(--s2); display: flex; flex-direction: column;
  background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
}
.tool { width: 32px; height: 32px; border: 0; background: none; display: grid; place-items: center; color: var(--muted); }
.tool svg { width: 17px; height: 17px; }
.tool:hover { color: var(--strong); background: var(--hover); }
.tool.on { color: var(--accent); }

.coord-chip {
  position: absolute; right: 52px; bottom: var(--s2); padding: 1px var(--s2); border-radius: var(--r-sm);
  font-size: 12px; background: var(--panel); color: var(--muted); pointer-events: none; font-variant-numeric: tabular-nums;
}
.coord-chip:empty { display: none; }

.draft-bar {
  position: absolute; left: 50%; bottom: var(--s3); transform: translateX(-50%);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); max-width: min(720px, calc(100% - 2 * var(--s3)));
  padding: var(--s2) var(--s2) var(--s2) var(--s3); border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.draft-moves { display: flex; flex-wrap: wrap; gap: var(--s1); font-size: 13px; color: var(--strong); }
.draft-moves .chip { padding: 1px 6px; border-radius: var(--r-sm); background: var(--inset); }
.draft-actions { display: flex; gap: var(--s1); margin-left: auto; }
.draft-hint { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.draft-hint:empty { display: none; }
.draft-hint.bad { color: var(--bad); }

.toast-host { position: absolute; left: 50%; top: var(--s3); transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--s1); align-items: center; pointer-events: none; z-index: 10; }
.toast { padding: 6px var(--s3); border-radius: var(--r); background: var(--panel); color: var(--strong); font-size: 13px; box-shadow: var(--shadow); border: 1px solid var(--border); max-width: 520px; }
.toast.err { border-color: var(--bad); color: var(--bad); }

/* ------------------------------------------------------------ analysis panel */
.game-info { padding: var(--s2) var(--s3); }
.players { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s2); color: var(--strong); font-weight: 600; }
.player { display: flex; align-items: center; gap: 6px; min-width: 0; }
.player > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player.right { justify-content: flex-end; }
.side-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 1px solid var(--border-strong); }
.side-dot.white { background: #fff; }
.side-dot.black { background: #222; }
.result { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--strong); }
.game-meta { margin-top: var(--s1); font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 var(--s2); }
.game-meta:empty { display: none; }
.game-meta .sep::before { content: "·"; margin-right: var(--s2); color: var(--faint); }
.game-meta button { border: 0; background: none; padding: 0; color: var(--accent); font-size: inherit; }
.game-meta button:hover { text-decoration: underline; }
.status-line { margin-top: var(--s1); font-size: 13px; color: var(--text); }
.status-line:empty { display: none; }
.tl-line { display: flex; flex-wrap: wrap; gap: 0 var(--s2); margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.tl-line:empty { display: none; }
.tl-line b { color: var(--text); font-weight: 600; }
.play-tl { margin: 0; padding: var(--s1) var(--s3); border-bottom: 1px solid var(--border); }
.status-line.check { color: var(--bad); }
.status-line.over { color: var(--strong); font-weight: 600; }

.ceval { overflow: hidden; }
.ceval-progress { height: 2px; background: transparent; }
.ceval-progress div { height: 100%; width: 0; background: var(--good); transition: width .3s; }
.ceval-head { display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s2) 6px var(--s3); background: var(--inset); }
.ceval-eval { min-width: 64px; font-size: 20px; font-weight: 700; color: var(--strong); text-align: center; font-variant-numeric: tabular-nums; }
.ceval-info { flex: 1; min-width: 0; line-height: 1.3; }
.ceval-name { font-size: 13px; font-weight: 600; color: var(--strong); }
.ceval-name span { font-weight: 400; color: var(--muted); }
.ceval-stats { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ceval-lines:empty { display: none; }
.ceval-settings { padding: var(--s2) var(--s3); border-top: 1px solid var(--border); display: grid; gap: var(--s2); background: var(--panel); }
.setting { display: grid; grid-template-columns: 72px 1fr 44px; align-items: center; gap: var(--s2); font-size: 13px; }
.setting > span { color: var(--muted); font-weight: 600; font-size: 12px; }
.setting select { grid-column: 2 / 4; }
.setting input[type="range"] { width: 100%; accent-color: var(--accent); }
.setting output { text-align: right; font-weight: 600; color: var(--strong); font-variant-numeric: tabular-nums; }
.setting-note { margin: 0; font-size: 12px; color: var(--muted); }
.setting-note:empty { display: none; }
#engine-settings-btn[aria-expanded="true"] { color: var(--accent); }
.engine-line { position: relative; display: flex; gap: var(--s2); padding: 5px 26px 5px var(--s3); font-size: 13px; line-height: 1.4; border-top: 1px solid var(--border); }
.line-eval { flex: none; min-width: 44px; font-weight: 700; color: var(--strong); font-variant-numeric: tabular-nums; }
.line-moves { display: flex; flex-wrap: wrap; gap: 0 3px; min-width: 0; color: var(--text); }
/* Collapsed (the default): the line on one row, fading out at its end; the toggle at the right
   end shows it whole (as on lichess). */
.engine-line.collapsed .line-moves { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.engine-line.collapsed .line-move { flex: none; }
.engine-line.collapsed.fits .line-moves { -webkit-mask-image: none; mask-image: none; }
.engine-line.collapsed.fits .line-toggle { visibility: hidden; }
.line-toggle { position: absolute; top: 0; right: 0; width: 24px; height: 100%; max-height: 30px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 11px; cursor: pointer; }
.line-toggle::before { content: "▲"; }
.engine-line.collapsed .line-toggle::before { content: "▼"; }
.line-toggle:hover { background: var(--accent-soft); color: var(--strong); }
.line-move { padding: 0 3px; border-radius: var(--r-sm); cursor: pointer; }
.line-move:hover { background: var(--accent-soft); color: var(--strong); }
.line-move .num { color: var(--muted); margin-right: 2px; }

.moves-panel { flex: 1 1 0; min-height: 220px; display: flex; flex-direction: column; overflow: hidden; }
.moves { flex: 1; overflow-y: auto; outline: none; font-size: 13.5px; min-height: 0; }
.mv-row { display: grid; grid-template-columns: 40px 1fr 1fr; }
.mv-num { display: flex; align-items: flex-start; justify-content: center; padding-top: 5px; background: var(--inset); color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; border-right: 1px solid var(--border); }
.mv { position: relative; display: flex; align-items: baseline; gap: var(--s1); min-height: var(--row-h); padding: 4px var(--s2); cursor: pointer; color: var(--text); word-break: break-word; line-height: 1.4; }
.mv:hover { background: var(--hover); color: var(--strong); }
.mv.cur { background: var(--accent-soft); color: var(--strong); font-weight: 600; }
.mv.book { color: var(--muted); }
.mv-book { flex: none; width: 14px; height: 14px; align-self: center; }
.mv.empty { cursor: default; color: var(--faint); }
.mv.empty:hover { background: none; }
.mv-eval { margin-left: auto; flex: none; font-size: 11.5px; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.mv-comment { grid-column: 1 / 4; font-size: 12.5px; color: var(--muted); padding: var(--s1) var(--s3); background: var(--zebra); }
.variation { grid-column: 1 / 4; padding: var(--s1) var(--s3) var(--s1) 48px; font-size: 12.5px; color: var(--muted); background: var(--zebra); display: flex; flex-wrap: wrap; gap: 0 var(--s1); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.variation .vmv { cursor: pointer; padding: 0 2px; border-radius: var(--r-sm); }
.variation .vmv:hover { color: var(--strong); background: var(--hover); }
.variation .vmv.cur { background: var(--accent-soft); color: var(--strong); }
.moves-empty { padding: var(--s3); color: var(--muted); font-size: 13px; }
.graph-wrap { height: 72px; border-top: 1px solid var(--border); flex: none; }
#graph { width: 100%; height: 100%; display: block; cursor: pointer; }
.controls { display: flex; border-top: 1px solid var(--border); flex: none; }
.ctrl { flex: 1; height: 38px; border: 0; background: none; display: grid; place-items: center; color: var(--text); }
.ctrl svg { width: 20px; height: 20px; }
.ctrl:hover:not(:disabled) { background: var(--hover); color: var(--strong); }
.ctrl:disabled { color: var(--faint); cursor: default; }
.ctrl .when-playing, .ctrl.playing .when-paused { display: none; }
.ctrl.playing .when-playing { display: block; }
.side-links { display: flex; gap: var(--s1); flex-wrap: wrap; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: var(--s1) var(--s2); border-radius: var(--r-sm); color: var(--muted); font-size: 13px; }
.link-btn svg { width: 15px; height: 15px; }
.link-btn:hover { color: var(--strong); background: var(--hover); }
.side-links .continue-btn { color: var(--accent); margin-right: auto; }
.analysis-actions { position: relative; }
.analysis-actions summary { list-style: none; cursor: pointer; }
.analysis-actions summary::-webkit-details-marker { display: none; }
.analysis-actions summary span { font-size: 18px; line-height: 1; }
.analysis-actions[open] summary { color: var(--strong); background: var(--hover); }
.analysis-actions-list { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 20; min-width: 180px; padding: 5px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--panel); box-shadow: var(--shadow); }
.analysis-actions-list .link-btn { width: 100%; padding: 10px 12px; white-space: nowrap; }
/* Variant picker (as infinitechess.org's analysis sidebar): a button showing the variant;
   it opens the groups, and a group its variants. */
.variant-setup { display: flex; flex-direction: column; gap: 6px; padding: var(--s2) 10px; overflow: visible; position: relative; z-index: 5; }
.model-label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; text-align: center; }
.variant-selector { position: relative; }
.variant-display { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; background: var(--inset); border: 1px solid var(--border); border-radius: 6px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); color: var(--strong); font-size: 14px; cursor: pointer; text-align: left; }
.variant-display:hover { border-color: var(--border-strong); }
.variant-display.open { border-color: var(--text); }
.variant-display .variant-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selector-arrow { width: 15px; height: 15px; flex: none; color: var(--muted); transition: transform .15s; }
.variant-display.open .selector-arrow { transform: rotate(180deg); }
.variant-dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; display: none; max-height: min(420px, 60vh); overflow-y: auto; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: var(--shadow); }
.variant-dropdown.open { display: block; }
.variant-group-item, .variant-list-back, .variant-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; font-size: 14px; text-align: left; cursor: pointer; color: var(--strong); }
.variant-group-item + .variant-group-item, .variant-item + .variant-item { border-top: 1px solid var(--border); }
.variant-group-item:hover, .variant-list-back:hover, .variant-item:hover { background: var(--inset); }
.variant-item.on, .variant-group-item.on .group-name { color: var(--accent); font-weight: 600; }
.variant-list-back { border-bottom: 1px solid var(--border-strong); position: sticky; top: 0; background: var(--panel); }
.group-name { flex: none; min-width: 92px; color: var(--strong); }
.group-desc { flex: 1; min-width: 0; color: var(--muted); font-size: 12.5px; }
.group-arrow, .back-arrow { width: 14px; height: 14px; flex: none; color: var(--muted); }

/* ------------------------------------------------------------ play panel */
.play-setup { padding: var(--s4); }
.busy { margin-bottom: var(--s4); padding-bottom: var(--s4); border-bottom: 1px solid var(--border); }
.busy-title { font-weight: 600; color: var(--warn); }
.busy p { margin: var(--s1) 0 var(--s3); font-size: 13px; }
.color-pick { display: flex; gap: var(--s2); }
.color-pick button { flex: 1; height: 52px; display: grid; place-items: center; grid-auto-flow: column; border: 1px solid var(--border); border-radius: var(--r); background: var(--inset); padding: 0; }
.color-pick button img { width: 38px; height: 38px; }
.color-pick button img.half { width: 28px; height: 28px; }
.color-pick button:hover { border-color: var(--border-strong); }
.color-pick button.on { border-color: var(--accent); background: var(--accent-soft); }
.tc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s1); }
.tc-grid button { height: 40px; border: 1px solid var(--border); border-radius: var(--r); background: var(--inset); color: var(--text); font-size: 15px; font-weight: 600; }
.tc-grid button:hover { border-color: var(--border-strong); color: var(--strong); }
.tc-grid button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--strong); }
.tc-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: 48px; line-height: 1.15; }
.tc-grid button small { font-size: 11px; font-weight: 500; color: var(--muted); }
.tc-grid button.on small { color: var(--text); }
.tc-custom { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s2); }
.tc-custom label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; }
.tc-custom .input { width: 100%; }
.tc-desc { margin: var(--s2) 0 0; font-size: 12.5px; color: var(--muted); }
.tc-desc:empty { display: none; }
.skill-field { border: 0; padding: 0; margin: 0 0 var(--s4); min-width: 0; }
.skill-field legend { padding: 0; margin-bottom: var(--s1); font-size: 12px; font-weight: 600; color: var(--muted); }
.skill-pick { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.skill-pick label { position: relative; cursor: pointer; }
.skill-pick input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.skill-pick span { display: grid; place-items: center; height: 36px; border: 1px solid var(--border); border-radius: var(--r); background: var(--inset); color: var(--text); font-size: 14px; font-weight: 600; }
.skill-pick label:hover span { border-color: var(--border-strong); color: var(--strong); }
.skill-pick input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--strong); }
.skill-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.clock-delay { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--good); font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock-delay:empty { display: none; }
.player-bar.delaying .clock { background: color-mix(in srgb, var(--accent) 35%, var(--inset)); color: var(--strong); }

.play-live { display: flex; flex-direction: column; overflow: hidden; flex: 1 1 0; min-height: 320px; }
.player-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 0 0 0 var(--s3); min-height: 48px; background: var(--inset); }
.pname { font-weight: 600; color: var(--strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clock { min-width: 112px; align-self: stretch; display: flex; align-items: center; justify-content: flex-end; padding: 0 var(--s3); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.player-bar.running .clock { background: var(--accent); color: #fff; }
.player-bar.running.low .clock { background: var(--bad); }
.player-bar.low .clock { color: var(--bad); }
.player-bar.running.low .clock { color: #fff; }
.play-status { padding: var(--s2) var(--s3) 0; font-weight: 600; color: var(--strong); }
.play-status.yours { color: var(--good); }
.play-moves { flex: 1; min-height: 120px; }
.thinking { padding: var(--s1) var(--s3); font-size: 12px; line-height: 1.4; color: var(--muted); min-height: 24px; overflow-wrap: anywhere; border-top: 1px solid var(--border); }
.play-actions { display: flex; border-top: 1px solid var(--border); }
.ctrl-text { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border: 0; background: none; color: var(--text); font-size: 13px; font-weight: 600; }
.ctrl-text svg { width: 16px; height: 16px; }
.ctrl-text:hover { background: var(--hover); color: var(--strong); }
#play-resign:hover { color: var(--bad); }
.spectators { font-size: 12px; color: var(--muted); padding: var(--s1) var(--s3); }
.spectators:empty { display: none; }

/* ------------------------------------------------------------ game browser */
.browser { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); height: 100%; padding: 0 var(--s2) var(--s2); }
.games-note { margin: 0 0 var(--s2); font-size: 12.5px; color: var(--muted); }
.games .res.win { color: var(--good); }
.games .res.loss { color: var(--bad); }
.games .side-cell { white-space: nowrap; }
.games .del { width: 1%; text-align: right; }
.games .del button { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: var(--r-sm); cursor: pointer; }
.games .del button:hover { color: var(--bad); background: var(--hover); }
.btn.danger:not(.primary) { color: var(--bad); }
.games .kind { display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 3px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; vertical-align: 1px; }
.games .kind.played { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--strong); }
.games .kind.saved { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--strong); }
.games .kind.online { background: color-mix(in srgb, var(--warn) 26%, transparent); color: var(--strong); }
.games .name-cell { white-space: normal; min-width: 160px; color: var(--strong); }
.games .notes { display: block; font-size: 11.5px; color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.games .date-cell, .games .engine-cell { color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.game-meta .game-name { flex-basis: 100%; font-weight: 600; color: var(--strong); }
.games-panel { padding: var(--s3); min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.games-head { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; justify-content: space-between; margin-bottom: var(--s2); }
.games-head .panel-title { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s1); }
.table-wrap { flex: 1; overflow: auto; }
table.games { width: 100%; border-collapse: collapse; font-size: 13px; }
.games th { white-space: nowrap; position: sticky; top: 0; background: var(--panel); text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 6px var(--s2); border-bottom: 1px solid var(--border); }
.games td { padding: 6px var(--s2); white-space: nowrap; }
.games tbody tr:nth-child(even) { background: var(--zebra); }
.games tbody tr { cursor: pointer; }
.games tbody tr:hover { background: var(--accent-soft); color: var(--strong); }
.games .num { text-align: right; font-variant-numeric: tabular-nums; }
.games .center { text-align: center; }
.games .res { font-weight: 700; color: var(--strong); text-align: center; font-variant-numeric: tabular-nums; }
.games .reason { color: var(--muted); max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.empty-state { padding: var(--s5) var(--s4); text-align: center; color: var(--muted); }

/* ------------------------------------------------------------ dialogs */
.modal { border: 1px solid var(--border); padding: 0; border-radius: var(--r); background: var(--panel); color: var(--text); box-shadow: 0 8px 30px rgba(0, 0, 0, .45); width: min(620px, calc(100vw - 2 * var(--s3))); }
.modal::backdrop { background: rgba(0, 0, 0, .55); }
.modal-body { padding: var(--s4) var(--s4) var(--s3); }
.modal h2 { margin: 0 0 var(--s2); font-size: 17px; color: var(--strong); }
.modal p { margin: 0 0 var(--s3); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s4); }
.modal.confirm { width: min(380px, calc(100vw - 2 * var(--s3))); }
/* The move list's right-click menu. */
.ctx-menu { position: fixed; z-index: 100; min-width: 190px; max-width: 280px; padding: 4px 0; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: var(--shadow); }
.ctx-title { padding: 6px 12px 7px; margin-bottom: 4px; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-item { display: block; width: 100%; padding: 8px 12px; border: 0; background: none; text-align: left; font-size: 13.5px; color: var(--strong); cursor: pointer; }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--inset); outline: none; }
.ctx-item.danger { color: var(--bad); }
.modal.confirm p { margin: 0; }
.load-row { display: flex; align-items: flex-end; gap: var(--s2); margin-top: var(--s3); }
.load-row .field { margin: 0; }
.jsonl-pick { margin-top: var(--s2); max-height: 180px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
.jsonl-pick .pick { display: flex; gap: var(--s3); padding: var(--s1) var(--s2); font-size: 12.5px; cursor: pointer; }
.jsonl-pick .pick:nth-child(even) { background: var(--zebra); }
.jsonl-pick .pick:hover { background: var(--hover); }
.jsonl-pick .pick.on { background: var(--accent-soft); color: var(--strong); }
.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.keys td { padding: 6px var(--s1); border-bottom: 1px solid var(--border); }
.keys td:first-child { white-space: nowrap; width: 46%; }

/* ------------------------------------------------------------ narrow screens */
@media (max-width: 980px) {
  :root { --side-w: 320px; }
}
/* Phones and narrow windows (portrait): an app layout. The board stays at the top, the
   panels scroll under it, and the move controls sit at the bottom edge; nothing scrolls the
   page itself, so dragging the board never scrolls it away. */
@media (max-width: 800px) and (orientation: portrait), (max-width: 560px) {
  :root { --header-h: 46px; }
  html, body { height: 100%; overscroll-behavior: none; }
  #app { height: calc(100% - var(--header-h)); height: calc(100dvh - var(--header-h)); }
  button, a, .mv, .variant-display, label.switch { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

  .site-header { gap: 6px; padding: 0 2px 0 var(--s3); }
  .site-logo .logo-name, .build, #btn-help { display: none; }
    .site-actions { gap: 0; }
  .site-actions .icon-btn { width: 34px; height: 36px; }

  .workspace { flex-direction: column; height: 100%; }
  .board-area { flex: none; height: 50%; min-height: 220px; }
  .eval-gauge { display: none !important; }
  .side { width: 100%; flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s2) var(--s2) calc(var(--s2) + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
  #side-analysis { padding-bottom: 50px; }
  .side-view { height: auto; }
  .moves-panel, .play-live { flex: none; min-height: 0; }
  .moves { max-height: none; }
  .play-moves { max-height: none; min-height: 0; }
  #side-analysis .controls { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--panel); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 8px rgba(0, 0, 0, .25); }
  .ctrl { height: 46px; }
  .ctrl svg { width: 22px; height: 22px; }

  /* Bigger touch targets in the lists and buttons. */
  .mv { min-height: 36px; padding-top: 7px; padding-bottom: 7px; }
  .mv-num { padding-top: 9px; }
  .link-btn { padding: 10px var(--s3); font-size: 14px; }
  .side-links { justify-content: center; }
  .btn { min-height: 38px; }
  .seg button { min-height: 40px; }

  /* The variant picker as one compact row. */
  .variant-setup { flex-direction: row; align-items: center; gap: var(--s2); padding: 6px var(--s2); }
  .model-label { display: none; }
  .variant-selector { flex: 1; min-width: 0; }
  .variant-display { padding: 8px 12px; }
  .variant-group-item, .variant-list-back, .variant-item { padding: 12px; }
  /* The menu as a sheet above the move controls, rather than under them. */
  .variant-dropdown { position: fixed; top: auto; left: var(--s2); right: var(--s2); bottom: calc(54px + env(safe-area-inset-bottom)); z-index: 40; max-height: min(70dvh, 520px); box-shadow: 0 -4px 24px rgba(0, 0, 0, .5); }
  .group-name { min-width: 84px; }

  /* View tools along the top of the board, out of the way of the action bar. */
  .board-tools { flex-direction: row; top: auto; bottom: var(--s2); right: var(--s2); opacity: .92; }
  .tool { width: 38px; height: 38px; }
  .coord-chip { display: none; }
  .draft-bar { top: 26px; bottom: auto; left: var(--s2); right: var(--s2); transform: none; max-width: none; }
  .draft-actions .btn { min-height: 40px; }
  .draft-hint:not(.bad) { display: none; }
  .toast-host { top: auto; bottom: var(--s3); width: calc(100% - 2 * var(--s3)); }

  /* Game browser and rules: their own scroll area under the header. */
  .browser { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; height: 100%; overflow-y: auto; padding: var(--s2); }
  .games-panel { min-height: 60vh; }
  .filters { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s1); }
  .filters > *, .filters .input.num { min-width: 0; width: 100%; max-width: none; }
  .table-wrap { max-height: none; overflow-x: auto; }
  /* Your games as cards: the name and its buttons, then the result and how it was played, then the date. */
  table.games, table.games tbody { display: block; }
  table.games thead, table.games .engine-cell { display: none; }
  table.games tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
  .games td { padding: 0; font-size: 12px; color: var(--muted); }
  .games td.name-cell { order: 0; flex: 1 1 calc(100% - 72px); min-width: 0; font-size: 14px; color: var(--strong); overflow-wrap: break-word; line-height: 1.35; }
  .games td.del { order: 1; width: auto; }
  .games td.del button { padding: 4px 8px; font-size: 18px; }
  .games td.res, .games td.reason, .games td.num, .games td.variant-cell, .games td.tc-cell { order: 3; }
  .games td.res { text-align: left; }
  .games td.reason { max-width: none; white-space: normal; }
  .games td.num:not(:empty)::after { content: attr(data-unit); }
  .games td.date-cell { order: 4; flex-basis: 100%; font-size: 11.5px; }
  .games .notes { max-width: none; white-space: normal; }
  .games td.empty-state { flex: 1; text-align: center; padding: var(--s4) 0; }
  .rules { padding: 0; }
  .rules-doc { padding: var(--s2) var(--s4) var(--s5); }
  .rules-doc h1 { font-size: 22px; }

  /* Dialogs fill the width and scroll inside. */
  .modal { width: calc(100vw - 2 * var(--s2)); max-height: calc(100dvh - 2 * var(--s3)); overflow-y: auto; }
  .modal-body { padding: var(--s3); }
  .modal-actions .btn { flex: 1; }
  .load-row { flex-wrap: wrap; }
  .load-row > * { flex: 1 1 100%; }
}

/* Very small phones (320-360 px): a tighter header. */
@media (max-width: 360px) {
  .site-header { padding-left: var(--s2); gap: 2px; }
}

/* Phones held sideways: board and panels side by side, with a narrower panel. */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --header-h: 40px; --side-w: min(300px, 42vw); }
  .site-logo .logo-name, .build, #btn-help { display: none; }
  .nav-top { padding: 0 8px; font-size: 12px; }
  .eval-gauge { display: none !important; }
  .side { padding: 6px; }
  .model-label { display: none; }
  .variant-setup { padding: 6px; }
  .coord-chip { display: none; }
  .tool { width: 34px; height: 34px; }
  .modal { max-height: calc(100dvh - 16px); overflow-y: auto; }
}

/* ---------------------------------------------------------------- rules page */
.rules { height: 100%; overflow-y: auto; padding: 0 var(--s2) var(--s4); }
.rules-doc { max-width: 780px; margin: 0 auto; padding: var(--s3) var(--s3) var(--s4); line-height: 1.6; }
.rules-doc h1 { font-size: 26px; margin: var(--s3) 0 var(--s2); color: var(--strong); letter-spacing: -.02em; }
.rules-doc h2 { font-size: 18px; margin: var(--s4) 0 var(--s2); padding-top: var(--s2); border-top: 1px solid var(--border); color: var(--strong); scroll-margin-top: var(--s2); }
.rules-doc p, .rules-doc li { color: var(--text); }
.rules-doc b, .rules-doc em { color: var(--strong); }
.rules-doc ul { padding-left: 20px; margin: var(--s2) 0; }
.rules-doc li { margin: 6px 0; }
.rules-doc code { padding: 1px 5px; border-radius: var(--r-sm); background: var(--inset); color: var(--strong); font-size: .92em; }
.rules-doc .lead { font-size: 15px; color: var(--text); }
.rules-doc blockquote { margin: var(--s2) 0; padding: var(--s2) var(--s3); border-left: 3px solid var(--accent); background: var(--inset); border-radius: 0 var(--r) var(--r) 0; color: var(--strong); font-weight: 600; }
.rules-toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: var(--s3) 0; font-size: 13px; }
.rules-toc a { color: var(--accent); text-decoration: none; }
.rules-toc a:hover { text-decoration: underline; }
.rules-table { width: 100%; border-collapse: collapse; margin: var(--s2) 0; font-size: 14px; }
.rules-table th, .rules-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.rules-table th { color: var(--strong); font-weight: 600; }

/* ------------------------------------------------------------ board editor */
.workspace.editing #eval-bar, .workspace.editing #draft-bar, .workspace.editing #tool-autosubmit, .workspace.editing #tool-present { display: none !important; }
.ed-panel { padding: var(--s3); }
.ed-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s2); }
.ed-head .panel-title { margin: 0; }
.ed-history { display: flex; gap: 2px; }
.ed-history .icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.ed-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s1); margin-bottom: var(--s2); }
.ed-tools button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 48px; border: 1px solid var(--border); border-radius: var(--r); background: var(--inset); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.ed-tools button svg { width: 18px; height: 18px; }
.ed-tools button:hover { border-color: var(--border-strong); color: var(--strong); }
.ed-tools button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--strong); }
.ed-palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.ed-palette button { aspect-ratio: 1; display: grid; place-items: center; padding: 2px; border: 1px solid transparent; border-radius: var(--r-sm); background: var(--inset); }
.ed-palette button:nth-child(n+13) { background: color-mix(in srgb, var(--inset) 80%, var(--strong) 8%); }
.ed-palette button img { width: 100%; height: 100%; max-width: 42px; max-height: 42px; pointer-events: none; }
.ed-palette button:hover { border-color: var(--border-strong); }
.ed-palette button.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.ed-palette button:nth-child(13) { margin-top: 0; }
.ed-hint { margin: var(--s2) 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); min-height: 3em; }
.ed-sel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); font-size: 13px; color: var(--strong); }
.ed-sel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s1); }
.ed-sel-actions .btn.danger { color: var(--bad); }
.ed-status { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-bottom: var(--s3); }
.ed-st { line-height: 1.4; }
.ed-st.head { font-size: 14px; color: var(--text); }
.ed-st.head strong { color: var(--strong); }
.ed-st.muted { color: var(--muted); font-size: 12.5px; }
.ed-st.warn { color: var(--warn); font-weight: 600; }
.ed-st.bad { color: var(--bad); }
.ed-st.note { color: var(--muted); font-size: 12.5px; padding-left: 14px; position: relative; }
.ed-st.note::before { content: "!"; position: absolute; left: 2px; font-weight: 700; color: var(--warn); }
.ed-st .link-btn { padding: 0 4px; color: var(--accent); font-weight: 600; }
.ed-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.ed-row { display: flex; gap: var(--s1); align-items: center; }
.ed-row select { flex: 1; min-width: 0; }
.ed-quick { margin: calc(-1 * var(--s1)) 0 var(--s3); }
.ed-quick .btn { flex: 1; }
.ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.ed-grid .field { margin-bottom: var(--s2); }
.ed-size select { flex: 1; }
.ed-size span { color: var(--muted); }
.ed-layout { margin: 0; display: flex; }
.ed-layout button { flex: 1; height: 30px; }
.ed-promos { display: flex; flex-wrap: wrap; gap: 3px; }
.ed-promos button { width: 34px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--inset); opacity: .45; }
.ed-promos button img { width: 100%; height: 100%; pointer-events: none; }
.ed-promos button.on { opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.ed-text-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: var(--s1); }
.ed-text-btns { display: flex; }
.ed-text-btns .link-btn { font-size: 12px; padding: 2px 6px; }
#ed-fen { height: auto; min-height: 120px; font-size: 11.5px; white-space: pre; overflow-x: auto; }
#ed-fen.bad { border-color: var(--bad); }
.ed-fen-error { margin-top: var(--s1); font-size: 12px; color: var(--bad); }

/* Phones: five sections in the header (no board-colour button there), and the editor's
   palette as one row per colour. */
@media (max-width: 800px) and (orientation: portrait), (max-width: 560px) {
  .ed-palette { grid-template-columns: repeat(12, 1fr); gap: 2px; }
  .ed-palette button { padding: 1px; }
  .ed-tools button { height: 42px; }
  .ed-hint { min-height: 0; }
}
.keys-head { margin: var(--s4) 0 var(--s1); font-size: 14px; color: var(--strong); }
.openings { height:100%; overflow-y:auto; padding:24px; }
.openings-page { max-width:1100px; margin:0 auto; padding:24px 32px 40px; background:var(--panel); border-radius:var(--r); box-shadow:var(--shadow); }
.openings-toolbar { display:flex; justify-content:space-between; align-items:center; gap:16px; padding-bottom:20px; border-bottom:1px solid var(--border); }
.openings-home { text-decoration:none; color:var(--muted); font-size:13px; text-transform:uppercase; letter-spacing:.08em; }
.openings-toolbar .variant-selector { width:280px; max-width:65%; }
.opening-path { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; margin-top:22px; font-size:13px; }
.opening-path a { text-decoration:none; }
.opening-path a:hover { text-decoration:underline; }
.opening-path [aria-current="page"] { color:var(--strong); }
.path-separator { color:var(--faint); }
.opening-heading h1 { font-weight:400; font-size:30px; line-height:1.3; color:var(--strong); margin:20px 0; }
.opening-actions { display:flex; flex-wrap:wrap; gap:8px; }
.opening-actions a { text-decoration:none; }
.opening-intro { display:flex; align-items:center; gap:28px; }
.opening-intro > .opening-boards { width:300px; flex:none; }
.opening-next-heading { font-size:17px; font-weight:400; color:var(--muted); margin:28px 0 16px; }
.opening-nexts { display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:24px; align-items:start; }
.opening-next { display:flex; flex-direction:column; background:var(--zebra); color:var(--strong); border:1px solid var(--border-strong); border-radius:var(--r); overflow:hidden; text-decoration:none; transition:border-color .15s,background .15s; }
.opening-next:hover { border-color:var(--accent); background:var(--accent-soft); }
.opening-next:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
.opening-next-title { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:64px; padding:12px 14px; }
.opening-next-title strong { font-size:18px; font-weight:400; overflow-wrap:anywhere; }
.opening-next-move { font-family:var(--mono); font-size:12px; color:var(--muted); }
.opening-next-meta { display:flex; justify-content:space-between; gap:8px; padding:10px 12px; font-size:12px; color:var(--muted); }
.opening-next:hover .opening-next-meta { color:var(--strong); }
.opening-boards { display:flex; gap:6px; align-items:center; overflow-x:auto; }
.opening-mini-wrap { flex:1 0 100%; min-width:0; }
.opening-boards:has(.opening-mini-wrap:nth-child(2)) .opening-mini-wrap { flex-basis:calc(50% - 3px); }
.opening-mini { display:grid; grid-template-columns:repeat(var(--files),1fr); width:100%; }
.mini-square { position:relative; display:block; }
.mini-square.light { background:var(--sq-light); }
.mini-square.dark { background:var(--sq-dark); }
.mini-square.last::before { content:''; position:absolute; inset:0; background:var(--hl-last); }
.mini-square img { display:block; position:absolute; width:100%; height:100%; }
.mini-coordinate { display:block; text-align:center; padding:4px; color:var(--muted); font:11px var(--mono); }
.opening-empty { color:var(--muted); padding:20px 0; }
.nav-toggle { display:none; }
@media(max-width:900px) {
  .site-header { position:relative; gap:8px; padding-left:4px; z-index:100; }
  .nav-toggle { display:grid; place-items:center; position:relative; flex:none; width:42px; height:42px; padding:0; border:0; border-radius:var(--r); background:none; color:var(--muted); }
  .nav-toggle:hover, .nav-toggle[aria-expanded="true"] { background:var(--panel); color:var(--strong); }
  .nav-toggle span, .nav-toggle span::before, .nav-toggle span::after { width:26px; height:2px; border-radius:2px; background:currentColor; transition:transform .15s,background .15s; }
  .nav-toggle span::before, .nav-toggle span::after { content:''; position:absolute; left:8px; }
  .nav-toggle span::before { transform:translateY(-8px); }
  .nav-toggle span::after { transform:translateY(8px); }
  .nav-toggle[aria-expanded="true"] span { background:transparent; }
  .nav-toggle[aria-expanded="true"] span::before { transform:rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span::after { transform:rotate(-45deg); }
  .site-nav { display:none; position:absolute; top:100%; left:4px; width:min(280px,calc(100vw - 8px)); height:auto; max-height:calc(100dvh - var(--header-h) - 8px); overflow-y:auto; background:var(--panel); border:1px solid var(--border); border-radius:0 0 var(--r) var(--r); box-shadow:var(--shadow); }
  .site-nav.open { display:flex; flex-direction:column; padding:6px 0; }
  /* The panel lists the main sections, then both groups open: their titles, their sections indented. */
  .nav-link { padding:12px 20px; border:0; border-left:3px solid transparent; }
  .nav-link.on { border-left-color:var(--accent); background:var(--accent-soft); }
  .nav-group { flex-direction:column; }
  .nav-top { padding:12px 20px 4px; font-size:12px; font-weight:650; text-transform:uppercase; letter-spacing:.06em; color:var(--faint); border:0; background:none !important; }
  .nav-caret { display:none; }
  .nav-group.on .nav-top { color:var(--faint); }
  .nav-drop { position:static; opacity:1; transform:none; pointer-events:auto; border:0; box-shadow:none; padding:0; background:none; min-width:0; }
  .nav-drop a { padding:12px 20px 12px 32px; font-size:14px; border-radius:0; border-left:3px solid transparent; }
  .nav-drop a.on { border-left-color:var(--accent); }
  .site-logo .logo-name { display:inline; font-size:17px; }
  .build { display:none; }
}
@media(max-width:600px) {
  .openings { padding:8px; }
  .openings-page { padding:16px; }
  .opening-heading h1 { font-size:24px; }
  .opening-nexts { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .opening-next-title { padding:10px; min-height:56px; flex-wrap:wrap; gap:4px; }
  .opening-next-title strong { font-size:15px; }
  .opening-next-meta { font-size:11px; flex-wrap:wrap; padding:8px; }
  .opening-intro { flex-direction:column; align-items:flex-start; gap:16px; }
  .opening-intro > .opening-boards { width:min(100%,300px); }
}
@media(max-width:420px) {
  .site-logo .logo-name { display:none; }
  .openings-toolbar { flex-direction:column; align-items:stretch; gap:12px; }
  .openings-toolbar .variant-selector { width:100%; max-width:none; }
  .opening-nexts { grid-template-columns:minmax(0,1fr); }
}

/* Which piece a pawn or brawn promotes to: the choices stacked beside the square (as Lichess),
   the rest of the board dimmed. */
.promo-scrim { position: absolute; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45); }
.promo-pick { --promo-size: 64px; position: absolute; display: grid; grid-auto-flow: column; grid-auto-columns: var(--promo-size); background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow); padding: 4px; gap: 2px; }
.promo-choice { width: var(--promo-size); height: var(--promo-size); padding: 4px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.promo-choice img { width: 100%; height: 100%; display: block; pointer-events: none; }
.promo-choice:hover, .promo-choice:focus-visible { background: var(--accent-soft); outline: none; }

/* Settings dialog. */
.set-head { margin: var(--s3) 0 var(--s1); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--border); cursor: pointer; }
.set-row > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.set-row b { font-weight: 600; color: var(--strong); font-size: 14px; }
.set-row small { color: var(--muted); font-size: 12px; }
.set-example { margin: var(--s2) 0 0; font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; color: var(--text); }

/* ------------------------------------------------------------ checkmate practice */
/* The list of practice positions covers the board and its panel until one is chosen (as
   infinitechess.org's checkmate practice): progress, then banners by difficulty, blue while
   unsolved and green with a check once beaten. */
.workspace { position: relative; }
.practice-select { position: absolute; inset: 0; z-index: 40; overflow-y: auto; background: var(--page); }
.practice-content { max-width: 960px; margin: 0 auto; padding: 28px 20px 48px; display: flex; flex-direction: column; gap: 28px; }
.practice-title-main { font-size: 28px; font-weight: 700; color: var(--strong); margin: 0 0 6px; }
.practice-intro { margin: 0 0 16px; font-size: 14px; }
.progress-panel { padding: 16px 20px 20px; }
.progress-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.progress-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.progress-count { font-size: 15px; font-weight: 700; color: var(--strong); }
.progress-track { position: relative; height: 14px; margin: 18px 22px 14px 0; border-radius: 999px; background: var(--inset); border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: var(--good); transition: width .3s ease; }
.progress-track .badge { position: absolute; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); isolation: isolate; }
#practice-badge-bronze { left: 50%; --shine: rgba(229, 203, 180, .3); }
#practice-badge-silver { left: 75%; --shine: rgba(192, 192, 192, .22); }
#practice-badge-gold { left: 100%; --shine: rgba(255, 215, 0, .24); }
.badge .medal { position: relative; display: block; width: 100%; height: 100%; filter: grayscale(1) opacity(.45); }
.badge.earned .medal { filter: none; }
.badge .shine { position: absolute; top: 50%; left: 50%; width: 200%; height: 200%; z-index: -1; display: none; pointer-events: none;
  background: repeating-conic-gradient(var(--shine) 0deg 15deg, transparent 15deg 40deg);
  -webkit-mask-image: radial-gradient(circle, black 30%, transparent 55%); mask-image: radial-gradient(circle, black 30%, transparent 55%);
  opacity: 0; transition: opacity .4s ease; animation: practice-shine 13s linear infinite; transform: translate(-50%, -50%); }
.badge .shine.ccw { animation-direction: reverse; animation-duration: 26s; }
.badge.earned .shine { display: block; }
.badge.earned:hover .shine { opacity: 1; }
@keyframes practice-shine { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
.difficulty-group + .difficulty-group { margin-top: 24px; }
.difficulty-title { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.checkmates { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
/* Banners as infinitechess.org draws them: blue while unsolved, green with a check once beaten. */
.checkmate { display: flex; align-items: center; min-height: 64px; padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1); color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #4a86c4 0%, #366ba6 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 3px 8px rgba(0, 0, 0, .35); -webkit-tap-highlight-color: transparent; }
.checkmate:hover { filter: brightness(1.08); }
.checkmate:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 4px rgba(0, 0, 0, .35); }
.checkmate.beaten { background: linear-gradient(180deg, #57a151 0%, #438840 100%); }
.mate-pieces { display: flex; align-items: center; flex: 1; }
.mate-pieces.mine { justify-content: flex-end; }
.mate-pieces.theirs { justify-content: flex-start; }
.mate-piece img { display: block; width: 34px; height: 34px; }
.mate-piece.collated { margin-left: -15px; }
.mate-versus { padding: 0 12px; font-size: 13px; font-weight: 600; opacity: .85; }
.mate-check { width: 22px; height: 22px; margin-left: 8px; color: #fff; opacity: 0; flex: none; }
.checkmate.beaten .mate-check { opacity: 1; }
.practice-head { padding: var(--s2) var(--s3); font-weight: 700; color: var(--strong); border-bottom: 1px solid var(--border); }
.player-bar.tempo { box-shadow: inset 3px 0 0 var(--accent); }
.player-bar.tempo .pname { color: var(--strong); }
.game-result { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 12px; border-top: 1px solid var(--border); text-align: center; }
.result-score { font-size: 1.1em; font-weight: 800; color: var(--strong); }
.result-text { font-style: italic; }
.practice-actions { display: flex; justify-content: center; border-top: 1px solid var(--border); }
.action-btn { display: flex; align-items: center; justify-content: center; width: 75px; height: 40px; border: 0; border-radius: 6px; background: none; color: var(--strong); cursor: pointer; }
.action-btn svg { width: 22px; height: 22px; }
.action-btn:hover:not(:disabled) { background: var(--hover); }
.action-btn:disabled { opacity: .4; cursor: default; }

/* ------------------------------------------------------------ home */
/* The home page: the 5D title screen's vortex and flying pieces behind, dimmed to the theme (as
   infinitechess.org dims its board backdrop), and a centred column: the hero, the three ways to
   play beside the lobby, then the games being played. */
.home { position: relative; height: 100%; overflow-y: auto; overflow-x: hidden; }
.title-canvas { position: fixed; left: 0; right: 0; bottom: 0; top: var(--header-h); width: 100%; height: calc(100% - var(--header-h)); display: block; z-index: 0; }
.title-dim { position: fixed; left: 0; right: 0; bottom: 0; top: var(--header-h); z-index: 0; pointer-events: none; }
html[data-theme="dark"] .title-dim { background: radial-gradient(ellipse 80% 70% at 50% 45%, rgba(22, 21, 18, .66), rgba(22, 21, 18, .9)); }
html[data-theme="light"] .title-dim { background: radial-gradient(ellipse 80% 70% at 50% 45%, rgba(242, 241, 239, .55), rgba(242, 241, 239, .86)); }
.home-inner { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: clamp(32px, 6vw, 64px) 20px 56px; pointer-events: none; }
.home-inner > * { pointer-events: auto; }
.home-hero { text-align: center; margin-bottom: 36px; pointer-events: none !important; }
.hero-title {
  margin: 0; font-size: clamp(2.6em, 7vw, 4.4em); font-weight: 800; letter-spacing: -.03em; line-height: 1.02;
  background: linear-gradient(180deg, var(--hero-top), var(--hero-bottom)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 14px rgba(0, 0, 0, .18));
}
html[data-theme="dark"] .home { --hero-top: #e8e8e8; --hero-bottom: #878787; }
html[data-theme="light"] .home { --hero-top: #646464; --hero-bottom: #111; }
.hero-5d { font-weight: 900; }
.hero-tag { margin: 12px 0 0; font-size: clamp(.78em, 1.5vw, .95em); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.annihilation { position: fixed; top: calc(var(--header-h) + 16px); right: 16px; z-index: 2; min-width: 128px; text-align: center; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--strong); font-weight: 600; box-shadow: var(--shadow); }
.lobby-layout { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; align-items: center; }
.lobby-actions { display: flex; flex-direction: column; gap: 12px; }
.lobby-btn {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 14px 18px; border-radius: 12px;
  font-size: 15px; font-weight: 650; color: var(--strong); text-align: left;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--border);
  box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, transform .15s, background .15s;
  backdrop-filter: blur(6px);
}
.lobby-btn svg { width: 26px; height: 26px; flex: none; color: var(--accent-text); }
.lobby-btn:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.lobby-btn:active:not(:disabled) { transform: translateY(1px); }
.lobby-btn:disabled { opacity: .5; cursor: default; }
.lobby-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.lobby-btn.primary svg { color: #fff; }
.lobby-btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.lobby { position: relative; height: 25em; display: flex; flex-direction: column; background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; backdrop-filter: blur(6px); }
.lobby-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.lobby-head h2 { margin: 0; font-size: 15px; font-weight: 650; color: var(--strong); }
.lobby-viewers { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; }
.lobby-viewers svg { width: 16px; height: 16px; }
.lobby-table { flex: 1; overflow-y: auto; }
.seek-row { display: grid; grid-template-columns: 1.2fr 1.3fr 1fr; gap: 8px; align-items: center; padding: 10px 16px; font-size: 13.5px; border-bottom: 1px solid var(--border); cursor: pointer; }
.seek-headrow { position: sticky; top: 0; z-index: 1; background: var(--panel); cursor: default; color: var(--faint); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.seek-rows .seek-row:hover { background: var(--hover); }
.seek-row.ours { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--strong); }
.seek-rows .seek-row.ours:hover { background: color-mix(in srgb, var(--good) 26%, transparent); }
.seek-row[aria-disabled="true"] { cursor: default; }
.seek-row[aria-disabled="true"] > * { opacity: .4; }
.seek-row.fresh { animation: seek-in .8s cubic-bezier(.22, 1, .36, 1); }
@keyframes seek-in { from { box-shadow: inset 0 0 0 2px var(--accent); } to { box-shadow: inset 0 0 0 2px transparent; } }
.seek-player { display: flex; align-items: center; gap: 6px; color: var(--strong); }
.seek-time .speed { color: var(--muted); font-size: 11.5px; margin-right: 6px; }
.side-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--border-strong); flex: none; }
.side-dot.white { background: #f2f2f2; }
.side-dot.black { background: #1d1d1d; }
.lobby-empty { padding: 28px 16px; color: var(--muted); text-align: center; margin: 0; }
.lobby-overlay { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: color-mix(in srgb, var(--panel) 90%, transparent); text-align: center; padding: 16px; }
.lobby-overlay p { margin: 0; font-weight: 600; color: var(--strong); }
.featured { margin-top: 40px; }
.featured-title { display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 650; color: var(--muted); margin: 0 0 14px; }
.featured-title::before, .featured-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }
.featured-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.featured-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px; background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.featured-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.fg-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.fg-name { flex: 1; color: var(--strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-clock { font-family: var(--mono); font-size: 13px; padding: 1px 6px; border-radius: 4px; background: var(--inset); }
.fg-clock:empty { display: none; }
.fg-clock.running { background: var(--accent); color: #fff; }
.fg-meta { font-size: 12px; color: var(--muted); }
.fg-result { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 4px 12px; border-radius: 6px; background: rgba(0, 0, 0, .7); color: #fff; font-weight: 800; }
@media (max-width: 899px) {
  .lobby-layout { grid-template-columns: 1fr; }
  .lobby-actions { flex-direction: row; }
  .lobby-btn { flex: 1; min-height: 54px; }
  .featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 652px) {
  .lobby-actions { flex-direction: column; }
  .home-inner { padding-left: 10px; padding-right: 10px; }
  .featured-grid { grid-template-columns: minmax(0, 1fr); }
  .seek-row { grid-template-columns: 1fr 1.2fr 1fr; padding: 10px 12px; font-size: 13px; }
}

/* ------------------------------------------------------------ puzzles */
/* The trainer (after lichess's): the theme and difficulty, then the feedback box (your turn,
   right, wrong, solved) with the hint and the solution, the puzzle (rating and themes once it
   is over), the moves, and the session's rounds. */
.invisible { visibility: hidden; }
#board.pz-hidden { visibility: hidden; }
#side-puzzle.loading .pz-main { visibility: hidden; }
.pz-main { display: flex; flex-direction: column; gap: var(--s2); flex: 1 1 0; min-height: 0; }
.pz-main > * { flex: none; }
.pz-top { display: flex; flex-direction: column; gap: 6px; padding: var(--s2) var(--s3) var(--s3); }
.pz-back { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; margin-left: -6px; padding: 2px 6px; border-radius: var(--r-sm); color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.pz-back svg { width: 14px; height: 14px; }
.pz-back:hover { color: var(--strong); background: var(--hover); }
.pz-theme { display: flex; flex-direction: column; gap: 2px; }
.pz-theme strong { font-size: 16px; color: var(--strong); }
.pz-theme span { font-size: 12.5px; line-height: 1.4; }
.pz-difficulty { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); font-size: 13px; }
.pz-difficulty select { min-width: 120px; }

.pz-feedback { overflow: hidden; }
.pz-fb { display: flex; align-items: center; gap: 14px; padding: 16px; min-height: 84px; }
.pz-fb-icon { position: relative; flex: none; width: 48px; height: 48px; display: grid; place-items: center; }
.pz-fb-icon > * { display: none; }
.pz-fb-icon img { width: 48px; height: 48px; }
.pz-fb-icon svg { width: 40px; height: 40px; }
.pz-fb.play .pz-fb-icon img { display: block; }
.pz-fb.good .ok, .pz-fb.reply .ok, .pz-fb.win .ok, .pz-fb.done .ok, .pz-fb.view .ok { display: block; color: var(--good); }
.pz-fb.view .ok { color: var(--muted); }
.pz-fb.fail .bad { display: block; color: var(--bad); }
.pz-fb.judge .spin { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--accent); animation: pz-spin .8s linear infinite; }
@keyframes pz-spin { to { transform: rotate(360deg); } }
.pz-fb-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pz-fb-body strong { font-size: 17px; color: var(--strong); }
.pz-fb-body span { color: var(--muted); }
.pz-fb-body span:empty { display: none; }
.pz-fb.good strong, .pz-fb.win strong { color: var(--good); }
.pz-fb.fail strong { color: var(--bad); }
.pz-tools { display: flex; border-top: 1px solid var(--border); }
.pz-tools .ctrl-text + .ctrl-text { border-left: 1px solid var(--border); }
.pz-tools .ctrl-text:disabled { opacity: .45; cursor: default; background: none; }
.pz-after { display: flex; flex-direction: column; gap: var(--s2); padding: 0 16px 14px; }
.pz-result { font-size: 13px; color: var(--muted); }
.pz-result:empty { display: none; }
.pz-result.up { color: var(--good); font-weight: 600; }
.pz-result.down { color: var(--bad); font-weight: 600; }
.pz-after-links { display: flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.pz-after-links .ctrl-text { height: 34px; }
.pz-after-links .ctrl-text + .ctrl-text { border-left: 1px solid var(--border); }

.pz-meta, .pz-session { display: flex; flex-direction: column; gap: 6px; padding: 10px var(--s3); font-size: 13px; }
.pz-meta-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.pz-meta a { color: var(--accent-text); text-decoration: none; font-weight: 600; }
.pz-meta a:hover { text-decoration: underline; }
.pz-themes { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; }
.pz-meta a.pz-theme-chip { padding: 2px 8px; border-radius: 10px; background: var(--inset); color: var(--text); font-weight: 500; }
.pz-meta a.pz-theme-chip:hover { background: var(--accent-soft); text-decoration: none; }
.pz-moves { flex: 1 1 0; min-height: 100px; }
.pz-my-rating { font-size: 18px; color: var(--strong); font-variant-numeric: tabular-nums; }
.pz-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.pz-chip { min-width: 34px; padding: 2px 6px; border-radius: 4px; text-align: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; text-decoration: none; color: #fff; }
.pz-chip.win { background: var(--good); }
.pz-chip.loss { background: var(--bad); }
.pz-chip.cur { outline: 2px solid var(--strong); outline-offset: 1px; }
.pz-chip:hover { filter: brightness(1.12); }

.pz-empty { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px 16px; background: var(--page); overflow-y: auto; }
.pz-empty-card { max-width: 480px; text-align: center; padding: 36px 28px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.pz-empty-card h1 { margin: 12px 0 8px; font-size: 22px; color: var(--strong); }
.pz-empty-card p { margin: 0 0 20px; }
.pz-empty-card .row { justify-content: center; }
.pz-empty-icon { width: 44px; height: 44px; color: var(--accent-text); }

/* The themes page: your numbers and the filters, then every theme by group, then your rounds. */
.pzh { height: 100%; overflow-y: auto; }
.pzh-inner { max-width: 1120px; margin: 0 auto; padding: 28px 20px 56px; display: flex; flex-direction: column; gap: 24px; }
.pzh-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pzh-head h1 { margin: 0 0 6px; font-size: 28px; color: var(--strong); }
.pzh-head p { margin: 0; max-width: 620px; }
.pzh-start { height: 42px; padding: 0 18px; font-size: 15px; gap: 8px; }
.pzh-start svg { width: 18px; height: 18px; }
.pzh-error { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.pzh-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: stretch; }
.pzh-stats { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; align-items: center; padding: 16px; }
.pzh-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.pzh-stat + .pzh-stat { border-left: 1px solid var(--border); }
.pzh-stat-v { font-size: 22px; font-weight: 700; color: var(--strong); font-variant-numeric: tabular-nums; }
.pzh-stat.main .pzh-stat-v { font-size: 32px; color: var(--accent-text); }
.pzh-stat-k { font-size: 12px; color: var(--muted); }
.pzh-filters { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.pzh-filter { display: flex; flex-direction: column; gap: 6px; }
.pzh-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pzh-seg { margin: 0; align-self: flex-start; flex-wrap: wrap; }
.pzh-seg.dim { opacity: .5; }
.pzh-range { display: flex; align-items: center; gap: 8px; }
.pzh-range input { width: 96px; }
.pzh-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.pzh-presets button { padding: 3px 10px; border: 1px solid var(--border); border-radius: 12px; background: none; color: var(--text); font-size: 12px; }
.pzh-presets button:hover { border-color: var(--faint); color: var(--strong); }
.pzh-presets button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--strong); }
.pzh-hint { font-size: 12px; }
.pzh-switch { flex-direction: row; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.pzh-note { margin: 0; font-size: 12.5px; }
.pzh-group h2 { margin: 0 0 10px; font-size: 15px; color: var(--strong); }
#pzh-groups { display: flex; flex-direction: column; gap: 22px; }
.pzh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pzh-theme { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--panel); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.pzh-theme:hover { border-color: var(--accent); transform: translateY(-1px); }
.pzh-theme.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pzh-theme.done { opacity: .6; }
.pzh-theme-name { font-weight: 700; color: var(--strong); }
.pzh-theme-desc { flex: 1; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.pzh-theme-foot { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.pzh-count { flex: none; font-size: 12px; font-weight: 600; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.pzh-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--inset); overflow: hidden; }
.pzh-bar i { display: block; height: 100%; background: var(--good); }
@media (max-width: 900px) {
  .pzh-top { grid-template-columns: 1fr; }
}
/* Phones: the panels stack under the board at their own heights, what to do first. */
@media (max-width: 800px) and (orientation: portrait), (max-width: 560px) {
  .pz-main { flex: none; }
  .pz-moves { flex: none; min-height: 0; max-height: 240px; }
  #side-puzzle .pz-top { order: 1; }
  #side-puzzle .pz-session { order: 2; }
}
@media (max-width: 520px) {
  .pzh-stats { grid-template-columns: 1fr 1fr; row-gap: 12px; }
  .pzh-stat:nth-child(3) { border-left: 0; }
}

/* ------------------------------------------------------------ the game options dialog */
.game-setup { width: min(520px, calc(100vw - 2 * var(--s3))); }
.game-setup .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; border: 0; padding: 0; }
.game-setup .field > span, .game-setup legend { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.game-setup .book-row { flex-direction: row; align-items: center; gap: 10px; }
.game-setup .book-row > span { text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--text); font-weight: 400; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; align-self: flex-start; }
.seg button { padding: 6px 14px; border: 0; background: none; color: var(--text); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }
.setup-clock { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.slider-row { display: grid; grid-template-columns: 1fr 1.4fr 48px; gap: 10px; align-items: center; font-size: 13px; }
.slider-row output { text-align: right; font-family: var(--mono); color: var(--strong); }
.tc-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-presets button { padding: 5px 9px; border-radius: 5px; border: 1px solid var(--border); background: var(--inset); color: var(--text); font-size: 12.5px; cursor: pointer; }
.tc-presets button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--strong); }
.setup-error { color: var(--bad); font-size: 13px; margin: 0 0 8px; }

/* ------------------------------------------------------------ a private challenge */
.challenge { height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 12px; overflow-y: auto; }
.ticket { display: flex; max-width: 760px; width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); overflow: hidden; }
.ticket-stub { flex: 0 0 260px; padding: 16px; background: var(--inset); border-right: 2px dashed var(--border-strong); display: flex; align-items: center; justify-content: center; }
.ticket-stub .opening-boards { width: 100%; }
.ticket-main { flex: 1; padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.ticket-title { margin: 0; font-size: 22px; color: var(--strong); }
.ticket-props { margin: 0; color: var(--muted); }
.ticket-owner, .ticket-visitor { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.ticket-owner p { margin: 0; }
.copy-link { display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--inset); color: var(--strong); font-family: var(--mono); font-size: 12.5px; cursor: pointer; overflow: hidden; }
.copy-link svg { width: 16px; height: 16px; flex: none; }
.copy-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-reason { margin: 0; font-size: 13px; color: var(--muted); }
@media (max-width: 640px) {
  .ticket { flex-direction: column; }
  .ticket-stub { flex: none; border-right: 0; border-bottom: 2px dashed var(--border-strong); }
}

/* ------------------------------------------------------------ an online game */
.online-live .player-bar { justify-content: flex-start; }
.online-live .player-bar .pname { flex: 1; }
.player-bar.lowtime.running .clock { background: rgb(101 35 32); color: #fff; }
.disconnect-status { padding: 8px 12px; background: color-mix(in srgb, var(--warn) 18%, transparent); border-top: 1px solid var(--border); font-size: 13px; }
.disconnect-status p { margin: 0; }
.og-claims { display: flex; gap: 8px; margin-top: 8px; }
.og-actions { display: flex; align-items: center; border-top: 1px solid var(--border); }
.og-actions .ctrl-text:disabled { opacity: .4; cursor: default; }
.og-actions a.ctrl-text { text-decoration: none; }
.og-actions .ctrl-text.confirming { color: #fff; background: linear-gradient(180deg, #d0553f, #a63a28); }
#og-draw.confirming { background: linear-gradient(180deg, #9c7a52, #7a5c38); }
.og-draw-offer { animation: attention-pulse 1.8s ease-in-out infinite; }
.og-draw-q { flex: 2; text-align: center; font-weight: 600; color: var(--strong); }
.og-spectating { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; color: var(--muted); font-size: 13px; }
.og-spectating svg { width: 16px; height: 16px; }
#og-rematch.rematch-offered { color: #fff; background: var(--good); animation: attention-pulse 1.8s ease-in-out infinite; }
.self-disconnect { padding: 6px 12px; text-align: center; font-size: 13px; border-top: 1px solid var(--border); }
.self-disconnect.lost { color: var(--bad); animation: attention-pulse 1.8s ease-in-out infinite; }
@keyframes attention-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.mv.pending { opacity: .55; }
.og-info { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.og-meta-line + .og-meta-line { margin-top: 2px; }
.og-watchers { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.og-watchers svg { width: 16px; height: 16px; }
.og-chat { display: flex; flex-direction: column; min-height: 140px; max-height: 260px; }
.og-chat-head { padding: 8px 12px; font-weight: 700; color: var(--strong); border-bottom: 1px solid var(--border); }
.chat-log { flex: 1; overflow-y: auto; padding: 6px 12px; font-size: 13px; }
.chat-notice { font-style: italic; color: var(--muted); }
.chat-line { overflow-wrap: anywhere; }
.chat-form { padding: 6px 8px; border-top: 1px solid var(--border); }
.chat-form .input { width: 100%; }
.chat-error { margin: 0; padding: 0 12px 6px; color: var(--bad); font-size: 12.5px; }

input[type="range"], input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

a.btn, a.ctrl-text { text-decoration: none; }

/* "Continue from here": three ways to play on from a position. */
.continue-with { width: min(360px, calc(100vw - 2 * var(--s3))); }
.continue-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.continue-btns .btn { justify-content: flex-start; gap: 10px; height: 44px; font-size: 14px; }
.continue-btns .btn svg { width: 20px; height: 20px; color: var(--accent-text); }

/* An online game's panel while it loads (it still shows the game before). */
#side-game.loading > * { visibility: hidden; }

/* ------------------------------------------------------------ new-player prompt */
/* "New? Take the tutorial / I'm experienced" above the lobby, as infinitechess.org's: it folds
   away when dismissed, and returning visitors never see it (the head script marks <html>). */
.new-prompt {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .75em 1em;
  padding: .75em 1em; margin: -16px 0 20px; font-size: 15px; color: var(--strong); max-height: 200px;
  transition: max-height .35s ease, padding .35s ease, margin .35s ease, opacity .25s ease;
}
.new-prompt-label { font-size: 1.2em; font-weight: 700; letter-spacing: .02em; }
.new-prompt-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5em; }
.new-prompt-btn {
  display: inline-flex; justify-content: center; padding: .5em 1em; border-radius: .4em; font: inherit; font-weight: 600;
  color: var(--strong); background: var(--inset); border: 1px solid var(--border); text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.new-prompt-btn:hover { background: var(--panel); text-decoration: none; }
.new-prompt-btn.primary { color: #fff; background: color-mix(in srgb, rgb(255 88 0) 70%, transparent); border-color: transparent; }
.new-prompt-btn.primary:hover { background: rgb(255 108 20 / 85%); }
.new-prompt.collapsed { max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; opacity: 0; pointer-events: none; overflow: hidden; }
html[data-home-prompt="dismissed"] .new-prompt { display: none; }

/* ------------------------------------------------------------ tutorial */
/* The lesson list (over the board, as checkmate practice's), then a lesson: its steps as dots,
   the coach's message, answers, feedback, and the lesson's end with its stars and recap. */
.tut-lessons { display: flex; flex-direction: column; gap: 28px; }
.tut-categ-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tut-categ-head h2 { margin: 0; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--strong); }
.tut-categ-head .muted { font-size: 13px; }
.tut-categ-blurb { margin: 4px 0 12px; font-size: 13px; }
.tut-categ-lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.tut-lesson-piece { flex: none; width: 38px; height: 38px; }
.tut-lesson.done .tut-lesson-piece { filter: drop-shadow(0 0 3px var(--good)); }
.tut-lesson {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 10px; text-align: left;
  background: var(--panel); border: 1px solid var(--border); color: var(--text); cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.tut-lesson:hover { border-color: var(--accent); transform: translateY(-1px); }
.tut-lesson.next { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tut-lesson-num {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--inset); color: var(--strong); font-weight: 700;
}
.tut-lesson.done .tut-lesson-num { background: var(--good); color: #fff; }
.tut-lesson-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tut-lesson-body strong { color: var(--strong); font-size: 15px; }
.tut-lesson-body .muted { font-size: 13px; }
.tut-chess-note { margin: 0; font-size: 13px; }
.tut-stars { display: inline-flex; gap: 2px; flex: none; }
.tut-star { width: 16px; height: 16px; fill: var(--inset); stroke: var(--border); stroke-width: 1; }
.tut-star.on { fill: #f5b301; stroke: #c98f00; }
.tut-stars.big .tut-star { width: 28px; height: 28px; }

.tut-panel { display: flex; flex-direction: column; gap: 10px; padding: var(--s2) var(--s3) var(--s3); }
.tut-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tut-head .pz-back { padding-left: 0; }
.tut-count { font-size: 12px; }
.tut-title { margin: 0; font-size: 19px; color: var(--strong); }
.tut-dots { display: flex; gap: 6px; }
.tut-dot { flex: 1; height: 5px; border-radius: 3px; background: var(--inset); }
.tut-dot.cur { background: var(--accent); }
.tut-dot.done { background: var(--good); }
.tut-coach { display: flex; flex-direction: column; gap: 10px; }
.tut-task { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text, var(--accent)); }
.tut-say { margin: 0; font-size: 16px; line-height: 1.5; color: var(--strong); }
.tut-say b, .tut-feedback b { color: var(--strong); }
.tut-options { display: flex; flex-direction: column; gap: 8px; }
.tut-option {
  padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--border); background: var(--inset);
  color: var(--strong); font-size: 14px; text-align: left; cursor: pointer;
}
.tut-option:hover:not(:disabled) { border-color: var(--accent); }
.tut-option:disabled { cursor: default; opacity: .7; }
.tut-option.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 22%, var(--inset)); opacity: 1; }
.tut-option.wrong { border-color: #c33; background: color-mix(in srgb, #c33 18%, var(--inset)); }
.tut-option.picked { border-color: var(--muted); opacity: 1; }
.tut-feedback { padding: 10px 12px; border-radius: var(--r); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--inset); border-left: 3px solid var(--border); }
.tut-feedback.good { border-left-color: var(--good); }
.tut-feedback.good strong { color: var(--good); }
.tut-feedback.bad { border-left-color: #c33; animation: tut-shake .3s; }
.tut-feedback.hint, .tut-feedback.nudge { border-left-color: var(--accent); }
@keyframes tut-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.tut-actions { display: flex; gap: 4px; }
.tut-actions .ctrl-text { flex: 0 0 auto; padding: 0 8px; height: 30px; }
.tut-done { display: flex; flex-direction: column; gap: 10px; }
.tut-done-head { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0 4px; text-align: center; }
.tut-done-head strong { font-size: 18px; color: var(--strong); }
.tut-recap { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; }
.tut-grad { display: flex; flex-direction: column; gap: 8px; }
.tut-grad p { margin: 4px 0 0; font-size: 13px; }
#draft-submit.tut-pulse:not(:disabled) { animation: tut-pulse 1.2s ease-in-out infinite; }
@keyframes tut-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }
.tut-key { padding: var(--s2) var(--s3); font-size: 13px; }
.tut-key summary { cursor: pointer; font-weight: 600; color: var(--strong); }
.tut-key ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; line-height: 1.4; }

/* ------------------------------------------------------------ accounts and profiles */
/* The header's account button (Sign in, or the name and rating), its dialog, ratings beside
   names (lobby, featured games, game page), and a player's profile page (after lichess's). */
.acct-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; margin: 0 2px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--inset); color: var(--strong); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.acct-btn:hover, .acct-btn[aria-expanded="true"] { border-color: var(--accent); }
.acct-btn.signed-in { background: none; border-color: transparent; padding: 0 8px 0 10px; }
.acct-btn.signed-in:hover, .acct-btn.signed-in[aria-expanded="true"] { background: var(--hover); border-color: transparent; }
.acct-btn .acct-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn .acct-rating { color: var(--muted); font-weight: 500; }
.acct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 2px color-mix(in srgb, var(--good) 25%, transparent); }
.acct-caret { width: 14px; height: 14px; color: var(--muted); transform: rotate(90deg); transition: transform .15s; }
.acct-btn[aria-expanded="true"] .acct-caret { transform: rotate(-90deg); }
.acct-dialog { width: min(440px, calc(100vw - 2 * var(--s3))); }
.acct-dialog h2 { margin-top: 0; }
.acct-providers { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.acct-provider { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 44px; font-weight: 600; }
.acct-provider svg { width: 20px; height: 20px; }
.acct-provider.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.acct-provider.discord:hover { background: #4752c4; }
.acct-small { font-size: 12.5px; }
.setup-rated-note { margin-left: auto; font-size: 12.5px; }
.seek-rating, .fg-rating { margin-left: 6px; color: var(--muted); font-weight: 500; }
.seek-rated { margin-left: 8px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--strong); }
a.pname { color: var(--strong); text-decoration: none; }
a.pname[href]:hover { text-decoration: underline; }
.prating { margin-left: 8px; margin-right: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.prating.up { color: var(--good); }
.prating.down { color: var(--bad); }

/* The header's menus (header.js): the account menu after lichess's dasher, and incoming challenges. */
.site-actions { align-items: center; }
.hdr-menu { position: relative; display: flex; align-items: center; }
.hdr-drop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 248px; max-width: calc(100vw - 16px);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow), 0 12px 32px rgba(0, 0, 0, .3);
  padding: 6px 0; animation: hdr-drop .12s ease-out;
}
@keyframes hdr-drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.hdr-count {
  position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; pointer-events: none;
}
#btn-challenges { position: relative; }
.dasher { width: 260px; padding: 0; }
.dasher-links { padding: 6px 0; border-bottom: 1px solid var(--border); }
.dasher-user { display: flex; align-items: center; gap: 10px; padding: 8px 14px 10px; color: var(--strong); text-decoration: none; }
.dasher-user:hover { background: var(--hover); }
.dasher-avatar, .cm-avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 16px;
  color: #fff; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #7a3ee8));
}
.dasher-who { display: flex; flex-direction: column; min-width: 0; }
.dasher-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dasher-who small { color: var(--muted); font-size: 12px; }
.dasher-item, .dasher-sub, .dasher-back, .dasher-choice {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; border: 0; background: none;
  color: var(--text); font: inherit; font-size: 13.5px; text-align: left; text-decoration: none; cursor: pointer;
}
.dasher-item:hover, .dasher-sub:hover, .dasher-back:hover, .dasher-choice:hover { background: var(--hover); color: var(--strong); }
.dasher-item svg, .dasher-sub svg, .dasher-back svg, .dasher-choice svg { width: 17px; height: 17px; flex: none; color: var(--muted); }
.dasher-item.signout:hover, .dasher-item.signout:hover svg { color: var(--bad); }
.dasher-subs { padding: 6px 0; }
.dasher-sub span:first-child { flex: 1; }
.dasher-value { color: var(--muted); font-size: 12.5px; }
.dasher-back { padding: 11px 14px; border-bottom: 1px solid var(--border); font-weight: 700; color: var(--strong); }
.dasher-choices { padding: 6px 0; }
.dasher-choice .dasher-check { opacity: 0; color: var(--accent); }
.dasher-choice.on { color: var(--strong); font-weight: 600; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.dasher-choice.on .dasher-check { opacity: 1; }
.dasher-swatch { width: 26px; height: 18px; border-radius: 3px; flex: none;
  background: conic-gradient(var(--sw-dark) 0 25%, var(--sw-light) 0 50%, var(--sw-dark) 0 75%, var(--sw-light) 0) 0 0 / 13px 9px; }
.dasher-swatch.board-brown { --sw-light: #f0d9b5; --sw-dark: #b58863; }
.dasher-swatch.board-blue { --sw-light: #dee3e6; --sw-dark: #8ca2ad; }
.dasher-swatch.board-green { --sw-light: #ffffdd; --sw-dark: #86a666; }
.dasher-slider { display: flex; flex-direction: column; gap: 6px; padding: 6px 14px 12px; font-size: 12.5px; color: var(--muted); }
.dasher-slider.off { opacity: .5; }
.dasher-volume { width: 100%; accent-color: var(--accent); }
.challenge-drop { width: 330px; padding: 0; }
.challenge-head { margin: 0; padding: 10px 14px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--border); }
.challenge-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; }
.challenge-item + .challenge-item { border-top: 1px solid var(--border); }
.challenge-who { font-weight: 700; color: var(--strong); }
.challenge-who a { color: var(--strong); }
.challenge-props { font-size: 12.5px; }
.challenge-btns { display: flex; gap: 8px; margin-top: 6px; }
.challenge-btns .btn svg { width: 15px; height: 15px; }
.challenge-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 16px; color: var(--muted); text-align: center; }
.challenge-empty svg { width: 30px; height: 30px; opacity: .6; }
.challenge-empty p { margin: 4px 0 0; color: var(--text); font-weight: 600; }
.admin-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
.admin-btn svg { width: 17px; height: 17px; }
.admin-btn:hover { color: var(--strong); background: var(--hover); }
.admin-btn .hdr-count { position: static; margin-left: 2px; }

/* A player's profile (player.js), after lichess's: ratings at the side, the box with the name, chart, facts and activity. */
.player-page { height: 100%; overflow-y: auto; }
.player-inner { max-width: 960px; margin: 0 auto; padding: 28px 20px 48px; }
.pl-wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 56px; }
.pl-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.pl-side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; }
.pl-perf {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 12px 12px 10px; border: 0; border-radius: var(--r) 0 0 var(--r);
  background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: background .15s;
}
.pl-perf:hover { background: color-mix(in srgb, var(--panel) 70%, transparent); }
.pl-perf.empty { opacity: .55; }
.pl-perf-icon { width: 34px; height: 34px; flex: none; color: var(--muted); opacity: .7; transition: color .15s, opacity .15s; }
.pl-perf:hover .pl-perf-icon { color: var(--accent); opacity: 1; }
.pl-perf-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pl-perf-text h3 { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pl-perf-v { font-size: 20px; color: var(--strong); line-height: 1.25; }
.pl-perf-v strong { font-weight: 700; }
.pl-perf-text small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.pl-perf-go { width: 14px; height: 14px; color: var(--faint); opacity: 0; transition: opacity .15s; }
.pl-perf:hover .pl-perf-go { opacity: 1; }
.pl-progress { font-size: 13px; font-weight: 600; }
.pl-progress.up, .pl-diff.up { color: var(--good); }
.pl-progress.down, .pl-diff.down { color: var(--bad); }
.pl-box { background: var(--panel); border-radius: var(--r); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); overflow: hidden; }
.pl-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 18px; padding: 22px 26px 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent); border-bottom: 1px solid var(--border); }
.pl-title { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.pl-title h1 { margin: 0; font-size: 30px; line-height: 1.15; color: var(--strong); overflow-wrap: anywhere; }
.pl-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.pl-dot.online { border-color: var(--good); background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.pl-badges { display: inline-flex; gap: 6px; }
.pl-badge { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--inset); color: var(--muted); letter-spacing: .02em; }
.pl-badge.sm { font-size: 10.5px; padding: 1px 7px; }
.pl-badge.admin { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pl-badge.banned { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.pl-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pl-actions .btn svg { width: 16px; height: 16px; }
.pl-actions .btn { height: 36px; }
.pl-admin { display: flex; gap: 8px; }
.pl-profile { padding: 18px 26px 6px; display: flex; flex-direction: column; gap: 16px; }
.pl-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.pl-chart-head h2 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pl-range { margin: 0; }
.pl-range button { padding: 3px 10px; font-size: 12px; }
.seg button.on, .seg a.on { background: var(--accent); color: #fff; }
.pl-svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.pl-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.pl-axis { fill: var(--muted); font-size: 11px; }
.pl-line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.pl-area { stroke: none; }
circle.pl-dot { fill: var(--panel); stroke: var(--accent); stroke-width: 1.6; border: 0; }
.pl-cross.hidden { display: none; }
.pl-cross-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.pl-cross-dot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.pl-tip-bg { fill: var(--inset); stroke: var(--border-strong); }
.pl-tip-v { fill: var(--strong); font-size: 13px; font-weight: 700; }
.pl-tip-d { fill: var(--muted); font-size: 10.5px; }
.pl-chart-empty { margin: 30px 0; text-align: center; }
.pl-new { padding: 18px 20px; border-radius: var(--r); background: color-mix(in srgb, var(--accent) 10%, var(--inset)); }
.pl-new h2 { margin: 0 0 4px; font-size: 18px; color: var(--strong); }
.pl-new p { margin: 0 0 12px; color: var(--text); }
.pl-new-links { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-infos { display: flex; flex-direction: column; gap: 10px; }
.pl-bio { margin: 0; padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--inset); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--strong); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.pl-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.pl-fact { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.pl-fact svg { width: 15px; height: 15px; }
.pl-tabs { display: flex; gap: 2px; margin: 12px 0 0; padding: 0 18px; border-bottom: 1px solid var(--border); }
.pl-tabs button { position: relative; padding: 12px 14px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.pl-tabs button:hover { color: var(--strong); }
.pl-tabs button.on { color: var(--strong); }
.pl-tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.pl-games { padding: 16px 20px 20px; }
.pl-wdl { display: flex; flex-direction: column; gap: 4px; }
.pl-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--inset); }
.pl-bar-win { background: var(--good); }
.pl-bar-draw { background: var(--muted); }
.pl-bar-loss { background: var(--bad); }
.pl-counts { display: flex; gap: 10px; font-size: 12.5px; }
.pl-counts .win, .pl-res.win { color: var(--good); }
.pl-counts .loss, .pl-res.loss { color: var(--bad); }
.pl-counts .draw, .pl-res.draw, .pl-res.aborted { color: var(--muted); }
.pl-levels { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.pl-level { display: flex; flex-direction: column; gap: 4px; min-width: 140px; padding: 8px 10px; border-radius: var(--r); background: var(--inset); font-size: 13px; }
.pl-table tbody tr { cursor: pointer; }
.pl-table tbody tr:hover { background: var(--hover); }
.pl-opp { white-space: nowrap; }
.pl-opp .side-dot { margin-right: 6px; vertical-align: -1px; }
.pl-res { font-weight: 600; }
.pl-empty { margin: 8px 0 0; }
#pl-more { margin-top: 10px; }
.pl-missing { text-align: center; margin-top: 60px; }

/* The activity timeline (lichess's): days, and their entries on a line with round icons. */
.pl-activity { padding: 8px 26px 26px; }
.act-none { padding: 30px 0; text-align: center; }
.act-day h2 { margin: 18px 0 6px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--accent-text); }
.act-entries { margin-left: 18px; border-left: 2px solid var(--border); }
.act-entry { position: relative; display: flex; align-items: flex-start; min-height: 46px; padding: 6px 0 8px 32px; }
.act-icon {
  position: absolute; left: -17px; top: 4px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--inset); border: 3px solid var(--panel); color: var(--muted);
}
.act-icon svg { width: 16px; height: 16px; }
.act-entry.rated .act-icon { color: var(--warn); }
.act-entry.puzzles .act-icon { color: var(--good); }
.act-entry.kairos .act-icon { color: var(--accent); }
.act-entry.signup .act-icon { color: #c06ae0; }
.act-body { flex: 1; min-width: 0; padding-top: 5px; }
.act-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; color: var(--strong); font-size: 14.5px; }
.act-rating { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.act-score { margin-left: auto; display: inline-flex; gap: 4px; }
.act-score strong { min-width: 22px; padding: 1px 6px; border-radius: 4px; color: #fff; font-size: 12px; text-align: center; opacity: .85; }
.act-score .win { background: var(--good); }
.act-score .draw { background: var(--muted); }
.act-score .loss { background: var(--bad); }
.act-sub { margin-top: 3px; font-size: 13px; color: var(--muted); }
.act-sub a { color: var(--text); }
.act-sub a:hover { color: var(--accent-text); }

/* The Community pages (community.js). */
.cm-wrap { max-width: 1040px; margin: 0 auto; padding: 24px 20px 56px; display: flex; flex-direction: column; gap: 18px; }
.cm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cm-head h1 { margin: 0; font-size: 28px; color: var(--strong); }
.cm-switch { margin: 0; }
.seg a { display: inline-flex; align-items: center; padding: var(--s1) var(--s3); font-weight: 600; font-size: 13px; color: var(--muted); background: var(--inset); text-decoration: none; }
.seg a + a { border-left: 1px solid var(--border); }
.seg a:hover { color: var(--strong); }
#cm-players, #cm-board { display: flex; flex-direction: column; gap: 18px; }
#cm-players.hidden, #cm-board.hidden { display: none; }
.cm-online h2 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.cm-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); font-size: 12px; text-align: center; }
.cm-online-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.cm-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--panel); color: var(--text);
  text-decoration: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .18); transition: transform .12s, box-shadow .12s; }
.cm-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.cm-card-text { display: flex; flex-direction: column; min-width: 0; }
.cm-card-text strong { display: flex; align-items: center; gap: 7px; color: var(--strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-card-text strong .pl-dot { width: 8px; height: 8px; }
.cm-card-text small { font-size: 12px; }
.cm-nobody { margin: 0; padding: 16px; border-radius: var(--r); background: var(--panel); text-align: center; }
.cm-all { padding: 14px 16px; }
.cm-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.cm-search { flex: 1 1 220px; height: 34px; }
.cm-sort { margin: 0; }
.cm-table tbody tr { cursor: pointer; }
.cm-table tbody tr:hover { background: var(--hover); }
.cm-name { display: inline-flex; align-items: center; gap: 8px; color: var(--strong); font-weight: 600; text-decoration: none; }
.cm-name:hover span:nth-child(2) { text-decoration: underline; }
.cm-name .pl-dot { width: 9px; height: 9px; }
.cm-you { font-size: 11px; font-weight: 700; color: var(--accent-text); }
.cm-on { color: var(--good); font-weight: 600; }
.cm-empty { margin: 10px 0 0; }
.cm-note { margin: 12px 0 0; font-size: 12.5px; }
.cm-rank { width: 44px; font-weight: 800; color: var(--muted); }
.cm-top-1 .cm-rank { color: #e0b03c; }
.cm-top-2 .cm-rank { color: #b8c2cc; }
.cm-top-3 .cm-rank { color: #c98a52; }
.cm-podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; padding-top: 10px; }
.cm-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 190px; padding: 18px 12px 0;
  color: var(--text); text-decoration: none; text-align: center; }
.cm-step:hover .cm-step-name { text-decoration: underline; }
.cm-medal { width: 30px; height: 30px; }
.cm-avatar.lg { width: 56px; height: 56px; font-size: 24px; margin: 2px 0 4px; }
.cm-step-name { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; color: var(--strong); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-step-name .pl-dot { width: 8px; height: 8px; }
.cm-step-rating { font-size: 22px; font-weight: 800; color: var(--strong); }
.cm-step-block { display: grid; place-items: center; width: 100%; margin-top: 10px; border-radius: var(--r) var(--r) 0 0; font-size: 26px; font-weight: 900; color: rgba(255, 255, 255, .85);
  background: linear-gradient(180deg, var(--step), color-mix(in srgb, var(--step) 55%, #000)); }
.cm-step-1 { --step: #c9a03a; }
.cm-step-2 { --step: #8d98a3; }
.cm-step-3 { --step: #a8703f; }
.cm-step-1 .cm-step-block { height: 96px; }
.cm-step-2 .cm-step-block { height: 66px; }
.cm-step-3 .cm-step-block { height: 46px; }

/* Editing your profile. */
.profile-dialog { width: min(480px, calc(100vw - 2 * var(--s3))); }
.profile-dialog h2 { margin-top: 0; }
.pe-field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 14px; }
.pe-field > span { font-weight: 700; color: var(--strong); font-size: 13px; }
.pe-field .input { width: 100%; height: 36px; padding: 0 10px; font: inherit; }
.pe-field textarea.input { height: auto; min-height: 90px; padding: 8px 10px; resize: vertical; font: inherit; }
.pe-field small { font-size: 12px; }
.pe-danger { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.pe-danger summary { cursor: pointer; color: var(--bad); font-weight: 700; font-size: 13px; }
.pe-danger p { font-size: 13px; color: var(--text); }

/* Fair play for admins (admin.js). */
.admin-page .player-inner > div { display: flex; flex-direction: column; gap: 16px; }
.admin-page .player-inner > div.hidden { display: none; }
.ad-title { margin: 0; font-size: 26px; color: var(--strong); }
.ad-lead { margin: -8px 0 0; font-size: 13.5px; }
.admin-page .panel { padding: 14px 16px; }
.ad-back { font-size: 13px; }
.ad-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ad-who h1 { margin: 0 0 4px; font-size: 24px; }
.ad-who h1 a { color: var(--strong); }
.ad-who .muted { font-size: 13px; }
.ad-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; font-size: 13px; }
.ad-facts dt { color: var(--muted); }
.ad-facts dd { margin: 0; }
.ad-status.open { color: var(--bad); font-weight: 600; }
.ad-status.banned { color: var(--bad); }
.ad-status.dismissed { color: var(--muted); }
.ad-decide { display: flex; flex-direction: column; gap: 10px; }
.ad-decide textarea { height: 64px; font: inherit; font-size: 13px; }
.ad-actions { display: flex; gap: 8px; justify-content: flex-end; }
#ad-games { display: flex; flex-direction: column; gap: 12px; }
.ad-game.flagged { border-color: var(--bad); }
.ad-game-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; font-size: 13.5px; }
.ad-sum { margin: 8px 0; font-size: 13px; }
.ad-warn { color: var(--bad); }
.ad-table td, .ad-table th { font-size: 12.5px; }
.ad-table tr.ad-flag { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.ad-out.top { color: var(--bad); font-weight: 600; }
.ad-out.good { color: var(--text); }
.ad-out.miss { color: var(--muted); }
@media (max-width: 900px) {
  .pl-layout { grid-template-columns: minmax(0, 1fr); }
  .pl-side { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .pl-perf { border-radius: var(--r); background: var(--panel); }
  .pl-perf-go { display: none; }
}
@media (max-width: 652px) {
  .acct-btn .acct-name { max-width: 80px; }
  .acct-btn .acct-rating { display: none; }
  .admin-btn .admin-label { display: none; }
  .admin-btn { padding: 0 6px; }
  .pl-wrap, .cm-wrap { padding: 14px 10px 40px; }
  .pl-header { padding: 16px; }
  .pl-title h1 { font-size: 24px; }
  .pl-profile { padding: 14px 16px 4px; }
  .pl-activity { padding: 4px 14px 18px; }
  .pl-tabs { padding: 0 6px; overflow-x: auto; }
  .pl-tabs button { padding: 12px 10px; white-space: nowrap; }
  .pl-side { gap: 6px; }
  .pl-perf { padding: 10px 12px; }
  .pl-perf-icon { display: none; }
  .pl-perf-v { font-size: 18px; }
  .act-score { margin-left: 0; }
  .cm-step { width: 33%; padding: 10px 4px 0; }
  .cm-step-rating { font-size: 18px; }
  .cm-avatar.lg { width: 44px; height: 44px; font-size: 20px; }
  .hdr-drop { position: fixed; top: 52px; right: 8px; left: auto; }
}

.home-footer { position: relative; display: flex; justify-content: center; gap: 10px; margin-top: 28px; font-size: 13px; color: var(--muted); }
.home-footer a { color: var(--muted); }
.home-footer a:hover { color: var(--strong); }
