/* Shared (Chess Lab and Think Ahead). Home: chess-lab-open/site/shared/ (MIT); the private kit pulls a pinned copy.
   Styles for the shared components, using only the theme's colour variables (shared/theme.css). */
/* 15 Nov 2026 (his phone review): quick taps on ‹ › zoomed the page in on iPhones (Safari's double-tap zoom, also on a
   dimmed button). manipulation keeps scrolling and pinch zoom and drops only double-tap zoom. :where() has no weight,
   so anything that sets its own touch-action (a drag grip's none) still wins; set on every element because a scroll
   box in between would bring double-tap zoom back for what is inside it. */
:where(html,html *){touch-action:manipulation}
/* 23 Nov 2026 (his device test): a drag that started on a piece scrolled the page up or down instead (manipulation lets
   iOS claim a vertical swipe for scrolling, so the piece only moved sideways). On a board you can move on, the squares
   with your own pieces take no touch gestures: the drag is the board's. A swipe from any other square still scrolls. */
.board.movable .sq.mine,.board.movable .sq.own{touch-action:none}   /* .own: a drag on your piece while the reply is still coming (or played back) doesn't scroll the page either (his recheck, 23 Nov 2026); .movable is on only while the board takes a move (makeBoard), so a finished or read-only board scrolls from anywhere */
/* ? = the keys on this page (shared/keys.js) */
#keys-overlay{position:fixed;inset:0;background:var(--scrim);display:grid;place-items:center;z-index:80;padding:16px}
#keys-overlay .card{background:var(--white);color:var(--ink);border-radius:var(--radius);padding:16px 18px;max-width:440px;width:100%;max-height:calc(100vh - 32px);overflow:auto;box-shadow:0 8px 30px rgba(0,0,0,.25)}
#keys-overlay h2{margin:0 0 6px;font:700 20px/1.2 var(--serif);color:var(--head)}
.keystable{border-collapse:collapse;margin:8px 0}.keystable td{padding:4px 10px 4px 0;vertical-align:top}
.keystable kbd{display:inline-block;min-width:2.2em;text-align:center;padding:1px 6px;border:1px solid var(--line);border-radius:4px;font:600 12px/1.6 var(--sans);background:var(--band)}
/* "?" help beside a stat (shared/help.js) */
.qglue{white-space:nowrap}.qhelp{display:inline-grid;place-items:center;width:18px;height:18px;margin-left:4px;padding:0;border:1px solid var(--line);border-radius:50%;background:var(--white);color:var(--muted);font:600 11px/1 var(--sans);cursor:help;vertical-align:middle}
.qhelp:hover,.qhelp:focus-visible{color:var(--head);border-color:var(--muted)}
.qpop{position:fixed;z-index:1000;display:block;margin:0;padding:8px 10px;max-width:320px;background:var(--white);color:var(--ink);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 6px 20px rgba(0,0,0,.18);font:400 13px/1.4 var(--sans);letter-spacing:0;text-transform:none;text-align:left;white-space:normal}
/* "needs internet" card (shared/net.js) */
.needs-net p{margin:4px 0}
/* Dropdowns that match the site (native behaviour kept, so phones still get their own picker). Site rules after this win. */
select{-webkit-appearance:none;appearance:none;background:var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23889' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center/11px 8px;
  border:1px solid var(--border-strong);border-radius:var(--radius);padding:7px 30px 7px 10px;color:var(--ink);font:inherit;min-height:36px;cursor:pointer;max-width:100%}
select:hover{border-color:var(--muted)}
select:focus-visible{outline:2px solid var(--blue);outline-offset:1px}
select[multiple]{background-image:none;padding-right:10px}
/* The reader (shared/reader.js): board pinned at the top, the moves and notes flowing as text underneath, a fixed
   bottom bar. --rb = the board's share of the screen (35-65, drag handle, remembered). Phones and upright iPads only:
   the Read button hides elsewhere. Main line bold in the text colour, side lines in --side (purple), notes as paragraphs. */
.btn.rd-open,.rd-open{display:none}
@media (orientation:portrait) and (max-width:1099.98px),(orientation:landscape) and (max-height:499.98px){.btn.rd-open,.rd-open{display:inline-flex;align-items:center;justify-content:center}}
html.reader-open,html.reader-open body{overflow:hidden}
.reader{position:fixed;inset:0;z-index:90;background:var(--band);color:var(--ink);display:grid;
  grid-template-rows:auto calc(var(--rb,50) * 1vh - 44px) 18px minmax(0,1fr) calc(60px + env(safe-area-inset-bottom,0px));
  grid-template-rows:auto calc(var(--rb,50) * 1dvh - 44px) 18px minmax(0,1fr) calc(60px + env(safe-area-inset-bottom,0px));grid-template-columns:100%;
  padding-top:env(safe-area-inset-top,0px)}
.rd-top{display:flex;align-items:center;gap:8px;padding:4px 12px;min-height:44px}
.rd-title{flex:1;font:700 16px/1.2 var(--serif);color:var(--head);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rd-close{min-width:44px;min-height:44px}
.rd-boardwrap{display:grid;place-items:center;overflow:hidden;padding:0 8px}
.rd-board{width:auto;height:100%;max-width:100%;aspect-ratio:1}
.rd-handle{display:grid;place-items:center;cursor:row-resize;touch-action:none}
.rd-handle span{width:44px;height:5px;border-radius:3px;background:var(--line)}
.rd-notes{overflow-y:auto;padding:4px 14px 0;min-height:0;position:relative;z-index:0;scroll-behavior:auto;overscroll-behavior:contain}
.rd-notes::after{content:'';display:block;height:40vh}   /* 14 Nov: the room to scroll the last move up used to be the box's own padding. A box can't be shorter than its
   padding, so with a tall board it grew past its row and lay over the bottom bar: the text showed through it, and on iPhones (where a scrolling box is its own layer)
   it took the taps meant for ‹ › and Flip. */
.rd-flow{max-width:44rem;margin:0 auto;font:400 16.5px/1.75 var(--sans);color:var(--ink)}
.rd-p{margin:0 0 10px}
.rd-note{margin:0 0 10px;line-height:1.55;color:var(--ink)}
.rd-flow .vmv{font-weight:500;color:var(--side);padding:3px 3px;margin:0 -1px;line-height:1.5}
.rd-flow .vmv.rd-mm{font-weight:700;color:var(--ink)}
.rd-flow .vmv.cur{background:var(--navy);color:var(--on-navy)}
.rd-flow .vline.rd-sl{display:inline;margin:0;font-size:inherit;line-height:inherit;color:var(--side)}
.rd-flow .rd-sl .vnote{color:var(--side);opacity:.9}
.rd-flow .rd-sl .vtext,.rd-flow .rd-sl .vdead{color:var(--side)}
.rd-flow .rd-sl .vpar{color:var(--side);opacity:.7}
.rd-done{margin:12px auto;max-width:44rem;padding:12px;background:var(--white);border-radius:var(--radius)}
.rd-bar{display:flex;align-items:center;gap:8px;padding:8px 12px calc(8px + env(safe-area-inset-bottom,0px));background:var(--white);border-top:1px solid var(--line);position:relative;z-index:2}
.rd-bar .btn{min-height:44px;min-width:44px}
.rd-bar .rd-prev,.rd-bar .rd-next{min-width:64px;font-size:1.6rem;line-height:1;padding:4px 10px 6px}.rd-bar .btn.sm{min-height:44px}   /* 13 Nov: scoped so .btn's size no longer wins (they were 14 px glyphs, Flip 40 px) */
.rd-prev{margin-right:auto}.rd-next{margin-left:auto}
.rd-main{color:var(--side);border-color:var(--side);white-space:nowrap}
.rd-pos{font-size:13px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.reader.rd-inside .rd-pos{color:var(--side)}
@media (orientation:landscape) and (max-height:499.98px){
  .reader{grid-template-columns:calc(var(--rb,50) * 1vw) 18px minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) calc(56px + env(safe-area-inset-bottom,0px));
    padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)}
  .rd-top{grid-column:1/-1}.rd-boardwrap{grid-row:2;grid-column:1}.rd-handle{grid-row:2;grid-column:2;cursor:col-resize}.rd-handle span{width:5px;height:44px}
  .rd-notes{grid-row:2;grid-column:3}.rd-bar{grid-row:3;grid-column:1/-1}
}
/* filter controls (shared/controls.js): a two-handle slider and a multi-select dropdown */
.rng{min-width:200px}.rng-head{display:flex;align-items:baseline;gap:6px}.rng-val{font-size:13px;color:var(--head)}
.rng-track{position:relative;height:30px}
.rng-track::before{content:'';position:absolute;left:0;right:0;top:13px;height:4px;border-radius:2px;background:var(--line)}
.rng-fill{position:absolute;top:13px;height:4px;border-radius:2px;background:var(--blue)}
.rng-track input[type=range]{position:absolute;left:0;top:0;width:100%;height:30px;margin:0;background:none;pointer-events:none;-webkit-appearance:none;appearance:none}
.rng-track input[type=range]::-webkit-slider-thumb{pointer-events:auto;-webkit-appearance:none;width:22px;height:22px;border-radius:50%;background:var(--white);border:2px solid var(--blue);cursor:pointer}
.rng-track input[type=range]::-moz-range-thumb{pointer-events:auto;width:18px;height:18px;border-radius:50%;background:var(--white);border:2px solid var(--blue);cursor:pointer}
.rng-track input[type=range]::-moz-range-track{background:none}
.msel{position:relative;display:inline-block}.msel summary{list-style:none;cursor:pointer;display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:6px 30px 6px 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23889' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center/11px 8px}
.msel summary::-webkit-details-marker{display:none}.msel-sum{color:var(--ink)}
.msel-pop{position:absolute;z-index:30;left:0;top:calc(100% + 4px);min-width:220px;max-height:320px;overflow:auto;padding:6px;background:var(--white);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 6px 20px rgba(0,0,0,.18)}
.msel-row{display:flex;gap:8px;align-items:center;min-height:36px;padding:2px 6px;cursor:pointer}.msel-row:hover{background:var(--band)}
.msel-acts{display:flex;justify-content:flex-end;padding-bottom:4px;border-bottom:1px solid var(--line);margin-bottom:4px}
/* Header tabs (shared/nav.js): main tabs, Extra drop-down, Settings at the right; on phones Settings moves into Extra */
nav.tabs{position:sticky;top:env(safe-area-inset-top,0px);z-index:30;background:var(--white);border-bottom:1px solid var(--line)}
nav.tabs .inner{display:flex;gap:2px;overflow-x:auto;scrollbar-width:none;align-items:stretch}
nav.tabs .inner::-webkit-scrollbar{display:none}
/* a row that scrolls sideways fades at the edge that has more tabs (13 Nov 2026: "Today" read "ay" at 320 px) */
nav.tabs .inner.fl{-webkit-mask-image:linear-gradient(to right,transparent 0,#000 28px);mask-image:linear-gradient(to right,transparent 0,#000 28px)}
nav.tabs .inner.fr{-webkit-mask-image:linear-gradient(to left,transparent 0,#000 28px);mask-image:linear-gradient(to left,transparent 0,#000 28px)}
nav.tabs .inner.fl.fr{-webkit-mask-image:linear-gradient(to right,transparent 0,#000 28px,#000 calc(100% - 28px),transparent 100%);mask-image:linear-gradient(to right,transparent 0,#000 28px,#000 calc(100% - 28px),transparent 100%)}
nav.tabs a{color:var(--muted);text-decoration:none;font-size:.95rem;padding:13px 12px;border-bottom:2px solid transparent;white-space:nowrap}
nav.tabs a:hover{color:var(--head)}
nav.tabs a[aria-current="page"]{color:var(--head);border-bottom-color:var(--blue);font-weight:600}
nav.tabs .xtab{display:inline-flex;align-items:center;gap:6px;background:none;border:0;border-bottom:2px solid transparent;font:inherit;font-size:.95rem;color:var(--muted);padding:13px 12px;cursor:pointer;white-space:nowrap}
nav.tabs .xtab:hover{color:var(--head)}
.xmenu a.ph-x{display:none}
nav.tabs .xtab[aria-expanded="true"] svg{transform:rotate(180deg)}
nav.tabs .xtab.cur{color:var(--head);border-bottom-color:var(--blue);font-weight:600}
nav.tabs .tabgap{flex:1 1 auto;min-width:8px}
nav.tabs a.settab{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;min-width:44px}
nav.tabs a.settab svg{flex:none;width:22px;height:22px}
.xmenu{position:fixed;z-index:40;min-width:260px;max-width:calc(100vw - 32px);background:var(--white);border:1px solid var(--line);border-radius:8px;box-shadow:0 10px 28px rgba(19,40,74,.18);padding:6px}
.xmenu a{display:flex;flex-direction:column;gap:1px;padding:9px 12px;border-radius:6px;text-decoration:none;color:var(--ink)}
.xmenu a b{font-weight:600;color:var(--head);font-size:.95rem}
.xmenu a span{font-size:.82rem;color:var(--muted)}
.xmenu a:hover,.xmenu a:focus-visible{background:var(--accent-soft);outline:none}
.xmenu a[aria-current="page"] b{color:var(--blue)}
.xmenu .xset{display:none}
.xmenu{overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
/* grouped Extra menu (13 Nov 2026): groups under small headings, two columns */
.xmenu.grouped{width:min(640px,calc(100vw - 32px));column-count:2;column-gap:6px;padding:8px}
@media (min-width:860px){.xmenu.grouped{column-count:auto;display:grid;grid-template-columns:repeat(var(--xg,2),minmax(0,1fr));gap:0 6px;width:min(calc(var(--xg,2) * 262px + 16px),calc(100vw - 32px));align-items:start}}
.xmenu.grouped .xgrp{break-inside:avoid;padding:2px 0 6px}
.xmenu.grouped .xgh{font-size:.72rem;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--muted);padding:6px 12px 4px}
.xmenu.grouped .xph{column-span:all;display:none}
.xmenu.grouped .xset{column-span:all;grid-column:1/-1}
.xmenu.grouped .xph{grid-column:1/-1}
@media (max-width:480px){nav.tabs .inner > a.ph-x{display:none}.xmenu a.ph-x{display:flex}nav.tabs .xtab.cur-ph{color:var(--head);border-bottom-color:var(--blue);font-weight:600}nav.tabs a.settab{display:none}.xmenu .xset{display:flex;border-top:1px solid var(--line);margin-top:4px;padding-top:11px}
  .xmenu.grouped{padding:6px}.xmenu.grouped a span{display:none}.xmenu.grouped a{padding:9px 10px;min-height:40px;justify-content:center}.xmenu.grouped .xgh{padding:6px 10px 2px}
  .xmenu.grouped .xph{display:grid;grid-template-columns:1fr 1fr;gap:0 6px;border-bottom:1px solid var(--line);padding:0 0 4px;margin-bottom:2px}
  nav.tabs a,nav.tabs .xtab{padding:12px 4px;font-size:.84rem}nav.tabs .tabgap{display:none}nav.tabs .inner{gap:0;padding-left:12px;padding-right:12px;justify-content:space-between}}   /* 14 Nov: 12 + the tab's own 4 = the page's 16 px margin, so the first tab's word starts on the same edge as the board and the cards (it sat 4 px left of them) */
/* 15 Nov 2026: the tabs spread evenly across a phone's width, the first word on the page's left edge and Extra's caret on
   its right edge (they were packed to the left with a gap at the right). A row too wide for the screen still scrolls. */
/* Groups that only exist on phones (a main tab filed under its own heading in Extra, nav.js) */
.xmenu.grouped .xphg{display:none}
@media (max-width:480px){.xmenu.grouped .xphg{display:block}}
/* The header hides while you read (nav.js autoHide, 15 Nov 2026): phones and touch screens only */
nav.tabs{transition:transform .22s ease}
html.navhid nav.tabs{transform:translateY(calc(-100% - env(safe-area-inset-top,0px)));box-shadow:none}
@media (prefers-reduced-motion:reduce){nav.tabs{transition:none}}
@media print{nav.tabs,.xmenu{display:none!important}}
/* Side lines you can click through (shared/varline.js): moves are buttons, notes grey, nested lines in brackets */
.vline{margin:3px 0 4px;font-size:.86rem;line-height:1.75;color:var(--muted)}
.vmv{border:0;background:none;font:inherit;font-weight:600;color:var(--ink);padding:1px 3px;margin:0 -1px;border-radius:3px;cursor:pointer}
.vmv:hover{background:var(--band)}.vmv.cur{background:var(--navy);color:var(--on-navy)}
.vmv:focus-visible{outline:2px solid var(--blue);outline-offset:1px}
.vpick{outline:2px solid var(--blue);outline-offset:1px;border-radius:3px}   /* ↓ ↑: the move → plays where lines branch */
.vnote{color:var(--muted);font-style:italic}.vpar,.vdead{color:var(--muted)}
/* v115 the move tree, as Lichess's move list (varline.js lay/stack/fold, reader.js flow): side lines stacked under the move
   they replace, one row each, joined on the left by a thin elbow line; a single short one inline in brackets and italics */
.vtree{display:block;margin:2px 0 4px 5px}
.vtree.vstack{margin:3px 0 4px 3px;font-size:.86rem;line-height:1.75;color:var(--muted)}
.vrow{display:block;position:relative;padding-left:14px;margin:0}
.vrow.vline{margin:0;font-size:inherit}
.vrow::before{content:'';position:absolute;left:0;top:0;bottom:0;border-left:1px solid var(--tree)}
.vrow:last-child::before{bottom:auto;height:.875em}
.vrow::after{content:'';position:absolute;left:0;top:.875em;width:9px;border-top:1px solid var(--tree)}
.vtree .vtree{margin:1px 0 2px 2px}
.vtree.vshut{display:none}
.vinl{font-style:italic}.vinl .vmv{font-weight:500}.vinl .vpar{font-style:normal}
.vfold{display:inline-grid;place-items:center;box-sizing:border-box;width:16px;height:16px;padding:0;margin:0 4px 0 1px;vertical-align:middle;position:relative;top:-1px;
  border:1px solid var(--tree);border-radius:3px;background:var(--band);color:var(--muted);font:700 13px/1 var(--sans);cursor:pointer;font-style:normal}
.vfold::before{content:'\2212'}.vfold.shut::before{content:'+'}
.vfold:hover{color:var(--ink);border-color:var(--muted)}.vfold:focus-visible{outline:2px solid var(--blue);outline-offset:1px}
@media (hover:none) and (pointer:coarse){.vfold{width:24px;height:24px;margin:0 6px 0 2px}}   /* layout rule 3: 24 px in text */
.vfg{white-space:nowrap}   /* ⊟ never wraps away from its move */
.rd-flow .vtree.rd-tree{margin:-4px 0 10px 4px}
.rd-flow .vrow.vline.rd-sl{display:block}   /* a stacked row (the inline rule above is for a single short line) */
.rd-flow .rd-tree .vrow{color:var(--side)}
.rd-flow .vline.rd-sl.vinl .vmv{font-weight:500}
/* ‹ › step buttons beside a page's main button (v95: Calculation, the opening trainer on phones): 44 px on touch */
.btn.navbtn{min-width:44px;font-size:1.6rem;line-height:1;padding:4px 10px 6px;justify-content:center}   /* 13 Nov: 1.6rem, the ‹ › glyphs read small at 1.3rem */
.btn.navbtn kbd{display:none}
.navgrp{display:inline-flex;gap:6px;align-items:stretch;flex:none;margin-left:auto}
@media (pointer:coarse){.navgrp>.btn{min-height:44px}}
@media (hover:hover) and (pointer:fine) and (min-width:861px){.navgrp>.navbtn{display:none}}   /* a mouse and keyboard: ← → do it */
@media (pointer:coarse){.boardtools>a.btn,.controls>a.btn{display:inline-flex;align-items:center;justify-content:center}}   /* 13 Nov: + .controls (Calculation's "Lichess ↗" sat above its row's text line) */
/* Blind tactics (shared/blind.js): the settings card, the move list with the task, the move box, the picked square, the
   peek frame; on phones the toolbar is a bottom bar (Next, Peek, Give up, Flip; 44 px targets). Scoped to .bl. */
.bl .bl-set{display:flex;flex-direction:column;gap:8px;padding:10px 12px;margin:0 0 6px}
.bl .bl-row{display:flex;align-items:center;gap:8px;margin:0}.bl .bl-row input[type=range]{flex:1;min-width:0;accent-color:var(--navy)}
.bl .bl-row .label{white-space:nowrap}
.bl .bl-auto{align-items:flex-start;font-size:.85rem;line-height:1.35;cursor:pointer}.bl .bl-auto input{margin:2px 0 0;flex:none;width:18px;height:18px;accent-color:var(--navy)}
.bl .bl-autonote{margin:-2px 0 0 26px;font-size:.78rem}
.bl .bl-moves{padding:12px 14px}
.bl .bl-line{margin:6px 0 10px;line-height:1.8;font-size:1rem;overflow-wrap:anywhere}
.bl .bl-no{color:var(--muted);margin-right:3px}.bl .bl-h{color:var(--ink);margin-right:2px}
.bl .bl-task{display:inline-block;font-family:var(--sans);font-weight:700;color:var(--head);margin:0 6px 0 2px}
.bl .bl-you{font-weight:700;color:var(--good);margin-right:2px}.bl .bl-opp{color:var(--ink);margin-right:2px}
.bl .bl-form{display:flex;gap:6px;margin:0}
.bl .bl-form input{flex:1;min-width:0;border:1px solid var(--border-strong);border-radius:var(--radius);padding:7px 10px;font:inherit;font-size:16px;background:var(--white);color:var(--ink)}
.bl .bl-form input:focus{border-color:var(--blue);outline:none;box-shadow:0 0 0 3px var(--callout)}
.bl .bl-lab{display:flex;align-items:center;gap:2px}.bl .bl-lab .qhelp{letter-spacing:0}
/* 15 Nov 2026: phones and tablets solve on the board; the typed-move box (and its keyboard) is for laptops, and its help is behind the "?" */
@media (hover:none) and (pointer:coarse){.bl .bl-form{display:none}.bl .bl-line{margin-bottom:0}}
.bl .sq.bl-sel{box-shadow:inset 0 0 0 3px var(--blue)}
.bl .board.bl-peek{outline:3px solid var(--brass);outline-offset:2px}
@media (max-width:860px){
  .bl .side .bl-moves{order:-2}.bl .side .status{order:-1}   /* one column: the board, then the moves and the box, then the verdict */
  .bl .bl-bar .btn,.bl .bl-form input,.bl .bl-form .btn{min-height:44px}
  .bl .bl-set .chip,.bl .filters .chip{min-height:44px}
}
@media (max-width:600px){   /* phones: the toolbar is a bar at the bottom of the screen */
  .bl{padding-bottom:calc(64px + env(safe-area-inset-bottom,0px))}
  .bl .bl-bar{position:fixed;left:0;right:0;bottom:0;z-index:40;margin:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;
    padding:8px max(10px,env(safe-area-inset-left,0px)) calc(8px + env(safe-area-inset-bottom,0px));background:var(--white);border-top:1px solid var(--line);box-shadow:0 -2px 10px rgba(0,0,0,.08)}
  .bl .bl-bar .btn{justify-content:center;padding:6px 4px;white-space:nowrap}
  .bl .bl-bar kbd{display:none}
  /* short phones (iPhone SE): a smaller board so the move box sits above the bar (13 Nov 2026: the bar covered it) */
  .tv.bl .boardwrap{max-width:min(100%,720px,max(232px,calc(100vh - 320px)));margin-inline:auto}
}

/* The result of an exercise (board.js endBanner; 17 Nov 2026, was a coloured bar with a Next button over the board).
   Nothing is drawn over the board: it gets a thin outline in the result's colour, and where the side panel is not beside
   the board (phones and narrow windows, up to 860 px) one slim strip sits directly under it with the result text. Wider
   screens leave the message to the side panel's status card. Success is the soft panel with a 4 px edge in --success (theme.css; the same shape as .status.good); a miss
   and a loss use the same soft colours as their status cards. A site that shows results only in its status card hides
   .endbar (Chess Lab: head.html). */
.boardbox{position:relative}
.boardbox.end-good .board{box-shadow:0 0 0 3px var(--success)}
.boardbox.end-warn .board{box-shadow:0 0 0 3px var(--warn)}
.boardbox.end-bad .board{box-shadow:0 0 0 3px var(--bad)}
.endbar{display:none}
@media (max-width:860px){
  .endbar:not([hidden]){display:flex;align-items:center;gap:8px;margin-top:6px;padding:7px 12px;border-radius:var(--radius);
    font-size:.92rem;font-weight:600;line-height:1.35;min-height:34px;box-sizing:border-box;background:var(--callout);color:var(--head)}
  .end-good .endbar{background:var(--success-soft);color:var(--success);box-shadow:inset 4px 0 0 var(--success)}
  .end-warn .endbar{background:var(--warn-soft);color:var(--warn);box-shadow:inset 4px 0 0 var(--warn)}
  .end-bad .endbar{background:var(--error-soft);color:var(--error);box-shadow:inset 4px 0 0 var(--error)}
  .endbar .endtext{min-width:0;overflow-wrap:anywhere}
}

/* "↑ Board": back to the page's main view when the board has scrolled mostly out of sight (nav.js, 13 Nov 2026) */
.mvbtn{position:fixed;right:14px;z-index:35;display:inline-flex;align-items:center;gap:4px;min-height:36px;padding:6px 14px;border-radius:999px;border:1px solid var(--line);background:var(--white);color:var(--head);font:600 .86rem/1 inherit;font-family:inherit;box-shadow:0 4px 14px rgba(19,40,74,.18);cursor:pointer}
.mvbtn:hover{border-color:var(--blue);color:var(--blue)}.mvbtn[hidden]{display:none}
@media (pointer:coarse){.mvbtn{min-height:44px}}
@media print{.mvbtn{display:none!important}}

/* Phones (14 Nov 2026, audit quick wins Q3 and Q9): no keyboard, so no key caps on buttons; and the small targets
   reach 40 px: the Rated / Training and Find the move / Play it out switches, and the ? bubbles (their tap area grows
   around them, the bubble itself stays its size). */
@media (hover:none) and (pointer:coarse) and (max-width:700px){
  .btn kbd{display:none}
  .seg.mini button{min-height:40px;padding:8px 12px}
  .qhelp{position:relative}
  .qhelp::after{content:"";position:absolute;inset:-9px}
}
/* Right / wrong on the board (colour direction A, 18 Nov 2026; both sites): a teal or orange wash over the move's squares,
   and on its destination a ✓ / ✗ badge, so the verdict never rests on colour alone (WCAG 1.4.1). Teal against orange
   differs in lightness too, so it stays apart for colour-blind eyes. board.js flash() marks the last square .flash-to. */
.sq.flash-good::before,.sq.flash-bad::before{content:"";position:absolute;inset:0;z-index:3;pointer-events:none;animation:sqflash .9s ease-out forwards}
.sq.flash-good::before{background:var(--sq-good)}
.sq.flash-bad::before{background:var(--sq-bad)}
.sq.flash-to.flash-good::after,.sq.flash-to.flash-bad::after{position:absolute;top:3%;right:3%;z-index:4;width:34%;height:34%;border-radius:50%;
  display:flex;align-items:center;justify-content:center;font:700 clamp(9px,2.2vmin,16px)/1 var(--sans);color:#fff;
  box-shadow:0 0 0 1.5px rgba(255,255,255,.9);pointer-events:none;animation:sqflash .9s ease-in forwards}
.sq.flash-to.flash-good::after{content:"\2713";background:var(--mark-good)}
.sq.flash-to.flash-bad::after{content:"\2715";background:var(--mark-bad)}
@keyframes sqflash{0%,55%{opacity:1}100%{opacity:0}}
@media (prefers-reduced-motion:reduce){.sq.flash-good::before,.sq.flash-bad::before,.sq.flash-to::after{animation:none;opacity:.85}}
.sq.hint::before{content:"";position:absolute;inset:0;box-shadow:inset 0 0 0 4px var(--sq-hint);z-index:3;pointer-events:none}
.sq.hintto::before{content:"";position:absolute;inset:0;box-shadow:inset 0 0 0 4px var(--mark-good);z-index:3;pointer-events:none}
/* Press feedback (19 Nov 2026): a tap shows at once that it landed. Before, buttons had no :active style at all, so on a
   phone nothing changed until the action finished. A quick press-in (scale .97, a touch darker) and a clear focus ring
   for the keyboard; no layout shift (transform only). iOS applies :active because nav.js listens for touchstart.
   Reduce Motion keeps the shade and drops the movement. */
.btn:not(:disabled),.seg button:not(:disabled){-webkit-tap-highlight-color:transparent;transition:transform .12s ease,filter .12s ease,border-color .15s,background .15s}
.btn:not(:disabled):active,.seg button:not(:disabled):active{transform:scale(.97);filter:brightness(.92)}
.btn:focus-visible,.seg button:focus-visible{outline:2px solid var(--accent,var(--blue));outline-offset:2px}
@media (prefers-reduced-motion:reduce){.btn:not(:disabled),.seg button:not(:disabled){transition:filter .12s ease,border-color .15s,background .15s}.btn:not(:disabled):active,.seg button:not(:disabled):active{transform:none}}

/* Smooth tab changes (router.js, View Transitions, 20 Nov 2026): a short crossfade of the page; the tab row is its own
   layer so it stays in place while only its marked tab changes. Reduce Motion: no animation (router.js skips it too). */
nav.tabs{view-transition-name:tabs}
::view-transition-old(root),::view-transition-new(root){animation-duration:.16s}
::view-transition-group(tabs){animation-duration:.16s}
@media (prefers-reduced-motion:reduce){::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none!important}}
