/* ==========================================================================
   1. BASE STYLES & OVERRIDES
   ========================================================================== */
body { 
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; 
  overscroll-behavior-y: none; 
}

img, span { 
  -webkit-touch-callout: none; 
  -webkit-user-select: none; 
  user-select: none; 
  pointer-events: auto; 
}

button svg, button i {
  pointer-events: none;
}


/* ==========================================================================
   2. ANIMATIONS & KEYFRAMES
   ========================================================================== */

/* Piece Destruction/Explosion */
@keyframes shatter-particle { 
  0% { 
    transform: translate(0, 0) rotate(0deg) scale(1); 
    opacity: 1; 
  } 
  100% { 
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0); 
    opacity: 0; 
  } 
}

/* Colorful Confetti Burst */
@keyframes mc-confetti {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  50% { opacity: 1; }
  100% { transform: translate(var(--tx), calc(var(--ty) + 200px)) rotate(var(--rot)) scale(0); opacity: 0; }
}

/* Check Status Shake */
@keyframes king-shake { 
  0%, 100% { transform: translateX(0) rotate(0deg); } 
  25% { transform: translateX(-3px) rotate(-3deg); } 
  75% { transform: translateX(3px) rotate(3deg); } 
}
.king-shake { animation: king-shake 0.4s ease-in-out; }

/* Dance Parties (Shift+D). Four styles, no sound ever (2026-08-23). Every piece
   runs in phase (0s delay) except the Wobble, which is out of step on purpose.
   Every frame of a routine lists the same transform functions in the same order,
   so the browser interpolates each function on its own (a clean 360 spin instead
   of a matrix blend). translateX is a percentage of the piece's own width, so 70%
   is most of a square: pieces move together and never collide; only the edge
   files hang over the rim, which is the gag. */
@keyframes piece-dance {
  0%, 100% { transform: translateY(0) rotate(0) scale(1) translateZ(0); }
  25% { transform: translateY(-12%) rotate(-15deg) scale(1.15) translateZ(0); }
  50% { transform: translateY(-5%) rotate(0) scale(1.05) translateZ(0); }
  75% { transform: translateY(-12%) rotate(15deg) scale(1.15) translateZ(0); }
}

@keyframes piece-dance-sync {
  0%, 100% { transform: translateY(0) scale(1) translateZ(0); }
  50% { transform: translateY(-20%) scale(1.1) translateZ(0); }
}

/* Cupid Shuffle at 120 bpm: 16 beats = 8s, one beat = 6.25%, half a beat = 3.125%.
   "To the right" x4 (0 to +70%) · "to the left" x4 (+70% to -70%, past home) ·
   "now kick" x4 (alternating kicks while drifting home) · "walk it by yourself"
   (three wiggles, then a full spin in place). Ends at home, so the loop is seamless. */
@keyframes piece-dance-cupid {
  0%      { transform: translateX(0)       translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  3.125%  { transform: translateX(8.75%)   translateY(-8%)  rotate(6deg)   scale(1)    translateZ(0); }
  6.25%   { transform: translateX(17.5%)   translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  9.375%  { transform: translateX(26.25%)  translateY(-8%)  rotate(6deg)   scale(1)    translateZ(0); }
  12.5%   { transform: translateX(35%)     translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  15.625% { transform: translateX(43.75%)  translateY(-8%)  rotate(6deg)   scale(1)    translateZ(0); }
  18.75%  { transform: translateX(52.5%)   translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  21.875% { transform: translateX(61.25%)  translateY(-8%)  rotate(6deg)   scale(1)    translateZ(0); }
  25%     { transform: translateX(70%)     translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  28.125% { transform: translateX(52.5%)   translateY(-8%)  rotate(-6deg)  scale(1)    translateZ(0); }
  31.25%  { transform: translateX(35%)     translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  34.375% { transform: translateX(17.5%)   translateY(-8%)  rotate(-6deg)  scale(1)    translateZ(0); }
  37.5%   { transform: translateX(0)       translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  40.625% { transform: translateX(-17.5%)  translateY(-8%)  rotate(-6deg)  scale(1)    translateZ(0); }
  43.75%  { transform: translateX(-35%)    translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  46.875% { transform: translateX(-52.5%)  translateY(-8%)  rotate(-6deg)  scale(1)    translateZ(0); }
  50%     { transform: translateX(-70%)    translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  53.125% { transform: translateX(-61.25%) translateY(-10%) rotate(-18deg) scale(1)    translateZ(0); }
  56.25%  { transform: translateX(-52.5%)  translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  59.375% { transform: translateX(-43.75%) translateY(-10%) rotate(18deg)  scale(1)    translateZ(0); }
  62.5%   { transform: translateX(-35%)    translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  65.625% { transform: translateX(-26.25%) translateY(-10%) rotate(-18deg) scale(1)    translateZ(0); }
  68.75%  { transform: translateX(-17.5%)  translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  71.875% { transform: translateX(-8.75%)  translateY(-10%) rotate(18deg)  scale(1)    translateZ(0); }
  75%     { transform: translateX(0)       translateY(0)    rotate(0)      scale(1)    translateZ(0); }
  78.125% { transform: translateX(0)       translateY(0)    rotate(-12deg) scale(1.06) translateZ(0); }
  81.25%  { transform: translateX(0)       translateY(0)    rotate(12deg)  scale(1.06) translateZ(0); }
  84.375% { transform: translateX(0)       translateY(0)    rotate(-12deg) scale(1.06) translateZ(0); }
  87.5%   { transform: translateX(0)       translateY(0)    rotate(0)      scale(1.1)  translateZ(0); }
  100%    { transform: translateX(0)       translateY(0)    rotate(360deg) scale(1)    translateZ(0); }
}

/* Cha Cha Slide at 125 bpm: 16 beats = 7.68s, one beat = 6.25%, half a beat = 3.125%.
   "To the left" (0 to -70%) · "take it back now y'all" (shrink + drop = a step away
   from the viewer, drifting to -35%) · "one hop this time" (crouch, hop home) ·
   "right foot let's stomp" · "left foot let's stomp" · "cha cha real smooth"
   (a ±12% shimmy) · "turn it out" (a full spin in place over the last three beats). */
@keyframes piece-dance-chacha {
  0%      { transform: translateX(0)       translateY(0)    rotate(0)      scale(1)          translateZ(0); }
  3.125%  { transform: translateX(-17.5%)  translateY(-8%)  rotate(-6deg)  scale(1)          translateZ(0); }
  6.25%   { transform: translateX(-35%)    translateY(0)    rotate(0)      scale(1)          translateZ(0); }
  9.375%  { transform: translateX(-52.5%)  translateY(-8%)  rotate(-6deg)  scale(1)          translateZ(0); }
  12.5%   { transform: translateX(-70%)    translateY(0)    rotate(0)      scale(1)          translateZ(0); }
  15.625% { transform: translateX(-61.25%) translateY(4%)   rotate(0)      scale(0.95)       translateZ(0); }
  18.75%  { transform: translateX(-52.5%)  translateY(8%)   rotate(0)      scale(0.9)        translateZ(0); }
  21.875% { transform: translateX(-43.75%) translateY(8%)   rotate(0)      scale(0.9)        translateZ(0); }
  25%     { transform: translateX(-35%)    translateY(8%)   rotate(0)      scale(0.9)        translateZ(0); }
  28.125% { transform: translateX(-35%)    translateY(10%)  rotate(0)      scale(0.88)       translateZ(0); }
  31.25%  { transform: translateX(-17.5%)  translateY(-30%) rotate(0)      scale(1)          translateZ(0); }
  34.375% { transform: translateX(0)       translateY(-8%)  rotate(0)      scale(1)          translateZ(0); }
  37.5%   { transform: translateX(0)       translateY(0)    rotate(0)      scale(1)          translateZ(0); }
  40.625% { transform: translateX(0)       translateY(-8%)  rotate(8deg)   scale(1)          translateZ(0); }
  43.75%  { transform: translateX(0)       translateY(3%)   rotate(0)      scale(1.06, 0.94) translateZ(0); }
  46.875% { transform: translateX(0)       translateY(0)    rotate(0)      scale(1)          translateZ(0); }
  50%     { transform: translateX(0)       translateY(0)    rotate(0)      scale(1)          translateZ(0); }
  53.125% { transform: translateX(0)       translateY(-8%)  rotate(-8deg)  scale(1)          translateZ(0); }
  56.25%  { transform: translateX(0)       translateY(3%)   rotate(0)      scale(1.06, 0.94) translateZ(0); }
  59.375% { transform: translateX(0)       translateY(0)    rotate(0)      scale(1)          translateZ(0); }
  62.5%   { transform: translateX(0)       translateY(0)    rotate(0)      scale(1)          translateZ(0); }
  65.625% { transform: translateX(12%)     translateY(0)    rotate(4deg)   scale(1)          translateZ(0); }
  68.75%  { transform: translateX(-12%)    translateY(0)    rotate(-4deg)  scale(1)          translateZ(0); }
  71.875% { transform: translateX(12%)     translateY(0)    rotate(4deg)   scale(1)          translateZ(0); }
  75%     { transform: translateX(-12%)    translateY(0)    rotate(-4deg)  scale(1)          translateZ(0); }
  78.125% { transform: translateX(12%)     translateY(0)    rotate(4deg)   scale(1)          translateZ(0); }
  81.25%  { transform: translateX(0)       translateY(0)    rotate(0)      scale(1.08)       translateZ(0); }
  100%    { transform: translateX(0)       translateY(0)    rotate(360deg) scale(1)          translateZ(0); }
}

/* For people who asked the OS for less motion: a gentle pulse in place. Not
   `none`, because the key must still visibly do something or it reads as broken. */
@keyframes piece-dance-still {
  0%, 100% { transform: scale(1) translateZ(0); }
  50% { transform: scale(1.08) translateZ(0); }
}

.dancing-piece { animation: piece-dance 0.6s infinite ease-in-out; }
.dancing-piece-sync { animation: piece-dance-sync 0.6s infinite ease-in-out; }
.dancing-piece-cupid { animation: piece-dance-cupid 8s infinite ease-in-out; transform-origin: 50% 70%; }
.dancing-piece-chacha { animation: piece-dance-chacha 7.68s infinite ease-in-out; transform-origin: 50% 70%; }
@media (prefers-reduced-motion: reduce) {
  .dancing-piece, .dancing-piece-sync, .dancing-piece-cupid, .dancing-piece-chacha { animation: piece-dance-still 1.6s infinite ease-in-out; }
}

/* Visual Effects */
@keyframes dust-puff { 
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; border: 4px solid currentColor; } 
  100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; border: 0px solid currentColor; } 
}

@keyframes piece-slam { 
  0% { transform: scale(1); } 
  30% { transform: scale(0.8) translateY(10%); filter: brightness(1.2); } 
  100% { transform: scale(1) translateY(0); filter: brightness(1); } 
}
.slam-piece { animation: piece-slam 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important; }

@keyframes pop-fade-symbol { 
  0% { 
    transform: translate(-50%, -50%) scale(0) rotate(calc(var(--rot) - 15deg)); 
    opacity: 0; 
    filter: drop-shadow(0 0 0 currentColor); 
  } 
  20% { 
    transform: translate(-50%, -50%) scale(1.2) rotate(calc(var(--rot) + 10deg)); 
    opacity: 1; 
    filter: drop-shadow(0 0 30px currentColor); 
  } 
  70% { 
    transform: translate(-50%, -50%) scale(1) rotate(calc(var(--rot) + 5deg)); 
    opacity: 1; 
    filter: drop-shadow(0 0 10px currentColor); 
  } 
  100% { 
    transform: translate(-50%, -50%) scale(2) rotate(calc(var(--rot) + 20deg)); 
    opacity: 0; 
    filter: blur(10px); 
  } 
}

/* ==========================================================================
   3. CUSTOM SCROLLBARS
   ========================================================================== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.dark ::-webkit-scrollbar-thumb { background: #374151; }

/* ==========================================================================
   4. BOARD & PIECE UTILITIES
   ========================================================================== */
/* Board size is owned by JS fitBoard() (js/core/init.js), which measures the
   real available width AND height and sets an inline `max-width: …px !important`.
   This rule is only a conservative fallback for first paint / if JS fails. */
.board-wrapper {
  max-width: min(100%, calc(100dvh - 220px));
  /* No max-width transition: fitBoard() sets an inline px max-width, and animating
     it over 200ms re-lays-out the board + every piece each frame on resize/panel
     toggles — that read as a visible "shake". Snap instantly instead. */
}

/* Large Board Size Mode — sizing handled by fitBoard(); keep the class hook
   for other large-board styling without fighting the JS-driven max-width. */
body.large-board-on #move-input:not(.hidden) {
  position: fixed;
  bottom: 1rem;
  right: 1.5rem;
  z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border: 2px solid #3b82f6;
}

/* ==========================================================================
   4b. MACBOOK & HIGH-RES SCALING
   ========================================================================== */
/* The root size grows with the screen; Settings → Display → Text size scales
   it (--text-scale: 1, 1.125, 1.25). It used to set html's font-size to a
   percentage, which REPLACED these sizes: on any screen 1280px and up "Large"
   (112.5% of 16 = 18px) equalled Normal (audit, 2026-10-19). A multiplier on
   top of the screen size can't do that. (responsive-desktop.css loads later
   and sets 18px from 1280 up, so the 20px below never wins today.) */
:root { --root-size: 16px; }
@media (min-width: 1280px) { /* e.g., MacBook Air/Pro default logical width */
  :root { --root-size: 18px; }
}
@media (min-width: 1536px) { /* e.g., larger external monitors */
  :root { --root-size: 20px; }
}
html { font-size: calc(var(--root-size) * var(--text-scale, 1)); }

#board-surface { 
  -webkit-touch-callout: none; 
  touch-action: none; 
  overflow: hidden;
  /* Fix: items-stretch on the parent overrides aspect-ratio, making the board
     non-square (squished). align-self: flex-start lets aspect-ratio: 1/1
     correctly set height = width so the board is always a perfect square. */
  align-self: flex-start !important;
  aspect-ratio: 1 / 1 !important;
  height: auto !important;
}

.ghost-piece { 
  opacity: 0; 
  pointer-events: none; 
  /* Pawn-structure mode fades the other pieces out and back in. This is the one
     fade that was meant; it used to come from a blanket rule on every piece
     (see .piece-shadow) that slowed every drag and drop. */
  transition: opacity 0.5s ease-in-out;
}

.pawn-mode-active { 
  border-color: #eab308 !important; 
  box-shadow: 0 0 30px rgba(234, 179, 8, 0.3) !important; 
}

.palette-selected { 
  border-radius: 0.5rem; 
  background-color: rgba(59, 130, 246, 0.2); 
  box-shadow: 0 0 0 2px #3b82f6; 
  transform: scale(1.1); 
}

/* ==========================================================================
   5. TEACHING MODE OVERRIDES
   ========================================================================== */
/* Teaching mode: board sizing also handled by fitBoard() (it measures whatever
   space this mode leaves). Only non-sizing overrides remain below. */
.teaching-mode #main-area {
  padding-top: 0.5rem !important; 
  padding-bottom: 0.5rem !important; 
  max-width: 100% !important; 
}

/* Teaching mode is what actually runs in the classroom, so the header has to be
   tall enough to carry a readable name badge and shot clock. It used to be 3rem,
   which forced the badge down to 0.65rem (~10px) and the clock to 1.25rem —
   unreadable from the back of the room on the academy's dim projector. The extra
   ~20px of header costs the board almost nothing (fitBoard() re-measures). */
.teaching-mode #main-header { height: 4.25rem !important; }

.teaching-mode #active-student-name {
  font-size: 1.6rem !important;
  padding: 0.3rem 1.1rem !important;
  max-width: 18rem !important;
  letter-spacing: 0.08em !important;
}
.teaching-mode #shot-clock {
  font-size: 3rem !important;
  padding: 0.15rem 1rem !important;
  line-height: 1.05 !important;
}
@media (min-width: 1024px) {
  .teaching-mode #main-header { height: 4.75rem !important; }
  .teaching-mode #active-student-name { font-size: 2rem !important; max-width: 24rem !important; }
  .teaching-mode #shot-clock { font-size: 3.5rem !important; }
}

.teaching-mode #header-text { font-size: 0.875rem !important; }
@media (min-width: 1024px) { 
  .teaching-mode #header-text { font-size: 1.125rem !important; } 
}

.teaching-mode #right-panel { 
  position: fixed; 
  right: 1.5rem; 
  top: 15%; 
  bottom: auto; 
  left: auto; 
  transform: none; 
  width: auto !important; 
  border: none !important; 
  background: transparent !important; 
  box-shadow: none !important; 
  z-index: 100; 
  overflow: visible !important; 
}

.teaching-mode #analysis-toolbar, 
.teaching-mode #move-list, 
.teaching-mode #engine-clean-lines, 
.teaching-mode #game-info-panel { 
  display: none !important; 
}

.teaching-mode #analysis-panel { 
  background: transparent !important; 
  border: none !important; 
}

/* Maximize: a small left-to-right row under the panel that fades in on hover.
   It never slides sideways (it used to swing out over the board as a tall pill). */
.teaching-mode #playback-controls {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  border-radius: 0.75rem;
  padding: 0.25rem 0.5rem !important;
  gap: 0.125rem;
  opacity: 0;
  transform: none;
  transition: opacity 0.2s ease;
}
.teaching-mode #playback-controls button { padding: 0.3rem !important; }
.teaching-mode #playback-controls svg { width: 1rem !important; height: 1rem !important; }

.teaching-mode #right-panel:hover #playback-controls {
  opacity: 1;
}

.teaching-mode #control-divider {
  width: 1px !important;
  height: 16px !important;
  margin: 0 0.25rem !important;
}

#teaching-copy-btn { display: none; }
.teaching-mode #teaching-copy-btn { display: block; }

/* Maximize is left by the same top-left button that entered it (always visible),
   so there is no separate exit button: one sat on top of the fullscreen button. */

/* ==========================================================================
   6. UI COMPONENTS (Timers, Names, Toasts)
   ========================================================================== */
.name-shuffle-pill { 
  position: fixed; 
  top: 50%; 
  left: 50%; 
  transform: translate(-50%, -50%); 
  z-index: 300; 
  background: rgba(15, 23, 42, 0.95); 
  color: #e2e8f0; 
  padding: 2rem 4.5rem;
  border-radius: 9999px;
  /* Sized for the academy's dim projector / old TV — readable from the back
     of the room. nowrap + ellipsis + max-width below keep long names contained. */
  font-size: clamp(3.25rem, 11vw, 8rem);
  font-weight: 900; 
  text-transform: uppercase; 
  letter-spacing: 0.15em; 
  pointer-events: none; 
  box-shadow: 0 15px 40px rgba(0,0,0,0.6); 
  border: 3px solid rgba(255,255,255,0.1); 
  backdrop-filter: blur(8px); 
  text-align: center; 
  white-space: nowrap; 
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90vw;
  transition: opacity 0.3s, transform 0.3s; 
}

.name-winner { 
  color: #4ade80; 
  border-color: #4ade80; 
  box-shadow: 0 0 60px rgba(74, 222, 128, 0.6); 
  transform: translate(-50%, -50%) scale(1.2); 
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

@keyframes timer-flash { 
  0%, 100% { color: #ef4444; text-shadow: 0 0 20px rgba(239, 68, 68, 0.8); } 
  50% { color: #fca5a5; text-shadow: 0 0 10px rgba(239, 68, 68, 0.4); } 
}
.timer-urgent { animation: timer-flash 0.5s ease-in-out infinite; }

/* ---- Shot clock visual styles (js/features/shotclock.js) --------------------
   The pill keeps the digits in every style; these draw the time around
   or beside them. Overlays are pointer-events:none at z 75: above the board and
   the dock, below every modal. Colour comes inline from ShotClock.color(). */
/* ---- SHOT CLOCK PLACEMENT --------------------------------------------------
   Jeff, 2026-10-02: the clock sat in the far top-right corner of the header,
   beside the fullscreen button and in the same right-edge column as the topic
   cards, and a long way from the board once it was maximised. It belongs on
   the board's corner. The pill is a direct child of <body> (index.html says
   why) and ShotClock._place() writes left/top from the board's measured rect,
   the same "measure, never guess" rule as placeChalkboard(). left/top start
   off-screen so a pill shown before its first placement never flashes at 0,0.
   z 76: above the header and right panel (60) and the timer overlays (75),
   below the teaching-mode exit button (200), toasts (500) and every modal.
   Phone mode overrides all of this (css/responsive-mobile.css, later in the
   cascade): a fixed pill in the screen corner, and _place() steps aside. */
#shot-clock { position: fixed; left: -999px; top: 0; z-index: 76; }
/* It used to inherit the header's projector zoom. Never `zoom` the pill itself:
   zoom scales the left/top that _place() wrote, and it would land off the board. */
.projector-mode #shot-clock { font-size: 115%; }
@media print { #shot-clock { display: none !important; } }
/* Scoresheet: the pill is parked in the sheet's title bar (Scoresheet.placeHud),
   so it is sized like the title, not like the projector number. */
body.scoresheet-mode #shot-clock { font-size: 1.5rem; padding: 0.15rem 0.6rem; }
/* The length picker in Settings → Classroom & Camp (10 / 24 / 30). */
#setting-timer-length button[aria-pressed="true"] { background: #2563eb; color: #fff; }

#shot-clock .sc-num { display: inline-block; min-width: 1.3em; text-align: center; }
#shot-clock[data-style="ring"] { padding: 0.15em 0.35em !important; border-radius: 9999px; }
.sc-ringwrap { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.1em; height: 2.1em; }
.sc-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.sc-ring circle { fill: none; stroke-width: 3.2; stroke-linecap: round; }
.sc-ring-track { stroke: rgba(255,255,255,0.12); }
.sc-ring-arc { stroke: #4ade80; transition: stroke 0.4s linear; }
.sc-ringwrap .sc-num { position: relative; font-size: 0.78em; min-width: 0; }
.sc-glass { width: 1.15em; height: 1.7em; margin-right: 0.25em; flex: none; }
.sc-glass-frame { fill: rgba(255,255,255,0.06); stroke: rgba(255,255,255,0.55); stroke-width: 1.2; stroke-linejoin: round; }
.sc-sand { fill: #fbbf24; transition: fill 0.4s linear; }
.sc-stream { stroke: #fde68a; stroke-width: 1; stroke-dasharray: 2 1.5; animation: sc-stream 0.5s linear infinite; }
@keyframes sc-stream { to { stroke-dashoffset: -3.5; } }
#shot-clock.sc-done .sc-stream { opacity: 0; }

.sc-fx { position: fixed; inset: 0; pointer-events: none; z-index: 75; }
/* bar: a strip along the very top of the screen, draining right → left */
.sc-fx-bar .sc-bar { position: absolute; left: 0; top: 0; height: 7px; width: 100%; background: #4ade80;
  border-radius: 0 4px 4px 0; transition: background 0.4s linear; }
.sc-fx-bar.sc-urgent .sc-bar { animation: sc-pulse 0.5s ease-in-out infinite; }
/* fuse: a rope hugging the very top edge; the burnt part goes dark behind a
   travelling spark. It stays inside the first ~12px and sits BELOW the header
   (z-60), so the name in the header (zen input, from y~17) is never crossed or
   glowed over: the rope can pass behind text, never in front of it. */
.sc-fx.sc-fx-fuse { z-index: 50; }
.sc-fx-fuse .sc-fuse-track { position: absolute; left: 0; right: 0; top: 1px; height: 6px; border-radius: 3px; opacity: 0.97;
  /* a braided rope: diagonal twists over a rounded body */
  background:
    repeating-linear-gradient(115deg, rgba(255,236,190,0.45) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(65deg, rgba(60,30,5,0.35) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #e2a54b 0%, #b7792b 45%, #7a4a14 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.45); }
.sc-fx-fuse .sc-canvas, .sc-fx-comet .sc-canvas { position: absolute; inset: 0; }
.sc-fx-fuse .sc-fuse-burnt { position: absolute; left: 0; top: 1px; height: 6px; width: 0;
  background: linear-gradient(90deg, rgba(15,17,21,0.2), rgba(15,17,21,0.9) 30%, #000); border-radius: 2px; }
.sc-fx-fuse .sc-fuse-rope { position: absolute; top: -1px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,0,0,0.9) 0 30%, transparent 70%); }
.sc-fx-fuse .sc-spark { position: absolute; top: 4px; width: 0; height: 0; margin-left: 0; }
.sc-fx-fuse .sc-spark span { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 18%, #fde047 30%, #f97316 55%, transparent 72%);
  box-shadow: 0 0 8px 2px rgba(251,146,60,0.7), 0 0 14px 4px rgba(234,88,12,0.3);
  animation: sc-flicker 0.12s steps(2, end) infinite; }
.sc-fx-fuse.sc-urgent .sc-spark span { animation-duration: 0.07s; box-shadow: 0 0 10px 3px rgba(239,68,68,0.8), 0 0 16px 5px rgba(239,68,68,0.4); }
.sc-fx-fuse.sc-finished .sc-fuse-track { background: #111; }
/* bar: a light sweep across the bar so it never looks static */
.sc-fx-bar .sc-bar { overflow: hidden; }
.sc-fx-bar .sc-bar-shine { position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.55) 50%, transparent 100%);
  width: 30%; animation: sc-shine 1.8s ease-in-out infinite; }
@keyframes sc-shine { from { transform: translateX(-120%); } to { transform: translateX(420%); } }
/* ring: a soft glow around the draining arc */
.sc-ring-arc { filter: drop-shadow(0 0 2.5px currentColor); }
/* comet: its own full-screen canvas, outside the board, below the header */
.sc-fx.sc-fx-comet { z-index: 50; }
@media (prefers-reduced-motion: reduce) { .sc-fx-bar .sc-bar-shine { animation: none; display: none; } }
.sc-bang { position: absolute; left: 50%; top: 4vh; transform: translate(-50%, 0) scale(0.3); font-size: min(22vmin, 12rem);
  line-height: 1; animation: sc-bang 1.1s cubic-bezier(0.2, 0.9, 0.3, 1) forwards; filter: drop-shadow(0 0 30px rgba(249,115,22,0.9)); }
@keyframes sc-bang { 0% { transform: translate(-50%, 0) scale(0.3); opacity: 0; } 20% { transform: translate(-50%, 0) scale(1.15); opacity: 1; }
  70% { transform: translate(-50%, 0) scale(1); opacity: 1; } 100% { transform: translate(-50%, -10px) scale(1.2); opacity: 0; } }
/* edge: a stroked rectangle laid over the board's own border (never a square) */
.sc-fx-edge .sc-edge { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sc-edge rect { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sc-edge-track { stroke: rgba(255,255,255,0.10); }
.sc-edge-arc { stroke: #4ade80; transition: stroke 0.4s linear; }
.sc-fx-edge.sc-urgent .sc-edge-arc { animation: sc-pulse 0.5s ease-in-out infinite; }
@keyframes sc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes sc-flicker { 0% { transform: scale(1); } 100% { transform: scale(1.25) rotate(20deg); } }
@media (prefers-reduced-motion: reduce) {
  .sc-fx-fuse .sc-spark span, .sc-stream, .sc-fx.sc-urgent .sc-bar, .sc-fx.sc-urgent .sc-edge-arc { animation: none; }
}

/* Golden Rule accent: the key coaching words glow gold for ~1s, then settle back
   to the chalk-white text so the sentence still reads as one line. One-shot
   (not infinite) with `both` so it holds the gold at start and lands on inherit. */
@keyframes gold-flash {
  0%   { color: #fbbf24; text-shadow: 0 0 14px rgba(251, 191, 36, 0.95); }
  55%  { color: #fde68a; text-shadow: 0 0 9px rgba(251, 191, 36, 0.55); }
  100% { color: inherit; text-shadow: none; }
}
.gold-flash { animation: gold-flash 1.15s ease-out 0.2s both; font-weight: 800; }

/* Chalkboard cards (Golden Rules, quiz prompt, /visualizefailure): scale with the
   screen so the back row can read them. Font tracks viewport size with a floor
   above the old text-xl. IDs outrank the Tailwind utility classes on the markup.

   The width below is only the FIRST PAINT guess. It used to be the whole story —
   a viewport formula with a 22rem floor — and on a MacBook the floor beat the
   ~160px gutter and parked the card a quarter of the way across the board, on
   top of the position the class was voting on. placeChalkboard() in
   js/ui/keyboard.js now measures #board-wrapper and sets width/left/right inline
   every time the card is shown, so this rule only matters for the split second
   before that runs (and if the script is missing entirely). Don't re-tune it to
   "fix" an overlap — fix the measurement. */
#chalkboard-text {
  font-size: clamp(1.375rem, 0.7vw + 0.7vh + 0.55rem, 2.5rem);
  line-height: 1.4;
}
@media (min-width: 1024px) {
  #chalkboard-overlay {
    width: clamp(20rem, calc((100vw - 26.25rem - (100vh - 11rem)) / 2 - 3rem), 34rem);
  }
}
/* Parked in the RIGHT gutter (placeChalkboard picks that when the left one is
   too narrow for a legible card). Flip the hidden transform so it slides in
   from the right — otherwise the card flies across the board to reach its seat,
   which is the exact distraction the move was meant to avoid. Overriding the
   Tailwind translate VARIABLE, not `transform`, keeps the slide animating. */
#chalkboard-overlay.chalk-right.-translate-x-full {
  --tw-translate-x: 100%;
}

@keyframes success-glow { 
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); } 
  70% { box-shadow: 0 0 0 20px rgba(74, 222, 128, 0); } 
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } 
}
.success-pulse { animation: success-glow 1.5s ease-out; }

/* ==========================================================================
   7. GLASS-MORPHISM PANELS
   ========================================================================== */
.glass-panel {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 40px -10px rgba(31, 38, 135, 0.15);
}

.dark .glass-panel {
  background: rgba(19, 21, 26, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.6);
}

/* Sleeker scrollbar inside the glass panel */
.glass-panel::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.5); 
}
.dark .glass-panel::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.5); 
}

/* ==========================================================================
   8. PREMIUM VISUAL EFFECTS
   ========================================================================== */

/* Glassmorphism */
body.glassmorphism-on #analysis-panel,
body.glassmorphism-on #right-panel {
    background-color: rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    transform: translateZ(0);
    /* No `will-change: backdrop-filter` — leaving it on permanently keeps the blur
       layer hot and produced faint ghost edges over the animated background.
       translateZ(0) alone is enough to composite the panel on its own layer. */
}
html.dark body.glassmorphism-on #analysis-panel,
html.dark body.glassmorphism-on #right-panel {
    background-color: rgba(15, 23, 42, 0.4) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    transform: translateZ(0);
    /* See note above: no permanent will-change on the blur. */
}

/* Gradient Background — STATIC ON PURPOSE. DO NOT RE-ANIMATE THIS.
   It has now been animated two different ways and both flickered:
     1. `background-position` on <body> — a main-thread paint; the whole body
        re-rasterized every frame and every glass panel's backdrop-filter
        re-blurred → smearing/ghosting.
     2. `transform` on this fixed ::after layer — believed to be compositor-only,
        it is not. The layer is viewport-sized and `rotate()` makes it
        non-axis-aligned, so the compositor cannot reuse its raster: it repaints
        the whole window every frame, forever, with the app completely idle.
   Measured 2026-07-30 with a CDP screencast frame-diff (a frame only arrives
   when the window visually changes) on the live app, idle, at 1512x982:
     as shipped ............................ 24.2 unique frames/sec
     glassmorphism-on removed .............. 26.8  (so: not the blur)
     gradient-bg-on removed ................  3.4  (only the caret blink)
   That permanent full-window repaint IS the flicker Jeff sees. Fullscreen hides
   it — macOS gives a fullscreen window its own opaque surface — so it only ever
   showed up windowed, and worst under a Zoom screen share, which recaptures and
   rescales every one of those frames.
   A 16s drift nobody consciously notices is not worth a permanently hot
   compositor. Keep the gradient; keep it still. */
body.gradient-bg-on {
    background: #eef2ff !important;
}
html.dark body.gradient-bg-on {
    background: #0b1020 !important;
}
body.gradient-bg-on::after {
    content: '';
    position: fixed;
    inset: -40%;
    z-index: -2;
    pointer-events: none;
    background: linear-gradient(-45deg, #e0f2fe, #ddd6fe, #fbcfe8, #e0f2fe);
    background-size: 100% 100%;
    /* Frozen mid-drift: the exact look the animation spent most of its time at,
       minus the animation. No `will-change` — that pins a permanently hot
       compositor layer for a layer that now never moves. */
    transform: translate3d(0, 0, 0) rotate(4deg);
    backface-visibility: hidden;
}
html.dark body.gradient-bg-on::after {
    background: linear-gradient(-45deg, #0f172a, #2e1065, #1e3a8a, #0f172a);
}
/* gradientDrift keyframes deleted deliberately — see the note above. If a
   drifting background is ever wanted again, it must be gated behind an
   explicitly opt-in setting that is OFF by default, and re-measured with the
   screencast frame-diff before it ships. */

/* Smooth Board Transitions */
body.smooth-themes-on div[id^="sq-"] {
    transition: background-color 0.5s ease-in-out;
}

/* ============ LITE EFFECTS (Settings → Effects, default OFF) ============ */
/* One switch for a classroom laptop or projector. backdrop-filter is the single
   most expensive thing on the page: #right-panel blurs everything behind it, and
   with Frosted panels on #analysis-panel blurs AGAIN inside it, and the move list
   that repaints on every move sits inside both. Without the blur the panels go
   nearly solid so they stay readable. Placed after the glass rules: same
   specificity, so order decides. */
/* The html.dark lines are not optional: the dark glass rule above is
   `html.dark body.glassmorphism-on #right-panel`, whose .dark outranks a plain
   body.lite-fx-on selector, and dark is the default theme. */
body.lite-fx-on .glass-panel,
body.lite-fx-on #analysis-panel,
body.lite-fx-on #right-panel,
body.lite-fx-on.glassmorphism-on #analysis-panel,
body.lite-fx-on.glassmorphism-on #right-panel,
html.dark body.lite-fx-on .glass-panel,
html.dark body.lite-fx-on.glassmorphism-on #analysis-panel,
html.dark body.lite-fx-on.glassmorphism-on #right-panel {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
body.lite-fx-on .glass-panel,
body.lite-fx-on.glassmorphism-on #right-panel { background-color: rgba(255, 255, 255, 0.94) !important; }
body.lite-fx-on.glassmorphism-on #analysis-panel { background-color: transparent !important; }
html.dark body.lite-fx-on .glass-panel,
html.dark body.lite-fx-on.glassmorphism-on #right-panel { background-color: rgba(19, 21, 26, 0.95) !important; }
html.dark body.lite-fx-on.glassmorphism-on #analysis-panel { background-color: transparent !important; }
/* 32 per-piece filter layers, re-rasterised whenever a piece moves. */
body.lite-fx-on .piece-shadow,
html.dark body.lite-fx-on .piece-shadow { filter: none !important; }
body.lite-fx-on.smooth-themes-on div[id^="sq-"] { transition: none; }

/* Eval Glows */
@keyframes glow-brilliant {
    0%, 100% { box-shadow: inset 0 0 15px rgba(45, 212, 191, 0.5); }
    50% { box-shadow: inset 0 0 30px rgba(45, 212, 191, 1); }
}
@keyframes glow-blunder {
    0%, 100% { box-shadow: inset 0 0 15px rgba(239, 68, 68, 0.5); }
    50% { box-shadow: inset 0 0 30px rgba(239, 68, 68, 1); }
}
/* One pulse, not two. The JS stripped the class at 1500ms while the animation
   asked for 2 iterations of 1.5s, so the second iteration never played and the
   count was a lie. Stamping is one pulse; hovering is the -hold pair below. */
.eval-glow-brilliant { animation: glow-brilliant 1.5s ease-in-out 1 !important; }
.eval-glow-blunder { animation: glow-blunder 1.5s ease-in-out 1 !important; }

/* Hover glow: STATIC, not animated. An animation that has finished leaves no
   box-shadow behind (there is none outside the keyframes), so a held hover lit
   up for 1.5s and then quietly went dark while the class was still on the
   element — invisible in the DOM, obvious on screen. A steady shadow holds for
   exactly as long as the pointer does. */
.eval-glow-hold-brilliant { box-shadow: inset 0 0 30px rgba(45, 212, 191, 1) !important; }
.eval-glow-hold-blunder { box-shadow: inset 0 0 30px rgba(239, 68, 68, 1) !important; }

/* Glowing Background — STATIC ON PURPOSE, same reason as the gradient above.
   The old note here argued that animating opacity only (never transform) made
   this cheap because opacity is GPU-composited. Measured, it is not: the
   screencast frame-diff on the live app, idle, with ONLY this layer animating,
   showed 28 unique frames/sec — a full-window repaint every frame, the same
   flicker the drifting gradient caused. A viewport-sized fixed layer under
   backdrop-filter panels is the problem; which property animates is a detail.
   Jeff does not run with this on today, but it is one Settings toggle away, so
   it is frozen too rather than left as a trap. Do not re-animate it —
   EXCEPT in fullscreen (body.is-fullscreen, set by init.js): macOS gives a
   fullscreen window its own opaque surface, so the repaint never shows, and
   that is the projector, where the breathing is wanted. Added 2026-10-05. */
body.glowing-bg-on::before {
    content: '';
    position: fixed;
    inset: -20%;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(ellipse at center,
        rgba(99, 102, 241, 0.45) 0%,
        rgba(139, 92, 246, 0.35) 25%,
        rgba(59, 130, 246, 0.25) 50%,
        transparent 70%);
    /* Frozen at the animation's midpoint brightness. No `will-change`. */
    opacity: 0.65;
    pointer-events: none;
    transform: translateZ(0);
    backface-visibility: hidden;
}
body.is-fullscreen.glowing-bg-on::before { animation: glow-breathe 7s ease-in-out infinite; }
@keyframes glow-breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }
html.dark body.glowing-bg-on::before {
    background: radial-gradient(ellipse at center,
        rgba(99, 102, 241, 0.6) 0%,
        rgba(139, 92, 246, 0.45) 25%,
        rgba(59, 130, 246, 0.3) 50%,
        transparent 70%);
}

/* Glow Color Variants — override only the ::before radial colors of the shared
   .glowing-bg-on aura. Declared AFTER the base so equal-specificity rules win. */
body.glow-emerald::before {
    background: radial-gradient(ellipse at center,
        rgba(16, 185, 129, 0.45) 0%, rgba(5, 150, 105, 0.35) 25%, rgba(20, 184, 166, 0.25) 50%, transparent 70%);
}
html.dark body.glow-emerald::before {
    background: radial-gradient(ellipse at center,
        rgba(16, 185, 129, 0.6) 0%, rgba(5, 150, 105, 0.45) 25%, rgba(20, 184, 166, 0.3) 50%, transparent 70%);
}

body.glow-sunset::before {
    background: radial-gradient(ellipse at center,
        rgba(251, 191, 36, 0.45) 0%, rgba(249, 115, 22, 0.35) 25%, rgba(244, 114, 182, 0.25) 50%, transparent 70%);
}
html.dark body.glow-sunset::before {
    background: radial-gradient(ellipse at center,
        rgba(251, 191, 36, 0.6) 0%, rgba(249, 115, 22, 0.45) 25%, rgba(244, 114, 182, 0.3) 50%, transparent 70%);
}

body.glow-crimson::before {
    background: radial-gradient(ellipse at center,
        rgba(239, 68, 68, 0.45) 0%, rgba(190, 24, 93, 0.35) 25%, rgba(127, 29, 29, 0.25) 50%, transparent 70%);
}
html.dark body.glow-crimson::before {
    background: radial-gradient(ellipse at center,
        rgba(239, 68, 68, 0.6) 0%, rgba(190, 24, 93, 0.45) 25%, rgba(127, 29, 29, 0.3) 50%, transparent 70%);
}

body.glow-cyan::before {
    background: radial-gradient(ellipse at center,
        rgba(34, 211, 238, 0.45) 0%, rgba(14, 165, 233, 0.35) 25%, rgba(59, 130, 246, 0.25) 50%, transparent 70%);
}
html.dark body.glow-cyan::before {
    background: radial-gradient(ellipse at center,
        rgba(34, 211, 238, 0.6) 0%, rgba(14, 165, 233, 0.45) 25%, rgba(59, 130, 246, 0.3) 50%, transparent 70%);
}

body.glow-amethyst::before {
    background: radial-gradient(ellipse at center,
        rgba(168, 85, 247, 0.45) 0%, rgba(139, 92, 246, 0.35) 25%, rgba(217, 70, 239, 0.25) 50%, transparent 70%);
}
html.dark body.glow-amethyst::before {
    background: radial-gradient(ellipse at center,
        rgba(168, 85, 247, 0.6) 0%, rgba(139, 92, 246, 0.45) 25%, rgba(217, 70, 239, 0.3) 50%, transparent 70%);
}

body.glow-blossom::before {
    background: radial-gradient(ellipse at center,
        rgba(244, 114, 182, 0.45) 0%, rgba(251, 113, 133, 0.35) 25%, rgba(249, 168, 212, 0.25) 50%, transparent 70%);
}
html.dark body.glow-blossom::before {
    background: radial-gradient(ellipse at center,
        rgba(244, 114, 182, 0.6) 0%, rgba(251, 113, 133, 0.45) 25%, rgba(249, 168, 212, 0.3) 50%, transparent 70%);
}

body.glow-abyss::before {
    background: radial-gradient(ellipse at center,
        rgba(20, 184, 166, 0.45) 0%, rgba(13, 148, 136, 0.35) 25%, rgba(30, 64, 175, 0.25) 50%, transparent 70%);
}
html.dark body.glow-abyss::before {
    background: radial-gradient(ellipse at center,
        rgba(20, 184, 166, 0.6) 0%, rgba(13, 148, 136, 0.45) 25%, rgba(30, 64, 175, 0.3) 50%, transparent 70%);
}

body.glow-magma::before {
    background: radial-gradient(ellipse at center,
        rgba(249, 115, 22, 0.45) 0%, rgba(234, 88, 12, 0.35) 25%, rgba(220, 38, 38, 0.25) 50%, transparent 70%);
}
html.dark body.glow-magma::before {
    background: radial-gradient(ellipse at center,
        rgba(249, 115, 22, 0.6) 0%, rgba(234, 88, 12, 0.45) 25%, rgba(220, 38, 38, 0.3) 50%, transparent 70%);
}

body.glow-graphite::before {
    background: radial-gradient(ellipse at center,
        rgba(148, 163, 184, 0.45) 0%, rgba(100, 116, 139, 0.35) 25%, rgba(71, 85, 105, 0.25) 50%, transparent 70%);
}
html.dark body.glow-graphite::before {
    background: radial-gradient(ellipse at center,
        rgba(148, 163, 184, 0.6) 0%, rgba(100, 116, 139, 0.45) 25%, rgba(71, 85, 105, 0.3) 50%, transparent 70%);
}

/* Noir: black-and-white. Light theme = dark halo bleeding out; dark theme = bright white halo. */
body.glow-noir::before {
    background: radial-gradient(ellipse at center,
        rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.3) 25%, rgba(2, 6, 23, 0.2) 50%, transparent 70%);
}
html.dark body.glow-noir::before {
    background: radial-gradient(ellipse at center,
        rgba(255, 255, 255, 0.55) 0%, rgba(226, 232, 240, 0.4) 25%, rgba(203, 213, 225, 0.25) 50%, transparent 70%);
}

body.glow-silver::before {
    background: radial-gradient(ellipse at center,
        rgba(226, 232, 240, 0.45) 0%, rgba(203, 213, 225, 0.35) 25%, rgba(148, 163, 184, 0.25) 50%, transparent 70%);
}
html.dark body.glow-silver::before {
    background: radial-gradient(ellipse at center,
        rgba(226, 232, 240, 0.6) 0%, rgba(203, 213, 225, 0.45) 25%, rgba(148, 163, 184, 0.3) 50%, transparent 70%);
}

/* Glow Color Variants, batch 2 (2026-09-01). Same contract as batch 1: override
   only the ::before radial colors, stay STATIC (see the flicker note above), and
   follow the 0.45/0.35/0.25 light and 0.6/0.45/0.3 dark alpha ladder. Nebula and
   Ember are two-tone — two offset ellipses in one background, still one layer. */

body.glow-nebula::before {
    background: radial-gradient(ellipse at 32% 38%,
        rgba(139, 92, 246, 0.45) 0%, rgba(168, 85, 247, 0.3) 30%, transparent 62%),
      radial-gradient(ellipse at 70% 62%,
        rgba(244, 114, 182, 0.4) 0%, rgba(236, 72, 153, 0.28) 30%, transparent 65%);
}
html.dark body.glow-nebula::before {
    background: radial-gradient(ellipse at 32% 38%,
        rgba(139, 92, 246, 0.6) 0%, rgba(168, 85, 247, 0.4) 30%, transparent 62%),
      radial-gradient(ellipse at 70% 62%,
        rgba(244, 114, 182, 0.5) 0%, rgba(236, 72, 153, 0.34) 30%, transparent 65%);
}

body.glow-ocean::before {
    background: radial-gradient(ellipse at center,
        rgba(37, 99, 235, 0.45) 0%, rgba(14, 165, 233, 0.35) 25%, rgba(20, 184, 166, 0.25) 50%, transparent 70%);
}
html.dark body.glow-ocean::before {
    background: radial-gradient(ellipse at center,
        rgba(37, 99, 235, 0.6) 0%, rgba(14, 165, 233, 0.45) 25%, rgba(20, 184, 166, 0.3) 50%, transparent 70%);
}

body.glow-gold::before {
    background: radial-gradient(ellipse at center,
        rgba(245, 158, 11, 0.45) 0%, rgba(234, 133, 8, 0.35) 25%, rgba(217, 119, 6, 0.25) 50%, transparent 70%);
}
html.dark body.glow-gold::before {
    background: radial-gradient(ellipse at center,
        rgba(245, 158, 11, 0.6) 0%, rgba(234, 133, 8, 0.45) 25%, rgba(217, 119, 6, 0.3) 50%, transparent 70%);
}

body.glow-rose::before {
    background: radial-gradient(ellipse at center,
        rgba(244, 63, 94, 0.45) 0%, rgba(225, 29, 72, 0.35) 25%, rgba(190, 24, 93, 0.25) 50%, transparent 70%);
}
html.dark body.glow-rose::before {
    background: radial-gradient(ellipse at center,
        rgba(244, 63, 94, 0.6) 0%, rgba(225, 29, 72, 0.45) 25%, rgba(190, 24, 93, 0.3) 50%, transparent 70%);
}

/* Lime and Ice are the two brightest in the set. Their light-mode alphas are held
   a notch below the ladder so the rank/file coordinates stay readable — the
   contrast fix below only adds a text-shadow, it cannot rescue a white-out. */
body.glow-lime::before {
    background: radial-gradient(ellipse at center,
        rgba(132, 204, 22, 0.38) 0%, rgba(115, 184, 20, 0.3) 25%, rgba(101, 163, 13, 0.22) 50%, transparent 70%);
}
html.dark body.glow-lime::before {
    background: radial-gradient(ellipse at center,
        rgba(132, 204, 22, 0.55) 0%, rgba(115, 184, 20, 0.42) 25%, rgba(101, 163, 13, 0.28) 50%, transparent 70%);
}

body.glow-ice::before {
    background: radial-gradient(ellipse at center,
        rgba(186, 230, 253, 0.4) 0%, rgba(125, 211, 252, 0.3) 25%, rgba(56, 189, 248, 0.2) 50%, transparent 70%);
}
html.dark body.glow-ice::before {
    background: radial-gradient(ellipse at center,
        rgba(186, 230, 253, 0.55) 0%, rgba(125, 211, 252, 0.4) 25%, rgba(56, 189, 248, 0.28) 50%, transparent 70%);
}

body.glow-ember::before {
    background: radial-gradient(ellipse at 42% 44%,
        rgba(239, 68, 68, 0.45) 0%, rgba(249, 115, 22, 0.3) 30%, transparent 62%),
      radial-gradient(ellipse at 66% 64%,
        rgba(88, 28, 135, 0.42) 0%, rgba(67, 20, 105, 0.28) 32%, transparent 68%);
}
html.dark body.glow-ember::before {
    background: radial-gradient(ellipse at 42% 44%,
        rgba(239, 68, 68, 0.6) 0%, rgba(249, 115, 22, 0.42) 30%, transparent 62%),
      radial-gradient(ellipse at 66% 64%,
        rgba(88, 28, 135, 0.55) 0%, rgba(67, 20, 105, 0.36) 32%, transparent 68%);
}

body.glow-forest::before {
    background: radial-gradient(ellipse at center,
        rgba(22, 101, 52, 0.45) 0%, rgba(45, 112, 40, 0.35) 25%, rgba(77, 124, 15, 0.25) 50%, transparent 70%);
}
html.dark body.glow-forest::before {
    background: radial-gradient(ellipse at center,
        rgba(22, 101, 52, 0.6) 0%, rgba(45, 112, 40, 0.45) 25%, rgba(77, 124, 15, 0.3) 50%, transparent 70%);
}

/* Coordinate Visibility Fix */
body.glowing-bg-on #rank-labels,
body.glowing-bg-on #file-labels,
body.glowing-bg-on #rank-labels-right,
body.glowing-bg-on #file-labels-top {
    text-shadow: 0 1px 3px rgba(255,255,255,0.9), 0 0 10px rgba(255,255,255,1);
    color: #1e293b !important;
}

html.dark body.glowing-bg-on #rank-labels,
html.dark body.glowing-bg-on #file-labels,
html.dark body.glowing-bg-on #rank-labels-right,
html.dark body.glowing-bg-on #file-labels-top {
    text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 12px rgba(0,0,0,1);
    color: #f8fafc !important;
}

/* Resting Piece Shadows */
.piece-shadow {
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.4));
    transform: translateZ(0);
    /* Never transition `filter`: it left drop-shadow ghost-trails when holding
       ←/→ to scrub moves, and a permanent `will-change: filter` kept that layer
       hot.

       There used to be `transition: opacity 0.5s !important` here, and it was the
       main reason moving a piece felt slow. Every piece hide/show went through
       it, so a dragged piece took half a second to leave its square (two pieces
       on screen next to the drag ghost), an illegal drop took half a second to
       come back, and the capture preview faded instead of popping. The
       !important also beat the release spring in clearPieceStyles() and the
       `transition-transform` utility, so the piece snapped instead of springing.
       Pawn-structure mode keeps its fade, scoped to .ghost-piece below. */
}
html.dark .piece-shadow {
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.8));
    transform: translateZ(0);
}

/* Piece shadows off (Settings → Appearance). Deliberately written as an OFF
   switch rather than a `piece-shadows-on` class: absence of the class has to
   mean the default, so a page that never applies it — or a boot that fails
   before the settings load — still gets shadows rather than silently losing
   them. */
body.piece-shadows-off .piece-shadow,
html.dark body.piece-shadows-off .piece-shadow {
    filter: none !important;
}

/* Elegant physical table shadow beneath the board outer ring */
.premium-board-ring {
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.65), 
              0 0 60px rgba(59, 130, 246, 0.15),
              inset 0 1px 1px rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.teaching-mode #app-toolbar { opacity: 0; }
.teaching-mode #app-toolbar:hover { opacity: 1; }

/* ============================================================
   WSB PANEL STYLES
   ============================================================ */

.wsb-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.wsb-row-idle {
  background: #fff;
  border-color: #e2e8f0;
}
.wsb-row-idle:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(59,130,246,0.13);
  transform: translateY(-2px);
}
html.dark .wsb-row-idle {
  background: #1a1d24;
  border-color: #2a2e38;
}
html.dark .wsb-row-idle:hover {
  border-color: #3b5bdb;
}
.wsb-row-selected {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2), 0 6px 16px rgba(59,130,246,0.15);
  transform: translateY(-2px);
}
html.dark .wsb-row-selected {
  background: rgba(59,130,246,0.10);
  border-color: #60a5fa;
}

/* Label + chip row */
.wsb-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wsb-label {
  font-weight: 800;
  font-size: 22px;
  color: #1e293b;
  letter-spacing: -0.01em;
  line-height: 1;
}
html.dark .wsb-label { color: #f1f5f9; }

/* Value pill — big and bold */
.wsb-chip {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 18px;
  border-radius: 999px;
  flex-shrink: 0;
  line-height: 1;
}
.wsb-chip-white {
  background: #f1f5f9;
  color: #334155;
  border: 2px solid #cbd5e1;
}
html.dark .wsb-chip-white {
  background: #e2e8f0;
  color: #1e293b;
  border-color: #cbd5e1;
}
.wsb-chip-black {
  background: #1e293b;
  color: #f8fafc;
  border: 2px solid #475569;
}
html.dark .wsb-chip-black {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}
.wsb-chip-equal {
  background: #94a3b8;
  color: #1e293b;
  border: 2px solid #64748b;
}
html.dark .wsb-chip-equal {
  background: #64748b;
  color: #f1f5f9;
  border-color: #94a3b8;
}

/* Advantage split bar */
.wsb-bar-track {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}
html.dark .wsb-bar-track { background: #2a2e38; }
.wsb-bar-white-seg {
  background: linear-gradient(90deg, #f1f5f9, #94a3b8);
  border-right: 2px solid #64748b;
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
}
html.dark .wsb-bar-white-seg {
  background: linear-gradient(90deg, #e2e8f0, #94a3b8);
}
.wsb-bar-black-seg {
  background: linear-gradient(90deg, #334155, #0f172a);
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
  flex: 1;
}
html.dark .wsb-bar-black-seg {
  background: linear-gradient(90deg, #475569, #1e293b);
}

/* Checkmate Animations */
@keyframes sad-balloon {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  25% { transform: scale(0.8) rotate(15deg); }
  50% { transform: scale(0.6) rotate(-15deg); }
  75% { transform: scale(0.4) rotate(10deg); }
  100% { transform: scale(0) rotate(0deg); opacity: 0; }
}
.anim-sad-balloon { animation: sad-balloon 2.5s ease-in-out forwards !important; pointer-events: none; }

@keyframes supernova-explosion {
  0% { transform: scale(1); filter: brightness(1); opacity: 1; }
  50% { transform: scale(3); filter: brightness(3) sepia(1) hue-rotate(-50deg) saturate(5); opacity: 1; }
  100% { transform: scale(4); filter: brightness(5); opacity: 0; }
}
.anim-supernova { animation: supernova-explosion 1s cubic-bezier(0.25, 1, 0.5, 1) forwards !important; pointer-events: none; }

@keyframes fleeing-coward {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  20% { transform: translate(-20px, 0) rotate(-10deg); }
  40% { transform: translate(40px, -20px) rotate(45deg); }
  100% { transform: translate(1000px, -500px) rotate(720deg); opacity: 0; }
}
.anim-fleeing-coward { animation: fleeing-coward 1.5s cubic-bezier(0.5, 0, 1, 1) forwards !important; pointer-events: none; }

@keyframes toilet-flush {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  100% { transform: scale(0) rotate(1080deg); opacity: 0; }
}
.anim-toilet-flush { animation: toilet-flush 1.5s ease-in forwards !important; pointer-events: none; }

@keyframes spring-back {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.25); opacity: 1; }
  85% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}
.anim-spring-back { animation: spring-back 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important; }


/* Annotation box active state */
.annotation-active {
  border-top: 3px solid #3b82f6 !important;
  box-shadow: 0 -6px 30px rgba(59, 130, 246, 0.3) !important;
}

/* ---- The board steps up out of the annotation box's way -------------------
   The annotation overlay is fixed to the bottom of the screen, so it lands on
   top of the file letters (a–h) — and now that the coordinates are bigger,
   more of them. Pressing A to annotate should not cost you the coordinates
   you were pointing at.

   TRANSFORM, not layout. Moving the board with margin or height would change
   its box, which fires the board ResizeObserver, which re-runs fitBoard — the
   exact churn that caused the idle-flicker bug (see the burst-guard note in
   js/game/board.js). A transform moves pixels and nothing else: no reflow, no
   observer, no resize.

   ON #board-cell, NOT #board-wrapper. BoardWall writes
   `wrapper.style.transform` directly for its slides (js/features/boardwall.js),
   so the two would overwrite each other. #board-cell is the wrapper's parent,
   is present in every view including the zen board, and nothing else touches
   it — so the lift and a wall slide compose instead of fighting.

   The distance is measured at open time (--annotation-lift) rather than
   guessed, because the overlay's height depends on the text size and the
   viewport. */
#board-cell {
  transition: transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
  transform-origin: top center;
}
/* --annotation-scale is 1 everywhere except the zen board, where there is no
   headroom to lift into: there openAnnotationBox() shrinks the board toward
   its top edge by just enough to clear the (now large) box. Same rule as the
   lift — a transform, never layout (css/responsive-mobile.css has the story). */
body.annotating #board-cell {
  transform: translateY(calc(-1 * var(--annotation-lift, 0px))) scale(var(--annotation-scale, 1));
}
@media (prefers-reduced-motion: reduce) {
  #board-cell { transition: none; }
}

/* Print view */
#print-pgn-block { display: none; }
@media print {
  header, footer, #right-panel, #analysis-toolbar, #playback-controls,
  #eval-bar-container, #engine-clean-lines, #palette-dropdown,
  #chalkboard-overlay, #annotation-overlay, #name-shuffle-overlay,
  #toast, canvas, .fixed:not(#board-wrapper) { display: none !important; }
  body { background: white !important; color: black !important;
         position: static !important; overflow: auto !important; }
  main { display: block !important; padding: 0 !important; }
  #board-wrapper { width: 100% !important; max-width: 560px; margin: 0 auto !important;
                   print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  /* Force background colors/images to print (squares and piece SVGs) */
  #board-wrapper * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  #print-pgn-block { display: block !important; font-family: monospace; font-size: 11px;
                     margin-top: 16px; white-space: pre-wrap; color: black; }
}

/* Camp team scoreboard (/teams) — score pop on +1 */
@keyframes team-pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.team-pop { animation: team-pop 0.3s ease-out; }

/* Projector / Camp mode (/projector) — scale UI for the back of the room.
   zoom scales all Tailwind sizes inside each region together. */
.projector-mode #right-panel { zoom: 1.25; }
.projector-mode #main-header { zoom: 1.15; }
.projector-mode #toast { zoom: 1.5; }
/* Projector mode makes the team scoreboard 1.4x through Teams._place (a CSS
   zoom would throw off its fit-beside-the-board measurement). */
#teams-overlay .team-editing { border-bottom: 2px dashed rgba(255,255,255,0.6); cursor: text; }

/* ============ SIMPLE MODE (/simple) — substitute-teacher demo board ============ */
/* Plain background: overrides gradient/glow/color themes but respects dark mode. */
body.simple-mode { background-color: #e2e8f0 !important; background-image: none !important; }
html.dark body.simple-mode { background-color: #0f1115 !important; }
body.simple-mode::before, body.simple-mode::after { display: none !important; } /* kill animated bg layers */
/* Hide all advanced chrome — the sub gets the board, the move list, and the dock. */
.simple-mode #analysis-toolbar,
.simple-mode #engine-clean-lines,
.simple-mode #game-info-panel,
.simple-mode #eval-graph-container,
.simple-mode #pgn-panel { display: none !important; }

/* ============ SWITCHING VIEWS (SwitchView._transition) ============ */
/* For the moment a board view changes, nothing on the page animates: every
   element goes straight to where the new layout puts it. Without this the
   header's transition-all eased its height over 300ms and the board, which
   follows its column, grew and shrank with it. The smoothness comes from the
   View Transition cross-fade below instead, which moves no layout at all. */
body.view-switching, body.view-switching *, body.view-switching *::before, body.view-switching *::after {
  transition: none !important;
}
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 200ms;
  animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ============ VARIATION MODE ============ */
/* A wordless "we are off the main road" signal, raised automatically whenever
   the current node sits in a side line (see syncVariationCue in
   js/features/teaching.js). Nothing is allowed over the board itself — the
   hairline lives on the screen edge and the ring is border and glow only, so
   every piece stays readable on a projector.

   This was animated hazard tape on both edges plus a pulsing ring, and it was
   too much. Now that the cue raises itself you can sit inside it for ten
   minutes at a stretch, and a crawling stripe pattern in the corner of the eye
   for ten minutes pulls attention off the pieces — the opposite of the job. The
   whole signal is static: it is the amber that carries the meaning, not motion.
   One quiet fade in, and then it holds still. */
.variation-tape {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  pointer-events: none;
  background: linear-gradient(90deg,
    rgba(0, 39, 76, 0) 0%,
    rgba(0, 39, 76, 0.85) 18%,
    rgba(0, 39, 76, 0.85) 82%,
    rgba(0, 39, 76, 0) 100%);
  opacity: 0;
  animation: variation-edge-in 420ms ease-out both;
}
.variation-tape-top { top: 0; }
/* The bottom edge is where the move list and clock live; one hairline at the
   top is enough to read the state without fencing in the whole screen. */
.variation-tape-bottom { display: none; }
@keyframes variation-edge-in { from { opacity: 0; } to { opacity: 1; } }

body.variation-mode #board-surface {
  border-color: #00274C !important;
  box-shadow: 0 0 0 2px rgba(0, 39, 76, 0.18), 0 0 18px rgba(0, 39, 76, 0.16);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}
/* Dark mode keeps the original amber: Michigan blue would vanish on a navy
   background. Light mode is blue (Jeff, 2026-10-13: "in light mode, the
   variation colors aren't yellow. Make it blue. Like Michigan blue"), because
   amber on a pale page read as a warning and glared on a projector. */
html.dark .variation-tape {
  background: linear-gradient(90deg,
    rgba(245, 158, 11, 0) 0%,
    rgba(245, 158, 11, 0.85) 18%,
    rgba(245, 158, 11, 0.85) 82%,
    rgba(245, 158, 11, 0) 100%);
}
html.dark body.variation-mode #board-surface {
  border-color: rgba(245, 158, 11, 0.85) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35), 0 0 18px rgba(245, 158, 11, 0.22);
}

@media (prefers-reduced-motion: reduce) {
  .variation-tape { animation: none; opacity: 1; }
  body.variation-mode #board-surface { transition: none; }
}
/* Peripheral reinforcement: the coordinates take the variation color too (blue
   by day, amber in dark mode), so the signal is still there for anyone whose
   eyes are on the edge of the board. */
body.variation-mode #rank-labels,
body.variation-mode #rank-labels-right,
body.variation-mode #file-labels,
body.variation-mode #file-labels-top { color: #00274C !important; }
html.dark body.variation-mode #rank-labels,
html.dark body.variation-mode #rank-labels-right,
html.dark body.variation-mode #file-labels,
html.dark body.variation-mode #file-labels-top { color: #fbbf24 !important; }

/* ============ BACK-STEP CUE (B) ============ */
/* A chevron that flashes left of the board on every back-step. It was slate, on
   the reasoning that any color would collide with something: amber is variation
   mode, yellow the last-move trace, cyan the fork bolts, and the board has
   thirteen themes underneath. That left it reading as dead chrome, and a cue
   nobody's eye catches is not doing its job.
   Indigo is the gap in that list — far enough from all three to never be
   mistaken for them, and cool enough to sit against every board theme. Kept
   desaturated and low-contrast: enough tint to register as a signal, not enough
   to compete with the pieces.
   Absolutely positioned so it contributes nothing to #board-wrapper's offsetWidth;
   see the note in js/features/backcue.js for why that matters to fitBoard(). */
#back-cue {
  display: none;
  position: absolute;
  right: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 45;
  color: #6366f1;
  filter: drop-shadow(0 1px 2px rgba(49, 46, 129, 0.22));
}
html.dark #back-cue { color: #a5b4fc; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55)); }
body.back-cue-mode #back-cue { display: block; }

.back-cue-glyph {
  display: block;
  width: clamp(30px, 4.4vmin, 64px);
  height: clamp(30px, 4.4vmin, 64px);
  opacity: 0;
}
/* The animated translateX lives here, on the inner glyph, so it never fights the
   outer translateY(-50%) that centers the whole thing. */
.back-cue-glyph.back-cue-sweep { animation: back-cue-sweep 420ms cubic-bezier(0.22, 0.61, 0.36, 1) both; }
/* Sustained state for a held arrow key: lit, still, and no animation to restart. */
.back-cue-glyph.back-cue-hold { opacity: 0.92; transform: none; animation: none; transition: opacity 90ms linear; }

/* Enters travelling left, holds, leaves travelling left — 16px in total. A glyph
   that slides in and then retreats the way it came reads as a blink; continuous
   drift in one direction reads as movement, which is the whole point. */
@keyframes back-cue-sweep {
  0%   { opacity: 0; transform: translateX(9px); }
  28%  { opacity: 1; transform: translateX(0); }
  57%  { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(-7px); }
}

/* Below the lg breakpoint #main-area stacks and the board goes full width, so there
   is no margin left of it to put anything in. */
@media (max-width: 1023px) { #back-cue { display: none !important; } }
body.phone-mode #back-cue { display: none !important; }
@media print { #back-cue { display: none !important; } }

/* ============ VARIATION WORD (js/features/variationword.js) ============ */
/* "variation!" (or the coach's own word, Settings → Classroom) flashes left of
   the board for about a second when the board steps into a side line. Same
   color as the variation coordinates (Michigan blue by day, amber in dark mode), so it reads as the same signal. Hung off
   #board-wrapper and absolutely positioned like #back-cue, so fitBoard() never
   sees it; above the chevron's centre line (32% vs 50%) so the two never meet.
   Right-aligned so it grows leftward, away from the board. */
#variation-word {
  position: absolute;
  right: calc(100% + 1.6rem);   /* a full rem further out than the rank numbers' own gap */
  top: 32%;
  transform: translateY(-50%);
  pointer-events: none;
  user-select: none;
  z-index: 45;
  opacity: 0;
  white-space: nowrap;
  text-align: right;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: clamp(1rem, 2.9vmin, 2.4rem);   /* the back row; _fit() steps it down if the gutter is tight */
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #00274C;
  text-shadow: 0 1px 2px rgba(0, 39, 76, 0.16);
}
html.dark #variation-word { color: #fbbf24; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); }
/* Drifts in toward the board, holds, fades. Duration must match SHOW_MS. */
#variation-word.variation-word-show { animation: variation-word-in 1100ms cubic-bezier(0.22, 0.61, 0.36, 1) both; }
@keyframes variation-word-in {
  0%   { opacity: 0; transform: translate(-10px, -50%); }
  18%  { opacity: 1; transform: translate(0, -50%); }
  75%  { opacity: 1; transform: translate(0, -50%); }
  100% { opacity: 0; transform: translate(0, -50%); }
}
/* The green name badge (N / random name) lives top-left in the header, and at its
   full size (up to 3rem type + padding = the whole 72px header) it sat right on
   the fuse. While a fuse is on screen the badge drops 12px and takes a compact
   size, so the rope runs clear above it. Other clock styles keep the big badge. */
body:has(.sc-fx-fuse) #active-student-name {
  margin-top: 12px;
  font-size: clamp(1.4rem, 3.2vw, 2rem) !important;
  padding: 0.3rem 1.1rem !important;
}

/* Asked for: the V toast pill sits lower while a fuse is on screen. */
body:has(.sc-fx-fuse) #toast { top: 5.5rem; }

/* A narrow gutter (a ~1200px laptop window): the word runs up the board's side,
   read bottom to top like a book spine. Own keyframes, because the transform
   now carries the rotation too. */
#variation-word.variation-word-vertical {
  writing-mode: vertical-rl;
  top: 30%;          /* centred above the back-step chevron (50%), never on it */
  transform: translateY(-50%) rotate(180deg);
}
#variation-word.variation-word-vertical.variation-word-show { animation-name: variation-word-in-v; }
@keyframes variation-word-in-v {
  0%   { opacity: 0; transform: translate(-10px, -50%) rotate(180deg); }
  18%  { opacity: 1; transform: translate(0, -50%) rotate(180deg); }
  75%  { opacity: 1; transform: translate(0, -50%) rotate(180deg); }
  100% { opacity: 0; transform: translate(0, -50%) rotate(180deg); }
}
@media (prefers-reduced-motion: reduce) {
  #variation-word.variation-word-show,
  #variation-word.variation-word-vertical.variation-word-show { animation: variation-word-still 1100ms linear both; }
  @keyframes variation-word-still { 0%, 90% { opacity: 1; } 100% { opacity: 0; } }
}
/* Same as #back-cue: below lg the board is full width, there is no gutter. */
@media (max-width: 1023px) { #variation-word { display: none !important; } }
body.phone-mode #variation-word { display: none !important; }
@media print { #variation-word { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  .back-cue-glyph.back-cue-sweep { animation: back-cue-fade 420ms linear both; }
  @keyframes back-cue-fade { 0% { opacity: 0; } 25% { opacity: 1; } 60% { opacity: 1; } 100% { opacity: 0; } }
}

/* ============ SUMMER CAMP MODE (settings toggle) ============ */
/* Banner: "18th Annual..." overlays the zen input for 10s, then fades out.
   Gold gradient text with a dark glow so it reads on any background. */
.camp-banner-text {
  background: linear-gradient(180deg, #fde68a 0%, #f59e0b 55%, #d97706 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.7)) drop-shadow(0 0 14px rgba(245,158,11,0.35));
}
@keyframes camp-banner-in {
  0%   { opacity: 0; transform: translateY(-1.25rem) scale(0.92); }
  60%  { opacity: 1; transform: translateY(0.15rem) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes camp-banner-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-1rem); }
}
#camp-banner.camp-banner-in  { animation: camp-banner-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
#camp-banner.camp-banner-out { animation: camp-banner-out 0.65s ease both; }

/* --- High Contrast (old TV): pure black canvas, white text, solid panels --- */
/* Overrides gradient/glow bg themes; pairs with the white/green 'camp' board theme. */
body.camp-high-contrast { background-color: #000 !important; background-image: none !important; }
body.camp-high-contrast::before, body.camp-high-contrast::after { display: none !important; }
.camp-high-contrast .glass-panel {
  background: #0a0a0d !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 2px solid #9ca3af !important;
  box-shadow: none !important;
}
/* Coordinates: bright white and extra bold so they survive a washed-out TV */
.camp-high-contrast #file-labels,
.camp-high-contrast #file-labels-top,
.camp-high-contrast #rank-labels,
.camp-high-contrast #rank-labels-right {
  color: #ffffff !important;
  font-weight: 900;
  text-shadow: 0 1px 2px #000;
}
.camp-high-contrast #board-surface { border-color: #ffffff !important; }
.camp-high-contrast #zen-input { color: #ffffff !important; }

/* --- Projector Boost: punch up a dim 320-ANSI-lumen image --- */
/* Filter only the board area + header (not body: filtering an ancestor of
   position:fixed elements like the toast would break their positioning). */
.camp-projector-boost #board-wrapper,
.camp-projector-boost #main-header {
  filter: contrast(1.3) brightness(1.12) saturate(1.3);
}

/* ============ BLACK & WHITE MODE (settings toggle) ============ */
/* Full grayscale at the <html> level: covers every panel, modal, toast, and
   piece without breaking position:fixed (html's box is the viewport here).
   Pairs with the 'bw' white/gray board theme for print-diagram legibility. */
html.bw-mode { filter: grayscale(1) contrast(1.08); }
html.bw-mode body { background-color: #000 !important; background-image: none !important; }
html.bw-mode body::before, html.bw-mode body::after { display: none !important; }
html.bw-mode .glass-panel {
  background: #0b0b0b !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 2px solid #d4d4d4 !important;
  box-shadow: none !important;
}
html.bw-mode #file-labels,
html.bw-mode #file-labels-top,
html.bw-mode #rank-labels,
html.bw-mode #rank-labels-right {
  color: #ffffff !important;
  font-weight: 900;
  text-shadow: 0 1px 2px #000;
}
html.bw-mode #board-surface { border-color: #ffffff !important; }
html.bw-mode #zen-input { color: #ffffff !important; }
/* Banner glow reads as a white flash in grayscale — keep it but tame it */
html.bw-mode .camp-banner-text { filter: drop-shadow(0 2px 3px rgba(0,0,0,0.8)); }

/* ============ SILLY GIMMICKS ============ */
/* Pancake: squash flat with a splat, then slowly reinflate */
@keyframes gimmick-pancake {
  0%   { transform: scaleY(1); }
  12%  { transform: scaleY(0.15) scaleX(1.45); }
  30%  { transform: scaleY(0.15) scaleX(1.45); }
  60%  { transform: scaleY(1.12) scaleX(0.94); }
  80%  { transform: scaleY(0.96) scaleX(1.03); }
  100% { transform: scaleY(1) scaleX(1); }
}
img.gimmick-pancake, span.gimmick-pancake {
  animation: gimmick-pancake 1.25s cubic-bezier(0.34, 1.56, 0.64, 1) both !important;
  transform-origin: 50% 100% !important;
}
/* Banana peel: 720° wipeout with a hop, lands back upright */
@keyframes gimmick-banana {
  0%   { transform: rotate(0deg) translateY(0); }
  20%  { transform: rotate(200deg) translateY(-35%); }
  45%  { transform: rotate(430deg) translateY(-10%); }
  70%  { transform: rotate(650deg) translateY(-20%); }
  88%  { transform: rotate(716deg) translateY(0); }
  100% { transform: rotate(720deg) translateY(0); }
}
img.gimmick-banana, span.gimmick-banana {
  animation: gimmick-banana 1.5s cubic-bezier(0.3, 0.7, 0.4, 1) both !important;
}
/* Googly eyes overlay */
/* No googly eyes during a dance party: they sit on the square, not the piece. */
body.is-dancing #googly-layer { display: none !important; }
.googly-eye {
  position: absolute;
  background: #fff;
  border: 2px solid #111;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.googly-pupil {
  width: 42%;
  height: 42%;
  background: #111;
  border-radius: 50%;
  transition: transform 0.08s linear;
}
/* Wrong-PIN shake on the vault door */
@keyframes gimmick-shake {
  0%,100% { transform: translateX(0) scale(1); }
  20% { transform: translateX(-10px) scale(1); }
  40% { transform: translateX(10px) scale(1); }
  60% { transform: translateX(-7px) scale(1); }
  80% { transform: translateX(7px) scale(1); }
}
.gimmick-shake { animation: gimmick-shake 0.45s ease both; }

/* Beginner mode help card slide-in */
@keyframes beginner-card-in {
  from { opacity: 0; transform: translate(-1.5rem, -50%); }
  to   { opacity: 1; transform: translate(0, -50%); }
}
#beginner-card.beginner-card-in { animation: beginner-card-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ============ GIMMICKS WAVE 2 ============ */
/* Sleepy: floating 💤 over undeveloped pieces */
@keyframes gimmick-zzz-float {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.7); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(8px, -22px) scale(1.15); }
}
.gimmick-zzz {
  position: absolute; top: 0; right: 2px; z-index: 45; pointer-events: none;
  font-size: 14px;
  animation: gimmick-zzz-float 2.4s ease-in-out infinite;
}
/* Startled awake */
@keyframes gimmick-startle {
  0%, 100% { transform: translateY(0) rotate(0); }
  15% { transform: translateY(-18%) rotate(-8deg); }
  35% { transform: translateY(0) rotate(6deg); }
  55% { transform: translateY(-8%) rotate(-4deg); }
  75% { transform: translateY(0) rotate(2deg); }
}
img.gimmick-startle, span.gimmick-startle { animation: gimmick-startle 0.7s ease both !important; }
/* Panic: trembling + sweat drop */
@keyframes gimmick-tremble {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-4%) rotate(-2deg); }
  50% { transform: translateX(4%) rotate(2deg); }
  75% { transform: translateX(-3%) rotate(-1deg); }
}
img.gimmick-tremble, span.gimmick-tremble { animation: gimmick-tremble 0.28s linear infinite !important; }
@keyframes gimmick-sweat-drip {
  0%   { opacity: 0; transform: translateY(-4px) scale(0.7); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px) scale(1.05); }
}
.gimmick-sweat {
  position: absolute; top: 4px; left: 2px; z-index: 45; pointer-events: none;
  font-size: 13px;
  animation: gimmick-sweat-drip 1.4s ease-in infinite;
}
/* /kls — Kings & Loose Spotlight. Tints are z-0 overlays that sit UNDER the piece
   (z-10) so the art stays crisp; semi-loose sweats at half the loose rate. */
.kls-tint { position: absolute; inset: 0; z-index: 0; pointer-events: none; border-radius: 3px; }
.kls-loose { background: rgba(239, 68, 68, 0.20); box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.55); }   /* subtle red */
.kls-semi  { background: rgba(234, 179, 8, 0.20); box-shadow: inset 0 0 0 2px rgba(202, 138, 4, 0.50); }   /* yellowish */
.kls-king  { background: rgba(99, 102, 241, 0.16); box-shadow: inset 0 0 0 2px rgba(129, 140, 248, 0.65); } /* king spotlight */

/* /fork — persistent fork-target tints (same overlay idiom as .kls-tint;
   .fork-fx is the repaint/cleanup handle, .fork-flash-fx the /fork! one-shot) */
.fork-king  { background: rgba(56, 189, 248, 0.18); box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.60); }
.fork-loose { background: rgba(56, 189, 248, 0.14); box-shadow: inset 0 0 0 2px rgba(125, 211, 252, 0.45); }
/* the teaching point: two lit targets on ONE square color = knight-fork bait */
.kls-tint.fork-hot { background: rgba(251, 146, 60, 0.30); box-shadow: inset 0 0 0 3px rgba(249, 115, 22, 0.80); }
.gimmick-sweat.kls-half { animation-duration: 2.8s; }

/* /target — "keep an eye on this piece": four small chevrons point in from the
   square's corners and breathe. Deliberately quiet — it sits on the board for
   minutes while the game goes on, so no fill, no glow, just the slow blink.
   .target-fx is the repaint/cleanup handle (same idiom as .fork-fx); z-20 so
   the corner arrows stay visible over the piece art without covering it. */
.target-fx { position: absolute; inset: 0; z-index: 20; pointer-events: none;
  animation: target-breathe 1.6s ease-in-out infinite alternate; }
.target-fx svg { width: 100%; height: 100%; display: block; }
.target-fx path { stroke: rgba(245, 158, 11, 0.9); stroke-width: 7; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.35)); }
@keyframes target-breathe {
  from { opacity: 0.3; transform: scale(1.06); }
  to   { opacity: 0.9; transform: scale(0.92); }
}

/* /square — ring a SQUARE to keep an eye on (a hole, an outpost). Cyan and
   dashed so it never reads as the amber piece chevrons above; z-0 under the
   piece art (the .kls-tint idiom) so anything standing on the watched square
   stays crisp. Cleared by clicking the square, so it must stay quiet enough
   to live on the board for a whole lesson. */
.sqmark-fx { position: absolute; inset: 7%; z-index: 0; pointer-events: none;
  border: 2.5px dashed rgba(13, 148, 136, 0.85); border-radius: 8px;
  background: rgba(45, 212, 191, 0.12);
  animation: sqmark-breathe 2.6s ease-in-out infinite alternate; }
@keyframes sqmark-breathe {
  from { opacity: 0.45; }
  to   { opacity: 1; }
}
/* Game show verdict stamps */
@keyframes gimmick-stamp-in {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(3) rotate(-18deg); }
  35%  { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
  45%  { transform: translate(-50%, -50%) scale(1.15) rotate(-8deg); }
  55%  { transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.95) rotate(-8deg); }
}
.gimmick-stamp {
  position: absolute; left: 50%; top: 50%; z-index: 60; pointer-events: none;
  font-size: clamp(4rem, 18vmin, 9rem); font-weight: 900; line-height: 1;
  animation: gimmick-stamp-in 1.2s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  text-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.gimmick-stamp-good { color: #22c55e; }
.gimmick-stamp-bad  { color: #ef4444; }
/* Ejector seat launch */
@keyframes gimmick-eject-fly {
  0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
  15%  { transform: translate(calc(var(--ex) * 0.15), -18vh) rotate(160deg); }
  100% { transform: translate(var(--ex), -120vh) rotate(940deg); opacity: 1; }
}
img.gimmick-eject { animation: gimmick-eject-fly 1.25s cubic-bezier(0.3, 0.1, 0.6, 1) both; }

/* ============ GIMMICKS WAVE 3 ============ */
/* Pawn dreams: 👑 thought bubble over an advanced pawn */
@keyframes gimmick-dream-float {
  0%   { opacity: 0; transform: translate(-50%, 2px) scale(0.6); }
  25%  { opacity: 0.95; }
  100% { opacity: 0; transform: translate(-50%, -20px) scale(1.2); }
}
.gimmick-dream {
  position: absolute; top: 0; left: 50%; z-index: 46; pointer-events: none;
  font-size: 15px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  animation: gimmick-dream-float 2.8s ease-in-out infinite;
}
/* One square from promoting — dreams bigger and faster */
.gimmick-dream-close { font-size: 21px; animation-duration: 1.8s; }
/* Promotion: red carpet unrolls up the file (origin set inline for board flip) */
@keyframes gimmick-carpet-roll {
  0%   { opacity: 0; transform: scaleY(0); }
  35%  { opacity: 1; transform: scaleY(1); }
  80%  { opacity: 1; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(1); }
}
.gimmick-carpet {
  position: absolute; z-index: 40; pointer-events: none;
  background: linear-gradient(90deg, #7f1d1d, #dc2626 18%, #ef4444 50%, #dc2626 82%, #7f1d1d);
  border-left: 2px solid #fbbf24; border-right: 2px solid #fbbf24;
  box-shadow: 0 0 26px rgba(220, 38, 38, 0.7);
  animation: gimmick-carpet-roll 2.6s ease-out both;
}
@keyframes gimmick-crown-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(-25deg); }
  45%  { opacity: 1; transform: translate(-50%, -50%) scale(1.35) rotate(6deg); }
  70%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.15) rotate(0); }
}
.gimmick-crown {
  position: absolute; z-index: 62; pointer-events: none; line-height: 1;
  font-size: clamp(2.5rem, 11vmin, 6rem);
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.55));
  animation: gimmick-crown-pop 2.2s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
/* Dramatic check: trailer zoom-punch, and a slower desaturated push-in on mate */
@keyframes gimmick-drama-zoom {
  0%   { transform: scale(1); }
  18%  { transform: scale(1.12); }
  55%  { transform: scale(1.09); }
  100% { transform: scale(1); }
}
.gimmick-drama-zoom { animation: gimmick-drama-zoom 0.75s cubic-bezier(0.2, 1.2, 0.3, 1) both; will-change: transform; }
@keyframes gimmick-drama-mate {
  0%   { transform: scale(1); filter: saturate(1); }
  12%  { transform: scale(1.18); filter: saturate(1.5); }
  70%  { transform: scale(1.14); filter: saturate(0.55) contrast(1.15); }
  100% { transform: scale(1); filter: saturate(1); }
}
.gimmick-drama-mate { animation: gimmick-drama-mate 2.1s cubic-bezier(0.15, 0.9, 0.2, 1) both; will-change: transform; }
@keyframes gimmick-vignette-in {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  70%  { opacity: 0.8; }
  100% { opacity: 0; }
}
.gimmick-vignette {
  position: fixed; inset: 0; z-index: 300; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(220, 38, 38, 0) 38%, rgba(190, 18, 18, 0.5) 78%, rgba(120, 8, 8, 0.82) 100%);
  animation: gimmick-vignette-in 0.9s ease-out both;
}
.gimmick-vignette-mate {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 30%, rgba(60, 0, 0, 0.6) 72%, rgba(0, 0, 0, 0.9) 100%);
  animation-duration: 2.2s;
}

/* ------------------------------------------------------------------ *
 * Legibility: kill the tiny "useless" font sizes app-wide.
 * These Tailwind arbitrary sizes (8–11px) were too small to read on a
 * projector or for young students. Bump them to a readable floor here
 * with !important so it wins over the runtime Tailwind utilities,
 * regardless of stylesheet order. One place to tune, covers every use.
 * (text-[12px]/[13px] get a 14px floor just below; text-[15px] is left alone.)
 * ------------------------------------------------------------------ */
.text-\[8px\]  { font-size: 15px !important; line-height: 1.35 !important; }
.text-\[9px\]  { font-size: 15px !important; line-height: 1.35 !important; }
.text-\[10px\] { font-size: 15px !important; line-height: 1.4  !important; }
.text-\[11px\] { font-size: 15px !important; line-height: 1.4  !important; }
/* The last arbitrary sizes under 14px (Jeff, 2026-11-17: "I want to avoid small
   font on screen"). 14px is the floor for anything on the classroom screen;
   the plain font-size rules in this file, settings.css, menubar.css and pti.css
   were lifted to the same floor on 2026-11-18. */
.text-\[12px\], .text-\[13px\], .text-\[0\.7rem\] { font-size: 14px !important; line-height: 1.4 !important; }
@media (min-width: 640px) { .sm\:text-\[13px\] { font-size: 15px !important; } }

/* Same idea one step up: Tailwind's text-xs (12px) and text-sm (14px) carry most
   of the app's chrome — toolbar labels, panel headers, help text, the move list.
   Both are a strain on the academy's dim projector and its old TV. Raise the
   floor for every use; anything that needs to stay small sets an explicit size.
   Line-heights are lifted with them so nothing collides in the dense panels. */
.text-xs { font-size: 14px !important; line-height: 1.45 !important; }
.text-sm { font-size: 15.5px !important; line-height: 1.5 !important; }

/* The floors above MUST be !important — Tailwind's runtime injects its utilities
   after this stylesheet, so a plain rule would lose. But !important also beats
   the responsive variants regardless of media query, which would pin an element
   like `text-sm sm:text-base` at 15.5px and make it SHRINK past 640px. Lift the
   variants that are actually paired with text-xs/text-sm so they still step up. */
@media (min-width: 640px) {
  .sm\:text-sm   { font-size: 15.5px !important; line-height: 1.5 !important; }
  .sm\:text-base { font-size: 17px   !important; line-height: 1.55 !important; }
}
@media (min-width: 768px) {
  .md\:text-sm   { font-size: 15.5px !important; line-height: 1.5 !important; }
  .md\:text-base { font-size: 17px   !important; line-height: 1.55 !important; }
}

/* WSB checklist widening lives in css/responsive-desktop.css, which is loaded
   after this file and is where every other #right-panel width is decided. */

/* ---- Game Info: long player names stack instead of truncating -------------
   .gi-stacked is applied by layoutGameInfoNames() (js/core/utils.js) when a
   name overflows its input in the side-by-side layout. White stays on top,
   the VS chip disappears, and the inputs (which already carry transition-all)
   ease to full width. No transition on the direction change itself. */
#gi-names-row.gi-stacked { flex-direction: column; align-items: stretch; }
#gi-names-row.gi-stacked #gi-vs { display: none; }

/* ============================================================
   Tip of the Day — reading typography.
   The card body is set in a text serif so a tip reads like a printed
   note rather than another block of UI chrome. Only the prose opts in;
   the kbd/code chips inside stay monospace, and the modal's buttons and
   checkbox keep the app's system sans.
   ============================================================ */
.tip-serif {
  font-family: 'Source Serif 4', Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  font-variant-numeric: oldstyle-nums;
}
.tip-serif kbd,
.tip-serif code {
  font-variant-numeric: normal;
}

/* --- Screensaver caption (/screensaver) -----------------------------------
   Sits above the board, never over the clickable UI: pointer-events:none so a
   click meant to WAKE the screensaver reaches the document handler underneath
   instead of being swallowed here. */
#screensaver-caption {
  position: fixed;
  left: 50%;
  bottom: 4vh;
  transform: translateX(-50%);
  z-index: 300;
  pointer-events: none;
  text-align: center;
  padding: 0.9rem 1.6rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-family: inherit;
  max-width: 90vw;
  animation: ss-fade-in 900ms ease-out both;
}
#screensaver-caption .ss-title { font-size: 1.9rem; font-weight: 700; line-height: 1.15; }
#screensaver-caption .ss-blurb { font-size: 1.05rem; opacity: 0.85; margin-top: 0.25rem; }
#screensaver-caption .ss-hint  { font-size: max(14px, 0.8rem);  opacity: 0.55; margin-top: 0.6rem; letter-spacing: 0.04em; text-transform: uppercase; }

@keyframes ss-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* A projector left idling is exactly where a motion-sensitive viewer is least
   able to look away, so honour the OS setting and skip the fade entirely. */
@media (prefers-reduced-motion: reduce) {
  #screensaver-caption { animation: none; }
}


/* ---- OPQ banner ---------------------------------------------------------
   The Official Puzzle Question announcement. Sized for the back of a room, so
   it is deliberately larger than .gimmick-stamp and, unlike that one, wraps to
   two or three lines — "OFFICIAL PUZZLE QUESTION #27" is not one glyph.

   Held, not just flashed: the whole point is that a kid who looked away still
   sees it. Timing comes from --opq-hold so the JS owns the duration and the CSS
   only owns the shape. The fade in/out slices are a fixed fraction of it.

   Static transform + opacity only, and it lives above the board rather than
   behind a backdrop-filter panel, so this does not hit the full-window repaint
   problem documented on the background gradients. */
.opq-banner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 70;
    pointer-events: none;
    width: 92%;
    text-align: center;
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1.05;
    font-size: clamp(1.75rem, 7.5vmin, 4.5rem);
    color: #fff;
    text-shadow: 0 3px 14px rgba(0, 0, 0, 0.75), 0 1px 2px rgba(0, 0, 0, 0.9);
    background: rgba(15, 23, 42, 0.82);
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 1rem;
    padding: 0.6em 0.5em;
    animation: opq-banner-hold var(--opq-hold, 2600ms) ease-in-out forwards;
}
.opq-banner-side {
    background: rgba(30, 64, 175, 0.88);
    font-size: clamp(2rem, 9vmin, 5.5rem);
}
@keyframes opq-banner-hold {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.86); }
    10%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    85%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.04); }
}


/* ---- inside-square coordinates (lichess style) --------------------------
   <i>, not <span>: _setPieceOnSquare() clears squares with
   querySelectorAll('img, span'), which would eat the bottom-rank letters the
   moment a piece stood there. Colour is set inline per square, from the board
   theme, so a coordinate always sits on the opposite shade.

   pointer-events:none so a coordinate never swallows a click on its square —
   the bottom rank and left file are where pieces actually get picked up. */
.sq-coord {
    position: absolute;
    font-style: normal;
    font-weight: 800;
    /* Sized for a projector at the back of a room, not for a desk. */
    font-size: clamp(0.6rem, 2.1vmin, 1.35rem);
    line-height: 1;
    pointer-events: none;
    user-select: none;
}
.sq-coord-file { right: 3px; bottom: 2px; }
.sq-coord-rank { left: 3px; top: 2px; }

/* 'inside' and 'off' both hide the gutter strips. The gutters keep their space
   in the grid, so the board does not resize when the style changes. */
body.coords-hidden #rank-labels,
body.coords-hidden #file-labels,
body.coords-hidden #rank-labels-right,
body.coords-hidden #file-labels-top {
    visibility: hidden;
}

/* ==========================================================================
   WORKSHEET BUILDER — page sizing
   ========================================================================== */
/* Jeff, 2026-09-05: "make the worksheet module page much bigger". The screen
   was already full-bleed; what was small was everything ON it — 10-12px chips,
   text-xs prompts, 160px diagrams. Rather than re-class two hundred lines of
   template, the utility sizes are re-based here, scoped to the modal, and the
   diagram size is computed from the available width in Worksheet._thumbPx().
   The id selector outranks Tailwind's single-class utilities, so nothing
   outside #worksheet-modal is touched. */
#worksheet-modal { font-size: 1.125rem; }
#worksheet-modal h2 { font-size: 1.6rem; }
#worksheet-modal h3 { font-size: 0.95rem; letter-spacing: 0.12em; }
#worksheet-modal .text-\[10px\] { font-size: 0.85rem; line-height: 1.3; }
#worksheet-modal .text-\[11px\] { font-size: 0.9rem; line-height: 1.3; }
#worksheet-modal .text-xs      { font-size: 1rem;    line-height: 1.4; }
#worksheet-modal .text-sm      { font-size: 1.1rem;  line-height: 1.45; }
#worksheet-modal .text-lg      { font-size: 1.5rem; }
#worksheet-modal select,
#worksheet-modal input[type="text"],
#worksheet-modal input[type="number"],
#worksheet-modal input:not([type]),
#worksheet-modal textarea { font-size: 1.05rem; }
#worksheet-modal input[type="checkbox"] { width: 1.15rem; height: 1.15rem; }
#worksheet-modal .w-4 { width: 1.25rem; }
#worksheet-modal .h-4 { height: 1.25rem; }
#worksheet-modal .w-5 { width: 1.5rem; }
#worksheet-modal .h-5 { height: 1.5rem; }
#worksheet-modal #worksheet-grid { gap: 1.25rem; }
#worksheet-modal .ws-drag[data-zone="sheet"] { padding: 0.9rem; gap: 0.6rem; }

/* The screen grid is a curation view; print density must not make its cards
   unreadable. Flexible squares also resize without rebuilding every diagram. */
#worksheet-grid.ws-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#worksheet-grid.ws-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#worksheet-grid .ws-drag { min-width: 0; }
#worksheet-grid .ws-drag > div:first-child,
#worksheet-grid .ws-drag > div:first-child span { flex-wrap: wrap; }
#worksheet-grid select { max-width: 100%; min-width: 0; }
#worksheet-shelves { width: clamp(15rem, 28vw, 26rem); }
#worksheet-modal > div:first-child { max-height: 35%; overflow-y: auto; }
#worksheet-body > div:first-child > div:first-child { flex-wrap: wrap; }
@media (max-width: 1100px) {
  #worksheet-grid.ws-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  #worksheet-grid.ws-cols-2,
  #worksheet-grid.ws-cols-3 { grid-template-columns: minmax(0, 1fr); }
  #worksheet-body { flex-direction: column; overflow-y: auto; }
  #worksheet-body > div:first-child { flex: none; }
  #worksheet-sheet-scroll { flex: none; overflow: visible; }
  #worksheet-shelves { width: 100%; flex-shrink: 0; border-left: 0; border-top: 1px solid #64748b; }
  #worksheet-shelves > div { flex: none; max-height: none; overflow: visible; }
  #worksheet-actions { margin-left: 0; }
}

/* ============ HOMEWORK LIGHT (homework.js _scanPill) ============ */
/* A tiny amber light while a game's homework is being banked. It used to be a
   dark pill with the whole sentence; Jeff, 2026-10-21: "just a tiny light that
   lets me hover". The 1.4rem box is the hover/tap target; the dot is 0.55rem.
   The sentence shows the moment the pointer is on it (a title tooltip waits a
   second and a half). */
#hw-scan-pill {
  position: fixed; left: 0.45rem; bottom: 0.45rem; z-index: 300;
  width: 1.4rem; height: 1.4rem; display: flex; align-items: center; justify-content: center;
  cursor: default; -webkit-tap-highlight-color: transparent;
}
#hw-scan-pill .hw-scan-dot {
  width: 0.55rem; height: 0.55rem; border-radius: 9999px;
  background: #fbbf24; box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.22), 0 0 8px rgba(251, 191, 36, 0.55);
}
#hw-scan-pill::after {
  content: attr(data-tip); position: absolute; left: 0.2rem; bottom: calc(100% + 0.35rem);
  white-space: nowrap; padding: 0.35rem 0.6rem; border-radius: 0.5rem;
  font: 600 max(14px, 0.75rem)/1.2 system-ui, -apple-system, sans-serif; color: #f1f5f9;
  background: rgba(24, 27, 34, 0.94); border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  opacity: 0; pointer-events: none; transition: opacity 0.12s ease;
}
#hw-scan-pill:hover::after { opacity: 1; }
/* At the top of the zen board the tooltip opens downward. */
body.phone-mode #hw-scan-pill::after { bottom: auto; top: calc(100% + 0.35rem); }
@media (prefers-reduced-motion: reduce) { #hw-scan-pill .hw-scan-dot { animation: none; } }
@media print { #hw-scan-pill { display: none !important; } }

/* ============ TOAST + UPDATE CHIP: quiet, professional ============ */
/* One look for every toast (2026-11-02): a dark card, not a pill, so a two-line
   message wraps cleanly; a coloured rule on the left and a matching icon say
   what kind of message it is (info blue, success green, warn amber, error red).
   It drops in from 6px above and lifts slightly when a new message replaces
   the one on screen. js/ui/modals.js showToast() sets the kind. */
/* Restyled 2026-12-01 (Jeff: the old card looked bad): a compact solid pill,
   no side stripe; the kind shows only as a small coloured icon disc. */
#toast {
  background: #111827;
  color: #f9fafb;
  border: none;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  /* Still readable from the back of the room (Jeff, 2026-11-17). !important
     beats the forced .text-xs / .sm:text-sm sizes the toast carries. */
  font-size: 18px !important;
  line-height: 1.3;
  padding: 0.55rem 1.1rem 0.55rem 0.55rem;
  gap: 0.6rem;
  width: max-content;
  max-width: min(32rem, calc(100vw - 2rem));
  text-wrap: pretty;
  transform: translate(-50%, 0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
/* A toast never takes a click. The `span { pointer-events: auto }` rule at the
   top of this file made the message text catch taps, so a toast lying over a
   button (Recap, after "17 moves loaded") blocked it until it faded. */
#toast, #toast * { pointer-events: none !important; }
#toast.opacity-0 { transform: translate(-50%, -6px); }
#toast .toast-icon { width: 30px; height: 30px; padding: 6px; border-radius: 999px; flex: none; fill: none;
  background: var(--toast-accent, #3b82f6); stroke: #fff;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
#toast.toast-info    { --toast-accent: #3b82f6; }
#toast.toast-success { --toast-accent: #16a34a; }
#toast.toast-warn    { --toast-accent: #d97706; }
#toast.toast-error, #toast.bg-red-600 { --toast-accent: #dc2626; background: #111827; }
#toast.toast-bump { animation: toast-bump 0.28s ease; }
@keyframes toast-bump { 0% { transform: translate(-50%, 0); } 40% { transform: translate(-50%, -3px) scale(1.02); } 100% { transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { #toast, #toast.opacity-0 { transition: opacity 0.2s; transform: translate(-50%, 0); } #toast.toast-bump { animation: none; } }
/* Popups sit top-right in the header row, left of the fullscreen button
   (Jeff, 2026-11-19): never over the board, the move list or the scoresheet. */
#toast { top: 0.6rem !important; left: auto !important; right: 4.5rem; max-width: min(30rem, calc(100vw - 6rem)); transform: none; }
#toast.opacity-0 { transform: translateY(-6px); }
#toast.toast-bump { animation: none; }
body:has(.sc-fx-fuse) #toast { top: 0.6rem; }
@media (prefers-reduced-motion: reduce) { #toast, #toast.opacity-0 { transform: none; } }
/* The "new update" chip (kit: js/kit/panda-update.js). Same neutral surface as the
   toast with a thin amber rule instead of a solid yellow slab. */
html #panda-update-chip {
  background: rgba(24, 27, 34, 0.96);
  color: #f1f5f9;
  border: 1px solid rgba(251, 191, 36, 0.55);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.30);
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 18px;
}
html #panda-update-chip.stuck { background: rgba(24, 27, 34, 0.96); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.4); font-weight: 500; }
html #panda-update-chip .pu-bar { background: rgba(255, 255, 255, 0.14); }
html #panda-update-chip .pu-bar i { background: #fbbf24; }

/* ---- SCORESHEET MODE (/scoresheet, js/features/scoresheet.js) ---------------
   The zen board plus one panel: the game as a scoresheet, in type a room can
   read. Only shows while BOTH the zen board and the mode are on, so a stray
   class can never put it over the full layout. Light = paper; dark = the same
   glass as the rest of the app. Moves are the reading serif (Source Serif 4),
   chrome is Montserrat, matching the Tip of the Day card. */
#scoresheet-panel { display: none; }
body.scoresheet-hidden #scoresheet-panel { display: none !important; }
body.phone-mode.scoresheet-mode:not(.scoresheet-hidden) #main-area { flex-direction: row !important; align-items: stretch; }
body.phone-mode.scoresheet-mode #scoresheet-panel {
  --ss-paper: #fbfaf6; --ss-ink: #0f172a; --ss-soft: #64748b; --ss-faint: #94a3b8;
  --ss-rule: rgba(15, 23, 42, 0.07); --ss-zebra: transparent; --ss-accent: #2563eb;
  --ss-cur-bg: rgba(37, 99, 235, 0.12); --ss-cur-ink: #1d4ed8; --ss-hover: rgba(37, 99, 235, 0.07);
  display: flex; flex-direction: column; flex: none;
  width: clamp(16rem, 26vw, 28rem);
  margin: 0.75rem 0.75rem calc(var(--phone-dock-h, 4.5rem) + env(safe-area-inset-bottom, 0px)) 0;
  background: var(--ss-paper); color: var(--ss-ink);
  border-radius: 1.25rem; overflow: hidden;
  box-shadow: 0 12px 32px -18px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(15, 23, 42, 0.05);
  position: relative; z-index: 65;
}
.dark body.phone-mode.scoresheet-mode #scoresheet-panel {
  --ss-paper: rgba(17, 19, 26, 0.92); --ss-ink: #f1f5f9; --ss-soft: #94a3b8; --ss-faint: #64748b;
  --ss-rule: rgba(255, 255, 255, 0.06); --ss-zebra: transparent; --ss-accent: #3b82f6;
  --ss-cur-bg: rgba(96, 165, 250, 0.18); --ss-cur-ink: #bfdbfe; --ss-hover: rgba(96, 165, 250, 0.10);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
}
/* Minimalist (2026-10-13): names on the left, one quiet ☰ on the right. Every
   action lives in the drop-down menu, never as a row of buttons. */
#scoresheet-panel .ss-head { position: relative; display: flex; align-items: flex-start; gap: 0.5rem; padding: 1rem 0.75rem 0.75rem 1.25rem; }
#scoresheet-panel .ss-who { flex: 1; min-width: 0; }
/* Slots for the floating pills (shot clock; XP on a phone held upright). Each
   is sized to its pill by Scoresheet.placeHud and the pill is parked on it, so
   the names make room instead of being covered. */
#scoresheet-panel .ss-hud { flex: none; display: flex; align-items: center; gap: 0.5rem; align-self: center; }
#scoresheet-panel .ss-hud-slot { display: block; flex: none; }
#scoresheet-panel .ss-hud-slot[hidden] { display: none; }
#scoresheet-panel .ss-menu-btn {
  flex: none; display: inline-flex; padding: 0.35rem; border-radius: 0.5rem; border: 0; background: transparent;
  color: var(--ss-faint); opacity: 0; transition: opacity 0.2s ease, background-color 0.15s ease;
}
/* The ☰ itself stays out of sight until the pointer is over the sheet (or a key
   has focus in it, or the menu is open). Touch screens can't hover: faint there. */
#scoresheet-panel:hover .ss-menu-btn, #scoresheet-panel:focus-within .ss-menu-btn { opacity: 0.6; }
@media (hover: none) { #scoresheet-panel .ss-menu-btn { opacity: 0.6; } }
#scoresheet-panel .ss-menu-btn:hover, #scoresheet-panel .ss-menu-btn[aria-expanded="true"] { opacity: 1; background: var(--ss-hover); color: var(--ss-ink); }
#scoresheet-panel .ss-menu-btn svg { width: 1.1rem; height: 1.1rem; }
/* Fullscreen, beside the ☰ (2026-11-15). Faint but always there, like the
   header's corner button, so it can be found without hunting. */
#scoresheet-panel .ss-fs-btn {
  flex: none; display: inline-flex; padding: 0.35rem; border-radius: 0.5rem; border: 0; background: transparent;
  color: var(--ss-faint); opacity: 0.35; cursor: pointer; transition: opacity 0.2s ease, background-color 0.15s ease;
}
#scoresheet-panel .ss-fs-btn:hover, #scoresheet-panel .ss-fs-btn:focus-visible { opacity: 1; background: var(--ss-hover); color: var(--ss-ink); }
#scoresheet-panel .ss-fs-btn svg { width: 1.1rem; height: 1.1rem; }
/* Brush font (☰ → Brush font, on by default, 2026-11-15). Kaushan Script is a
   slanted brush script with one weight; it runs a touch wide, so it is set a
   little smaller than the serif to keep "Nxe5+" on one line. */
body.scoresheet-brush #scoresheet-panel .ss-mv,
body.scoresheet-brush #scoresheet-panel .ss-num,
body.scoresheet-brush #scoresheet-panel .ss-vmv { font-family: 'Kaushan Script', 'Source Serif 4', Georgia, serif; font-style: normal; font-weight: 400; letter-spacing: 0.01em; }
body.scoresheet-brush #scoresheet-panel .ss-mv { font-size: clamp(1.2rem, 2vw, 1.85rem); }
body.scoresheet-brush.scoresheet-huge #scoresheet-panel .ss-mv { font-size: clamp(1.8rem, 3.4vw, 3.2rem); }
/* More fonts (☰ → Font, 2026-11-18). The italic ones lead, per Jeff. */
body[data-ss-font="elegant"] #scoresheet-panel :is(.ss-mv, .ss-num, .ss-vmv) { font-family: 'Playfair Display', 'Source Serif 4', Georgia, serif; font-style: italic; }
body[data-ss-font="book"] #scoresheet-panel :is(.ss-mv, .ss-num, .ss-vmv) { font-family: 'Lora', 'Source Serif 4', Georgia, serif; font-style: italic; }
body[data-ss-font="pen"] #scoresheet-panel :is(.ss-mv, .ss-num, .ss-vmv) { font-family: 'Dancing Script', 'Source Serif 4', cursive; font-style: normal; }
body[data-ss-font="hand"] #scoresheet-panel :is(.ss-mv, .ss-num, .ss-vmv) { font-family: 'Caveat', 'Source Serif 4', cursive; font-style: normal; letter-spacing: 0.02em; }
body[data-ss-font="typewriter"] #scoresheet-panel :is(.ss-mv, .ss-num, .ss-vmv) { font-family: 'Courier Prime', 'Courier New', monospace; font-style: italic; font-weight: 700; }
body[data-ss-font="plain"] #scoresheet-panel :is(.ss-mv, .ss-num, .ss-vmv) { font-family: Montserrat, 'Helvetica Neue', Arial, sans-serif; font-style: normal; font-weight: 700; }
#scoresheet-panel .ss-menu {
  position: absolute; top: 2.9rem; right: 0.75rem; z-index: 5; min-width: 13rem; padding: 0.35rem;
  background: var(--ss-paper); border-radius: 0.75rem; backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--ss-rule);
}
#scoresheet-panel .ss-menu[hidden] { display: none; }
#scoresheet-panel .ss-menu hr { border: 0; border-top: 1px solid var(--ss-rule); margin: 0.3rem 0.25rem; }
#scoresheet-panel .ss-item {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.5rem 0.6rem; border: 0; border-radius: 0.45rem;
  background: transparent; color: var(--ss-ink); font: 600 0.85rem 'Montserrat', sans-serif; text-align: left; cursor: pointer;
}
#scoresheet-panel .ss-item:hover { background: var(--ss-hover); }
#scoresheet-panel .ss-item svg { width: 1rem; height: 1rem; color: var(--ss-soft); flex: none; }
#scoresheet-panel .ss-item span { flex: 1; }
#scoresheet-panel .ss-item .ss-check { visibility: hidden; color: var(--ss-accent); }
#scoresheet-panel .ss-item[aria-checked="true"] .ss-check { visibility: visible; }
#scoresheet-panel .ss-players {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.6rem;
  font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: clamp(1.05rem, 1.6vw, 1.45rem); line-height: 1.2;
}
#scoresheet-panel .ss-name { display: inline-flex; align-items: center; gap: 0.45rem; min-width: 0; overflow-wrap: anywhere; }
#scoresheet-panel .ss-dot { width: 0.7rem; height: 0.7rem; border-radius: 9999px; flex: none; border: 2px solid var(--ss-ink); }
#scoresheet-panel .ss-dot-w { background: #fff; }
#scoresheet-panel .ss-dot-b { background: #0f172a; }
.dark #scoresheet-panel .ss-dot-b { border-color: #94a3b8; }
#scoresheet-panel .ss-vs { font-size: 0.8em; font-weight: 600; color: var(--ss-faint); }
#scoresheet-panel .ss-meta { margin-top: 0.2rem; font-family: 'Source Serif 4', Georgia, serif; font-size: 0.95rem; color: var(--ss-soft); }
#scoresheet-panel .ss-meta:empty { display: none; }
#scoresheet-panel .ss-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0.25rem 0.5rem 0.75rem; scrollbar-width: thin; }
#scoresheet-panel .ss-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
#scoresheet-panel .ss-table td { padding: 0; }
#scoresheet-panel .ss-row td { border-bottom: 1px solid var(--ss-rule); }
#scoresheet-panel .ss-row:nth-child(even of .ss-row) td { background: var(--ss-zebra); }
#scoresheet-panel .ss-num {
  width: 3.2rem; padding-right: 0.8rem !important; text-align: right; color: var(--ss-faint);
  font: 600 clamp(1rem, 1.5vw, 1.35rem) 'Source Serif 4', Georgia, serif; font-variant-numeric: tabular-nums;
}
/* The moves are in italics (Jeff, 2026-11-09: "italicize notation font"), drawn
   from Source Serif 4's real italic, which index.html loads for this. */
#scoresheet-panel .ss-mv {
  font: italic 600 clamp(1.3rem, 2.2vw, 2rem)/1.15 'Source Serif 4', Georgia, serif;
  padding: 0.38rem 0.5rem !important; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background-color 0.12s ease;
}
#scoresheet-panel .ss-mv:not(.ss-empty):hover { background: var(--ss-hover) !important; }
#scoresheet-panel .ss-mv.ss-empty { cursor: default; height: calc(clamp(1.3rem, 2.2vw, 2rem) * 1.15 + 0.76rem); }
#scoresheet-panel .ss-mv.ss-cur { background: var(--ss-cur-bg) !important; color: var(--ss-cur-ink); border-radius: 0.5rem; }
/* Large type (the ☰ menu's "Large type", on by default): about half the screen, moves roughly twice
   the size, for the back row. The board shrinks to fit; fitBoard() reruns. */
body.phone-mode.scoresheet-mode.scoresheet-huge #scoresheet-panel { width: clamp(22rem, 40vw, 50rem); }
body.scoresheet-huge #scoresheet-panel .ss-mv { font-size: clamp(2rem, 3.8vw, 3.6rem); padding: 0.45rem 0.6rem !important; }
body.scoresheet-huge #scoresheet-panel .ss-mv.ss-empty { height: calc(clamp(2rem, 3.8vw, 3.6rem) * 1.15 + 0.9rem); }
body.scoresheet-huge #scoresheet-panel .ss-num { width: 4.4rem; font-size: clamp(1.4rem, 2.4vw, 2.2rem); }
body.scoresheet-huge #scoresheet-panel .ss-players { font-size: clamp(1.4rem, 2.4vw, 2.3rem); }
#scoresheet-panel .ss-blank .ss-num { opacity: 0.45; }
#scoresheet-panel .ss-var td {
  padding: 0.3rem 0.5rem 0.5rem !important; border-bottom: 1px solid var(--ss-rule);
  font: italic 400 clamp(0.95rem, 1.25vw, 1.15rem)/1.55 'Source Serif 4', Georgia, serif; color: var(--ss-soft);
}
#scoresheet-panel .ss-vmv { cursor: pointer; border-radius: 0.3rem; padding: 0 0.1rem; }
#scoresheet-panel .ss-vmv:hover { background: var(--ss-hover); color: var(--ss-ink); }
#scoresheet-panel .ss-vmv.ss-cur { background: var(--ss-cur-bg); color: var(--ss-cur-ink); font-style: normal; }
#scoresheet-panel .ss-vnum { color: var(--ss-faint); }
#scoresheet-panel .ss-result {
  padding: 0.7rem 1.25rem; border-top: 1px solid var(--ss-rule); text-align: right;
  font: 800 1.4rem 'Montserrat', sans-serif; letter-spacing: 0.04em;
}
/* Portrait / narrow: the sheet goes under the board instead of beside it. */
@media (max-aspect-ratio: 1/1) {
  /* Must carry the same :not(.scoresheet-hidden) as the side-by-side rule above,
     or that rule out-specifies this one and an upright phone gets the sheet
     BESIDE the board: the board squeezed to a 6px stamp (found 2026-10-19 by
     tests/test_shotclock_modes.js). */
  body.phone-mode.scoresheet-mode:not(.scoresheet-hidden) #main-area { flex-direction: column !important; }
  body.phone-mode.scoresheet-mode #scoresheet-panel {
    width: auto; height: 38vh; margin: 0 0.5rem calc(var(--phone-dock-h, 4.5rem) + env(safe-area-inset-bottom, 0px));
  }
  body.phone-mode.scoresheet-mode #board-cell { padding-bottom: 0.35rem !important; }
}
@media print { #scoresheet-panel { display: none !important; } }

/* ---- PRINT CHOOSER (/print, js/features/printsheet.js) ------------------- */
#printsheet-modal { position: fixed; inset: 0; z-index: 470; display: flex; align-items: center; justify-content: center; padding: 1rem; }
#printsheet-modal.hidden { display: none; }
#printsheet-modal .ps-scrim { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.2s ease; }
#printsheet-modal .ps-card {
  --ps-bg: #ffffff; --ps-ink: #0f172a; --ps-soft: #64748b; --ps-line: #e2e8f0; --ps-tile: #f8fafc; --ps-accent: #2563eb;
  position: relative; width: min(62rem, 100%); max-height: calc(100vh - 2rem); overflow-y: auto;
  display: grid; grid-template-columns: minmax(0, 30rem) minmax(0, 1fr); column-gap: 1.5rem; align-content: start;
  background: var(--ps-bg); color: var(--ps-ink); border-radius: 1.5rem; padding: 1.5rem;
  box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(15, 23, 42, 0.06);
  border-top: 5px solid var(--ps-accent);
  transform: translateY(12px) scale(0.98); opacity: 0; transition: transform 0.2s ease, opacity 0.2s ease;
}
.dark #printsheet-modal .ps-card {
  --ps-bg: #14161c; --ps-ink: #f1f5f9; --ps-soft: #94a3b8; --ps-line: rgba(255, 255, 255, 0.08); --ps-tile: rgba(255, 255, 255, 0.04); --ps-accent: #3b82f6;
  box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
#printsheet-modal.open .ps-scrim { opacity: 1; }
#printsheet-modal.open .ps-card { transform: none; opacity: 1; }
#printsheet-modal .ps-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
#printsheet-modal .ps-kicker { font: 800 max(14px, 0.72rem) 'Montserrat', sans-serif; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ps-accent); }
#printsheet-modal .ps-title { margin-top: 0.3rem; font: 800 1.45rem/1.2 'Montserrat', sans-serif; }
#printsheet-modal .ps-x { padding: 0.45rem; border-radius: 9999px; color: var(--ps-soft); }
#printsheet-modal .ps-x:hover { background: var(--ps-tile); color: var(--ps-ink); }
#printsheet-modal .ps-x svg { width: 1.2rem; height: 1.2rem; }
#printsheet-modal .ps-choices { display: flex; flex-direction: column; gap: 0.6rem; }
#printsheet-modal .ps-choice {
  display: flex; align-items: center; gap: 0.9rem; width: 100%; text-align: left;
  padding: 0.85rem 1rem; border-radius: 1rem; background: var(--ps-tile); border: 2px solid transparent;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
#printsheet-modal .ps-choice:hover { border-color: var(--ps-line); transform: translateY(-1px); }
#printsheet-modal .ps-choice.on { border-color: var(--ps-accent); background: rgba(37, 99, 235, 0.07); }
#printsheet-modal .ps-ico { flex: none; display: flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border-radius: 0.8rem; background: var(--ps-bg); color: var(--ps-accent); box-shadow: 0 0 0 1px var(--ps-line); }
#printsheet-modal .ps-ico svg { width: 1.35rem; height: 1.35rem; }
#printsheet-modal .ps-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#printsheet-modal .ps-ct { font: 700 1.02rem 'Montserrat', sans-serif; }
#printsheet-modal .ps-cs { font: 400 0.95rem 'Source Serif 4', Georgia, serif; color: var(--ps-soft); }
#printsheet-modal .ps-tick { flex: none; display: flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 9999px; background: var(--ps-accent); color: #fff; opacity: 0; transform: scale(0.6); transition: all 0.15s ease; }
#printsheet-modal .ps-tick svg { width: 0.95rem; height: 0.95rem; }
#printsheet-modal .ps-choice.on .ps-tick { opacity: 1; transform: none; }
#printsheet-modal .ps-opt { display: flex; align-items: center; gap: 0.8rem; margin-top: 1rem; padding: 0.85rem 1rem; border-radius: 1rem; border: 1px dashed var(--ps-line); cursor: pointer; transition: opacity 0.15s ease; }
#printsheet-modal .ps-opt.ps-off { opacity: 0.4; cursor: default; }
#printsheet-modal .ps-opt input { position: absolute; opacity: 0; pointer-events: none; }
#printsheet-modal .ps-switch { flex: none; position: relative; width: 2.6rem; height: 1.5rem; border-radius: 9999px; background: #cbd5e1; transition: background-color 0.15s ease; }
.dark #printsheet-modal .ps-switch { background: #334155; }
#printsheet-modal .ps-switch::after { content: ''; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.1rem; height: 1.1rem; border-radius: 9999px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s ease; }
#printsheet-modal .ps-opt input:checked + .ps-switch { background: var(--ps-accent); }
#printsheet-modal .ps-opt input:checked + .ps-switch::after { transform: translateX(1.1rem); }
#printsheet-modal .ps-ot { display: block; font: 700 0.95rem 'Montserrat', sans-serif; }
#printsheet-modal .ps-os { display: block; font: 400 0.9rem 'Source Serif 4', Georgia, serif; color: var(--ps-soft); }
/* Live preview of the real PDF, in the right-hand column (below on narrow screens). */
#printsheet-modal .ps-head, #printsheet-modal .ps-choices, #printsheet-modal .ps-opt, #printsheet-modal .ps-dopts, #printsheet-modal .ps-foot { grid-column: 1; }
/* Each kind shows only its own options (PrintSheet._sync sets [hidden]). */
#printsheet-modal .ps-opt[hidden], #printsheet-modal .ps-dopts[hidden] { display: none; }
/* Diagram options: the annotations switch and "On the bottom: White · Black · Both". */
#printsheet-modal .ps-dopts { display: flex; flex-direction: column; }
#printsheet-modal .ps-dopts .ps-opt { margin-top: 1rem; }
#printsheet-modal .ps-pov { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.8rem; margin-top: 0.6rem; padding: 0.7rem 1rem; border-radius: 1rem; border: 1px dashed var(--ps-line); }
#printsheet-modal .ps-pov .ps-os { flex-basis: 100%; font-size: max(14px, 0.85rem); }
#printsheet-modal .ps-pov .ps-os:empty { display: none; }
#printsheet-modal .ps-seg { display: inline-flex; padding: 0.2rem; border-radius: 0.75rem; background: var(--ps-bg); box-shadow: inset 0 0 0 1px var(--ps-line); }
#printsheet-modal .ps-seg button { padding: 0.35rem 0.9rem; border-radius: 0.55rem; font: 700 0.85rem 'Montserrat', sans-serif; color: var(--ps-soft); transition: all 0.15s ease; }
#printsheet-modal .ps-seg button:hover { color: var(--ps-ink); }
#printsheet-modal .ps-seg button.on { background: var(--ps-accent); color: #fff; box-shadow: 0 2px 6px -2px rgba(37, 99, 235, 0.6); }
#printsheet-modal .ps-preview { grid-column: 2; grid-row: 1 / span 4; position: relative; min-height: 28rem; border-radius: 0.75rem; overflow: hidden; background: #e5e7eb; box-shadow: inset 0 0 0 1px var(--ps-line); }
#printsheet-modal .ps-preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#printsheet-modal .ps-preview-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1rem; text-align: center; background: #e5e7eb; color: #475569; font: italic 400 0.95rem 'Source Serif 4', Georgia, serif; }
#printsheet-modal .ps-preview-msg[hidden] { display: none; }
@media (max-width: 52rem) {
  #printsheet-modal .ps-card { grid-template-columns: minmax(0, 1fr); }
  #printsheet-modal .ps-preview { grid-column: 1; grid-row: auto; min-height: 22rem; margin-top: 1rem; }
}
#printsheet-modal .ps-foot { display: flex; align-items: center; gap: 0.6rem; margin-top: 1.3rem; flex-wrap: wrap; }
#printsheet-modal .ps-note { flex: 1 1 12rem; font: italic 400 0.88rem 'Source Serif 4', Georgia, serif; color: var(--ps-soft); }
#printsheet-modal .ps-btn { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.65rem 1.1rem; border-radius: 0.8rem; font: 700 0.92rem 'Montserrat', sans-serif; transition: all 0.15s ease; }
#printsheet-modal .ps-btn svg { width: 1.05rem; height: 1.05rem; }
#printsheet-modal .ps-ghost { color: var(--ps-ink); background: var(--ps-tile); box-shadow: inset 0 0 0 1px var(--ps-line); }
#printsheet-modal .ps-ghost:hover { box-shadow: inset 0 0 0 1px var(--ps-accent); color: var(--ps-accent); }
#printsheet-modal .ps-primary { color: #fff; background: var(--ps-accent); box-shadow: 0 8px 20px -8px rgba(37, 99, 235, 0.7); }
#printsheet-modal .ps-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
@media print { #printsheet-modal { display: none !important; } }

/* --- Break timer (/break) --------------------------------------------------
   Full-screen overlay: countdown on the left, the knight running KnightTour's
   Minefield drill in the middle, the rules on the right. Sits above every
   modal; Esc or a click ends it (js/features/break.js). */
#break-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(260px, 1.2fr);
  align-items: center; gap: clamp(16px, 3vw, 48px); padding: clamp(16px, 3vw, 48px);
  color: #eef2ff; font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(99, 102, 241, 0.35), transparent 60%),
    radial-gradient(900px 600px at 85% 90%, rgba(16, 185, 129, 0.22), transparent 60%),
    linear-gradient(160deg, #0b1020 0%, #121a33 55%, #0b1020 100%);
  opacity: 0; transition: opacity 0.35s ease; cursor: pointer;
}
#break-overlay.on { opacity: 1; }
#break-overlay .bk-col { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1rem; }
#break-overlay .bk-right { align-items: flex-start; text-align: left; }
#break-overlay .bk-kicker { font-size: clamp(0.8rem, 1.2vw, 1.1rem); letter-spacing: 0.35em; text-transform: uppercase; color: #a5b4fc; font-weight: 800; }
#break-overlay .bk-ring { position: relative; width: clamp(180px, 22vw, 340px); aspect-ratio: 1; }
#break-overlay .bk-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
#break-overlay .bk-ring-track { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 5; }
#break-overlay .bk-ring-fill { fill: none; stroke: #818cf8; stroke-width: 5; stroke-linecap: round;
  filter: drop-shadow(0 0 10px rgba(129, 140, 248, 0.8)); transition: stroke-dashoffset 0.25s linear; }
#break-overlay .bk-clock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: clamp(3rem, 6.5vw, 6.5rem); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
  text-shadow: 0 0 30px rgba(165, 180, 252, 0.6); }
#break-overlay.over .bk-clock { color: #fbbf24; animation: bk-blink 0.8s steps(2) infinite; }
@keyframes bk-blink { to { opacity: 0.35; } }
#break-overlay .bk-sub { font-size: clamp(1rem, 1.4vw, 1.4rem); color: #c7d2fe; max-width: 26ch; font-weight: 600; }
#break-overlay.over .bk-sub { color: #fde68a; font-size: clamp(1.2rem, 1.8vw, 1.9rem); }
#break-overlay .bk-progress { font-size: clamp(0.9rem, 1.1vw, 1.2rem); color: #94a3b8; font-variant-numeric: tabular-nums; }
#break-overlay .bk-progress span { color: #fff; font-weight: 800; }

#break-overlay .bk-board-wrap { display: flex; align-items: center; justify-content: center; }
#break-overlay .bk-board { position: relative; width: min(70vh, 44vw); aspect-ratio: 1; border-radius: 6px;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.12), 0 30px 80px rgba(0,0,0,0.6), 0 0 60px rgba(99,102,241,0.25); }
#break-overlay .bk-squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); border-radius: 6px; overflow: hidden; }
#break-overlay .bk-sq { position: relative; transition: background 0.3s; }
#break-overlay .bk-sq.light { background: #e8edf5; }
#break-overlay .bk-sq.dark { background: #5b6c9a; }
#break-overlay .bk-sq.poison::after { content: ''; position: absolute; inset: 30%; border-radius: 50%;
  background: radial-gradient(circle, rgba(239,68,68,0.9), rgba(239,68,68,0.25) 70%, transparent 72%); }
#break-overlay .bk-sq.done.light { background: #bbf7d0; }
#break-overlay .bk-sq.done.dark { background: #15803d; }
#break-overlay .bk-sq.just { box-shadow: inset 0 0 0 100px rgba(74, 222, 128, 0.55); animation: bk-pop 0.6s ease-out; }
@keyframes bk-pop { from { box-shadow: inset 0 0 0 100px rgba(255,255,255,0.9); } }
#break-overlay .bk-sq.next { box-shadow: inset 0 0 0 100px rgba(59, 130, 246, 0.55); animation: bk-pulse 1s ease-in-out infinite alternate; }
@keyframes bk-pulse { to { box-shadow: inset 0 0 0 100px rgba(96, 165, 250, 0.85); } }
#break-overlay .bk-trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#break-overlay .bk-trail polyline { fill: none; stroke: rgba(250, 204, 21, 0.85); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 1.5px rgba(250, 204, 21, 0.9)); }
#break-overlay .bk-pieces { position: absolute; inset: 0; pointer-events: none; }
#break-overlay .bk-piece { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.45)); }
#break-overlay .bk-knight { transition: transform 0.38s cubic-bezier(0.34, 1.4, 0.64, 1); z-index: 2;
  filter: drop-shadow(0 0 10px rgba(250, 204, 21, 0.9)) drop-shadow(0 4px 6px rgba(0,0,0,0.5)); }
#break-overlay.complete .bk-knight { animation: bk-bounce 0.7s ease-in-out infinite alternate; }
@keyframes bk-bounce { to { filter: drop-shadow(0 0 22px rgba(250, 204, 21, 1)) drop-shadow(0 4px 6px rgba(0,0,0,0.5)); } }
#break-overlay .bk-files, #break-overlay .bk-ranks { position: absolute; display: flex; font-weight: 800; color: #c7d2fe;
  font-size: clamp(0.8rem, 1.3vw, 1.3rem); pointer-events: none; }
#break-overlay .bk-files { left: 0; right: 0; top: calc(100% + 10px); }
#break-overlay .bk-files span { flex: 1; text-align: center; }
#break-overlay .bk-ranks { top: 0; bottom: 0; right: calc(100% + 12px); flex-direction: column; }
#break-overlay .bk-ranks span { flex: 1; display: flex; align-items: center; }

#break-overlay h2 { font-size: clamp(1.6rem, 2.6vw, 2.8rem); font-weight: 900; margin: 0; }
#break-overlay .bk-rules { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 0.75em;
  font-size: clamp(0.95rem, 1.35vw, 1.4rem); line-height: 1.45; color: #e2e8f0; max-width: 34ch; }
#break-overlay .bk-rules b { color: #fff; }
#break-overlay .bk-blue { color: #93c5fd; font-weight: 800; }
#break-overlay .bk-red { color: #fca5a5; font-weight: 800; }
#break-overlay .bk-practice { margin-top: 0.5rem; padding: 0.9em 1.2em; border-radius: 14px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.14);
  font-size: clamp(0.95rem, 1.3vw, 1.35rem); line-height: 1.4; }
#break-overlay .bk-practice b { color: #fde68a; }
#break-overlay .bk-practice span { color: #a5b4fc; font-family: ui-monospace, Menlo, monospace; font-size: 0.85em; }
#break-overlay .bk-hint { font-size: max(14px, 0.85rem); color: #64748b; letter-spacing: 0.1em; text-transform: uppercase; }
/* The break settings under the clock (2026-11-02): length and lesson. Hidden
   until the faint gear in the bottom-left corner (or S) is pressed, so a break
   keeps its minimal look by default. */
#break-overlay:not(.bk-show-choose) .bk-choose { display: none; }
#break-overlay .bk-gear { position: absolute; left: 18px; bottom: 16px; width: 34px; height: 34px; padding: 7px;
  border-radius: 50%; background: transparent; border: 1px solid transparent; color: #94a3b8; opacity: 0.35;
  cursor: pointer; transition: opacity 0.15s, background 0.15s, border-color 0.15s; }
#break-overlay .bk-gear:hover, #break-overlay .bk-gear:focus-visible { opacity: 1; background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); }
#break-overlay .bk-gear[aria-pressed="true"] { opacity: 0.9; color: #c7d2fe; }
#break-overlay .bk-gear svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#break-overlay .bk-choose { display: flex; flex-direction: column; align-items: center; gap: 0.55rem; cursor: default; }
#break-overlay .bk-choose-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem; max-width: 22rem; }
#break-overlay .bk-choose-row:first-child { flex-wrap: nowrap; }
#break-overlay .bk-choose button { font: 700 clamp(0.8rem, 1vw, 1rem)/1 'Montserrat', system-ui, sans-serif; color: #c7d2fe;
  padding: 0.5em 0.7em; border-radius: 999px; white-space: nowrap; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
  cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
#break-overlay .bk-choose button:hover { background: rgba(255,255,255,0.13); color: #fff; }
#break-overlay .bk-choose button[aria-pressed="true"] { background: #818cf8; border-color: #a5b4fc; color: #0b1020; }
#break-overlay .bk-choose-what button { font-size: clamp(0.7rem, 0.85vw, 0.85rem); font-weight: 600; padding: 0.4em 0.7em; }

/* Break lessons (js/features/break-lessons.js): the ring on the left, a stage
   of scenes on the right — a few big words, then boards of different sizes,
   some cropped to a window, with arrows that draw themselves in. Entrance
   animations only; nothing loops, so the overlay is still once a scene lands. */
#break-overlay.bk-lesson { grid-template-columns: minmax(200px, 0.62fr) 2.6fr; }
#break-overlay .bk-stage { display: flex; flex-direction: column; gap: clamp(10px, 2.2vh, 28px); justify-content: center; min-width: 0; height: 100%; }
#break-overlay .bk-scene { display: flex; flex-direction: column; gap: clamp(16px, 4vh, 48px); }
#break-overlay .bk-dots { display: flex; gap: 8px; }
#break-overlay .bk-dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.18); transition: background 0.4s, transform 0.4s; }
#break-overlay .bk-dots i.done { background: #4ade80; }
#break-overlay .bk-dots i.now { background: #a5b4fc; transform: scale(1.35); }
#break-overlay .bl-say { font: 700 clamp(1.9rem, 3.6vw, 3.9rem)/1.1 'Source Serif 4', Georgia, serif; letter-spacing: -0.01em; color: #fff;
  text-shadow: 0 2px 30px rgba(99, 102, 241, 0.45); }
#break-overlay .bl-boards { display: flex; align-items: flex-end; justify-content: center; gap: clamp(18px, 3.2vw, 56px); flex-wrap: wrap; }
#break-overlay .bl-board { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
#break-overlay .bl-board.bl-l { --w: min(52vh, 30vw); }
#break-overlay .bl-board.bl-m { --w: min(36vh, 21vw); }
#break-overlay .bl-board.bl-s { --w: min(23vh, 13.5vw); }
#break-overlay .bl-frame { position: relative; width: var(--w); aspect-ratio: var(--cols) / var(--rows); border-radius: 8px;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12), 0 24px 60px rgba(0,0,0,0.55), 0 0 50px rgba(99,102,241,0.2); }
#break-overlay .bl-crop .bl-frame { border-radius: 16px; box-shadow: 0 0 0 2px rgba(250,204,21,0.55), 0 18px 44px rgba(0,0,0,0.5), 0 0 40px rgba(250,204,21,0.18); }
#break-overlay .bl-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--cols), 1fr); border-radius: inherit; overflow: hidden; }
#break-overlay .bl-sq { position: relative; }
#break-overlay .bl-sq.light { background: #e8edf5; }
#break-overlay .bl-sq.dark { background: #5b6c9a; }
#break-overlay .bl-sq img { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.45)); z-index: 1; }
#break-overlay .bl-sq.zone::before { content: ''; position: absolute; inset: 0; background: rgba(250, 204, 21, 0.3); }
#break-overlay .bl-sq.m-good::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 100px rgba(74, 222, 128, 0.55); }
#break-overlay .bl-sq.m-key::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 4px #facc15, inset 0 0 22px rgba(250, 204, 21, 0.8); }
#break-overlay .bl-sq.m-bad::before { content: ''; position: absolute; inset: 0; background: rgba(239, 68, 68, 0.45); }
#break-overlay .bl-sq.m-bad::after { content: '✕'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 900 calc(var(--w) / var(--cols) * 0.55) system-ui, sans-serif; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.5); z-index: 2; }
#break-overlay .bl-sq.m-ghost::after { content: ''; position: absolute; inset: 22%; border-radius: 50%; border: 3px dashed rgba(15, 23, 42, 0.55); }
#break-overlay .bl-arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; overflow: visible; }
#break-overlay .bl-arrows line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: bl-draw 0.7s ease-out forwards;
  filter: drop-shadow(0 0 0.06px rgba(0,0,0,0.8)); opacity: 0.95; }
@keyframes bl-draw { to { stroke-dashoffset: 0; } }
#break-overlay .bl-board figcaption { font-size: clamp(0.9rem, 1.25vw, 1.35rem); font-weight: 700; color: #c7d2fe; letter-spacing: 0.02em; text-align: center; max-width: var(--w); }
#break-overlay .bk-scene.in .bl-say { animation: bl-rise 0.6s ease-out both; }
#break-overlay .bk-scene.in .bl-board { animation: bl-rise 0.75s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes bl-rise { from { opacity: 0; transform: translateY(18px) scale(0.97); } }
#break-overlay.bk-replay .bk-scene { gap: clamp(12px, 2vh, 24px); }
#break-overlay.bk-replay .bk-stage { text-align: center; }
#break-overlay.bk-replay .bk-scene.in :is(.bl-say, .bl-board) { animation: none; }
#break-overlay.bk-replay .bl-board.bl-l { --w: min(58vh, 50vw); }
#break-overlay.bk-replay figcaption { min-height: 3em; }
@media (max-width: 900px) {
  #break-overlay.bk-replay .bk-ring { width: clamp(100px, 25vw, 180px); }
  #break-overlay.bk-replay .bl-board.bl-l { --w: min(78vw, 45vh); }
}
/* Lesson mates (the default break): one puzzle at a time, answer hidden until
   A — the arrow draws itself in when shown, the SAN keeps its space when not. */
#break-overlay.bk-mates .bk-scene { gap: clamp(10px, 2.4vh, 30px); align-items: center; }
#break-overlay.bk-mates .bk-stage > .bk-kicker { text-align: center; }
#break-overlay .bk-mate-n { font-size: clamp(1.2rem, 2vw, 2.1rem); font-weight: 800; color: #fde68a; letter-spacing: 0.04em; margin-top: calc(-1 * clamp(4px, 1.2vh, 16px)); }
#break-overlay .bk-mate-ans { font: 800 clamp(1.4rem, 2.4vw, 2.6rem)/1 ui-monospace, Menlo, monospace; color: #4ade80; visibility: hidden; }
#break-overlay .bk-scene.bk-show-answer .bk-mate-ans { visibility: visible; animation: bl-rise 0.4s ease-out both; }
#break-overlay.bk-mates .bk-scene:not(.bk-show-answer) .bl-arrows line { display: none; }
#break-overlay.bk-mates .bl-arrows line { animation-delay: 0s !important; }
#break-overlay.bk-mates .bl-board.bl-l { --w: min(58vh, 34vw); }
@media (max-width: 900px) {
  #break-overlay.bk-lesson { grid-template-columns: 1fr; }
  #break-overlay .bl-board.bl-l, #break-overlay.bk-mates .bl-board.bl-l { --w: min(70vw, 44vh); }
  #break-overlay .bl-board.bl-m { --w: min(46vw, 30vh); }
  #break-overlay .bl-board.bl-s { --w: min(30vw, 20vh); }
}
@media (max-width: 900px) {
  #break-overlay { grid-template-columns: 1fr; grid-template-rows: auto auto auto; overflow-y: auto; align-content: start; }
  #break-overlay .bk-board { width: min(80vw, 50vh); margin: 24px auto 32px; }
  #break-overlay .bk-right { align-items: center; text-align: center; }
}

@media (max-height: 540px) and (orientation: landscape) {
  #break-overlay.bk-lesson.bk-replay { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); grid-template-rows: auto; align-content: center; }
  #break-overlay.bk-replay .bk-col { gap: 0.55rem; }
  #break-overlay.bk-replay .bk-ring { width: min(28vh, 180px); }
  #break-overlay.bk-replay .bl-board.bl-l { --w: min(57vh, 44vw); }
}

/* Class Room reactions (js/core/reactions.js): a student's thumbs-up, smile or
   heart floats up over the teaching board with their nickname. --s grows with
   how much they have answered. One short animation each, then it is removed. */
.class-react { position: fixed; z-index: 590; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px;
  transform: translate(-50%, 0); animation: class-react-rise 3s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.class-react-icon { width: calc(3.4rem * var(--s, 1)); height: calc(3.4rem * var(--s, 1)); color: var(--c); stroke-width: 2.2;
  filter: drop-shadow(0 0 14px var(--c)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45)); }
.class-react span { font: 800 0.85rem 'Montserrat', system-ui, sans-serif; color: #fff; background: rgba(15, 23, 42, 0.75);
  padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
@keyframes class-react-rise {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(0.5); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
  25% { transform: translate(-50%, -30px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -260px) scale(0.95); }
}
/* A student just earned a new reaction: gold ring, slower rise, and the
   caption says so ("Tiger 42 unlocked the Flame") so the class hears it. */
.class-react.unlock { animation-duration: 4.5s; }
.class-react.unlock .class-react-icon { filter: drop-shadow(0 0 18px #fde047) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45)); }
.class-react.unlock span { background: linear-gradient(90deg, #b45309, #f59e0b); box-shadow: 0 0 0 2px #fde047; }
/* Podium medals in the dock: 1 2 3 on gold / silver / bronze discs (no emoji). */
.class-medal { display: inline-flex; width: 1.35rem; height: 1.35rem; border-radius: 50%; align-items: center; justify-content: center;
  font: 900 max(14px, 0.7rem) 'Montserrat', system-ui, sans-serif; color: #1e2430; }
.class-medal.m1 { background: #fcd34d; } .class-medal.m2 { background: #cbd5e1; } .class-medal.m3 { background: #d6a46a; }

/* /stats (js/features/statspanel.js): the Settings usage dashboard, moved into
   its own panel and set in bigger type. Scoped to .stats-big, which is only on
   while the panel is open, so the Settings copy is untouched. */
#feature-usage-stats.stats-big { margin: 0; padding: 0; background: transparent; border: 0; gap: 1.5rem; }
#feature-usage-stats.stats-big > .grid:first-child { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.75rem; }
#feature-usage-stats.stats-big > .grid:first-child > div { padding: 1rem 0.5rem; border: 1px solid rgba(148, 163, 184, 0.2); }
#feature-usage-stats.stats-big > .grid:first-child > div > div:first-child { font-size: 2rem; line-height: 1.1; }
#feature-usage-stats.stats-big > .grid:first-child > div > div:last-child { font-size: max(14px, 0.7rem); }
#feature-usage-stats.stats-big .text-xs { font-size: 0.95rem; }
#feature-usage-stats.stats-big .text-\[11px\] { font-size: max(14px, 0.85rem); }
#feature-usage-stats.stats-big #stats-recent { max-height: 16rem; }
@media (max-width: 700px) { #feature-usage-stats.stats-big > .grid:first-child { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* /stats game stats (js/features/gamestats.js): White and Black side by side,
   numbers big enough for the back row; tap a number for the moves. */
#gamestats-body .gs-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0.6rem 1rem; align-items: center; }
#gamestats-body .gs-side { text-align: center; font: 800 1.05rem 'Montserrat', system-ui, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: #64748b; }
#gamestats-body .gs-name { font-size: 0.95rem; letter-spacing: 0; text-transform: none; color: #0f172a; margin-top: 2px; }
.dark #gamestats-body .gs-name { color: #f1f5f9; }
#gamestats-body .gs-dot { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 50%; margin-right: 0.4rem; vertical-align: -1px; border: 2px solid #64748b; }
#gamestats-body .gs-w { background: #fff; }
#gamestats-body .gs-b { background: #0f172a; }
#gamestats-body .gs-label { font-weight: 700; font-size: 1.1rem; color: #0f172a; padding: 0.6rem 0; border-top: 1px solid rgba(148, 163, 184, 0.25); }
.dark #gamestats-body .gs-label { color: #f1f5f9; }
#gamestats-body .gs-help { font-weight: 500; font-size: max(14px, 0.8rem); color: #94a3b8; margin-top: 2px; }
#gamestats-body .gs-num { font: 800 2.4rem/1 'Montserrat', system-ui, sans-serif; padding: 0.7rem 0; border-radius: 14px; color: #0f172a;
  background: rgba(148, 163, 184, 0.1); border: 1px solid rgba(148, 163, 184, 0.2); transition: background 0.15s; }
.dark #gamestats-body .gs-num { color: #f8fafc; }
#gamestats-body .gs-num:hover { background: rgba(59, 130, 246, 0.12); }
#gamestats-body .gs-num small { font-size: 0.5em; color: #94a3b8; }
#gamestats-body .gs-num.gs-bad { color: #ef4444; }
#gamestats-body .gs-num.gs-good { color: #22c55e; }
#gamestats-body .gs-pct { font-size: max(14px, 0.85rem); font-weight: 700; color: #3b82f6; margin-top: 4px; }
#gamestats-body .gs-list { display: contents; }
#gamestats-body .gs-list > div { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; padding-bottom: 0.4rem; }
#gamestats-body .gs-move { font: 600 0.95rem 'Source Serif 4', Georgia, serif; padding: 0.2rem 0.55rem; border-radius: 8px; background: rgba(59, 130, 246, 0.12); color: inherit; }
#gamestats-body .gs-move:hover { background: rgba(59, 130, 246, 0.3); }
#gamestats-body .gs-none { font-size: max(14px, 0.85rem); color: #94a3b8; font-style: italic; }
#gamestats-body .gs-progress { margin-top: 1.25rem; font-size: max(14px, 0.85rem); color: #64748b; }
#gamestats-body .gs-bar { height: 6px; border-radius: 99px; background: rgba(148, 163, 184, 0.2); overflow: hidden; margin-bottom: 0.4rem; }
#gamestats-body .gs-bar span { display: block; height: 100%; background: #3b82f6; transition: width 0.3s; }
#gamestats-body .gs-empty { color: #64748b; }


/* ===== GLOBE INTRO (js/features/globe.js) ===== */
#globe-intro {
  position: fixed; inset: 0; z-index: 2100; cursor: pointer;
  background: radial-gradient(ellipse at 50% 40%, #0b1a33 0%, #050a16 55%, #000 100%);
  opacity: 0; visibility: hidden; transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}
#globe-intro.show { opacity: 1; visibility: visible; transition: opacity 0.45s ease, visibility 0s; }
#globe-intro .gi3-stars {
  position: absolute; inset: 0; opacity: 0.7; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 33% 72%, #cfe3ff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 64%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 88%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 90%, #cfe3ff 50%, transparent 51%),
    radial-gradient(1px 1px at 94% 34%, #fff 50%, transparent 51%);
  background-size: 420px 420px;
}
#globe-intro .gi3-earth { position: absolute; inset: 0; }
#globe-intro.no-earth .gi3-earth { display: none; }
#globe-intro .gi3-card {
  position: absolute; left: 50%; bottom: 7vh; display: flex; align-items: center; gap: 1.4rem;
  padding: 1.1rem 1.8rem 1.1rem 1.1rem; border-radius: 18px; width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box;
  /* No backdrop-filter: blurring a moving WebGL scene re-blurs every frame. */
  background: rgba(8, 16, 34, 0.86); border: 1px solid rgba(255, 224, 138, 0.35);
  box-shadow: 0 18px 50px rgba(0,0,0,0.55), 0 0 40px rgba(255, 205, 60, 0.15);
  opacity: 0; transform: translate(-50%, 40px) scale(0.92);
  transition: opacity 0.5s ease, transform 0.7s cubic-bezier(.2,1.4,.4,1);
  color: #fff; pointer-events: none;
}
#globe-intro.no-earth .gi3-card { bottom: 50%; transform: translate(-50%, 50%) scale(0.92); }
#globe-intro.flag-in .gi3-card { opacity: 1; transform: translate(-50%, 0) scale(1); }
#globe-intro.no-earth.flag-in .gi3-card { transform: translate(-50%, 50%) scale(1); }
#globe-intro .gi3-flagwrap { perspective: 600px; flex: none; }
#globe-intro .gi3-flag {
  display: block; width: clamp(120px, 16vw, 220px); aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 6px; box-shadow: 0 6px 22px rgba(0,0,0,0.5);
  transform-origin: left center; transform: rotateY(80deg);
}
#globe-intro.flag-in .gi3-flag { animation: gi3-unfurl 0.9s 0.15s cubic-bezier(.2,1.3,.4,1) forwards, gi3-wave 3.2s 1.1s ease-in-out infinite; }
@keyframes gi3-unfurl { to { transform: rotateY(0deg); } }
@keyframes gi3-wave {
  0%, 100% { transform: rotateY(0deg) skewY(0deg); }
  50%      { transform: rotateY(-10deg) skewY(-1.5deg); }
}
#globe-intro .gi3-text { min-width: 0; }
#globe-intro .gi3-place { font-size: clamp(1rem, 2.2vw, 1.5rem); color: #ffe08a; font-weight: 600; letter-spacing: 0.02em; }
#globe-intro .gi3-place:empty { display: none; }
#globe-intro .gi3-country { font-size: clamp(1.6rem, 4.4vw, 3.2rem); font-weight: 800; line-height: 1.05; text-shadow: 0 2px 12px rgba(0,0,0,0.6); }
#globe-intro .gi3-today { display: block; font-size: 0.4em; font-weight: 500; color: #cbd5e1; margin-top: 0.2em; }
#globe-intro .gi3-sub { font-size: clamp(0.85rem, 1.6vw, 1.05rem); color: #cbd5e1; margin-top: 0.35rem; }
#globe-intro .gi3-sub:empty { display: none; }
#globe-intro .gi3-hint { position: absolute; top: 14px; right: 18px; font-size: max(14px, 0.75rem); color: rgba(255,255,255,0.45); pointer-events: none; }
@media (max-width: 600px) {
  #globe-intro .gi3-card { flex-direction: column; text-align: center; gap: 0.8rem; padding: 1rem; width: calc(100vw - 32px); }
  #globe-intro .gi3-flag { transform-origin: center; }
}
@media (prefers-reduced-motion: reduce) {
  #globe-intro .gi3-card, #globe-intro .gi3-flag { transition: none; animation: none !important; transform: none; }
  #globe-intro.flag-in .gi3-card { transform: translate(-50%, 0); }
}

/* ============ DAYTIME COMFORT (light mode only) ============ */
/* Jeff, 2026-10-13: "make daytime mode easier on the eyes". Light mode was pure
   white panels on a sky/violet/pink pastel wash, which glares on a laptop at
   full brightness and on a projector. Same layout and the same chessotron
   character (glass panel, soft diagonal wash), but on warm paper:
     - the wash keeps its three hues, desaturated to near-gray;
     - panels and white surfaces are off-white (#faf9f6), never #fff;
     - hairline borders are a warm gray instead of cool slate.
   Text colors are untouched: slate-800 on #faf9f6 is about 14:1, and the
   lightest text in use (slate-400 move numbers) stays where it was.
   Board squares are the board theme's business and are not touched here.
   Scoped to html:not(.dark), so dark mode is byte-for-byte what it was. */
html:not(.dark) body.gradient-bg-on { background: #e9e7e2 !important; }
html:not(.dark) body.gradient-bg-on::after {
    background: linear-gradient(-45deg, #e4e7ea, #e7e4ea, #ece6e2, #e4e7ea);
}
html:not(.dark) body.glassmorphism-on #analysis-panel,
html:not(.dark) body.glassmorphism-on #right-panel {
    background-color: rgba(250, 249, 246, 0.62) !important;
    border-color: rgba(72, 62, 48, 0.10) !important;
}
html:not(.dark) body.lite-fx-on .glass-panel,
html:not(.dark) body.lite-fx-on.glassmorphism-on #right-panel { background-color: rgba(250, 249, 246, 0.95) !important; }
html:not(.dark) body.lite-fx-on.glassmorphism-on #analysis-panel { background-color: transparent !important; }
html:not(.dark) .bg-white   { background-color: #faf9f6; }
html:not(.dark) .bg-slate-50 { background-color: #f3f2ee; }
html:not(.dark) .bg-slate-100,
html:not(.dark) body.bg-slate-100 { background-color: #ebe9e4; }
html:not(.dark) .border-slate-100 { border-color: #e7e4de; }
html:not(.dark) .border-slate-200 { border-color: #dcd9d2; }
html:not(.dark) .border-slate-300 { border-color: #cfcbc3; }

/* ---- SETTINGS HELP (js/features/settings-help.js) ------------------------
   A small round "?" at the end of a confusing setting's row; it opens a plain-
   words card over the Settings window. Esc or a click outside closes the card. */
#settings-modal .setting-help {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 1.25rem; height: 1.25rem; margin-left: 0.4rem; border-radius: 9999px;
  font: 700 max(14px, 0.72rem)/1 'Montserrat', sans-serif; color: #64748b; background: transparent;
  border: 1.5px solid #cbd5e1; cursor: pointer; transition: all 0.15s ease;
}
#settings-modal .setting-help:hover { color: #2563eb; border-color: #2563eb; background: rgba(37, 99, 235, 0.08); }
.dark #settings-modal .setting-help { color: #94a3b8; border-color: #475569; }
.dark #settings-modal .setting-help:hover { color: #60a5fa; border-color: #60a5fa; }
#settings-help-card {
  position: fixed; z-index: 420; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(26rem, calc(100vw - 2rem)); max-height: calc(100vh - 4rem); overflow-y: auto;
  padding: 1.1rem 1.25rem 1.2rem; border-radius: 1rem; background: #ffffff; color: #0f172a;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(15, 23, 42, 0.08);
}
#settings-help-card[hidden] { display: none; }
.dark #settings-help-card { background: #1b1e26; color: #e2e8f0; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08); }
#settings-help-card .shc-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }
#settings-help-card h3 { font: 800 1.05rem/1.25 'Montserrat', sans-serif; }
#settings-help-card .shc-x { padding: 0.2rem 0.45rem; border-radius: 0.4rem; color: #94a3b8; }
#settings-help-card .shc-x:hover { background: rgba(148, 163, 184, 0.15); color: inherit; }
#settings-help-card .shc-body { font: 400 0.92rem/1.5 'Source Serif 4', Georgia, serif; }
#settings-help-card .shc-body p { margin: 0.45rem 0; }
#settings-help-card .shc-body ul { margin: 0.3rem 0 0.5rem; padding-left: 1.1rem; list-style: disc; }
#settings-help-card .shc-body li { margin: 0.2rem 0; }
#settings-help-card .shc-body b { font-weight: 700; }

/* ---- /3lives (js/features/threelives.js) ---------------------------------
   Three pawns stacked up the board's LEFT edge from its bottom corner, outside
   the board. A lost life: a red X draws over the pawn, it flips upside down and
   tumbles off the bottom of the screen (the motion is WAAPI in the module). */
#three-lives { position: fixed; z-index: 60; display: flex; flex-direction: column-reverse; gap: 0.35rem; pointer-events: auto; }
#three-lives[hidden] { display: none; }
#three-lives .tl-slot { position: relative; width: var(--tl-size, 48px); height: var(--tl-size, 48px); padding: 0; border: 0; background: transparent; cursor: default; }
#three-lives .tl-slot::before { content: ''; position: absolute; inset: 8%; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,0.16), rgba(255,255,255,0.02) 70%);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.18); }
html:not(.dark) #three-lives .tl-slot::before { background: radial-gradient(circle at 50% 40%, rgba(15,23,42,0.08), rgba(15,23,42,0.01) 70%); box-shadow: inset 0 0 0 1.5px rgba(15,23,42,0.15); }
#three-lives .tl-pawn { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.45)); transform-origin: 50% 55%; }
#three-lives .tl-x { position: absolute; inset: 6%; width: 88%; height: 88%; overflow: visible; pointer-events: none; }
#three-lives .tl-x path { fill: none; stroke: #ef4444; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 64; stroke-dashoffset: 64;
  filter: drop-shadow(0 0 4px rgba(239,68,68,0.8)); }
#three-lives .tl-lost .tl-x path { animation: tl-x 0.45s ease-out forwards, tl-x-out 0.4s ease-in 0.8s forwards; }
@keyframes tl-x { to { stroke-dashoffset: 0; } }
@keyframes tl-x-out { to { opacity: 0; } }
#three-lives .tl-gone { cursor: pointer; }
#three-lives .tl-gone::before { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.12); background: none; border: 1.5px dashed rgba(148,163,184,0.45); }
#three-lives .tl-gone:hover::before { border-color: #60a5fa; }
@media print { #three-lives { display: none !important; } }

/* ---- Scoresheet spacing (2026-10-13, Jeff: "pristine and beautiful") ------
   One centred reading column for the names, the moves and the result, so on a
   wide panel White and Black don't drift a screen apart. The list fades at its
   top and bottom edges instead of slicing a row in half, and scroll-padding
   keeps the current move clear of both edges. */
body.phone-mode.scoresheet-mode #scoresheet-panel { --ss-col: 26rem; }
body.phone-mode.scoresheet-mode.scoresheet-huge #scoresheet-panel { --ss-col: 34rem; }
#scoresheet-panel .ss-head,
#scoresheet-panel .ss-table,
#scoresheet-panel .ss-result { width: 100%; max-width: var(--ss-col, 30rem); margin-inline: auto; }
#scoresheet-panel .ss-head { padding: 1.4rem 1rem 1rem 1.25rem; border-bottom: 1px solid var(--ss-rule); }
#scoresheet-panel .ss-players { column-gap: 0.75rem; row-gap: 0.2rem; }
#scoresheet-panel .ss-vs { padding: 0 0.1rem; }
#scoresheet-panel .ss-meta { margin-top: 0.4rem; letter-spacing: 0.01em; }
#scoresheet-panel .ss-body {
  padding: 0.9rem 1rem 1.25rem;
  scroll-padding-block: 2.75rem;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.1rem, #000 calc(100% - 1.6rem), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 1.1rem, #000 calc(100% - 1.6rem), transparent 100%);
}
#scoresheet-panel .ss-num { width: 3.6rem; padding-right: 1.1rem !important; }
body.scoresheet-huge #scoresheet-panel .ss-num { width: 4.8rem; padding-right: 1.4rem !important; }
#scoresheet-panel .ss-mv { padding-left: 0.65rem !important; }
#scoresheet-panel .ss-result { padding: 0.8rem 1.25rem 0.9rem; }
body.scoresheet-huge #scoresheet-panel .ss-players { font-size: clamp(1.15rem, 1.75vw, 1.75rem); }

/* ---- Board-only button (#view-toggle-btn, top-left corner) -----------------
   Invisible until the mouse is over it (Jeff, 2026-10-14). It still sits in the
   same spot and still answers a click, Shift+Tab and /maximize. Only on devices
   with a real mouse: an iPad has no hover, so there it stays visible. */
@media (hover: hover) {
  #view-toggle-btn, #fullscreen-btn { opacity: 0; transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease; }
  #view-toggle-btn:hover, #view-toggle-btn:focus-visible,
  #fullscreen-btn:hover, #fullscreen-btn:focus-visible { opacity: 1; }
}

/* ---- XP (js/ui/keyboard.js XpTally / showXpFloat) -------------------------
   The score sits in the top-right corner of the header; the award is a gold SVG
   star gem with "+1 XP" that pops in over the board and flies up to it. */
#xp-tally { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.95rem 0.3rem 0.45rem;
  border-radius: 9999px; background: linear-gradient(180deg, #2b2416 0%, #14110b 100%);
  box-shadow: 0 0 0 1.5px rgba(251,191,36,0.8), 0 0 18px rgba(251,191,36,0.35), 0 6px 16px -6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,236,170,0.25);
  font: 900 1.15rem/1 'Montserrat', sans-serif; color: #fcd34d; white-space: nowrap; user-select: none; transform-origin: 80% 50%; }
/* a slow glint that sweeps across the pill every few seconds */
#xp-tally::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255,246,200,0.45) 50%, transparent 65%);
  transform: translateX(-120%); animation: xp-glint 4.5s ease-in-out infinite; }
@keyframes xp-glint { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
#xp-tally .xp-tally-star { width: 1.7rem; height: 1.7rem; filter: drop-shadow(0 0 6px rgba(251,191,36,0.7)) drop-shadow(0 1px 1.5px rgba(146,64,14,0.6));
  animation: xp-star-spin 6s ease-in-out infinite; }
@keyframes xp-star-spin { 0%, 85% { transform: rotate(0deg) scale(1); } 92% { transform: rotate(-12deg) scale(1.12); } 100% { transform: rotate(0deg) scale(1); } }
#xp-tally .xp-tally-n { font-weight: 900; font-variant-numeric: tabular-nums;
  color: transparent; background: linear-gradient(180deg, #fff7d6 0%, #fcd34d 45%, #f59e0b 100%); -webkit-background-clip: text; background-clip: text; }
#xp-tally .xp-tally-u { font-weight: 800; font-size: max(14px, 0.72rem); letter-spacing: 0.1em; color: #fbbf24; opacity: 0.85; }
@media (prefers-reduced-motion: reduce) { #xp-tally::after, #xp-tally .xp-tally-star { animation: none; } }
.xp-award { position: absolute; z-index: 70; display: flex; align-items: center; gap: 0.35rem; pointer-events: none; user-select: none;
  transform: translate(-50%, -50%); opacity: 0; }
.xp-award .xp-award-star { width: clamp(2.6rem, 5vmin, 4rem); height: clamp(2.6rem, 5vmin, 4rem);
  filter: drop-shadow(0 6px 10px rgba(120,53,15,0.45)) drop-shadow(0 0 14px rgba(251,191,36,0.55)); }
.xp-award .xp-award-txt { display: flex; align-items: baseline; gap: 0.15rem; font-family: 'Montserrat', sans-serif; line-height: 1;
  color: transparent; background: linear-gradient(180deg, #fff7d6 0%, #fcd34d 40%, #d97706 100%); -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.45)); }
.xp-award .xp-award-txt b { font-weight: 900; font-size: clamp(2rem, 4.2vmin, 3.2rem); }
.xp-award .xp-award-txt i { font-style: normal; font-weight: 800; font-size: clamp(1rem, 2vmin, 1.5rem); letter-spacing: 0.06em; }
.xp-award .xp-burst { position: absolute; left: clamp(1.3rem, 2.5vmin, 2rem); top: 50%; width: 1px; height: 1px; }
.xp-award .xp-burst::before { content: ''; position: absolute; left: -3.2rem; top: -3.2rem; width: 6.4rem; height: 6.4rem; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 8deg, rgba(253,230,138,0.9) 8deg 12deg, transparent 12deg 45deg, rgba(253,230,138,0.9) 45deg 49deg, transparent 49deg 90deg,
    rgba(253,230,138,0.9) 90deg 94deg, transparent 94deg 135deg, rgba(253,230,138,0.9) 135deg 139deg, transparent 139deg 180deg, rgba(253,230,138,0.9) 180deg 184deg,
    transparent 184deg 225deg, rgba(253,230,138,0.9) 225deg 229deg, transparent 229deg 270deg, rgba(253,230,138,0.9) 270deg 274deg, transparent 274deg 315deg,
    rgba(253,230,138,0.9) 315deg 319deg, transparent 319deg 360deg);
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 40%, #000 62%, transparent 64%); mask: radial-gradient(circle, transparent 38%, #000 40%, #000 62%, transparent 64%);
  animation: xp-burst 0.6s ease-out forwards; }
@keyframes xp-burst { from { transform: scale(0.3) rotate(0deg); opacity: 1; } to { transform: scale(1.5) rotate(25deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .xp-award { opacity: 1; } .xp-award .xp-burst::before { animation: none; display: none; } }
/* the award sits on a dark glass pill so the gold reads on any board colour */
.xp-award { padding: 0.3rem 1rem 0.3rem 0.4rem; border-radius: 9999px;
  background: linear-gradient(180deg, rgba(30,27,20,0.88), rgba(12,12,16,0.88));
  box-shadow: 0 0 0 1.5px rgba(251,191,36,0.75), 0 10px 28px -8px rgba(0,0,0,0.65), 0 0 22px rgba(251,191,36,0.35); }
.xp-award .xp-award-star { width: clamp(3rem, 5.5vmin, 4.4rem); height: clamp(3rem, 5.5vmin, 4.4rem); }

/* ---- XP, Ink look (the default since 2026-10-14) ----------------------------
   Black and white with a hint of blue, after PandaRepo's e-ink style: paper,
   a hairline ink border, a mono "XP" label, and the star in one flat blue.
   No glow, no glint, no gradient. html.xp-gold (Settings → Graphics → XP look →
   Gold) turns all of this off and the gold rules above take over again. The
   star's SVG still carries the gold gradient; CSS fill beats the attribute. */
html:not(.xp-gold) { --xp-paper: #f6f5f2; --xp-ink: #14130f; --xp-ink-3: #8a8781; --xp-blue: #2f5fd0; --xp-blue-soft: rgba(47,95,208,0.14); }
html.dark:not(.xp-gold) { --xp-paper: #171716; --xp-ink: #eceae5; --xp-ink-3: #8a8781; --xp-blue: #7aa2f7; --xp-blue-soft: rgba(122,162,247,0.18); }
html:not(.xp-gold) #xp-tally, html:not(.xp-gold) .gfx-xp, html:not(.xp-gold) .xp-award {
  background: var(--xp-paper); border-radius: 3px; box-shadow: 0 0 0 1px var(--xp-ink); color: var(--xp-ink); }
html:not(.xp-gold) #xp-tally { padding: 0.3rem 0.75rem 0.3rem 0.45rem; gap: 0.45rem; }
html:not(.xp-gold) #xp-tally::after { display: none; }
html:not(.xp-gold) .xp-tally-star, html:not(.xp-gold) .xp-award-star { filter: none !important; animation: none !important; }
html:not(.xp-gold) .xp-tally-star path:first-child, html:not(.xp-gold) .xp-award-star path:first-child { fill: var(--xp-blue); stroke: var(--xp-ink); stroke-width: 1.1; }
html:not(.xp-gold) .xp-tally-star path + path, html:not(.xp-gold) .xp-award-star path + path { display: none; }
html:not(.xp-gold) .xp-tally-n, html:not(.xp-gold) .xp-award-txt { color: var(--xp-ink) !important; background: none !important; filter: none !important; }
html:not(.xp-gold) .xp-tally-n { font-weight: 800; letter-spacing: -0.02em; }
html:not(.xp-gold) .xp-tally-u, html:not(.xp-gold) .xp-award-txt i {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: 0.1em;
  color: var(--xp-ink-3) !important; opacity: 1; }
html:not(.xp-gold) #xp-tally .xp-tally-u { font-size: max(14px, 0.66rem); padding-left: 0.45rem; border-left: 1px solid var(--xp-ink-3); }
html:not(.xp-gold) .xp-award { padding: 0.35rem 1rem 0.35rem 0.45rem; box-shadow: 0 0 0 1.5px var(--xp-ink), 0 0 0 6px var(--xp-blue-soft); }
html:not(.xp-gold) .xp-award .xp-burst::before { background: repeating-conic-gradient(from 8deg, var(--xp-blue) 0 4deg, transparent 4deg 45deg); }

/* ---- Board frame (js/features/boardframe.js) -------------------------------
   The chosen frame colour, in the normal state only: side lines (variation-mode),
   High Contrast, Black & White and the Studio / Front Row looks keep their own
   frames on purpose. */
html:not(.bw-mode):not([data-look]) body:not(.variation-mode):not(.camp-high-contrast) #board-surface {
  border-color: var(--board-frame, #1c2130) !important;
}

/* ---- Library grid (js/features/librarygrid.js) ----------------------------
   The Game Library as a wall of games: lecture games first, then this library.
   Cards = a small board + players + event/year + result; Up next bar at the
   bottom. Light and dark both. */
#library-grid { position: fixed; inset: 0; z-index: 420; display: flex; flex-direction: column;
  --lg-bg: #f6f5f1; --lg-card: #ffffff; --lg-ink: #0f172a; --lg-soft: #64748b; --lg-line: rgba(15,23,42,0.08); --lg-accent: #2563eb;
  background: var(--lg-bg); color: var(--lg-ink); }
.dark #library-grid { --lg-bg: #0f1218; --lg-card: #171b24; --lg-ink: #e2e8f0; --lg-soft: #94a3b8; --lg-line: rgba(255,255,255,0.07); --lg-accent: #60a5fa; }
#library-grid[hidden] { display: none; }
#library-grid .lg-head { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.5rem; border-bottom: 1px solid var(--lg-line); }
#library-grid .lg-title { font: 800 1.35rem 'Montserrat', sans-serif; margin-right: 0.5rem; white-space: nowrap; }
#library-grid .lg-search { flex: 1; max-width: 32rem; padding: 0.55rem 0.9rem; border-radius: 0.75rem; border: 1px solid var(--lg-line);
  background: var(--lg-card); color: var(--lg-ink); font: 500 0.95rem 'Montserrat', sans-serif; outline: none; }
#library-grid .lg-search:focus { border-color: var(--lg-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
#library-grid .lg-link { padding: 0.45rem 0.8rem; border-radius: 0.6rem; font: 700 0.82rem 'Montserrat', sans-serif; color: var(--lg-soft); }
#library-grid .lg-link:hover { color: var(--lg-accent); background: rgba(37,99,235,0.08); }
#library-grid .lg-x { margin-left: auto; padding: 0.4rem 0.6rem; border-radius: 0.5rem; color: var(--lg-soft); font-size: 1.1rem; }
#library-grid .lg-x:hover { background: var(--lg-line); color: var(--lg-ink); }
#library-grid .lg-body { flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem 7rem; }
#library-grid .lg-sec + .lg-sec { margin-top: 2rem; }
#library-grid .lg-sec h2 { font: 800 0.8rem 'Montserrat', sans-serif; letter-spacing: 0.18em; text-transform: uppercase; color: var(--lg-soft); margin-bottom: 0.9rem; }
#library-grid .lg-sec h2 span { margin-left: 0.4rem; font-weight: 700; opacity: 0.7; letter-spacing: 0; }
#library-grid .lg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 1rem; }
#library-grid .lg-card { position: relative; display: flex; flex-direction: column; border-radius: 0.9rem; overflow: hidden; cursor: pointer;
  background: var(--lg-card); box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 1px var(--lg-line); transition: transform 0.15s ease, box-shadow 0.15s ease; }
#library-grid .lg-card:hover, #library-grid .lg-card:focus-visible { transform: translateY(-2px); box-shadow: 0 12px 28px -12px rgba(0,0,0,0.35), 0 0 0 1px var(--lg-accent); outline: none; }
#library-grid .lg-lecture { box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 1.5px rgba(245,158,11,0.55); }
#library-grid .lg-lecture::before { content: 'LECTURE'; position: absolute; z-index: 2; top: 0.5rem; left: 0.5rem; padding: 0.15rem 0.45rem; border-radius: 0.35rem;
  font: 800 max(14px, 0.6rem) 'Montserrat', sans-serif; letter-spacing: 0.14em; color: #78350f; background: linear-gradient(180deg, #fde68a, #fbbf24); box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
#library-grid .lg-thumb { aspect-ratio: 1; background: var(--lg-line); }
#library-grid .lg-board { display: block; width: 100%; height: 100%; }
#library-grid .lg-meta { padding: 0.6rem 0.75rem 0.4rem; min-width: 0; }
#library-grid .lg-players { display: flex; flex-wrap: wrap; gap: 0 0.3rem; font: 700 0.86rem/1.25 'Montserrat', sans-serif; }
#library-grid .lg-vs { color: var(--lg-soft); font-weight: 600; }
#library-grid .lg-sub { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-top: 0.2rem;
  font: 400 0.82rem 'Source Serif 4', Georgia, serif; color: var(--lg-soft); }
#library-grid .lg-res { font: 800 0.8rem 'Montserrat', sans-serif; color: var(--lg-ink); white-space: nowrap; }
#library-grid .lg-q { margin: 0 0.75rem 0.7rem; align-self: flex-start; padding: 0.3rem 0.65rem; border-radius: 9999px;
  font: 700 max(14px, 0.75rem) 'Montserrat', sans-serif; color: var(--lg-accent); box-shadow: inset 0 0 0 1px rgba(37,99,235,0.35); }
#library-grid .lg-q:hover { background: rgba(37,99,235,0.08); }
#library-grid .lg-q.on { color: #059669; box-shadow: inset 0 0 0 1px rgba(5,150,105,0.4); }
#library-grid .lg-note { margin: -0.25rem 0 1rem; font: 400 0.95rem 'Source Serif 4', Georgia, serif; color: var(--lg-soft); }
#library-grid .lg-err { color: #b91c1c; }
#library-grid .lg-btn { margin-left: 0.4rem; padding: 0.4rem 0.85rem; border-radius: 0.6rem; font: 700 0.82rem 'Montserrat', sans-serif;
  color: #fff; background: var(--lg-accent); }
#library-grid .lg-more { display: block; margin: 1.25rem auto 0; }
#library-grid .lg-empty { grid-column: 1 / -1; color: var(--lg-soft); font: italic 400 0.95rem 'Source Serif 4', Georgia, serif; }
/* the Up next bar: a floating pill, bottom centre */
#library-grid .lg-upnext { position: absolute; left: 50%; bottom: 1.25rem; transform: translateX(-50%); }
#library-grid .lg-un { display: flex; align-items: center; gap: 0.8rem; padding: 0.55rem 0.7rem 0.55rem 0.55rem; min-width: 18rem; max-width: min(36rem, 90vw);
  border-radius: 9999px; color: #fff; text-align: left;
  background: linear-gradient(135deg, rgba(30,41,82,0.96), rgba(49,46,129,0.96)); backdrop-filter: blur(12px);
  box-shadow: 0 18px 40px -14px rgba(49,46,129,0.75), 0 0 0 1px rgba(255,255,255,0.12), inset 0 1px 0 rgba(255,255,255,0.15); transition: transform 0.15s ease; }
#library-grid .lg-un:not(.empty):hover { transform: translateY(-2px); }
#library-grid .lg-un.empty { opacity: 0.85; cursor: default; }
#library-grid .lg-un-ico svg { width: 2.4rem; height: 2.4rem; display: block; filter: drop-shadow(0 2px 6px rgba(99,102,241,0.6)); }
#library-grid .lg-un-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
#library-grid .lg-un-txt b { font: 800 max(14px, 0.72rem) 'Montserrat', sans-serif; letter-spacing: 0.18em; text-transform: uppercase; color: #c7d2fe; }
#library-grid .lg-un-txt i { font: 600 0.95rem 'Montserrat', sans-serif; font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#library-grid .lg-un-n { min-width: 1.8rem; height: 1.8rem; padding: 0 0.45rem; display: grid; place-items: center; border-radius: 9999px;
  font: 800 0.85rem 'Montserrat', sans-serif; color: #312e81; background: #fff; }
@media (max-width: 640px) { #library-grid .lg-head { flex-wrap: wrap; padding: 0.75rem 1rem; } #library-grid .lg-body { padding: 1rem 1rem 7rem; } #library-grid .lg-grid { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); } }

/* ---- Puzzles (js/features/pandalibrary.js) ----------------------------------
   A list with a preview board on the right, Next / Random in the header, and a
   slim bar under the board while a puzzle is on it. Jeff, 2026-10-14. */
.plib { --pl-bg: #ffffff; --pl-panel: #f6f7f9; --pl-line: #e3e6eb; --pl-ink: #1c2130; --pl-mute: #6b7280; --pl-hover: #eef2ff; --pl-acc: #2563eb; --pl-acc-ink: #ffffff;
  --pl-lt: #ebecd0; --pl-dk: #779556;
  background: var(--pl-bg); color: var(--pl-ink); width: min(96vw, 72rem); height: 86vh; border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px rgba(15,23,42,0.55), 0 0 0 1px rgba(15,23,42,0.06); font-family: 'Inter', system-ui, sans-serif; }
.dark .plib { --pl-bg: #15171d; --pl-panel: #1b1e26; --pl-line: #2a2e38; --pl-ink: #eef0f4; --pl-mute: #9aa3b2; --pl-hover: #222838; --pl-acc: #3b82f6; }
.plib-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--pl-line); }
.plib-head h2 { display: flex; align-items: center; gap: 0.55rem; font: 800 1.3rem/1 'Montserrat', sans-serif; margin: 0; }
.plib-head h2 svg { width: 1.4rem; height: 1.4rem; color: var(--pl-mute); }
#plib-count { font: 600 0.85rem/1 'Inter', sans-serif; color: var(--pl-mute); margin-left: 0.25rem; }
.plib-head-actions { display: flex; align-items: center; gap: 0.5rem; }
.plib-btn, .plib-toggle { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.95rem; border-radius: 10px; font-weight: 700; font-size: 0.92rem;
  background: var(--pl-panel); color: var(--pl-ink); border: 1px solid var(--pl-line); transition: background .15s, border-color .15s, transform .1s; }
.plib-btn:hover, .plib-toggle:hover { border-color: var(--pl-acc); }
.plib-btn:active { transform: scale(0.97); }
.plib-btn svg, .plib-toggle svg { width: 1rem; height: 1rem; }
.plib-primary { background: var(--pl-acc) !important; color: var(--pl-acc-ink) !important; border-color: var(--pl-acc) !important; box-shadow: 0 6px 16px -6px rgba(37,99,235,0.6); }
.plib-toggle[aria-pressed="true"] { color: var(--pl-acc); border-color: var(--pl-acc); background: var(--pl-hover); }
.plib-x { padding: 0.4rem; border-radius: 8px; color: var(--pl-mute); background: none; border: 0; font-size: 1.4rem; line-height: 1; }
.plib-x:hover { color: var(--pl-ink); background: var(--pl-panel); }
.plib-x svg { width: 1.3rem; height: 1.3rem; }
.plib-filters { padding: 0.7rem 1.1rem; border-bottom: 1px solid var(--pl-line); display: flex; flex-direction: column; gap: 0.55rem; }
.plib-topics { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.plib-topics button { padding: 0.35rem 0.8rem; border-radius: 999px; font-size: max(14px, 0.85rem); font-weight: 700; color: var(--pl-mute); background: transparent; border: 1px solid var(--pl-line); transition: all .15s; }
.plib-topics button:hover { color: var(--pl-ink); border-color: var(--pl-mute); }
.plib-topics button[aria-pressed="true"] { color: var(--pl-acc-ink); background: var(--pl-ink); border-color: var(--pl-ink); }
.dark .plib-topics button[aria-pressed="true"] { color: #15171d; background: #eef0f4; }
.plib-filter-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.plib-filter-row select, .plib-filter-row input { background: var(--pl-panel); color: var(--pl-ink); border: 1px solid var(--pl-line); border-radius: 9px; padding: 0.4rem 0.6rem; font-size: 0.9rem; max-width: 14rem; }
.plib-filter-row input { flex: 1; min-width: 8rem; max-width: none; }
.plib-main { flex: 1; min-height: 0; display: flex; }
.plib-body { flex: 1; min-width: 0; overflow-y: auto; padding: 0.5rem 0.6rem 1rem; }
.plib-preview { display: none; width: 21rem; flex-shrink: 0; border-left: 1px solid var(--pl-line); background: var(--pl-panel); padding: 1.1rem; overflow-y: auto; }
.plib-preview-on .plib-preview { display: block; }
.plib-list { display: flex; flex-direction: column; }
.plib-row { display: flex; align-items: center; gap: 0.8rem; width: 100%; text-align: left; padding: 0.6rem 0.7rem; border-radius: 10px; border: 0; background: none; color: inherit; transition: background .12s; }
.plib-row:hover, .plib-row.plib-sel { background: var(--pl-hover); }
.plib-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.plib-row-text b { font-weight: 700; font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plib-row-text span { font-size: max(14px, 0.8rem); color: var(--pl-mute); }
.plib-seen .plib-row-text b { color: var(--pl-mute); font-weight: 600; }
.plib-seen .plib-row-text b::after { content: ' · done'; font-weight: 500; font-size: max(14px, 0.78rem); }
.plib-side, .plib-bar-side { width: 0.8rem; height: 0.8rem; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 1.5px #64748b; }
.plib-side-w { background: #ffffff; } .plib-side-b { background: #111318; }
.plib-grade { flex-shrink: 0; min-width: 1.5rem; height: 1.5rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font-weight: 800; font-size: max(14px, 0.8rem);
  background: rgba(16,185,129,0.14); color: #047857; }
.dark .plib-grade { color: #6ee7b7; }
.plib-dots { display: inline-flex; gap: 3px; flex-shrink: 0; }
.plib-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--pl-line); }
.plib-dots i.on { background: var(--pl-mute); }
.plib-more { width: 100%; margin-top: 0.6rem; padding: 0.6rem; border-radius: 10px; font-weight: 700; color: var(--pl-mute); background: var(--pl-panel); border: 1px dashed var(--pl-line); }
.plib-more:hover { color: var(--pl-ink); }
.plib-empty { text-align: center; color: var(--pl-mute); padding: 3rem 1rem; }
.plib-board { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 24px -10px rgba(0,0,0,0.45), 0 0 0 3px #1c2130; }
.plib-board span { position: relative; } .plib-lt { background: var(--pl-lt); } .plib-dk { background: var(--pl-dk); }
.plib-board img { position: absolute; inset: 4%; width: 92%; height: 92%; }
.plib-preview-title { margin-top: 1rem; font: 800 1.1rem/1.25 'Montserrat', sans-serif; }
.plib-preview-sub { margin-top: 0.25rem; font-size: max(14px, 0.85rem); color: var(--pl-mute); }
.plib-preview-hook { margin-top: 0.6rem; font-size: 0.92rem; }
.plib-preview-meta { margin-top: 0.6rem; display: flex; align-items: center; gap: 0.6rem; font-size: max(14px, 0.8rem); color: var(--pl-mute); }
.plib-preview-blank { color: var(--pl-mute); text-align: center; padding-top: 40%; }
.plib-load { margin-top: 1rem; width: 100%; padding: 0.65rem; border-radius: 10px; font-weight: 800; background: var(--pl-acc); color: #fff; border: 0; box-shadow: 0 6px 16px -6px rgba(37,99,235,0.6); }
@media (max-width: 760px) { .plib-preview-on .plib-preview { display: none; } .plib-head { flex-wrap: wrap; } .plib-toggle { display: none; } }
/* Puzzles | Games switch in the title, and the Games tab (TODO #58, 2026-11-09) */
.plib-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--pl-panel); border: 1px solid var(--pl-line); }
.plib-tabs button { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.8rem; border-radius: 9px; border: 0; background: none; color: var(--pl-mute); font: 800 1.05rem/1 'Montserrat', sans-serif; }
.plib-tabs button:hover { color: var(--pl-ink); }
.plib-tabs button[aria-pressed="true"] { background: var(--pl-bg); color: var(--pl-ink); box-shadow: 0 1px 3px rgba(15,23,42,0.15); }
.plib-head h2 .plib-tabs svg { width: 1.05rem; height: 1.05rem; }
.plib-game-filters { display: none; }
.plib-tab-games .plib-game-filters { display: flex; }
.plib-tab-games #pandalib-filters, .plib-tab-games #plib-next, .plib-tab-games #plib-random { display: none; }
.plib-res { flex-shrink: 0; min-width: 2.6rem; padding: 0.2rem 0.35rem; border-radius: 6px; text-align: center; font: 800 max(14px, 0.75rem)/1.2 'Inter', sans-serif; border: 1px solid var(--pl-line); }
.plib-res-w { background: #ffffff; color: #1c2130; }
.plib-res-b { background: #1c2130; color: #ffffff; border-color: #1c2130; }
.plib-res-d { background: var(--pl-panel); color: var(--pl-ink); }
.plib-res-u { color: var(--pl-mute); }
.dark .plib-res-b { border-color: #4b5262; }
/* right-click menu */
#plib-menu { position: fixed; z-index: 700; min-width: 15rem; padding: 0.35rem; border-radius: 12px; background: #ffffff; color: #1c2130;
  box-shadow: 0 18px 50px -12px rgba(15,23,42,0.5), 0 0 0 1px rgba(15,23,42,0.08); font: 500 0.9rem/1.2 'Inter', sans-serif; }
.dark #plib-menu { background: #1b1e26; color: #eef0f4; box-shadow: 0 18px 50px -12px rgba(0,0,0,0.7), 0 0 0 1px #2a2e38; }
#plib-menu > button { display: block; width: 100%; text-align: left; padding: 0.5rem 0.7rem; border-radius: 8px; background: none; border: 0; color: inherit; }
#plib-menu > button:hover { background: rgba(37,99,235,0.1); }
.plib-menu-head { padding: 0.45rem 0.7rem 0.35rem; font-weight: 800; font-size: max(14px, 0.8rem); color: #6b7280; }
.plib-menu-label { padding: 0.35rem 0.7rem 0.2rem; font-size: max(14px, 0.75rem); font-weight: 700; color: #6b7280; }
.plib-menu-sep { height: 1px; margin: 0.3rem 0.4rem; background: rgba(100,116,139,0.25); }
.plib-menu-grades { display: flex; gap: 0.3rem; padding: 0.2rem 0.7rem 0.4rem; }
.plib-menu-grades button { flex: 1; padding: 0.35rem 0; border-radius: 7px; font-weight: 800; border: 1px solid rgba(100,116,139,0.35); background: none; color: inherit; }
.plib-menu-grades button:hover, .plib-menu-grades button.on { background: #2563eb; border-color: #2563eb; color: #fff; }
/* the bar under the board while a puzzle is on it */
#plib-bar { position: fixed; left: 50%; bottom: 0.5rem; z-index: 560; display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.35rem 0.3rem 0.75rem;
  border-radius: 999px; background: rgba(255,255,255,0.94); color: #1c2130; box-shadow: 0 8px 22px -10px rgba(15,23,42,0.45), 0 0 0 1px rgba(15,23,42,0.07);
  font: 600 0.82rem/1 'Inter', system-ui, sans-serif; white-space: nowrap;
  transform: translate(-50%, 140%); opacity: 0; pointer-events: none; transition: transform .3s cubic-bezier(.2,.9,.3,1.2), opacity .2s; max-width: calc(100vw - 2rem); }
.dark #plib-bar { background: rgba(27,30,38,0.95); color: #eef0f4; box-shadow: 0 8px 22px -10px rgba(0,0,0,0.7), 0 0 0 1px #2a2e38; }
#plib-bar.plib-bar-on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
#plib-bar .plib-bar-side { width: 0.65rem; height: 0.65rem; }
.plib-bar-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; margin-right: 0.25rem; }
.plib-bar-mode { font-size: 14px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.6; margin-right: 0.15rem; white-space: nowrap; }
#plib-bar button { padding: 0.32rem 0.7rem; border-radius: 999px; font-weight: 700; font-size: max(14px, 0.78rem); background: rgba(100,116,139,0.12); color: inherit; border: 0; }
#plib-bar button:hover { background: rgba(100,116,139,0.22); }
#plib-bar button.plib-primary { background: #2563eb !important; color: #fff !important; }
#plib-bar button.plib-x { background: none; font-size: 1rem; padding: 0.2rem 0.45rem; color: #94a3b8; }

/* ---- Settings → Graphics (js/features/graphics.js) --------------------------- */
html.no-blur *, html.no-blur *::before, html.no-blur *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
#graphics-panel { display: flex; flex-direction: column; gap: 1rem; }
.gfx-block { display: flex; flex-direction: column; gap: 0.55rem; padding: 0.8rem; border-radius: 12px; background: #f8fafc; border: 1px solid #e2e8f0; }
.dark .gfx-block { background: rgba(19,21,26,0.6); border-color: #2a2e38; }
.gfx-h { font-size: 14px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #64748b; }
.gfx-note { font-size: 14px; color: #94a3b8; margin: 0; }
.gfx-pills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
@media (max-width: 520px) { .gfx-pills { grid-template-columns: 1fr; } }
.gfx-pill-card { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; padding: 0.8rem 0.4rem 0.6rem; border-radius: 10px; background: #ffffff; border: 1px solid #e2e8f0; text-align: center; }
.dark .gfx-pill-card { background: #1a1d24; border-color: #2a2e38; }
.gfx-cap { font-size: 14px; font-weight: 700; color: #334155; } .dark .gfx-cap { color: #e2e8f0; }
.gfx-xp { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.75rem 0.25rem 0.4rem; border-radius: 999px; background: linear-gradient(180deg, #2b2416, #14110b);
  box-shadow: 0 0 0 1.5px rgba(251,191,36,0.8), 0 0 14px rgba(251,191,36,0.35); font: 900 1rem/1 'Montserrat', sans-serif; color: #fcd34d; height: 2.2rem; }
.gfx-xp .xp-tally-star { width: 1.4rem; height: 1.4rem; filter: drop-shadow(0 0 5px rgba(251,191,36,0.7)); }
.gfx-xp .xp-tally-u { font-size: max(14px, 0.65rem); letter-spacing: 0.1em; color: #fbbf24; }
.gfx-clock { position: relative; display: inline-flex; align-items: center; justify-content: center; height: 2.2rem; min-width: 4.4rem; padding: 0 0.8rem; border-radius: 999px;
  font: 900 1.05rem/1 'Montserrat', sans-serif; color: #0f172a; background: #ffffff; box-shadow: 0 0 0 2px #0f172a; }
.dark .gfx-clock { color: #fff; background: #0f172a; box-shadow: 0 0 0 2px #e2e8f0; }
.gfx-clock-ring { box-shadow: 0 0 0 3px #22c55e; } .gfx-clock-fuse { box-shadow: 0 0 0 2px #f97316, 0 0 12px rgba(249,115,22,0.6); }
.gfx-clock-bar { box-shadow: inset 0 -4px 0 #3b82f6, 0 0 0 2px #0f172a; } .gfx-clock-edge, .gfx-clock-comet { box-shadow: 0 0 0 2px #38bdf8, 0 0 14px rgba(56,189,248,0.6); }
.gfx-clock-hourglass { box-shadow: 0 0 0 2px #d97706; }
.gfx-tip { display: inline-flex; align-items: center; gap: 0.4rem; height: 2.2rem; padding: 0 0.7rem; border-radius: 10px; background: #1f2229; color: #e2e8f0; font-size: 14px; text-align: left; max-width: 100%; }
.gfx-tip svg { width: 0.95rem; height: 0.95rem; color: #fbbf24; flex-shrink: 0; }
.gfx-tip span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; white-space: nowrap; overflow: hidden; }
.gfx-tip b { font: 700 14px/1.2 Georgia, serif; letter-spacing: 0.12em; text-transform: uppercase; color: #cbd5e1; }
.gfx-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: #e2e8f0; gap: 2px; }
.dark .gfx-seg { background: #2a2e38; }
.gfx-seg button { padding: 0.3rem 0.75rem; border-radius: 8px; font-size: 14px; font-weight: 700; color: #475569; background: none; border: 0; }
.dark .gfx-seg button { color: #cbd5e1; }
.gfx-seg button[aria-checked="true"] { background: #ffffff; color: #0f172a; box-shadow: 0 1px 3px rgba(15,23,42,0.18); }
.dark .gfx-seg button[aria-checked="true"] { background: #e2e8f0; color: #0f172a; }
.gfx-select { font-size: 14px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; color: #334155; padding: 0.2rem 0.4rem; max-width: 100%; }
.dark .gfx-select { background: #13151a; border-color: #3a3e48; color: #e2e8f0; }
.gfx-link { font-size: 14px; font-weight: 700; color: #2563eb; background: none; border: 0; padding: 0; }
.gfx-link:hover { text-decoration: underline; }
.gfx-glass { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.gfx-glass-demo { position: relative; height: 5.5rem; border-radius: 10px; overflow: hidden; cursor: pointer; border: 2px solid transparent;
  background: conic-gradient(#ebecd0 0 25%, #779556 0 50%, #ebecd0 0 75%, #779556 0) 0 0 / 1.6rem 1.6rem; }
.gfx-glass-demo.on { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.25); }
.gfx-glass-demo span { position: absolute; right: 0.5rem; top: 0.5rem; bottom: 0.5rem; width: 55%; border-radius: 8px; border: 1px solid rgba(255,255,255,0.5); }
.gfx-frosted span { background: rgba(255,255,255,0.35); -webkit-backdrop-filter: blur(6px) !important; backdrop-filter: blur(6px) !important; }
.gfx-clear span { background: #ffffff; }
.dark .gfx-clear span { background: #1a1d24; border-color: #2a2e38; }
.gfx-glass-demo b { position: absolute; left: 0.5rem; bottom: 0.4rem; font-size: 14px; font-weight: 800; color: #0f172a; background: rgba(255,255,255,0.9); padding: 0.1rem 0.45rem; border-radius: 6px; }
.gfx-looks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
@media (max-width: 520px) { .gfx-looks { grid-template-columns: 1fr; } }
.gfx-look { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.5rem; border-radius: 10px; text-align: left; background: #fff; border: 2px solid #e2e8f0; transition: border-color .15s; }
.dark .gfx-look { background: #1a1d24; border-color: #2a2e38; }
.gfx-look:hover { border-color: #94a3b8; } .gfx-look.on { border-color: #2563eb; }
.gfx-look b { font-size: 14px; color: #0f172a; } .dark .gfx-look b { color: #f1f5f9; }
.gfx-look > span:last-child { font-size: 14px; color: #64748b; line-height: 1.3; }
.gfx-look-sw { display: grid; grid-template-columns: 1fr 1fr; width: 2.4rem; height: 2.4rem; padding: 0.35rem; border-radius: 8px; margin-bottom: 0.2rem; }
.gfx-look-sw i { display: block; }

/* ---- App map (js/features/appmap.js) ---------------------------------------- */
#appmap { position: fixed; inset: 0; z-index: 640; display: none; align-items: center; justify-content: center; background: rgba(15,23,42,0.55); outline: none; }
#appmap.appmap-on { display: flex; }
.appmap-box { width: min(97vw, 92rem); height: min(92vh, 56rem); display: flex; flex-direction: column; border-radius: 20px; overflow: hidden;
  background: #fbfaf7; color: #1c2130; box-shadow: 0 30px 80px -20px rgba(15,23,42,0.6); font-family: 'Inter', system-ui, sans-serif; }
.dark .appmap-box { background: #15171d; color: #eef0f4; }
.appmap-head { display: flex; align-items: center; gap: 1.2rem; padding: 1rem 1.3rem; border-bottom: 1px solid rgba(100,116,139,0.2); }
.appmap-head > div:first-child { flex: 1; min-width: 0; }
.appmap-head h2 { margin: 0; font: 800 1.5rem/1.1 'Montserrat', sans-serif; }
.appmap-head p { margin: 0.25rem 0 0; font-size: 0.9rem; color: #64748b; }
.dark .appmap-head p { color: #9aa3b2; }
.appmap-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: rgba(100,116,139,0.15); flex-shrink: 0; }
.appmap-seg button { padding: 0.45rem 0.9rem; border-radius: 9px; font-weight: 700; font-size: 0.88rem; border: 0; background: none; color: inherit; opacity: 0.75; }
.appmap-seg button[aria-pressed="true"] { background: #1c2130; color: #fbfaf7; opacity: 1; }
.dark .appmap-seg button[aria-pressed="true"] { background: #eef0f4; color: #15171d; }
.appmap-x { border: 0; background: none; color: #64748b; font-size: 1.8rem; line-height: 1; padding: 0.2rem 0.5rem; border-radius: 8px; }
.appmap-x:hover { background: rgba(100,116,139,0.15); }
.appmap-body { flex: 1; min-height: 0; display: flex; }
.appmap-canvas { position: relative; flex: 1; min-width: 0; margin: 1rem; }
.appmap-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.appmap-hub, .appmap-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.appmap-hub { padding: 1.1rem 1.6rem; border-radius: 999px; background: #1c2130; color: #fbfaf7; box-shadow: 0 14px 30px -10px rgba(15,23,42,0.6); }
.dark .appmap-hub { background: #eef0f4; color: #15171d; }
.appmap-hub b { font: 900 1.35rem/1 'Montserrat', sans-serif; }
.appmap-hub span { font-size: max(14px, 0.78rem); opacity: 0.7; margin-top: 0.3rem; }
.appmap-node { min-width: 8.5rem; max-width: 11rem; padding: 0.6rem 0.9rem; border-radius: 16px; border: 2px solid var(--c); background: #ffffff; color: inherit;
  box-shadow: 0 8px 20px -10px rgba(15,23,42,0.35); transition: transform .15s, box-shadow .15s; cursor: pointer; }
.dark .appmap-node { background: #1b1e26; }
.appmap-node b { font-size: 0.95rem; line-height: 1.15; }
.appmap-node span { font-size: max(14px, 0.75rem); color: #64748b; margin-top: 0.2rem; }
.appmap-node.on { background: var(--c); color: #ffffff; transform: translate(-50%, -50%) scale(1.08); box-shadow: 0 14px 28px -10px var(--c); }
.appmap-node.on span { color: rgba(255,255,255,0.85); }
.appmap-node.dim { opacity: 0.4; }
.appmap-side { width: 27rem; flex-shrink: 0; display: flex; flex-direction: column; border-left: 1px solid rgba(100,116,139,0.2); background: rgba(100,116,139,0.06); }
.appmap-side h3 { margin: 0; padding: 1rem 1.2rem 0.6rem; font: 800 1.2rem/1 'Montserrat', sans-serif; color: var(--c); }
.appmap-list { flex: 1; overflow-y: auto; padding: 0 0.7rem 1rem; display: flex; flex-direction: column; gap: 0.2rem; }
.appmap-cmd { display: flex; flex-direction: column; gap: 0.2rem; text-align: left; padding: 0.55rem 0.6rem; border-radius: 10px; border: 0; background: none; color: inherit; }
.appmap-cmd:hover { background: rgba(100,116,139,0.14); }
.appmap-cmd-top { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.appmap-cmd code { font: 700 0.95rem/1.2 ui-monospace, 'JetBrains Mono', monospace; color: var(--c); }
.appmap-cmd kbd { font: 700 max(14px, 0.7rem)/1 ui-monospace, monospace; padding: 0.15rem 0.35rem; border-radius: 4px; background: rgba(100,116,139,0.18); }
.appmap-cmd em { font-style: normal; font-size: max(14px, 0.68rem); font-weight: 800; padding: 0.12rem 0.4rem; border-radius: 999px; letter-spacing: 0.03em; }
.appmap-new { background: rgba(59,130,246,0.15); color: #2563eb; }
.appmap-unused { background: rgba(100,116,139,0.15); color: #64748b; }
.appmap-desc { font-size: max(14px, 0.82rem); color: #475569; line-height: 1.35; }
.dark .appmap-desc { color: #b4bccb; }
.appmap-empty { color: #64748b; padding: 1rem; }
@media (max-width: 900px) { .appmap-body { flex-direction: column; } .appmap-canvas { height: 22rem; flex: none; } .appmap-side { width: auto; flex: 1; border-left: 0; }
  .appmap-node { min-width: 0; max-width: 7rem; padding: 0.35rem 0.5rem; } .appmap-node b { font-size: max(14px, 0.72rem); } .appmap-node span { display: none; } .appmap-head { flex-wrap: wrap; } }

/* ---- Try These sheet preview (js/features/trythese.js). The printed sheet's
   own CSS lives inside the frame, so none of this reaches the paper. ---- */
#trythese { position: fixed; inset: 0; z-index: 640; display: none; align-items: center; justify-content: center; background: rgba(15,23,42,0.55); outline: none; }
#trythese.tt-on { display: flex; }
.tt-box { width: min(97vw, 70rem); height: min(94vh, 60rem); display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: #fbfaf7; color: #1c2130; box-shadow: 0 30px 80px -20px rgba(15,23,42,0.6); font-family: 'Inter', system-ui, sans-serif; }
.dark .tt-box { background: #15171d; color: #eef0f4; }
.tt-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1.1rem; border-bottom: 1px solid rgba(100,116,139,0.2); }
.tt-head > div:first-child { flex: 1; min-width: 0; }
.tt-head h2 { margin: 0; font: 800 1.3rem/1.1 'Montserrat', sans-serif; }
.tt-head p { margin: 0.2rem 0 0; font-size: max(14px, 0.8rem); color: #64748b; }
.tt-btn { padding: 0.45rem 0.8rem; border-radius: 10px; border: 1px solid rgba(100,116,139,0.35); background: transparent; color: inherit; font-weight: 700; font-size: max(14px, 0.8rem); cursor: pointer; white-space: nowrap; }
.tt-btn:hover { background: rgba(100,116,139,0.12); }
.tt-primary { background: #334155; border-color: #334155; color: #fff; }
.tt-primary:hover { background: #1e293b; }
.tt-x { font-size: 1.6rem; line-height: 1; background: none; border: 0; color: #64748b; cursor: pointer; padding: 0 0.3rem; }
#trythese-frame { flex: 1; width: 100%; border: 0; background: #fff; }
@media print { #trythese { display: none !important; } }

/* ---- Hide icons (js/features/hide-icons.js) ---------------------------------
   Right-click a toolbar icon → Hide. Own class so it never fights a feature's
   own `hidden` toggling. */
.icon-hidden { display: none !important; }
#hide-icons-menu { position: fixed; z-index: 700; min-width: 12rem; max-width: 22rem; padding: 0.3rem; border-radius: 0.6rem;
  background: #ffffff; border: 1px solid #e2e8f0; box-shadow: 0 12px 30px -10px rgba(15,23,42,0.35); display: flex; flex-direction: column; }
.dark #hide-icons-menu { background: #1a1d24; border-color: #3a3e48; }
#hide-icons-menu button { text-align: left; padding: 0.45rem 0.7rem; border-radius: 0.4rem; font-size: 14px; font-weight: 600; color: #334155; }
.dark #hide-icons-menu button { color: #e2e8f0; }
#hide-icons-menu button:hover { background: #f1f5f9; } .dark #hide-icons-menu button:hover { background: #2a2e38; }
/* The line at the top that says what the button does and its key (HideIcons.describe). */
#hide-icons-menu .hi-info { padding: 0.45rem 0.7rem 0.5rem; margin-bottom: 0.2rem; border-bottom: 1px solid #e2e8f0; font-size: 14px; font-weight: 500; line-height: 1.4; color: #64748b; white-space: normal; cursor: default; }
#hide-icons-menu .hi-info b { color: #1e293b; font-weight: 700; }
#hide-icons-menu .hi-info kbd { padding: 0.05rem 0.35rem; border-radius: 0.25rem; background: #f1f5f9; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; color: #334155; }
.dark #hide-icons-menu .hi-info { color: #94a3b8; border-color: #3a3e48; }
.dark #hide-icons-menu .hi-info b { color: #f1f5f9; }
.dark #hide-icons-menu .hi-info kbd { background: #2a2e38; color: #e2e8f0; }

/* Scoresheet mode: the drawn name rides in the sheet's title bar (placed by
   Scoresheet._placeName), so it is sized to sit beside the clock, not to
   headline the screen. A long name shrinks to fit instead of being cut off. */
body.scoresheet-mode:not(.scoresheet-hidden) #active-student-name {
  font-size: clamp(0.9rem, 1.4vw, 1.35rem) !important;
  padding: 0.25rem 0.9rem !important;
  max-width: min(26rem, 46vw) !important;
  letter-spacing: 0.04em !important;
  z-index: 76;
}
#scoresheet-panel .ss-hud { flex-wrap: wrap; justify-content: flex-end; max-width: 65%; }
/* With a name parked, the pills take their own row under the players, so
   neither the players nor the name is squeezed. */
#scoresheet-panel .ss-head:has(.ss-hud-slot[data-hud="name"]:not([hidden])) { flex-wrap: wrap; }
#scoresheet-panel .ss-head:has(.ss-hud-slot[data-hud="name"]:not([hidden])) .ss-hud {
  order: 3; flex-basis: 100%; max-width: 100%; justify-content: flex-start;
}
/* A centred flex box clips a long name at BOTH ends ("DRA MONTO") and never
   shows the ellipsis. As a centred block it keeps the start of the name and
   ends in "…". */
#active-student-name.flex { display: block; text-align: center; }

/* Engine candidates (Engine._renderLines): one plain sentence with the chess
   sign, then the top moves named by rank. Hover a row for the expected line. */
#engine-clean-lines .eng-say { display: flex; align-items: center; gap: 0.75rem; padding: 0.35rem 0.4rem 0.6rem; margin-bottom: 0.15rem; border-bottom: 1px solid rgba(148, 163, 184, 0.25); }
#engine-clean-lines .eng-sign { flex: none; min-width: 2.6rem; height: 2.6rem; padding: 0 0.4rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 0.75rem; font: 800 1.35rem/1 'JetBrains Mono', ui-monospace, monospace; background: #1e293b; color: #fff; }
.dark #engine-clean-lines .eng-sign { background: #f1f5f9; color: #0f172a; }
#engine-clean-lines .eng-say-txt { display: flex; flex-direction: column; min-width: 0; }
#engine-clean-lines .eng-say-head { font-weight: 800; font-size: 1.05rem; color: #0f172a; }
.dark #engine-clean-lines .eng-say-head { color: #f8fafc; }
#engine-clean-lines .eng-say-sub { font-size: max(14px, 0.85rem); color: #64748b; }
.dark #engine-clean-lines .eng-say-sub { color: #94a3b8; }
#engine-clean-lines .eng-row { display: grid; grid-template-columns: 6.75rem 1fr auto; align-items: baseline; column-gap: 0.75rem; padding: 0.35rem 0.6rem; border-radius: 0.6rem; cursor: pointer; transition: background-color 0.12s ease; }
#engine-clean-lines .eng-row:hover { background: rgba(148, 163, 184, 0.18); }
#engine-clean-lines .eng-rank { white-space: nowrap; font-size: max(14px, 0.7rem); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #94a3b8; }
#engine-clean-lines .eng-best .eng-rank { color: #2563eb; }
.dark #engine-clean-lines .eng-best .eng-rank { color: #60a5fa; }
#engine-clean-lines .eng-move { font-size: 1.15rem; font-weight: 700; color: #1e293b; white-space: nowrap; }
#engine-clean-lines .eng-best .eng-move { font-size: 1.3rem; font-weight: 800; }
.dark #engine-clean-lines .eng-move { color: #e2e8f0; }
#engine-clean-lines .eng-score { font: 700 0.95rem 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; color: #475569; }
.dark #engine-clean-lines .eng-score { color: #94a3b8; }
#engine-clean-lines .eng-pv { grid-column: 1 / -1; display: none; padding: 0.2rem 0 0.1rem 7.5rem; font-size: max(14px, 0.85rem); color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#engine-clean-lines .eng-row:hover .eng-pv { display: block; }

/* Discover icons (js/features/hide-icons.js): a small dot on the two features
   slipped into the icon grid for you to try. */
.discover-icon { position: relative; }
.discover-icon .discover-dot { position: absolute; top: 0.3rem; right: 0.3rem; width: 0.4rem; height: 0.4rem; border-radius: 9999px; background: #3b82f6; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7); }
.dark .discover-icon .discover-dot { box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.8); }

/* /wsb — Who Stands Better (renderWsbPanel, js/game/commands.js). Four factor
   cards and an overall card, each with three choices; the app's verdict under
   them while the engine is on; WSB's own settings at the foot. */
#wsb-list { gap: 0.8rem; }
#wsb-list .wsb-row { border-radius: 1.1rem; padding: 0.9rem 1rem; background: rgba(255, 255, 255, 0.7); box-shadow: inset 0 0 0 2px rgba(148, 163, 184, 0.25); cursor: pointer; transition: box-shadow 0.15s ease, background-color 0.15s ease; }
.dark #wsb-list .wsb-row { background: rgba(0, 0, 0, 0.25); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.07); }
#wsb-list .wsb-row.sel { box-shadow: inset 0 0 0 2px #3b82f6; }
#wsb-list .wsb-row.done:not(.sel) { box-shadow: inset 0 0 0 2px rgba(16, 185, 129, 0.45); }
#wsb-list .wsb-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.6rem; }
#wsb-list .wsb-ico { font-size: 1.8rem; line-height: 1; width: 2rem; text-align: center; }
#wsb-list .wsb-lab { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; color: #0f172a; }
.dark #wsb-list .wsb-lab { color: #f1f5f9; }
#wsb-list .wsb-overall { margin-top: 0.3rem; background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(99, 102, 241, 0.08)); }
#wsb-list .wsb-seg { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 0.4rem; }
#wsb-list .wsb-c { padding: 0.6rem 0.5rem; border-radius: 0.8rem; font-weight: 800; font-size: 1rem; color: #475569; background: rgba(148, 163, 184, 0.14); transition: all 0.12s ease; }
.dark #wsb-list .wsb-c { color: #cbd5e1; background: rgba(255, 255, 255, 0.06); }
#wsb-list .wsb-c:hover { background: rgba(148, 163, 184, 0.28); }
#wsb-list .wsb-c-w.on { background: #fff; color: #0f172a; box-shadow: 0 0 0 2px #0f172a, 0 4px 10px -4px rgba(0, 0, 0, 0.35); }
#wsb-list .wsb-c-b.on { background: #0f172a; color: #fff; box-shadow: 0 0 0 2px #0f172a, 0 4px 10px -4px rgba(0, 0, 0, 0.5); }
.dark #wsb-list .wsb-c-b.on { box-shadow: 0 0 0 2px #e2e8f0; }
#wsb-list .wsb-c-eq.on { background: #64748b; color: #fff; box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.4); }
#wsb-list .wsb-app { margin-top: 0.55rem; font-size: 0.92rem; color: #334155; }
.dark #wsb-list .wsb-app { color: #cbd5e1; }
#wsb-list .wsb-app-k { font-size: max(14px, 0.72rem); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #64748b; }
#wsb-list .wsb-app-why { display: block; font-size: max(14px, 0.82rem); color: #64748b; margin-top: 0.1rem; }
#wsb-list .wsb-agree { color: #059669; font-weight: 800; }
#wsb-list .wsb-hint { margin-top: 0.55rem; font-size: max(14px, 0.85rem); font-style: italic; color: #94a3b8; }
#wsb-list .wsb-settings { margin-top: 0.4rem; padding: 0.6rem 0.9rem; border-radius: 0.9rem; border: 1px dashed rgba(148, 163, 184, 0.45); font-size: 0.92rem; color: #475569; }
.dark #wsb-list .wsb-settings { color: #cbd5e1; }
#wsb-list .wsb-settings summary { cursor: pointer; font-weight: 800; font-size: max(14px, 0.8rem); letter-spacing: 0.06em; text-transform: uppercase; color: #64748b; }
#wsb-list .wsb-settings label { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; cursor: pointer; }
/* Big classroom text */
#wsb-panel.wsb-big .wsb-lab { font-size: 2rem; }
#wsb-panel.wsb-big .wsb-ico { font-size: 2.4rem; width: 2.6rem; }
#wsb-panel.wsb-big .wsb-c { font-size: 1.35rem; padding: 0.85rem 0.6rem; }
#wsb-panel.wsb-big .wsb-app { font-size: 1.15rem; }
#wsb-panel.wsb-big .wsb-app-why { font-size: 1rem; }

/* Icon grid favorites and drag-to-arrange (js/features/hide-icons.js, IconArrange). */
#toolbar-icons .fav-icon { position: relative; }
#toolbar-icons .fav-icon::after { content: '\2605'; position: absolute; top: 0.05rem; right: 0.15rem; font-size: 0.6rem; line-height: 1; color: #f59e0b; text-shadow: 0 0 2px rgba(255, 255, 255, 0.9); pointer-events: none; }
.dark #toolbar-icons .fav-icon::after { text-shadow: 0 0 2px rgba(15, 23, 42, 0.9); }
#toolbar-icons button.icon-dragging { opacity: 0.35; }

/* Coach Mode (js/core/coach-mode.js): the student view hides the coach's own
   controls — Lichess account, homework, About/growth, the usage log. */
body.student-view [data-coach-only] { display: none !important; }
/* ============ TOOLBAR MODE (js/features/toolbar-mode.js) ============ */
/* Hidden: the whole icon grid, not a list of ids. Under 601px (not on the zen
   board) the grid is already replaced by the row of words, which stays. */
body.toolbar-hidden #toolbar-icons { display: none !important; }
@media (min-width: 601px) {
  body.toolbar-hidden:not(.phone-mode) #analysis-toolbar { display: none !important; }

  /* Auto-hide, like the Dock. The strip collapses to a 12px band with a short
     grabber in the middle; the icons are laid OVER the move list when they come
     down, absolutely positioned, so nothing reflows and the board never moves. */
  body.toolbar-auto #analysis-toolbar {
    position: relative;
    height: 12px; min-height: 12px;
    padding: 0 !important;
    overflow: visible;
    z-index: 40;
    cursor: pointer;
    border-bottom-color: transparent !important;
    background: transparent !important;
  }
  body.toolbar-auto #analysis-toolbar::before {
    content: '';
    position: absolute; left: 50%; top: 4px;
    width: 40px; height: 4px; margin-left: -20px;
    border-radius: 9999px;
    background: rgba(100, 116, 139, 0.35);
    transition: background-color 160ms ease, opacity 160ms ease, width 160ms ease;
  }
  body.toolbar-auto #analysis-toolbar:hover::before { background: rgba(59, 130, 246, 0.65); }
  body.toolbar-auto.toolbar-revealed #analysis-toolbar::before { opacity: 0; }

  body.toolbar-auto #toolbar-icons {
    position: absolute; top: 0; left: 0; right: 0;
    justify-content: center;
    padding: 0.4rem 0.5rem 0.5rem;
    border-radius: 0 0 14px 14px;
    background: rgba(255, 255, 255, 0.93);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
    box-shadow: 0 14px 30px -12px rgba(15, 23, 42, 0.35), 0 1px 0 rgba(15, 23, 42, 0.06);
    opacity: 0;
    transform: translateY(-10px) scale(0.985);
    transform-origin: top center;
    pointer-events: none;
    /* Going away: a beat slower than coming in, so it does not snap shut. */
    transition: opacity 180ms ease, transform 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .dark body.toolbar-auto #toolbar-icons {
    background: rgba(22, 24, 30, 0.95);
    box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  body.toolbar-auto.toolbar-revealed #toolbar-icons {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition: opacity 120ms ease, transform 160ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }
}
@media (prefers-reduced-motion: reduce) {
  body.toolbar-auto #toolbar-icons, body.toolbar-auto.toolbar-revealed #toolbar-icons { transition: opacity 80ms linear; transform: none; }
}

/* Panel tabs (js/features/paneltabs.js): plain words, a thin underline on the current one. */
.panel-tabs { display: flex; gap: 2px; padding: 0 8px; flex-shrink: 0; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid rgba(148,163,184,.25); }
.panel-tabs::-webkit-scrollbar { display: none; }
.panel-tabs .ptab { padding: 8px 10px 6px; font-size: 14px; font-weight: 600; color: #64748b; background: none;
  border: 0; border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; }
.panel-tabs .ptab:hover { color: #0f172a; }
.panel-tabs .ptab-menu { display: none; margin-left: auto; padding: 6px 8px; color: #64748b; background: none; border: 0; }
.panel-tabs .ptab.is-on { color: #0f172a; border-bottom-color: currentColor; }
.dark .panel-tabs .ptab, .dark .panel-tabs .ptab-menu { color: #cbd5e1; }
.panel-tabs button:focus-visible { outline: 2px solid #2962ff; outline-offset: -2px; }
.dark .panel-tabs .ptab:hover, .dark .panel-tabs .ptab.is-on { color: #f1f5f9; }

/* Settings → Pieces (js/core/piece-sets.js) */
.ps-swatch { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 10px;
  border: 2px solid transparent; background: rgba(148,163,184,.15); font-weight: 600; font-size: 15px; }
.ps-swatch img { width: 36px; height: 36px; }
.ps-swatch span { margin-left: 6px; }
.ps-swatch.is-on { border-color: #2563eb; }

/* Opening explorer, minimalist (js/features/explorer.js, Jeff 2026-11-19).
   Rows are 32px so the opening name, summary and the top 5 moves fit with no scrolling. */
.xp-top { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; }
.xp-summary { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: #64748b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-menu-btn { padding: 4px; border-radius: 8px; color: #64748b; }
.xp-menu-btn:hover { background: rgba(148,163,184,.2); color: #0f172a; }
.dark .xp-menu-btn:hover { color: #f1f5f9; }
.xp-menu { margin-bottom: 8px; padding: 10px; border-radius: 12px; background: rgba(148,163,184,.12);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.xp-menu.hidden { display: none; }
.xp-menu-label { width: 100%; font-size: 13px; font-weight: 700; color: #64748b; margin-top: 2px; }
.xp-seg { display: flex; border-radius: 8px; padding: 2px; background: rgba(148,163,184,.18); }
#explorer-body > div:first-child.font-bold { font-size: 15px; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-moves { display: flex; flex-direction: column; margin: 0 -4px; }
.xp-row { position: relative; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px;
  border-radius: 8px; cursor: pointer; }
.xp-row:hover { background: rgba(148,163,184,.15); }
.xp-engine { box-shadow: inset 0 0 0 2px rgba(52,211,153,.8); }
.xp-san { width: 52px; flex-shrink: 0; font-size: 18px; font-weight: 800; color: #0f172a; }
.dark .xp-san { color: #fff; }
.xp-row:hover .xp-san { color: #2563eb; }
.xp-games { width: 46px; flex-shrink: 0; text-align: right; font-size: 14px; font-weight: 600; color: #94a3b8;
  font-variant-numeric: tabular-nums; }
.xp-result { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.xp-result-pct { justify-content: flex-end; }
.xp-pct { min-width: 48px; text-align: right; font-size: 18px; font-weight: 800; color: #334155;
  font-variant-numeric: tabular-nums; }
.dark .xp-pct { color: #e2e8f0; }
.xp-pct.xp-good { color: #15803d; }
.xp-pct.xp-bad { color: #b91c1c; }
.dark .xp-pct.xp-good { color: #4ade80; }
.dark .xp-pct.xp-bad { color: #f87171; }
.xp-bar { flex: 1; min-width: 0; display: flex; height: 22px; border-radius: 6px; overflow: hidden;
  font-size: 13px; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(100,116,139,.45); }
.xp-bar > div { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.xp-bar-empty { background: rgba(148,163,184,.15); }
.xp-w { background: #fff; color: #334155; }
.xp-d { background: #94a3b8; color: #fff; }
.xp-b { background: #1e293b; color: #fff; }
/* The other view, after a deliberate hover (0.7 s), never a flicker. */
.xp-pop { position: absolute; right: 0; bottom: calc(100% + 4px); z-index: 30; padding: 6px 10px; border-radius: 8px;
  background: #0f172a; color: #fff; font-size: 14px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s 0s, visibility 0s .15s; }
.xp-pop-bar { width: 220px; padding: 6px; }
.xp-row:hover .xp-pop { opacity: 1; visibility: visible; transition: opacity .15s .7s, visibility 0s .7s; }

/* The Summer Camp welcome banner (#camp-banner, z 610) sat on top of the
   worksheet builder's toolbar when /worksheet opened inside its 10 seconds.
   An open worksheet builder hides it (2026-11-21). */
body:has(#worksheet-modal:not(.hidden)) #camp-banner { display: none !important; }

/* ==========================================================================
   CHESS CLUB LOOK (2026-11-21): Settings → Graphics → Quick looks → Chess Club,
   or Background → Chess Club. Colours from the STUDENT-1 mockup
   (art-source/student/student-phone.png). Light mode only; dark mode ignores it.
   ========================================================================== */
html:not(.dark) body.club-look { color: #1B2A24; }
html:not(.dark) body.club-look .glass-panel {
  background: #FFFDF7;
  border: 1px solid #E3D9C3;
  box-shadow: 0 6px 24px -12px rgba(25, 82, 66, 0.25);
}
html:not(.dark) body.club-look #main-footer { border-top-color: #E3D9C3; }
html:not(.dark) body.club-look #scoresheet-panel { --ss-paper: #FFFDF7; --ss-ink: #1B2A24; --ss-accent: #195242; --ss-cur-bg: rgba(25, 82, 66, 0.12); --ss-cur-ink: #195242; --ss-hover: rgba(25, 82, 66, 0.07); }
/* Chess Club accents: the app's blue becomes the mockup's dark green (#195242),
   only while Chess Club is picked, light mode only. Tailwind classes come from
   vendor/tailwindcss.js at runtime, so they are overridden by name here. */
html:not(.dark) body.club-look #settings-modal,
html:not(.dark) body.club-look #printsheet-modal .ps-card,
html:not(.dark) body.club-look #library-grid { --st-accent: #195242 !important; --ps-accent: #195242 !important; --lg-accent: #195242 !important; }
html:not(.dark) body.club-look .bg-blue-500,
html:not(.dark) body.club-look .bg-blue-600,
html:not(.dark) body.club-look .bg-indigo-600,
html:not(.dark) body.club-look #setting-timer-length button[aria-pressed="true"],
html:not(.dark) body.club-look #plib-bar button.plib-primary { background-color: #195242 !important; }
html:not(.dark) body.club-look .bg-blue-700,
html:not(.dark) body.club-look .hover\:bg-blue-700:hover,
html:not(.dark) body.club-look .hover\:bg-blue-600:hover,
html:not(.dark) body.club-look .hover\:bg-blue-500:hover { background-color: #12402F !important; }
html:not(.dark) body.club-look .bg-blue-50,
html:not(.dark) body.club-look .bg-blue-100 { background-color: #E6EFE5 !important; }
html:not(.dark) body.club-look .text-blue-500,
html:not(.dark) body.club-look .text-blue-600,
html:not(.dark) body.club-look .text-blue-700,
html:not(.dark) body.club-look .gfx-link { color: #195242 !important; }
html:not(.dark) body.club-look .border-blue-400,
html:not(.dark) body.club-look .border-blue-500,
html:not(.dark) body.club-look .border-blue-600,
html:not(.dark) body.club-look .gfx-look.on { border-color: #195242 !important; }
html:not(.dark) body.club-look .ring-blue-500 { --tw-ring-color: #195242 !important; }

/* The Staunton pawn board shares the app's background through its transparent viewer. */
#board-surface.pawn-structure-3d-active { background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
#board-surface.pawn-structure-3d-active > :not(#pawn-structure-3d) { visibility: hidden; }
#board-wrapper.pawn-structure-3d-active :is(#rank-labels, #rank-labels-right, #file-labels) { visibility: hidden; }

/* Ink artwork uses its own lettering, with an inverse for dark surfaces. */
#footer-author, #footer-link { min-width: 0; }
#footer-author:focus-visible, #footer-link:focus-visible { outline: 2px solid #2962ff; outline-offset: 3px; border-radius: 3px; }
.footer-ink { display: block; object-fit: contain; height: 38px; width: auto; max-width: 210px; }
#footer-link .footer-ink { max-width: 170px; height: 32px; }
.dark .footer-ink { filter: invert(1); }
@media (max-width: 640px) {
  #footer-author .footer-ink { max-width: 40vw; height: 34px; }
  #footer-link .footer-ink { max-width: 36vw; height: 28px; }
}

/* Stopwatch (js/features/stopwatch.js): a question is open. Above the board's
   top-left corner, never over a square; only the pill takes clicks. */
#stopwatch { position: fixed; left: -999px; top: 0; z-index: 70; display: inline-flex; align-items: baseline; gap: 2px;
  padding: 6px 12px 6px 10px; border-radius: 14px; cursor: pointer; user-select: none; -webkit-user-select: none;
  --sw: #60a5fa; color: #f1f5f9; background: rgba(15, 23, 42, 0.86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid color-mix(in srgb, var(--sw) 70%, transparent); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  font: 700 clamp(1.1rem, 1.6vw, 1.6rem)/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums;
  transition: opacity 0.4s, border-color 0.3s; }
#stopwatch.hidden { display: none; }
#stopwatch[data-kind="predict"] { --sw: #a78bfa; }
#stopwatch[data-kind="manual"] { --sw: #94a3b8; }
#stopwatch .sw-dot { align-self: center; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: var(--sw);
  box-shadow: 0 0 0 0 var(--sw); animation: sw-pulse 1s ease-out infinite; }
#stopwatch .sw-ms { font-size: 0.62em; opacity: 0.7; min-width: 2.4em; }
#stopwatch.sw-paused .sw-dot { animation: none; opacity: 0.5; }
#stopwatch.sw-done { --sw: #4ade80; }
#stopwatch.sw-urgent { --sw: #f87171; color: #fecaca; }
#stopwatch.sw-zero { --sw: #ef4444; color: #fca5a5; }
@keyframes sw-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sw) 70%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
@media (prefers-reduced-motion: reduce) { #stopwatch .sw-dot { animation: none; } }
.teaching-mode #stopwatch { font-size: 2.2rem; }
#stopwatch-menu { position: fixed; z-index: 74; min-width: 230px; padding: 8px; border-radius: 14px; background: #1e2430; color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); font: 600 14px/1.3 system-ui, -apple-system, sans-serif; }
#stopwatch-menu .swm-h { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #94a3b8; padding: 6px 8px 4px; }
#stopwatch-menu button { display: block; width: 100%; text-align: left; padding: 7px 8px; border-radius: 8px; color: inherit; background: none; }
#stopwatch-menu button:hover, #stopwatch-menu button:focus-visible { background: rgba(255, 255, 255, 0.08); outline: none; }
#stopwatch-menu .swm-row { display: flex; gap: 4px; padding: 0 4px 4px; }
#stopwatch-menu .swm-row button { flex: 1; text-align: center; padding: 7px 4px; background: rgba(255, 255, 255, 0.05); }
#stopwatch-menu input[type="text"] { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 8px; background: #0f172a; color: #f1f5f9; border: 1px solid #334155; }
#stopwatch-menu .swm-chk { display: flex; align-items: center; gap: 8px; padding: 7px 8px; cursor: pointer; }
#stopwatch-menu .swm-sep { height: 1px; margin: 6px 4px; background: rgba(255, 255, 255, 0.08); }
