/* ==========================================================================
   Quantum Chess 5×5 — design tokens
   Neutrals are warm charcoal (chess-site familiar). Quantum state has its own
   language: a cyan/magenta "chromatic split", used only where something is
   genuinely in superposition. Green is reserved for primary actions.
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg: #1b1a18;
  --surface: #232220;
  --surface-2: #2a2926;
  --raised: #33312d;
  --hair: rgba(255, 255, 255, 0.07);
  --hair-2: rgba(255, 255, 255, 0.13);
  --text: #eeece6;
  --text-2: #bdb9af;
  --text-3: #a3a097;

  --go: #81b64c;
  --go-press: #5f8a35;
  --q-cyan: #5fd4e8;
  --q-mag: #ff76b8;
  --q-ink: #1f8fa6;
  --select: rgba(255, 221, 87, 0.52);
  --lastmove: rgba(255, 221, 87, 0.36);

  --ui: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;

  --sq: min(13.4vh, 106px);
  --r: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 40px -18px rgba(0, 0, 0, 0.7);
}
body[data-theme="blue"]     { --light: #e9eef5; --dark: #7f9cc2; --hl-light: #c9dcf3; --hl-dark: #6a8fc2; --sel-light: #b2cdef; --sel-dark: #5a82bb; }
body[data-theme="pink"]     { --light: #fcf0f3; --dark: #d98fa8; --hl-light: #f7d6e1; --hl-dark: #cb7a97; --sel-light: #f3c4d4; --sel-dark: #bf6a88; }
body[data-theme="lavender"] { --light: #f2eefa; --dark: #9886c4; --hl-light: #e0d6f6; --hl-dark: #8873bb; --sel-light: #d3c5f2; --sel-dark: #7a64b0; }
body[data-theme="green"]    { --light: #ecedd1; --dark: #779657; --hl-light: #f5f682; --hl-dark: #b9ca43; --sel-light: #f7f769; --sel-dark: #bbcb2b; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--q-cyan); }
.hidden { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
code { font: 500 0.88em var(--mono); background: rgba(95, 212, 232, 0.1); color: #a9ecf6; padding: 1px 6px; border-radius: 5px; }
kbd { font: 600 11px var(--mono); color: var(--text-3); border: 1px solid var(--hair-2); border-radius: 4px; padding: 0 5px; line-height: 16px; }
:focus-visible { outline: 2px solid var(--q-cyan); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 10px; font-weight: 700; font-size: 15px; transition: transform 0.08s, background 0.15s, box-shadow 0.15s; }
.btn.primary { background: var(--go); color: #fff; box-shadow: 0 3px 0 var(--go-press); }
.btn.primary:hover { background: #8cc256; }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--go-press); }
.btn.primary:disabled { opacity: 0.55; cursor: progress; }
.btn.ghost { color: var(--text-2); box-shadow: inset 0 0 0 1px var(--hair-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 9px; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .ic { width: 20px; height: 20px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  height: 60px; padding: 0 20px;
  background: rgba(27, 26, 24, 0.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; justify-self: start; }
/* logo: the knight in superposition (same cyan/pink fringe as pieces on the board) on a dark tile */
.mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: none; box-shadow: none; }
.mark img { width: 36px; height: 36px; border-radius: 10px; transition: transform 0.2s; box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.6); }
.brand:hover .mark img { transform: scale(1.06); }
.mark .logo-light { display: none; }
html[data-ui="light"] .mark { background: none; box-shadow: none; }
html[data-ui="light"] .mark img { box-shadow: 0 4px 12px -6px rgba(60, 45, 25, 0.35), inset 0 0 0 1px var(--hair); }
html[data-ui="light"] .mark .logo-dark { display: none; }
html[data-ui="light"] .mark .logo-light { display: block; }
.wordmark { font: 400 30px/1 var(--display); letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 6px; transform: scaleY(1.18); transform-origin: left center; }
.wordmark small { font: 700 11px var(--mono); color: var(--q-cyan); background: rgba(95, 212, 232, 0.1); padding: 2px 6px; border-radius: 5px; letter-spacing: 0.02em; }

.nav { display: flex; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; }
.nav a { display: flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 8px; color: var(--text-3); text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap; transition: color 0.15s, background 0.15s; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); background: var(--raised); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.nav .ic { width: 16px; height: 16px; }
.nav .s { display: none; }
.top-actions { display: flex; align-items: center; gap: 6px; justify-self: end; }
.engine-status { display: inline-flex; align-items: center; gap: 8px; font: 600 12px var(--mono); color: var(--text-3); padding: 6px 10px; border-radius: 8px; }
.engine-status .edot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.engine-status.qiskit { color: var(--text-2); }
.engine-status.qiskit .edot { background: var(--q-cyan); box-shadow: 0 0 0 3px rgba(95, 212, 232, 0.18); }

/* ---------- play layout ---------- */
.layout { display: flex; gap: 28px; justify-content: center; align-items: stretch; padding: 24px 24px 24px; flex-wrap: wrap; }
.board-col { display: flex; flex-direction: column; gap: 8px; }

.player-bar { display: flex; align-items: center; gap: 12px; width: calc(var(--sq) * 5); height: 52px; padding: 0 14px 0 7px; border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); transition: background 0.2s, box-shadow 0.2s; }
.player-bar.turn { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair-2), inset 3px 0 0 var(--go); }
.avatar { width: 38px; height: 38px; border-radius: 8px; background-size: 78%; background-position: center 60%; background-repeat: no-repeat; flex: none; }
.avatar.white { background-color: #dedbd3; background-image: url(pieces/wK.svg); }
.avatar.black { background-color: #45423d; background-image: url(pieces/bK.svg); }
.pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.pname { font-weight: 800; font-size: 15px; line-height: 1.2; }
.captured { display: flex; height: 18px; margin-top: 2px; }
.captured:empty { display: none; }
.captured span { width: 18px; height: 18px; background-size: contain; margin-right: -5px; opacity: 0.9; }
.turn-flag { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--go); opacity: 0; transition: opacity 0.2s; }
.player-bar.turn .turn-flag { opacity: 1; }

/* ---------- board ---------- */
.board-wrap { position: relative; }
.board {
  display: grid; grid-template-columns: repeat(5, var(--sq)); grid-template-rows: repeat(5, var(--sq));
  border-radius: 6px; overflow: hidden; user-select: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 24px 50px -20px rgba(0, 0, 0, 0.8);
}
.sq { position: relative; display: grid; place-items: center; cursor: pointer; }
.sq.light { background: var(--light); }
.sq.dark { background: var(--dark); }
.sq.light.last { background: var(--hl-light); }
.sq.dark.last { background: var(--hl-dark); }
.sq.light.sel { background: var(--sel-light); }
.sq.dark.sel { background: var(--sel-dark); }
.coord { position: absolute; font: 700 12px var(--ui); pointer-events: none; }
.coord.rank { top: 6px; left: 8px; line-height: 1; }
.coord.file { bottom: 6px; right: 8px; line-height: 1; }
.sq.light .coord { color: var(--dark); }
.sq.dark .coord { color: var(--light); }

.piece {
  position: relative; width: 86%; height: 86%;
  background: center / contain no-repeat;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.28));
  transition: opacity 0.35s ease, transform 0.15s ease; pointer-events: none;
}
.sq:hover .piece { transform: translateY(-2px); }
/* superposition: a chromatic split, not a glow */
.piece.maybe {
  filter: drop-shadow(2.5px 0 0 rgba(255, 118, 184, 0.6)) drop-shadow(-2.5px 0 0 rgba(95, 212, 232, 0.7)) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.22));
  animation: qsplit 3.2s ease-in-out infinite;
}
@keyframes qsplit {
  50% { filter: drop-shadow(1px 0 0 rgba(255, 118, 184, 0.5)) drop-shadow(-1px 0 0 rgba(95, 212, 232, 0.6)) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.22)); }
}
.prob-num {
  position: absolute; top: 5%; right: 5%; z-index: 2; pointer-events: none;
  font: 700 11px/16px var(--mono); color: #0e3b45; background: rgba(255, 255, 255, 0.9);
  padding: 0 5px; border-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.prob-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, 0.14); pointer-events: none; }
.prob-bar i { display: block; height: 100%; background: var(--q-ink); }

.dot { position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(0, 0, 0, 0.16); pointer-events: none; }
.ring { position: absolute; inset: 3%; border-radius: 50%; border: 6px solid rgba(0, 0, 0, 0.16); pointer-events: none; }
.qdot { position: absolute; width: 32%; height: 32%; border-radius: 50%; border: 2.5px dashed var(--q-ink); background: rgba(95, 212, 232, 0.22); pointer-events: none; }
.picked { position: absolute; inset: 0; background: rgba(95, 212, 232, 0.28); box-shadow: inset 0 0 0 3px var(--q-ink); pointer-events: none; }
.partner { position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--q-ink); pointer-events: none; }
.flash::after { content: ""; position: absolute; inset: 0; pointer-events: none; animation: measure 0.9s ease-out forwards; }
@keyframes measure {
  0% { box-shadow: inset 0 0 0 0 rgba(95, 212, 232, 0.9); background: rgba(95, 212, 232, 0.45); }
  100% { box-shadow: inset 0 0 0 calc(var(--sq) / 2) rgba(95, 212, 232, 0); background: transparent; }
}
body.no-anim .piece.maybe { animation: none; }
body.no-anim .piece, body.no-anim .sq:hover .piece { transition: none; transform: none; }
body.no-anim .flash::after { animation: none; }

/* game-over card */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, rgba(15, 14, 13, 0.45), rgba(15, 14, 13, 0.78)); backdrop-filter: blur(3px); border-radius: 6px; z-index: 5; animation: ov-fade 0.3s ease-out both; }
.overlay-card { width: min(380px, 88%); padding: 30px 30px 24px; border-radius: 20px; text-align: center; background: linear-gradient(180deg, #2c2a27, #232220); border: 1px solid var(--hair-2); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.06); animation: ov-pop 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.15) both; }
.ov-crown { width: 92px; height: 92px; margin: -2px auto 14px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.ov-crown img { width: 62px; height: 62px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45)); position: relative; }
.ov-crown::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; animation: ov-glow 2.4s ease-in-out infinite; }
.ov-crown.white { background: radial-gradient(circle, #f4f1ea, #cfc9bc); }
.ov-crown.white::before { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25), 0 0 40px 6px rgba(255, 236, 180, 0.35); }
.ov-crown.black { background: radial-gradient(circle, #4a4742, #2a2825); box-shadow: inset 0 0 0 2px rgba(95, 212, 232, 0.5); }
.ov-crown.black::before { box-shadow: 0 0 0 1px rgba(95, 212, 232, 0.25), 0 0 40px 6px rgba(95, 212, 232, 0.28); }
.ov-crown.draw { width: 120px; border-radius: 46px; background: linear-gradient(90deg, #ddd8cd 50%, #3a3834 50%); }
.ov-crown.draw img { width: 46px; height: 46px; }
.overlay-kicker { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-3); }
.overlay-title { font: 400 54px/1.02 var(--display); margin: 6px 0 6px; color: var(--text); }
.overlay-sub { color: var(--text-2); font-size: 15px; margin-bottom: 20px; }
.ov-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 -6px 22px; padding: 14px 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.ov-stats div { display: flex; flex-direction: column; gap: 3px; }
.ov-stats div + div { border-left: 1px solid var(--hair); }
.ov-stats b { font: 400 28px/1 var(--display); color: var(--text); }
.ov-stats span { font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.ov-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ov-actions .btn { height: 46px; }
@keyframes ov-fade { from { opacity: 0; } }
@keyframes ov-pop { from { opacity: 0; transform: translateY(12px) scale(0.94); } }
@keyframes ov-glow { 50% { opacity: 0.55; transform: scale(1.06); } }
body.no-anim .overlay, body.no-anim .overlay-card, body.no-anim .ov-crown::before { animation: none; }

/* mini boards (manual figures) */
.board.mini { --msq: min(15vw, 58px); grid-template-columns: repeat(5, var(--msq)); grid-template-rows: repeat(5, var(--msq)); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 12px 30px -14px rgba(0, 0, 0, 0.8); }
.board.mini .sq { cursor: default; }
.board.mini .coord { font-size: 10px; top: 4px; left: 5px; }
.board.mini .coord.file { top: auto; left: auto; bottom: 4px; right: 5px; }
.board.mini .prob-num { font-size: 10px; line-height: 14px; padding: 0 4px; }
.board.mini .prob-bar { height: 3px; }
.board.mini .ring { border-width: 4px; }
.board.mini .qdot { border-width: 2px; }
.board.mini .partner, .board.mini .picked { box-shadow: inset 0 0 0 2px var(--q-ink); }
.board.mini .piece.maybe { animation: none; filter: drop-shadow(1.5px 0 0 rgba(255, 118, 184, 0.6)) drop-shadow(-1.5px 0 0 rgba(95, 212, 232, 0.7)); }

/* ---------- side panel ---------- */
.panel {
  width: 400px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; scrollbar-width: thin;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 16px; padding: 20px; box-shadow: var(--shadow);
}
.panel-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.kicker { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.mode-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 6px; border-radius: 999px; font: 700 10.5px var(--mono); letter-spacing: 0.08em; }
.mode-pill .ic { width: 12px; height: 12px; }
.mode-pill.q { color: var(--q-cyan); background: rgba(95, 212, 232, 0.12); box-shadow: inset 0 0 0 1px rgba(95, 212, 232, 0.25); }
.mode-pill.c { color: #e8b86a; background: rgba(232, 184, 106, 0.12); box-shadow: inset 0 0 0 1px rgba(232, 184, 106, 0.28); }
html[data-ui="light"] .mode-pill.q { color: #0b7f95; background: rgba(11, 127, 149, 0.1); box-shadow: inset 0 0 0 1px rgba(11, 127, 149, 0.25); }
html[data-ui="light"] .mode-pill.c { color: #9a6a12; background: rgba(154, 106, 18, 0.1); box-shadow: inset 0 0 0 1px rgba(154, 106, 18, 0.25); }
.status { font: 400 30px/1.1 var(--display); margin-top: 3px; }
.qmeter { width: 116px; }
.qm-row { display: flex; justify-content: space-between; font: 600 11px var(--mono); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.qm-row b { color: var(--text); font-weight: 600; letter-spacing: 0; }
.qm-bar { height: 5px; border-radius: 3px; background: var(--raised); margin-top: 6px; overflow: hidden; }
.qm-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--q-cyan), var(--q-mag)); transition: width 0.4s ease; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--bg); border-radius: 12px; border: 1px solid var(--hair); }
.mode { display: flex; align-items: center; justify-content: center; gap: 7px; height: 40px; border-radius: 9px; color: var(--text-3); font-weight: 700; font-size: 14px; transition: color 0.15s, background 0.15s; }
.mode:hover { color: var(--text); }
.mode.active { background: var(--raised); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.mode[data-mode="split"].active .ic, .mode[data-mode="merge"].active .ic { color: var(--q-cyan); }
.mode kbd { margin-left: 2px; }
.mode.active kbd { color: var(--text-2); }
.hint { margin: -4px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--text-2); height: 40px; overflow: hidden; }

.psec h4 { margin: 0 0 8px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.empty { margin: 0; color: var(--text-3); font-size: 13.5px; }
.psec.grow { flex: 1 1 110px; min-height: 96px; display: flex; flex-direction: column; }
.psec.grow .movelist { flex: 1 1 0; min-height: 0; }
/* move list in the chess.com manner, with a slim scrollbar in the page's own colours */
.movelist { overflow-y: auto; border-radius: 8px; background: var(--bg); scrollbar-width: thin; scrollbar-color: #4a4742 transparent; }
.movelist::-webkit-scrollbar { width: 8px; }
.movelist::-webkit-scrollbar-track { background: transparent; }
.movelist::-webkit-scrollbar-thumb { background: #4a4742; border-radius: 8px; border: 2px solid var(--bg); }
.movelist::-webkit-scrollbar-thumb:hover { background: #5e5a54; }
.movelist .empty { padding-top: 10px; }
.mrow { display: grid; grid-template-columns: 38px 1fr 1fr; align-items: center; height: 32px; padding-right: 6px; font: 600 13.5px var(--mono); }
.mrow:nth-child(even) { background: rgba(255, 255, 255, 0.035); }
.mno { color: var(--text-3); padding-left: 10px; font-weight: 500; }
.mv { min-width: 0; cursor: pointer; }
.mv[data-ply]:hover .mchip { background: rgba(255, 255, 255, 0.07); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--q-cyan); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.panel.reviewing .movelist { box-shadow: inset 0 0 0 1.5px var(--q-cyan); }
.board.review { box-shadow: 0 0 0 2px var(--q-cyan), 0 18px 40px -18px rgba(0, 0, 0, 0.8); }
.mchip { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; padding: 3px 7px; border-radius: 5px; color: var(--text); white-space: nowrap; overflow: hidden; }
.mv.cur .mchip { background: rgba(255, 255, 255, 0.13); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.mv .q { color: var(--q-cyan); }
.mv.fail .mt { color: #f0a35e; text-decoration: line-through; text-decoration-thickness: 1px; }
.fig-ico { width: 17px; height: 17px; flex: none; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.5)); }
.qmark { width: 7px; height: 7px; border-radius: 50%; background: var(--q-cyan); margin-left: 4px; flex: none; box-shadow: 0 0 0 2px rgba(95, 212, 232, 0.2); }
.movelist .empty { padding: 10px 12px; }
.psec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.psec-head h4 { margin: 0; }
.viewtoggle { display: flex; gap: 2px; padding: 2px; border-radius: 7px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--hair); }
.viewtoggle button { padding: 3px 9px; border-radius: 5px; font: 600 11.5px var(--ui); color: var(--text-3); }
.viewtoggle button:hover { color: var(--text); }
.viewtoggle button.active { background: var(--raised); color: var(--text); }
/* the circuit section shares the panel's spare height with the move list; the drawing scales to its box */
.psec.grow2 { flex: 2 1 220px; min-height: 0; display: flex; flex-direction: column; position: relative; }
.circuit { flex: 1 1 120px; min-height: 90px; overflow: hidden; background: #f6f5f2; border-radius: 10px; padding: 8px 10px; display: flex; align-items: center; justify-content: center; }
.circuit img, .circuit svg { display: block; width: 100%; height: 100%; object-fit: contain; }
.circuit .empty { color: #6f6c66; padding: 6px 8px; }
.panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 10px; max-width: min(560px, 92vw);
  background: #2d2b28; color: var(--text); padding: 11px 16px 11px 14px; border-radius: 12px;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.7), inset 0 0 0 1px var(--hair-2); font-size: 14px;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--q-cyan); flex: none; }

/* ---------- manual & blog ---------- */
.doc { display: grid; grid-template-columns: 220px minmax(0, 720px); gap: 56px; justify-content: center; padding: 48px 24px 96px; }
.doc.single { grid-template-columns: minmax(0, 720px); }
#manualBody { grid-column: 2; }
.toc-side { position: fixed; top: 110px; bottom: 56px; left: max(24px, calc(50% - 498px)); width: 220px; display: flex; flex-direction: column; }
.toc-side .toc-title { font: italic 400 22px/1.1 var(--display); color: var(--q-cyan); margin-bottom: 10px; }
.toc { position: relative; display: flex; flex-direction: column; justify-content: space-between; flex: 1; max-height: 640px; border-left: 1px solid var(--hair-2); }
.toc-ind { position: absolute; left: -1px; right: 0; height: 0; background: rgba(95, 212, 232, 0.11); border-left: 2px solid var(--q-cyan); border-radius: 0 8px 8px 0; transition: top 0.08s linear; pointer-events: none; }
.toc a { position: relative; z-index: 1; }
.toc a { color: var(--text-3); text-decoration: none; font-size: 14px; font-weight: 600; padding: 7px 0 7px 14px; transition: color 0.15s; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--text); }

.article { font-size: 16.5px; line-height: 1.72; color: var(--text-2); }
.article p, .article li { color: var(--text-2); }
.article b, .article strong { color: var(--text); font-weight: 700; }
.article h1 { font: 400 clamp(38px, 5vw, 56px)/1.04 var(--display); color: var(--text); margin: 10px 0 18px; letter-spacing: -0.01em; }
.article h1 em { color: var(--q-cyan); }
.article .eyebrow { font-size: 24px; color: var(--q-cyan); margin-bottom: 0; }
.article h1 + .eyebrow { margin: -10px 0 18px; }
.article .eyebrow.small { font-size: 18px; margin-bottom: 6px; }
.article h2 { font: 400 34px/1.15 var(--display); color: var(--text); margin: 64px 0 14px; scroll-margin-top: 90px; }
.article h3 { font: 700 17px var(--ui); color: var(--text); margin: 28px 0 6px; }
.eyebrow { font: italic 400 22px/1.1 var(--display); letter-spacing: 0.01em; color: var(--q-cyan); margin: 0 0 2px; }
/* page titles: one serif headline at one size on every page; the descriptive words in cyan italic, the name in white */
.page-title { font: 400 36px/1.1 var(--display); color: var(--text); margin: 0 0 8px; letter-spacing: -0.005em; display: flex; flex-direction: column; gap: 3px; }
.page-title em { order: 1; font: italic 400 24px/1.15 var(--display); color: var(--q-cyan); }

.lede { font-size: 20px; line-height: 1.6; color: var(--text); margin: 0 0 8px; }
.secno { display: none; font: 600 12px var(--mono); letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 6px; }
.byline { display: flex; align-items: center; gap: 16px; margin: 22px 0 6px; padding: 16px 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); font-size: 14px; }
.byline .av { width: 72px; height: 72px; }
.byline b { display: block; color: var(--text); }
.byline span { color: var(--text-3); }
.qbox { background: var(--surface); border: 1px solid var(--hair); border-left: 3px solid var(--q-cyan); padding: 14px 18px; border-radius: 0 10px 10px 0; font-size: 15px; }
.pull { font: italic 400 30px/1.3 var(--display); color: var(--text); border-left: 3px solid var(--q-mag); padding: 4px 0 4px 22px; margin: 34px 0; }
.ticks { list-style: none; padding: 0; }
.ticks li { position: relative; padding-left: 22px; margin: 8px 0; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 0.72em; width: 8px; height: 2px; background: var(--q-cyan); border-radius: 1px; }
.steps { padding-left: 22px; }
.steps li { margin: 8px 0; padding-left: 4px; }
.steps li::marker { font: 600 14px var(--mono); color: var(--q-cyan); }

.rules-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14.5px; line-height: 1.5; }
.rules-table th, .rules-table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.rules-table th { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); border-bottom-color: var(--hair-2); }
.rules-table td { color: var(--text-2); }
.rules-table td:first-child { color: var(--text); font-weight: 700; white-space: nowrap; }
.rules-table.compact { max-width: 520px; }
.inline-piece { width: 26px; height: 26px; vertical-align: -8px; margin-right: 8px; }

.fig { margin: 34px 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.fig-row { display: flex; flex-wrap: wrap; gap: 36px 44px; justify-content: center; margin: 34px 0; }
.fig-row .fig { margin: 0; max-width: 300px; }
.fig-board { position: relative; }
.fig-arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fig figcaption { font-size: 14px; line-height: 1.55; color: var(--text-2); text-align: center; max-width: 290px; }
.fig figcaption b { color: var(--text-2); font: 600 12px var(--mono); margin-right: 4px; }

.compare-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 22px 0; background: var(--hair); border: 1px solid var(--hair); border-radius: 12px; overflow: hidden; }
.cc { background: var(--bg); padding: 18px 20px; }
.cc .cc-k { font: 600 11px var(--mono); color: var(--q-cyan); text-transform: uppercase; letter-spacing: 0.1em; }
.cc h3 { margin: 4px 0 6px; }
.cc p { margin: 0; font-size: 15px; line-height: 1.55; }
.experiment { background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 20px; margin: 22px 0; }
.exp-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.exp-title { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.exp-status { font-size: 13px; color: var(--text-3); }
.experiment .btn { height: 38px; font-size: 14px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 112px; align-items: center; gap: 14px; font-size: 14px; color: var(--text-2); }
.bar-track { background: var(--bg); border-radius: 6px; height: 24px; overflow: hidden; }
.bar { height: 100%; border-radius: 6px; transition: width 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.bar-value { font: 600 14px var(--mono); color: var(--text); text-align: right; white-space: nowrap; }
.chart { width: 100%; display: block; }
.chart .grid { stroke: var(--hair-2); stroke-width: 1; }
.chart .tick { fill: var(--text-3); font: 500 11px var(--mono); }
.chart .axis { fill: var(--text-3); font: 500 12px var(--ui); }
.note { font-size: 13.5px; color: var(--text-2); margin: 12px 0 0; }
.refs { font-size: 14px; }
.refs li { margin: 6px 0; }

/* ---------- settings drawer ---------- */
.drawer {
  margin: 0 0 0 auto; padding: 0; border: 0; height: 100vh; max-height: 100vh; width: min(440px, 100vw);
  background: var(--surface); color: var(--text); box-shadow: -30px 0 60px -20px rgba(0, 0, 0, 0.7);
  display: none; flex-direction: column;
}
.drawer[open] { display: flex; animation: slide-in 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
.drawer::backdrop { background: rgba(10, 10, 9, 0.5); backdrop-filter: blur(2px); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px 24px; border-bottom: 1px solid var(--hair); }
.drawer-head h2 { margin: 0; font: 400 30px var(--display); outline: none; }
.drawer form { margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 0 12px; }
.drawer-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--hair); }
.set-group { padding: 18px 24px 6px; }
.set-group h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.set-group h3 .ic { width: 15px; height: 15px; }
.themes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-card { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--hair); text-align: left; transition: box-shadow 0.15s; }
.theme-card:hover { box-shadow: inset 0 0 0 1px var(--hair-2); }
.theme-card.active { box-shadow: inset 0 0 0 2px var(--go); }
.theme-preview { display: grid; grid-template-columns: repeat(2, 18px); grid-template-rows: repeat(2, 18px); border-radius: 5px; overflow: hidden; flex: none; }
.theme-preview i { display: block; }
.theme-card .tname { font-weight: 700; font-size: 14px; line-height: 1.2; }
.theme-card .tsub { font: 500 12px var(--ui); color: var(--text-3); white-space: nowrap; }
.theme-card .ic { margin-left: auto; color: var(--go); opacity: 0; }
.theme-card.active .ic { opacity: 1; }

.row, .engine-card { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--hair); cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row > .ic, .engine-card > .ic { color: var(--text-3); width: 20px; height: 20px; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-text b { font-weight: 700; font-size: 14.5px; }
.row-text small { color: var(--text-3); font-size: 12.5px; line-height: 1.4; }
.row input, .engine-card input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 40px; height: 24px; border-radius: 12px; background: var(--raised); position: relative; flex: none; transition: background 0.18s; box-shadow: inset 0 0 0 1px var(--hair-2); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #d8d5ce; transition: transform 0.18s; }
.row input:checked + .switch { background: var(--go); box-shadow: none; }
.row input:checked + .switch::after { transform: translateX(16px); background: #fff; }
.row input:focus-visible + .switch { outline: 2px solid var(--q-cyan); outline-offset: 2px; }
.engines { display: flex; flex-direction: column; gap: 8px; }
.engine-card { padding: 12px 14px; border: 0; border-radius: 12px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--hair); }
.engine-card:has(input:checked) { box-shadow: inset 0 0 0 2px var(--go); }
.engine-card:has(input:checked) > .ic { color: var(--text); }
.radio { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--text-3); flex: none; }
.engine-card input:checked ~ .radio { box-shadow: inset 0 0 0 5px var(--go); }
.engine-card input:focus-visible ~ .radio { outline: 2px solid var(--q-cyan); outline-offset: 2px; }
.chip { align-self: flex-start; margin-top: 6px; font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 5px; background: var(--raised); color: var(--text-3); }
.chip.ok { background: rgba(129, 182, 76, 0.16); color: #a9d57a; }
.chip.off { background: rgba(240, 163, 94, 0.14); color: #f0b27a; }
.set-note { font-size: 12.5px; color: var(--text-3); margin: 12px 0 8px; line-height: 1.5; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .doc { grid-template-columns: minmax(0, 720px); }
  .toc-side { display: none; }
  #manualBody { grid-column: 1; }
}
@media (max-width: 860px) {
  .topbar { grid-template-columns: 1fr auto; height: auto; padding: 10px 14px; row-gap: 10px; }
  .nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
  .nav a { padding: 7px 10px; flex: 1; justify-content: center; }
  .nav .l { display: none; }
  .nav .s { display: inline; }
  .engine-status span:last-child { display: none; }
}
@media (max-width: 760px) {
  :root { --sq: calc((100vw - 40px) / 5); }
  body { overflow-x: hidden; }
  .layout { padding: 16px 20px 40px; }
  .psec.grow { flex: none; }
  .psec.grow .movelist { flex: none; max-height: 220px; }
  .panel { width: 100%; }
  .status { font-size: 26px; }
  .doc { padding: 28px 20px 72px; }
  .article h2 { font-size: 29px; margin-top: 48px; }
  .compare-cards { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 96px 1fr 92px; font-size: 13px; }
  .themes { grid-template-columns: 1fr; }
  .mode kbd { display: none; }
  .rules-table { display: block; overflow-x: auto; font-size: 13.5px; }
  .rules-table th, .rules-table td { padding: 9px 8px; }
  .rules-table td:first-child { white-space: normal; min-width: 96px; }
}

/* ---------- video tutorials ---------- */
.tutorials { margin-bottom: 8px; }
.tut { background: var(--surface); border: 1px solid var(--hair); border-radius: 16px; overflow: hidden; margin-top: 18px; box-shadow: var(--shadow); }
.tut-stage { display: grid; grid-template-columns: auto 1fr; gap: 26px; padding: 22px; align-items: start; }
.tut-boardwrap { position: relative; }
.board.tut-b { --sq: min(12vw, 62px); }
.board.tut-b .sq { cursor: default; }
.board.tut-b .piece { transition: opacity 0.7s ease; }
.board.tut-b .coord { font-size: 10px; }
.board.tut-b .prob-num { font-size: 9.5px; line-height: 14px; }
.tut-mark { position: absolute; inset: 0; pointer-events: none; }
.tut-mark.qdot { inset: 34%; border-radius: 50%; border: 2.5px dashed var(--q-ink); background: rgba(95, 212, 232, 0.22); }
.tut-mark.dot { inset: 36%; border-radius: 50%; background: rgba(0, 0, 0, 0.16); }
.tut-mark.ring { inset: 4%; border-radius: 50%; border: 5px solid rgba(0, 0, 0, 0.16); }
.tut-mark.partner { box-shadow: inset 0 0 0 3px var(--q-ink); }
.tut-arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tut-arrow { animation: draw 0.6s ease-out both; }
@keyframes draw { from { opacity: 0; } }
.tut-big { position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%; background: rgba(20, 20, 18, 0.72); color: #fff; display: grid; place-items: center; backdrop-filter: blur(3px); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); transition: opacity 0.2s, transform 0.2s; }
.tut-big .ic { width: 28px; height: 28px; margin-left: 3px; }
.tut-big:hover { transform: scale(1.06); }
.tutorials.is-playing .tut-big { opacity: 0; pointer-events: none; }
.tut-side { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tut-kicker { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--q-cyan); }
.article .tut-title { font: 400 28px/1.15 var(--display); margin: 0; color: var(--text); }
.tut-caption { margin: 0; font-size: 15px; line-height: 1.6; min-height: 72px; }
.tut-ket { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.tut-ket span { font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); flex: none; }
.tut-ket code { background: none; padding: 0; font-size: 14px; color: #bfeff7; white-space: normal; overflow-wrap: anywhere; }
.tut-circuit { background: #f6f5f2; border-radius: 10px; padding: 8px; min-height: 60px; display: flex; align-items: center; justify-content: center; }
.tut-circuit svg { width: 100%; height: auto; max-height: 170px; }
.tut-circuit .empty { color: #6f6c66; font-size: 13px; }
.tut-controls { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--hair); background: var(--bg); }
.tut-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--text-2); flex: none; }
.tut-btn:hover { background: var(--surface-2); color: var(--text); }
.tut-play { color: var(--text); }
.tut-progress { flex: 1; display: flex; gap: 4px; margin: 0 8px; }
.tut-progress .seg { flex: 1; height: 6px; padding: 0; border-radius: 3px; background: var(--raised); overflow: hidden; }
.tut-progress .seg:hover { background: var(--hair-2); }
.tut-progress .seg i { display: block; height: 100%; background: var(--q-cyan); }
.tut-time { font: 600 12px var(--mono); color: var(--text-3); min-width: 82px; text-align: right; }
.tut-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0 0; }
.tut-item { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); text-align: left; transition: box-shadow 0.15s; }
.tut-item:hover { box-shadow: inset 0 0 0 1px var(--hair-2); }
.tut-item.active { box-shadow: inset 0 0 0 2px var(--q-cyan); }
.tut-thumb { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--raised); color: var(--q-cyan); flex: none; }
.tut-meta { display: flex; flex-direction: column; min-width: 0; }
.tut-meta { gap: 3px; }
.tut-meta b { font-size: 15px; color: var(--text); line-height: 1.25; }
.tut-meta small { font: 500 12px/1.4 var(--ui); color: var(--text-2); }
.tut-meta small em { font: 600 11.5px var(--mono); font-style: normal; color: var(--text-3); }

/* ---------- puzzles ---------- */
.puzzles { padding: 20px 24px; }
.pz-sub { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.pz-progress { width: 100%; }
.pzp-num { font: 400 34px/1 var(--display); }
.pzp-num b { font-weight: 400; color: var(--go); }
.pzp-label { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.pzp-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.pz-progress .qm-bar i { background: var(--go); }
.pz-strip { display: flex; }
.pz-group { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 12px 14px; }
.pz-level { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.pz-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; width: 100%; }
.pz-tiles:has(.endless) { display: flex; }
.pz-tile { width: auto; min-width: 0; height: 30px; border-radius: 8px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--hair-2); font: 700 13px var(--mono); color: var(--text-2); display: grid; place-items: center; position: relative; }
.pz-tile:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--text-3); }
.pz-tile.solved { background: rgba(129, 182, 76, 0.16); color: #b6dd8f; box-shadow: inset 0 0 0 1px rgba(129, 182, 76, 0.45); }
.pz-tile.active { box-shadow: inset 0 0 0 2px var(--q-cyan); color: var(--text); }
.pz-tile.endless .ic { width: 18px; height: 18px; }
.pz-layout { --sq: min(11.2vh, 92px); display: grid; grid-template-columns: 224px auto 400px; gap: 28px; justify-content: center; align-items: stretch; }
.pz-side { display: flex; flex-direction: column; gap: 18px; }
.pz-strip { flex: 1; }
.pz-strip .pz-group { flex: 1; justify-content: center; }
.pz-intro h1 { font: 400 42px/1 var(--display); margin: 4px 0 8px; }
.pz-strip { flex-direction: column; flex-wrap: nowrap; gap: 10px; padding: 0; }
.pz-group { flex-direction: column; align-items: flex-start; gap: 7px; }
.pz-tile.endless { width: auto; padding: 0 12px; display: inline-flex; gap: 8px; font: 700 13px var(--ui); }
.pz-panel { width: 400px; }
.pz-panel header { padding-bottom: 2px; }
.pz-task { margin: 0; color: var(--text); font-size: 15px; line-height: 1.6; }
.pz-goal { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-weight: 700; font-size: 14px; }
.pz-goal span { font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--q-cyan); }
/* grows with its text: never a scrollbar */
.pz-feedback { flex: none; font-size: 14px; line-height: 1.55; color: var(--text-2); border-radius: 10px; padding: 12px 14px; background: var(--bg); }
.pz-feedback.idle { display: flex; align-items: center; gap: 10px; color: var(--text-3); background: none; border: 1px dashed var(--hair-2); }
.pz-feedback.good { box-shadow: inset 3px 0 0 var(--go); }
.pz-feedback.bad { box-shadow: inset 3px 0 0 #f0a35e; }
.pz-feedback.hint { box-shadow: inset 3px 0 0 var(--q-cyan); }
.pz-feedback b { color: var(--text); }


.pz-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: auto; }
.pz-actions #pzNext { grid-column: 1 / -1; }
.pz-actions #pzReset.retry { color: #f6c08f; box-shadow: inset 0 0 0 1px rgba(240, 163, 94, 0.6); background: rgba(240, 163, 94, 0.08); }
.pz-actions .btn { padding: 0 8px; font-size: 13.5px; gap: 6px; }

@media (max-width: 860px) {
  .tut-stage { grid-template-columns: 1fr; justify-items: center; }
  .tut-side { width: 100%; }
  .tut-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .board.tut-b { --sq: calc((100vw - 84px) / 5); }
  .tut-stage { padding: 14px; }
  .puzzles { padding: 24px 20px 40px; }
  .pz-layout { --sq: calc((100vw - 40px) / 5); }
}

/* puzzle feedback card: verdict, number, move, reason, outcome — each on its own line */
.pz-feedback .fb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fb-badge { font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; padding: 4px 9px; border-radius: 6px; background: var(--raised); color: var(--text-2); }
.pz-feedback.good .fb-badge { background: rgba(129, 182, 76, 0.16); color: #b6dd8f; }
.pz-feedback.bad .fb-badge { background: rgba(240, 163, 94, 0.14); color: #f6c08f; }
.pz-feedback.hint .fb-badge { background: rgba(95, 212, 232, 0.12); color: #a9ecf6; }
.fb-stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.fb-stat b { font: 400 28px/1 var(--display); color: var(--text); }
.fb-stat small { font-size: 11.5px; color: var(--text-3); margin-top: 3px; text-align: right; }
.fb-row { display: grid; grid-template-columns: 74px 1fr; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hair); font-size: 14px; color: var(--text); font-weight: 600; }
.fb-row > span { font: 600 10.5px/20px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.fb-row.why { font-weight: 500; }
.fb-row.why p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text-2); }
.fb-body { margin: 10px 0 0; font-size: 13.5px; color: var(--text-2); }
.fb-roll { margin-top: 12px; padding: 9px 11px; border-radius: 8px; background: var(--surface); font-size: 13px; color: var(--text-2); }
.pz-feedback.hint .fb-head + .fb-body { margin-top: 10px; }

/* ---------- blog list ---------- */
.post-list { display: flex; flex-direction: column; gap: 16px; margin-top: 30px; }
.post-card { display: block; padding: 26px 28px; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); color: inherit; text-decoration: none; transition: box-shadow 0.15s, transform 0.15s; }
.post-card:hover { box-shadow: inset 0 0 0 1px var(--hair-2), 0 16px 30px -18px rgba(0, 0, 0, 0.8); transform: translateY(-1px); }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 600 11.5px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.post-meta .post-no { color: var(--q-cyan); }
.article .post-title { font: 400 34px/1.12 var(--display); margin: 12px 0 10px; color: var(--text); }
.post-title em { color: var(--q-cyan); }
.post-dek { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text-2); }
.post-foot { display: flex; align-items: center; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--hair); font-size: 14px; color: var(--text-2); }
.post-foot .av { width: 48px; height: 48px; }
.post-foot b { color: var(--text); }
.post-read { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--q-cyan); }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 22px; font-weight: 700; font-size: 14px; color: var(--text-2); text-decoration: none; }
.back-link:hover { color: var(--text); }

/* ---------- circuit key: plain-English legend under every circuit ---------- */
.circuit-key { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; line-height: 1.4; color: var(--text-2); }
.ck-intro { color: var(--text-3); font-size: 12.5px; }
.ck-row { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 10px; }
.ck-sym { justify-self: start; font: 600 11px/1 var(--ui); color: #fff; background: #9f1853; padding: 5px 8px; white-space: nowrap; }
.ck-sym.ck-blue { background: #002d9c; }
.ck-sym.ck-grey { background: #8d8d8d; }
.ck-sym.ck-dot { width: 14px; height: 14px; padding: 0; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 2px #9f1853; margin-left: 4px; }
.ck-sym.ck-meter { width: 26px; height: 20px; padding: 0; background: #8d8d8d; position: relative; }
.ck-sym.ck-meter::before { content: ""; position: absolute; left: 6px; top: 7px; width: 14px; height: 7px; border: 1.6px solid #fff; border-bottom: 0; border-radius: 14px 14px 0 0; }
.ck-sym.ck-meter::after { content: ""; position: absolute; left: 12px; top: 5px; width: 1.6px; height: 9px; background: #fff; transform: rotate(35deg); transform-origin: bottom; }
.tut-key .circuit-key { margin-top: 0; }
#circuitKey summary { cursor: pointer; margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--q-cyan); list-style: none; display: flex; align-items: center; gap: 6px; }
#circuitKey summary::-webkit-details-marker { display: none; }
#circuitKey summary::before { content: "+"; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: rgba(95, 212, 232, 0.14); font-size: 13px; line-height: 1; }
#circuitKey details[open] summary::before { content: "−"; }
/* the key opens as a card over the circuit, so nothing below it is pushed out of the panel */
#circuitKey details[open] .circuit-key { position: absolute; left: 0; right: 0; bottom: 34px; z-index: 6; margin: 0; padding: 14px 16px;
  background: var(--surface-2); border-radius: 12px; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.75), inset 0 0 0 1px var(--hair-2); }
html[data-ui="light"] #circuitKey details[open] .circuit-key { background: #fff; box-shadow: 0 18px 40px -16px rgba(60, 45, 25, 0.45), inset 0 0 0 1px var(--hair-2); }

/* √iSWAP in text: the radical's bar spans the whole gate name */
.rad { display: inline-flex; align-items: flex-end; white-space: nowrap; }
.rad-sign { font-size: 1.15em; line-height: 1; margin-right: -0.04em; }
.rad-body { border-top: 1.4px solid currentColor; padding: 0.06em 0.12em 0 0.08em; line-height: 1.1; }
.ck-sym .rad-body { border-top-width: 1.2px; }
.ck-sym sup, .tut-title sup, .qbox sup { font-size: 0.7em; }

/* ---------- history timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 20px 0 8px; border-left: 2px solid var(--hair-2); }
.timeline li { position: relative; display: grid; grid-template-columns: 92px 1fr; gap: 14px; padding: 0 0 18px 20px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--q-cyan); }
.timeline li:last-child::before { background: var(--q-cyan); }
.tl-year { font: 600 13px/1.6 var(--mono); color: var(--q-cyan); }
.timeline b { color: var(--text); }
.timeline p { margin: 2px 0 0; font-size: 15px; line-height: 1.55; }
.next-art { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--hair); font-size: 15px; }
@media (max-width: 760px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

/* puzzles: narrower windows put the list on top, phones stack everything */
@media (max-width: 1180px) {
  .pz-layout { grid-template-columns: auto 400px; }
  .pz-side { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 12px 24px; align-items: center; }
  .pz-intro h1 { font-size: 34px; }
  .pz-progress { width: 160px; }
  .pz-strip { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 10px 24px; }
}
@media (max-width: 760px) {
  .pz-layout { grid-template-columns: 1fr; }
  .pz-side { grid-template-columns: 1fr; }
  .pz-panel { width: 100%; }
}

.fb-why { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--hair); }
.fb-why summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--q-cyan); }
.fb-why summary::-webkit-details-marker { display: none; }
.fb-why summary::before { content: "+"; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: rgba(95, 212, 232, 0.14); font-size: 13px; line-height: 1; }
.fb-why[open] summary::before { content: "−"; }
.fb-why p { margin: 8px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--text-2); }

/* short screens: the puzzle panel tightens up so the page never needs to scroll */
.pz-panel.compact { gap: 11px; padding: 16px 18px; }
.pz-panel.compact .status { font-size: 26px; }
.pz-panel.compact .pz-task { font-size: 14px; line-height: 1.5; }
.pz-panel.compact .pz-goal { padding: 8px 12px; }
.pz-panel.compact .mode { height: 36px; }
.pz-panel.compact .pz-feedback { padding: 10px 12px; }
.pz-panel.compact .btn { height: 40px; }
.pz-panel.compact .fb-row, .pz-panel.compact .fb-why { margin-top: 9px; padding-top: 9px; }
.pz-panel.compact .fb-stat b { font-size: 24px; }
.pz-panel.tight { gap: 9px; padding: 14px 16px; }
.pz-panel.tight .kicker { display: none; }
.pz-panel.tight .status { font-size: 24px; margin-top: 0; }
.pz-panel.tight .pz-task { font-size: 13.5px; line-height: 1.45; }
.pz-panel.tight .pz-goal { flex-direction: row; gap: 8px; align-items: baseline; font-size: 13px; padding: 7px 10px; }
.pz-panel.tight .mode { height: 34px; }
.pz-panel.tight .btn { height: 38px; }
.pz-panel.tight .pz-actions { gap: 6px; }
.pz-panel.tight .fb-roll { padding: 6px 9px; margin-top: 8px; }
.pz-panel.tight .fb-head .fb-stat small { display: none; }
/* short windows: the puzzle list column tightens so it also fits */
@media (max-height: 800px) and (min-width: 1181px) {
  .pz-side { gap: 12px; }
  .pz-sub { display: none; }
  .pz-intro h1 { font-size: 32px; margin-bottom: 0; }
  .pzp-num { font-size: 28px; }
  .pz-strip { gap: 8px; }
  .pz-group { padding: 10px 12px; }
  .pz-tile { height: 30px; font-size: 13px; }
}

/* author photo: cropped to the face, round, with a thin ring that lifts it off the dark page */
.av { border-radius: 50%; object-fit: cover; flex: none; background: var(--raised); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }

/* ==========================================================================
   Light appearance: warm paper tones, not stark white. Same structure as the
   dark theme; only colours change. Set on <html data-ui="light">.
   ========================================================================== */
html[data-ui="light"] {
  color-scheme: light;
  --bg: #f3f1ec;
  --surface: #fbfaf7;
  --surface-2: #efece6;
  --raised: #e6e2da;
  --hair: rgba(40, 33, 24, 0.09);
  --hair-2: rgba(40, 33, 24, 0.16);
  --text: #23211d;
  --text-2: #55514a;
  --text-3: #79746a;
  --q-cyan: #127c95;
  --q-mag: #c2477f;
  --q-ink: #127c95;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 16px 34px -20px rgba(60, 45, 25, 0.3);
}
html[data-ui="light"] code { color: #0f6b80; background: rgba(18, 124, 149, 0.09); }
html[data-ui="light"] .topbar { background: rgba(243, 241, 236, 0.88); }
html[data-ui="light"] .nav a.active { box-shadow: 0 1px 2px rgba(60, 45, 25, 0.18); background: #fff; }
html[data-ui="light"] .mode.active { background: #fff; box-shadow: 0 1px 2px rgba(60, 45, 25, 0.18); }
html[data-ui="light"] .viewtoggle button.active { background: #fff; box-shadow: 0 1px 2px rgba(60, 45, 25, 0.15); }
html[data-ui="light"] .avatar.white { background-color: #fff; box-shadow: inset 0 0 0 1px var(--hair-2); }
html[data-ui="light"] .board { box-shadow: 0 0 0 1px rgba(40, 33, 24, 0.12), 0 22px 44px -24px rgba(60, 45, 25, 0.45); }
html[data-ui="light"] .board.mini { box-shadow: 0 0 0 1px rgba(40, 33, 24, 0.12), 0 12px 26px -16px rgba(60, 45, 25, 0.45); }
html[data-ui="light"] .player-bar.turn { background: #fff; }

/* move list */
html[data-ui="light"] .movelist { background: var(--surface-2); scrollbar-color: #cbc5ba transparent; }
html[data-ui="light"] .movelist::-webkit-scrollbar-thumb { background: #cbc5ba; border-color: var(--surface-2); }
html[data-ui="light"] .movelist::-webkit-scrollbar-thumb:hover { background: #b5aea1; }
html[data-ui="light"] .mrow:nth-child(even) { background: rgba(40, 33, 24, 0.035); }
html[data-ui="light"] .mv.cur .mchip { background: #fff; box-shadow: 0 1px 2px rgba(60, 45, 25, 0.2), inset 0 0 0 1px var(--hair); }
html[data-ui="light"] .mv.fail .mt { color: #b45d16; }
html[data-ui="light"] .fig-ico { filter: invert(1); }   /* dark figurines on the light list, as on chess.com */

/* circuits */
html[data-ui="light"] .circuit, html[data-ui="light"] .tut-circuit { background: #fff; box-shadow: inset 0 0 0 1px var(--hair); }
html[data-ui="light"] .tut-ket code { color: #0f6b80; }

/* small feedback colours, darkened for contrast on light */
html[data-ui="light"] .chip.ok, html[data-ui="light"] .pz-tile.solved, html[data-ui="light"] .pz-feedback.good .fb-badge { color: #4a7a1f; background: rgba(129, 182, 76, 0.18); }
html[data-ui="light"] .chip.off, html[data-ui="light"] .pz-feedback.bad .fb-badge { color: #a4561a; background: rgba(240, 163, 94, 0.18); }
html[data-ui="light"] .pz-feedback.hint .fb-badge { color: #0f6b80; background: rgba(18, 124, 149, 0.1); }
html[data-ui="light"] .pz-feedback.bad { box-shadow: inset 3px 0 0 #d9812f; }
html[data-ui="light"] .pz-actions #pzReset.retry { color: #a4561a; background: rgba(240, 163, 94, 0.12); }
html[data-ui="light"] .pz-feedback:not(.idle), html[data-ui="light"] .pz-goal { background: var(--surface-2); }
html[data-ui="light"] .fb-roll { background: #fff; }

/* controls */
html[data-ui="light"] .switch { background: #d9d4ca; }
html[data-ui="light"] .switch::after { background: #fff; box-shadow: 0 1px 2px rgba(60, 45, 25, 0.3); }
html[data-ui="light"] .theme-card, html[data-ui="light"] .engine-card, html[data-ui="light"] .ui-card { background: #fff; }
html[data-ui="light"] .toast { background: #fff; color: var(--text); box-shadow: 0 16px 36px -14px rgba(60, 45, 25, 0.35), inset 0 0 0 1px var(--hair-2); }
html[data-ui="light"] .drawer { box-shadow: -24px 0 50px -20px rgba(60, 45, 25, 0.35); }
html[data-ui="light"] .drawer::backdrop { background: rgba(40, 33, 24, 0.28); }
html[data-ui="light"] .av { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px rgba(40, 33, 24, 0.14), 0 6px 14px -6px rgba(60, 45, 25, 0.5); }

/* game-over card */
html[data-ui="light"] .overlay { background: radial-gradient(circle at 50% 45%, rgba(243, 241, 236, 0.35), rgba(243, 241, 236, 0.72)); }
html[data-ui="light"] .overlay-card { background: linear-gradient(180deg, #ffffff, #f7f4ef); box-shadow: 0 28px 60px -24px rgba(60, 45, 25, 0.45), inset 0 0 0 1px var(--hair); }
html[data-ui="light"] .ov-crown.white { box-shadow: inset 0 0 0 1px rgba(40, 33, 24, 0.12); }

/* blog and manual */
html[data-ui="light"] .post-card, html[data-ui="light"] .experiment, html[data-ui="light"] .qbox, html[data-ui="light"] .tut { background: #fff; }
html[data-ui="light"] .post-card:hover { box-shadow: inset 0 0 0 1px var(--hair-2), 0 16px 30px -20px rgba(60, 45, 25, 0.4); }
html[data-ui="light"] .cc { background: var(--surface); }
html[data-ui="light"] .tut-controls { background: var(--surface-2); }

/* ---------- appearance picker in Settings ---------- */
.ui-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ui-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 8px 9px; border-radius: 12px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--hair); font-size: 13px; font-weight: 700; }
.ui-card:hover { box-shadow: inset 0 0 0 1px var(--hair-2); }
.ui-card.active { box-shadow: inset 0 0 0 2px var(--go); }
.ui-preview { width: 100%; height: 44px; border-radius: 7px; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.ui-preview::before { content: ""; position: absolute; left: 8px; top: 8px; width: 46%; height: 6px; border-radius: 3px; }
.ui-preview::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 8px; height: 14px; border-radius: 4px; }
.ui-preview.dark { background: #1b1a18; }
.ui-preview.dark::before { background: #4a4742; }
.ui-preview.dark::after { background: #2a2926; }
.ui-preview.light { background: #f3f1ec; }
.ui-preview.light::before { background: #cfc9be; }
.ui-preview.light::after { background: #fff; box-shadow: 0 0 0 1px rgba(40, 33, 24, 0.1); }
.ui-preview.system { background: linear-gradient(90deg, #1b1a18 50%, #f3f1ec 50%); }
.ui-preview.system::before { background: linear-gradient(90deg, #4a4742 50%, #cfc9be 50%); width: calc(100% - 16px); }
.ui-preview.system::after { background: linear-gradient(90deg, #2a2926 50%, #fff 50%); }
.ui-card span { display: inline-flex; align-items: center; gap: 6px; }
.ui-card .ic { width: 15px; height: 15px; }



/* ---------- action tiles (Play / Bots panel) ---------- */
.side-col { width: 224px; display: flex; flex-direction: column; gap: 8px; align-self: flex-start; }
.play-side { align-self: stretch; gap: 18px; }
.play-side #actions { width: auto; align-self: stretch; gap: 10px; }
.play-side .tile-btn { flex: none; height: 72px; gap: 14px; padding: 0 14px; }
.side-card.tips { margin-top: auto; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--hair); display: flex; flex-direction: column; gap: 9px; }
.tips-title { font: italic 400 18px/1 var(--display); color: var(--q-cyan); margin-bottom: 2px; }
.tip { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.tip > span { display: inline-flex; gap: 3px; flex: none; }
.tip kbd { min-width: 20px; text-align: center; }
@media (max-height: 760px) { .side-card.tips { display: none; } }
.play-side .tile-ic { width: 46px; height: 46px; border-radius: 12px; }
.play-side .tile-ic .ic { width: 22px; height: 22px; }
.play-side .tile-text { gap: 5px; }
.play-side .tile-text b { font-size: 16px; }
.play-side .tile-text small { font-size: 12.5px; }
/* on Bots the two tiles sit side by side under the options, compact so the column fits the window */
.bots-side .side-col { width: auto; align-self: stretch; display: flex; flex-direction: column; gap: 8px; }
.bots-side .tile-btn { height: 48px; padding: 0 8px; gap: 8px; min-width: 0; }
.bots-side .tile-text b { font-size: 13.5px; }
.bots-side .tile-btn.primary { box-shadow: none; }
.bots-side .tile-btn.primary:active { transform: translateY(1px); box-shadow: none; }
.bots-side .tile-text small { display: none; }
@media (max-height: 820px) { .bots-sub { display: none; } }
@media (max-width: 1100px) {
  .side-col { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .side-col .tile-btn { flex: 1 1 180px; }
}
.tile-btn { display: flex; align-items: center; gap: 11px; height: 58px; padding: 0 12px 0 10px; border-radius: 12px; text-align: left; background: var(--bg); box-shadow: inset 0 0 0 1px var(--hair); color: var(--text-2); transition: box-shadow 0.15s, background 0.15s, transform 0.08s; }
.tile-btn:hover { box-shadow: inset 0 0 0 1px var(--hair-2); color: var(--text); }
.tile-btn:active { transform: translateY(1px); }
.tile-btn:disabled { opacity: 0.45; cursor: default; }
.tile-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--raised); color: var(--text-2); flex: none; }
.tile-ic .ic { width: 17px; height: 17px; }
.tile-text { display: flex; flex-direction: column; gap: 4px; line-height: 1.1; min-width: 0; }
.tile-text b { font-size: 14px; color: var(--text); white-space: nowrap; }
.tile-text small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.tile-btn.primary { background: var(--go); box-shadow: 0 3px 0 var(--go-press); }
.tile-btn.primary:hover { background: #8cc256; box-shadow: 0 3px 0 var(--go-press); }
.tile-btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--go-press); }
.tile-btn.primary .tile-ic { background: rgba(255, 255, 255, 0.18); color: #fff; }
.tile-btn.primary .tile-text b, .tile-btn.primary .tile-text small { color: #fff; }
.tile-btn.primary .tile-text small { opacity: 0.85; }
body[data-mode="bots"] .play-only, body[data-mode="play"] .bots-only { display: none; }

/* ---------- Bots section: bots | board | panel ---------- */
.botsview { padding: 24px 24px 24px; }
.bots-grid { display: grid; grid-template-columns: 250px auto; gap: 28px; justify-content: center; align-items: start; }
.bots-side { display: flex; flex-direction: column; gap: 14px; }
.bots-intro h1 { font: 400 42px/1 var(--display); margin: 4px 0 8px; }
.bots-sub { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.bot-cards { display: flex; flex-direction: column; gap: 8px; }
.bot-card { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 10px; border-radius: 12px; text-align: left; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); color: var(--text-2); transition: box-shadow 0.15s; }
.bot-card:hover { box-shadow: inset 0 0 0 1px var(--hair-2); color: var(--text); }
.bot-card.active { box-shadow: inset 0 0 0 2px var(--go); color: var(--text); }
.bot-badge { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--raised); color: var(--text-2); flex: none; }
.bot-card.active .bot-badge { background: rgba(129, 182, 76, 0.18); color: var(--go); }
.bot-badge .ic { width: 19px; height: 19px; }
.bot-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bot-text b { font: 400 20px/1.1 var(--display); color: var(--text); }
.bot-text small { font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-top: 3px; }
.bot-go { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); flex: none; }
.bot-card.active .bot-go { background: var(--go); color: #fff; }
.bot-go .ic { width: 14px; height: 14px; }
.bots-options { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; }
.opt-block { display: flex; flex-direction: column; gap: 7px; }
.setup-label { font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pick { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 10px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--hair); color: var(--text-2); font-weight: 700; font-size: 13.5px; transition: box-shadow 0.15s, color 0.15s; }
.pick:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--hair-2); }
.pick.active { color: var(--text); box-shadow: inset 0 0 0 2px var(--go); }
.pick img { width: 26px; height: 26px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
.pick .ic { width: 17px; height: 17px; }
.pick.active .ic { color: var(--go); }
#botsArena { padding: 0; align-items: stretch; }
.bot-ic { width: 14px; height: 14px; vertical-align: -2px; margin-left: 4px; color: var(--go); }
@media (max-width: 1100px) {
  .bots-grid { grid-template-columns: 1fr; }
  .bots-side { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; align-items: start; }
  .bots-intro { grid-column: 1 / -1; }
}
@media (max-width: 760px) { .botsview { padding: 20px 20px 36px; } .bots-side { grid-template-columns: 1fr; } }

/* ---------- blog author block ---------- */
.author-card { display: flex; align-items: center; gap: 18px; margin: 26px 0 8px; padding: 18px 22px; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); }
.author-card .av { width: 88px; height: 88px; }
.author-card > div { display: flex; flex-direction: column; gap: 2px; }
.author-card b { font: 400 26px/1.15 var(--display); color: var(--text); }
.author-card span { font-size: 14px; color: var(--text-2); line-height: 1.5; }
.author-kicker { font: 600 10.5px var(--mono) !important; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3) !important; }
.byline > div { display: flex; flex-direction: column; gap: 2px; }
.byline b { font: 400 22px/1.15 var(--display); }
.post-by { display: flex; flex-direction: column; line-height: 1.25; }
.post-by b { color: var(--text); }
.post-by small { color: var(--text-3); font-size: 12.5px; }
@media (max-width: 760px) { .author-card { flex-direction: column; align-items: flex-start; } }

/* classical rules: the king in check */
.sq.in-check::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle, rgba(235, 97, 80, 0.95) 0, rgba(235, 97, 80, 0.55) 38%, rgba(235, 97, 80, 0) 72%); }
html[data-ui="light"] .pick, html[data-ui="light"] .tile-btn:not(.primary) { background: #fff; }
