/* Shared workspace shell. Layout only; colours come from --ws-* tokens each game maps to its own theme. */
:root {
  --ws-bg: var(--surface, #1b1b1b); --ws-bg-2: var(--surface-2, #242424); --ws-line: var(--line, #3a3a3a);
  --ws-text: var(--fg, #eee); --ws-dim: var(--fg-dim, #aaa); --ws-accent: var(--brass, #d8b06a);
  --ws-live: var(--brass, #d8b06a); --ws-ok: var(--ok, #8cc084); --ws-bad: var(--bad, #e0735b);
  --ws-mono: var(--font-mono, ui-monospace, monospace); --ws-bar-h: 34px;
}
body[data-game=sql] { --ws-live: var(--mt-live); --ws-accent: var(--mt-gold); --ws-bg: var(--mt-surface); --ws-bg-2: var(--mt-surface-2); --ws-line: var(--mt-line-solid); }

/* Hidden outside play. */
.ws-crumb, .ws-inspector, .ws-statusbar { display: none; }
.ws-console-empty[hidden] { display: none; }

/* Editor frame (always on: the real textarea sits beside a synced gutter). */
.ws-editor { border: 1px solid var(--ws-line); border-radius: 8px; overflow: hidden; background: var(--ws-bg-2); margin-top: 6px; }
.ws-tab { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 12px; border-bottom: 1px solid var(--ws-line); font: 12px var(--ws-mono); color: var(--ws-dim); }
.ws-file { color: var(--ws-text); border-bottom: 2px solid var(--ws-accent); padding-bottom: 2px; }
.ws-editor-body { display: flex; align-items: stretch; }
.ws-gutter { margin: 0; padding: 12px 8px 12px 10px; min-width: 2.6em; text-align: right; font: 14px/1.5 var(--ws-mono); color: var(--ws-dim); background: transparent; border-right: 1px solid var(--ws-line); overflow: hidden; user-select: none; white-space: pre; }
.ws-editor-body textarea { flex: 1; min-width: 0; border: 0 !important; border-radius: 0 !important; margin: 0 !important; white-space: pre; overflow-wrap: normal; overflow-x: auto; font-family: var(--ws-mono) !important; line-height: 1.5 !important; box-shadow: none !important; }

/* Brief + console. */
.ws-brief > summary { cursor: pointer; font: 600 12px var(--ws-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ws-dim); padding: 4px 0; min-height: 32px; display: flex; align-items: center; }
.ws-console { margin-top: 14px; border: 1px solid var(--ws-line); border-radius: 8px; background: var(--ws-bg-2); padding: 0 12px 10px; font-family: var(--ws-mono); }
.ws-console-head { font: 600 12px var(--ws-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ws-dim); padding: 8px 0; border-bottom: 1px solid var(--ws-line); margin-bottom: 8px; }
.ws-console-empty { margin: 4px 0; font-size: 13px; color: var(--ws-dim); }
.ws-console .result-heading::before, .ws-console .sub::before { content: '> '; color: var(--ws-accent); }

/* ---- Play mode ---- */
body.ws-on .ws-crumb { display: flex; align-items: center; gap: 10px; flex: 1 1 100%; min-width: 0; }
.ws-crumb-list { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; font: 13px var(--ws-mono); color: var(--ws-dim); min-width: 0; }
.ws-crumb-list li + li::before { content: '›'; margin: 0 6px; color: var(--ws-accent); }
.ws-crumb-list li:last-child { color: var(--ws-text); }
.ws-explorer-btn, .ws-sheet-btn, .ws-tabbtn { font: 600 12px var(--ws-mono); color: var(--ws-text); background: transparent; border: 1px solid var(--ws-line); border-radius: 6px; padding: 6px 10px; min-height: 32px; cursor: pointer; }
.ws-explorer-btn[aria-expanded=true], .ws-tabbtn[aria-selected=true] { border-color: var(--ws-accent); color: var(--ws-accent); }
:is(.ws-explorer-btn, .ws-sheet-btn, .ws-tabbtn):focus-visible { outline: 2px solid var(--ws-accent); outline-offset: 2px; }

body.ws-on :is(.sql-instrument-header, #sqlFilterBar, .ws-deck > .stack + .stack) { display: none !important; }
body.ws-on .ws-deck { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) !important; }
body.ws-on .ws-inspector { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 12px; max-height: calc(100vh - var(--ws-bar-h) - 24px); overflow: auto; min-width: 0; }
.ws-insp-head { font: 600 12px var(--ws-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ws-dim); }
.ws-tabs { display: none; }
.ws-sec { border: 1px solid var(--ws-line); border-radius: 8px; background: var(--ws-bg); padding: 0 12px; }
.ws-sec > summary { cursor: pointer; padding: 10px 0; min-height: 40px; font: 600 12px var(--ws-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ws-accent); }
.ws-sec-body { padding-bottom: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ws-sec-body > .card, .ws-sec-body > details.card { margin: 0; box-shadow: none !important; }
.ws-line { margin: 0; font: 13px/1.5 var(--ws-mono); color: var(--ws-text); }
.ws-think { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; font-size: 14px; color: var(--ws-dim); }
.ws-think b { color: var(--ws-text); font-family: var(--ws-mono); font-size: 13px; margin-right: 4px; }
.ws-think li.current { color: var(--ws-text); border-left: 2px solid var(--ws-live); padding-left: 8px; margin-left: -10px; }
.ws-think li.current b { color: var(--ws-live); }
/* Docked stopwatch: same panel and logic, new place. */
body.ws-on .ws-sec-body .sql-speed-panel { position: static !important; transform: none !important; width: auto !important; max-width: none; box-shadow: none !important; border: 0 !important; background: transparent !important; padding: 0 !important; }
body.ws-on .ws-sec-body .sql-speed-panel .speed-body { display: block !important; }
body.ws-on .ws-sec-body .sql-speed-panel .speed-toggle { display: none; }
body.ws-on .ws-sec-body .sql-speed-panel { visibility: visible !important; opacity: 1 !important; }
body.ws-on .ws-sec-body .weekly { margin-left: 0; }
body[data-game=sql].ws-on { padding-right: 24px !important; padding-bottom: calc(var(--ws-bar-h) + 24px) !important; }
body[data-game=sql].ws-on .sitenav { margin-right: 0 !important; }

body.ws-on .ws-statusbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; min-height: var(--ws-bar-h); align-items: center; justify-content: space-between; gap: 12px; padding: 4px 14px; background: var(--ws-bg); border-top: 1px solid var(--ws-line); font: 12px var(--ws-mono); color: var(--ws-dim); }
.ws-status-items { display: flex; gap: 18px; min-width: 0; overflow: hidden; white-space: nowrap; }
.ws-status-items span { overflow: hidden; text-overflow: ellipsis; }
.ws-status-items span:nth-child(2) { color: var(--ws-live); }
.ws-sheet-btn { display: none; }
body.ws-on .alex { bottom: calc(var(--ws-bar-h) + 16px) !important; }

/* Explorer: the hub as a side panel while playing. */
body.ws-on.ws-explorer .ws-explorer-panel { display: block !important; position: fixed; z-index: 45; left: 0; top: 0; bottom: var(--ws-bar-h); width: min(560px, 92vw); overflow: auto; padding: 18px; background: var(--ws-bg); border-right: 1px solid var(--ws-accent); box-shadow: 0 0 40px rgb(0 0 0 / .5); }
.ws-explorer-close { display: none; position: sticky; top: 6px; z-index: 3; margin: 0 0 8px auto; align-items: center; justify-content: center; width: 44px; height: 44px; background: var(--ws-bg); border: 1px solid var(--ws-line); border-radius: 50%; color: var(--ws-text); font: 600 16px/1 var(--ws-mono, inherit); cursor: pointer; }
body.ws-on.ws-explorer .ws-explorer-close { display: flex; }
.ws-sheet-close { display: none; flex: none; margin-left: auto; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; background: var(--ws-bg); border: 1px solid var(--ws-line); border-radius: 50%; color: var(--ws-text); font: 600 16px/1 var(--ws-mono, inherit); cursor: pointer; }
body.ws-on.ws-sheet-open .ws-sheet-close { display: inline-flex; }
.ws-explorer-close:focus-visible, .ws-sheet-close:focus-visible { outline: 2px solid var(--ws-accent); outline-offset: 2px; }

/* ---- Phones / small tablets: editor full width, Inspector as a bottom sheet with tabs ---- */
@media (max-width: 819px) {
  body.ws-on .ws-deck { grid-template-columns: minmax(0, 1fr) !important; }
  body.ws-on .ws-inspector { position: fixed; left: 0; right: 0; bottom: var(--ws-bar-h); top: auto; z-index: 41; max-height: 58vh; padding: 10px 12px 12px; background: var(--ws-bg); border-top: 1px solid var(--ws-accent); border-radius: 12px 12px 0 0; transform: translateY(110%); visibility: hidden; transition: transform .2s ease, visibility .2s; }
  body.ws-on.ws-sheet-open .ws-inspector { transform: none; visibility: visible; }
  body.ws-on.ws-sheet-open { padding-bottom: calc(58vh + var(--ws-bar-h) + 12px) !important; }
  .ws-insp-head { display: none; }
  body.ws-on .ws-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; flex: none; }
  .ws-tabbtn { min-height: 44px; white-space: nowrap; }
  body.ws-on .ws-sec { display: none; }
  body.ws-on .ws-sec[data-active=true] { display: block; }
  body.ws-on .ws-sec > summary { pointer-events: none; }
  body.ws-on .ws-sheet-btn { display: inline-flex; align-items: center; min-height: 40px; }
  body.ws-on .ws-statusbar { --ws-bar-h: 48px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  body.ws-on { --ws-bar-h: 48px; }
  .ws-status-items { gap: 10px; }
  .ws-status-items span:nth-child(3) { display: none; }
  body.ws-on .alex { bottom: calc(var(--ws-bar-h) + 12px) !important; }
  body.ws-on.ws-sheet-open .alex { visibility: hidden; }
  .ws-kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ws-inspector { transition: none !important; } }
.ws-editor-body { flex-wrap: wrap; }
.ws-editor-body > textarea { flex: 1 1 0; }
.ws-editor-body > :not(.ws-gutter):not(textarea) { flex: 1 1 100%; margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; }
.ws-tabs { min-width: 0; max-width: 100%; }
body.ws-on .ws-sec #dailyCard { display: flex !important; }
/* Keep scrolled-to controls clear of the status bar and Alex. */
html:has(body.ws-on) { scroll-padding-bottom: calc(var(--ws-bar-h, 34px) + 120px); }
@media (max-width: 819px) { html:has(body.ws-on) { scroll-padding-bottom: 40vh; } }
body.ws-on.ws-alex-tuck .alex { top: 84px; bottom: auto !important; flex-direction: column-reverse; }

/* ---- Three columns: Dashboard · Editor · Inspector (decluttered) ---- */
.ws-dash { display: none; }
body.ws-on .ws-dash { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 12px; max-height: calc(100vh - var(--ws-bar-h) - 24px); overflow: auto; min-width: 0; }
.ws-rail-btn { display: none; }
@media (min-width: 1200px) { body.ws-on .ws-deck:has(.ws-dash) { grid-template-columns: minmax(220px, 1fr) minmax(420px, 2.4fr) minmax(260px, 1.3fr) !important; gap: 28px; } }
/* One home per fact: during play these live in the dashboard / status bar only. */
body.ws-on .topbar > :is(#xp, #rankbox, #combo, #dayStreak, #streak, #difficultyPill) { display: none !important; }
/* Fewer boxes: one surface per column, sections separated by hairlines. */
body.ws-on :is(.ws-dash, .ws-inspector) .ws-sec { border: 0; border-radius: 0; background: transparent; padding: 0; border-bottom: 1px solid color-mix(in srgb, var(--ws-line) 60%, transparent); }
body.ws-on :is(.ws-dash, .ws-inspector) .ws-sec > summary { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font: 600 12px var(--ws-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ws-dim); padding: 12px 0; }
.ws-sum { text-transform: none; letter-spacing: 0; font: 600 14px var(--ws-mono); color: var(--ws-text); margin-left: auto; }
.ws-sum:empty { display: none; }
.ws-ic { width: 1.4em; text-align: center; color: var(--ws-accent); }
.ws-num { font: 600 20px/1.2 var(--ws-mono); color: var(--ws-text); }
.ws-kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: 14px; }
.ws-kv dt { font-size: 12px; color: var(--ws-dim); } .ws-kv dd { margin: 0; font: 600 14px var(--ws-mono); color: var(--ws-text); text-align: right; }
.ws-muted { margin: 0; font-size: 12px; color: var(--ws-dim); }
.ws-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }
.ws-list li { display: flex; justify-content: space-between; gap: 8px; }
.ws-list li[aria-current] { color: var(--ws-accent); font-weight: 600; }
.ws-list li.dim { color: var(--ws-dim); }
.ws-bars { display: flex; gap: 4px; align-items: flex-end; height: 32px; }
.ws-bars i { flex: 1; background: var(--ws-accent); opacity: .75; min-height: 2px; border-radius: 2px; }
.ws-dash .ws-primary { width: 100%; }
.ws-info { font: 12px var(--ws-mono); color: var(--ws-dim); background: none; border: 1px solid var(--ws-line); border-radius: 50%; width: 22px; height: 22px; cursor: help; }
body.ws-on .ws-sec-body > :is(.card, details.card) { border: 0 !important; background: transparent !important; padding: 0 !important; }
/* Density */
body.ws-compact.ws-on :is(.ws-dash, .ws-inspector) .ws-sec > summary { padding: 6px 0; min-height: 32px; }
body.ws-compact.ws-on .ws-sec-body { gap: 6px; padding-bottom: 8px; }
body.ws-compact.ws-on .ws-deck { gap: 16px !important; }
/* Focus mode: editor only; everything else one keypress away. */
body.ws-on.ws-focus :is(.ws-dash, .ws-inspector) { display: none !important; }
body.ws-on.ws-focus .ws-deck { grid-template-columns: minmax(0, 1fr) !important; max-width: 980px; margin-inline: auto; }
.ws-focus-btn[aria-pressed=true] { border-color: var(--ws-accent); color: var(--ws-accent); }
/* Rail (820-1199px): icons only, expands as an overlay. */
@media (min-width: 820px) and (max-width: 1199px) {
  body.ws-on .ws-deck:has(.ws-dash) { grid-template-columns: 56px minmax(0, 3fr) minmax(0, 2fr) !important; }
  body.ws-on .ws-rail-btn { display: block; font: 600 12px var(--ws-mono); writing-mode: vertical-rl; background: none; border: 1px solid var(--ws-line); border-radius: 6px; color: var(--ws-text); padding: 10px 6px; min-height: 44px; cursor: pointer; }
  body.ws-on:not(.ws-dash-open) .ws-dash .ws-sec > summary { justify-content: center; padding: 10px 0; min-height: 44px; }
  body.ws-on:not(.ws-dash-open) .ws-dash :is(.ws-sum-label, .ws-sum, .ws-sec-body) { display: none; }
  body.ws-on.ws-dash-open .ws-dash { position: fixed; z-index: 44; left: 0; top: 0; bottom: var(--ws-bar-h); width: min(340px, 90vw); max-height: none; padding: 16px; background: var(--ws-bg); border-right: 1px solid var(--ws-accent); }
  body.ws-on.ws-dash-open .ws-rail-btn { writing-mode: horizontal-tb; }
}
/* Phones: dashboard is the Home tab of the bottom sheet. */
@media (max-width: 819px) {
  body.ws-on .ws-dash { display: none; }
  body.ws-on.ws-sheet-open.ws-home .ws-dash { display: flex; position: fixed; left: 0; right: 0; top: auto; bottom: calc(var(--ws-bar-h) + 70px); border-top: 1px solid var(--ws-accent); border-radius: 12px 12px 0 0; padding-top: 8px !important; z-index: 42; max-height: calc(58vh - 64px); padding: 0 12px 12px; background: var(--ws-bg); }
  body.ws-on.ws-home .ws-inspector .ws-sec { display: none !important; }
  body.ws-on .ws-dash .ws-sec { display: block; }
  body.ws-on .ws-dash .ws-sec > summary { pointer-events: auto; }
  body.ws-on.ws-sheet-open.ws-home .ws-dash { overflow: auto; }
  /* Run / Check stay visible above the keyboard. */
  body.ws-on #editorUI > .row { position: sticky; bottom: calc(var(--ws-bar-h) + 4px); z-index: 30; background: var(--ws-bg); padding: 8px 0; margin-top: 8px !important; }
}
@media (min-width: 820px) { body.ws-on .ws-deck:has(.ws-dash) > .ws-col { grid-column: 2; grid-row: 1; } body.ws-on .ws-deck:has(.ws-dash) > .ws-inspector { grid-column: 3; grid-row: 1; } body.ws-on .ws-deck > .ws-dash { grid-column: 1; grid-row: 1; } body.ws-on.ws-focus .ws-deck > .ws-col { grid-column: 1 !important; } }

/* ---- Python Forge opt-in: same shell, ember/copper tokens, its own page structure ---- */
body[data-game=python] { --ws-live: var(--forge-ember); --ws-accent: var(--forge-copper, var(--forge-ember)); --ws-bg: var(--forge-surface); --ws-bg-2: var(--forge-surface-2); --ws-line: var(--forge-line-solid); --ws-text: var(--forge-text); --ws-dim: var(--forge-text-dim); }
body[data-game=python].ws-on { padding-bottom: calc(var(--ws-bar-h) + 24px) !important; }
body[data-game=python].ws-on .wrap { max-width: 1680px; }
body[data-game=python].ws-on :is(.forge-hero, .py-reference) { display: none !important; }
body[data-game=python].ws-on .ws-deck { display: grid; gap: 28px; align-items: start; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
body[data-game=python].ws-on .ws-deck > #mapScreen:not(.ws-explorer-panel) { display: none; }
body[data-game=python].ws-on.ws-explorer .ws-deck > #mapScreen { display: block !important; }
body[data-game=python].ws-on .play-layout { grid-template-columns: minmax(0, 1fr) !important; grid-template-areas: "data" "editor" !important; }
body[data-game=python].ws-on .ws-sec-body :is(#stopwatchSwitch, #practiceChip) { align-self: flex-start; }
@media (max-width: 819px) { body[data-game=python].ws-on .ws-deck { grid-template-columns: minmax(0, 1fr) !important; } }
/* Run/Reset/Ask Alex stay in reach above the status bar while the board and editor scroll. */
body[data-game=python].ws-on .coding > .row:has(#runBtn) { position: sticky; bottom: calc(var(--ws-bar-h) + 6px); z-index: 5; background: var(--ws-bg); padding: 8px 0; border-top: 1px solid var(--ws-line); }
body[data-game=sql].ws-on.ws-explorer .ws-explorer-panel { background: var(--mt-bg) !important; isolation: isolate; }

/* ===== Calm layout (both games): one thing to do, the rest pulled on demand ===== */
/* Play screen: question, editor, Run/Check, console and one thin status line. */
body.ws-calm.ws-on .ws-deck { grid-template-columns: minmax(0, 1fr) !important; width: 100% !important; max-width: 900px !important; margin-inline: auto !important; gap: 0 !important; box-sizing: border-box; }
body.ws-calm.ws-on .ws-deck > .ws-col { grid-column: 1 !important; grid-row: 1; }
body.ws-calm.ws-on .topbar > :not(.ws-crumb) { display: none !important; }
body.ws-calm.ws-on .topbar { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 0 !important; min-height: 0; margin-bottom: 8px; }
body.ws-calm .ws-focus-btn, body.ws-calm .ws-rail-btn, body.ws-calm .ws-insp-head { display: none !important; }
body.ws-calm.ws-on :is(#modeTag, #trackTag, #levelDiffPips) { display: none !important; }
body.ws-calm.ws-on #questionDots { display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px; }
body.ws-calm.ws-on:not(.ws-extras) :is(#alexBtn, #hintBtn, #conceptBtn, #pySymbols, #sqlSymbols, .sym-help) { display: none !important; }
.ws-bar-btns { display: flex; gap: 4px; flex: none; }
.ws-help-btn { display: none; }
body.ws-calm.ws-on .ws-help-btn { display: inline-flex; }
body.ws-calm.ws-on .ws-tabbtn { background: transparent !important; }
body.ws-calm.ws-on .ws-kbd, body.ws-calm.ws-on .alex-tag { display: none !important; }
body.ws-calm.ws-on .ws-crumb-list li + li::before, body.ws-calm.ws-on .ws-console .result-heading::before, body.ws-calm.ws-on .ws-console .sub::before { color: var(--ws-dim); }
body.ws-calm.ws-on .ws-file { border-bottom-color: var(--ws-line); }
body.ws-calm.ws-on .ws-explorer-btn[aria-expanded=true] { border-color: var(--ws-text); color: var(--ws-text); }
body.ws-calm.ws-on .ws-status-items span:nth-child(n+3) { display: none; }
body.ws-calm.ws-on .ws-status-items span:nth-child(2) { color: var(--ws-dim); }
body.ws-calm.ws-on .ws-sheet-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; border-color: transparent; color: var(--ws-dim); }
body.ws-calm.ws-on .ws-sheet-btn:hover, body.ws-calm.ws-on .ws-sheet-btn[aria-expanded=true] { color: var(--ws-text); border-color: var(--ws-line); }
.ws-keyhint { font: 11px var(--ws-mono); color: var(--ws-dim); opacity: .85; }

/* Drawer: Today + the Inspector tabs, one section at a time, on top of the page. */
body.ws-calm.ws-on .ws-inspector { display: flex; flex-direction: column; gap: 14px; position: fixed; z-index: 46; top: 0; right: 0; bottom: var(--ws-bar-h); left: auto; width: min(400px, 100vw); max-height: none; overflow: auto; padding: 20px 22px 24px; background: var(--ws-bg); border-left: 1px solid var(--ws-line); border-top: 0; border-radius: 0; box-shadow: -24px 0 48px rgb(0 0 0 / .35); transform: none; transition: none; visibility: hidden; }
body.ws-calm.ws-on.ws-sheet-open .ws-inspector { visibility: visible; }
body.ws-calm.ws-on:not(.ws-sheet-open) .ws-inspector * { visibility: hidden; }
body.ws-calm.ws-on .ws-tabs { display: flex; flex-wrap: wrap; gap: 2px 14px; padding: 0 0 6px; border-bottom: 1px solid color-mix(in srgb, var(--ws-line) 60%, transparent); overflow: visible; }
body.ws-calm.ws-on .ws-tabbtn { border: 0; border-radius: 0; padding: 6px 0; min-height: 44px; color: var(--ws-dim); font-weight: 500; }
body.ws-calm.ws-on .ws-tabbtn[aria-selected=true] { color: var(--ws-text); box-shadow: inset 0 -1px 0 var(--ws-text); }
body.ws-calm.ws-on .ws-inspector > .ws-sec { display: none !important; }
body.ws-calm.ws-on:not(.ws-home) .ws-inspector > .ws-sec[data-active=true] { display: block !important; }
body.ws-calm.ws-on .ws-inspector > .ws-sec > summary { pointer-events: none; }
body.ws-calm.ws-on .ws-inspector > .ws-sec > summary::-webkit-details-marker { display: none; }
body.ws-calm.ws-on .ws-dash { display: none !important; position: static; max-height: none; overflow: visible; padding: 0; border: 0; background: transparent; }
body.ws-calm.ws-on.ws-home .ws-dash { display: flex !important; flex-direction: column; gap: 0; }
body.ws-calm.ws-on .ws-dash .ws-sec { display: block !important; }
body.ws-calm.ws-on :is(.ws-dash, .ws-inspector) .ws-sec { border-bottom-color: color-mix(in srgb, var(--ws-line) 45%, transparent); }
body.ws-calm.ws-on .ws-sec > summary { color: var(--ws-dim); font-weight: 500; }
body.ws-calm.ws-on .ws-sec-body { gap: 12px; padding-bottom: 16px; font-size: 14px; line-height: 1.6; }
body.ws-calm.ws-on .ws-ic { color: var(--ws-dim); }
body.ws-calm.ws-on .ws-list li[aria-current] { color: var(--ws-text); }
body.ws-calm.ws-on .ws-bars i { background: var(--ws-dim); opacity: .6; }
body.ws-calm.ws-on .ws-think li.current { border-left-color: var(--ws-text); }
body.ws-calm.ws-on .ws-think li.current b { color: var(--ws-text); }
.ws-more > summary { cursor: pointer; font: 12px var(--ws-mono); color: var(--ws-dim); min-height: 44px; display: flex; align-items: center; list-style: none; }
.ws-more > summary::before { content: '›'; margin-right: 8px; display: inline-block; }
.ws-more[open] > summary::before { transform: rotate(90deg); }
.ws-more[open] { display: flex; flex-direction: column; gap: 12px; }
.ws-sec[data-sec=think]:not(:has(.ws-more[open])) .ws-think li:not(.current) { display: none; }
.ws-sec[data-sec=think]:not(:has(.ws-more[open])) .ws-think { padding-left: 0; list-style: none; }
body.ws-calm.ws-on.ws-sheet-open { padding-bottom: calc(var(--ws-bar-h) + 24px) !important; }
body.ws-calm.ws-on.ws-sheet-open .alex { visibility: hidden; }
@media (max-width: 819px) {
  body.ws-calm.ws-on .ws-inspector { top: auto; left: 0; width: auto; max-height: 72vh; border-left: 0; border-top: 1px solid var(--ws-line); border-radius: 12px 12px 0 0; box-shadow: 0 -24px 48px rgb(0 0 0 / .35); }
  body.ws-calm.ws-on.ws-sheet-open .ws-dash { position: static; max-height: none; }
  .ws-keyhint { display: none; }
}

/* Home / map screen: hero, Continue, one rank line and the track list; the rest behind "More". */
.ws-hub-more { display: none; }
body.ws-hub-calm:not(.ws-on) .ws-hub-more { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; margin: 24px 0 8px; padding: 12px 0; background: none; border: 0; border-top: 1px solid color-mix(in srgb, var(--ws-line) 60%, transparent); color: var(--ws-text); font: 500 14px inherit; text-align: left; cursor: pointer; }
.ws-hub-more::after { content: '›'; color: var(--ws-dim); font-size: 18px; order: 3; }
.ws-hub-more[aria-expanded=true]::after { transform: rotate(90deg); }
.ws-hub-more-hint { margin-left: auto; font-size: 12px; color: var(--ws-dim); }
.ws-hub-more:focus-visible { outline: 2px solid var(--ws-text); outline-offset: 3px; }
/* SQL */
body[data-game=sql].ws-hub-calm:not(.ws-on):not(.ws-hub-open) :is(#heroDailyBtn, .topbar > #xp, .topbar > #combo, .topbar > #dayStreak, .topbar > #difficultyPill, #shareRankBtn, .topbar .gk-btn, #sqlFilterBar, .sql-speed-panel, #album > .player-panel, .album-head > button, #sqlRunner, #dailyCard, .sql-dial, #sqlKitchen, .sql-folds, .album-tools, #shelf, .deck, .world-tools, .world .kitchen-card, .world-info) { display: none !important; }
/* Python */
body[data-game=python].ws-hub-calm:not(.ws-on):not(.ws-hub-open) :is(#heroDailyBtn, .topbar > #xp, .topbar > #streak, .topbar > #difficultyPill, .topbar .diff-group, #stopwatchSwitch, #practiceChip, #shareRankBtn, .topbar .gk-btn, #mapScreen > .player-panel, #mapScreen > .album-head > button, #pyRunner, .py-stage-count, #pyDiffSummary, .py-unlock-note, .game-folds, #pythonKitchen, .py-reference, .world .kitchen-card, .world-done, .world-title > span, .level-dot small, .level-dot .pips, .level-dot [class*=pip]) { display: none !important; }
body.ws-hub-calm:not(.ws-on):not(.ws-hub-open) .topbar.game-status { min-height: 0; padding-block: 10px !important; }
body.ws-hub-calm:not(.ws-on) .world-count { font: 12px var(--ws-mono); color: var(--ws-dim); margin-left: auto; }
/* Calm drawer overrides the old 820-1199px icon rail. */
body.ws-calm.ws-on .ws-dash :is(.ws-sum-label, .ws-sum) { display: inline !important; }
body.ws-calm.ws-on .ws-dash .ws-sum:empty { display: none !important; }
body.ws-calm.ws-on .ws-dash .ws-sec-body { display: flex !important; }
body.ws-calm.ws-on .ws-dash .ws-sec > summary { justify-content: flex-start !important; }
/* Python world list on the home screen: plain names, hairlines, tiny n/4. */
body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap { display: block !important; max-width: 760px; }
body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap .world { border: 0 !important; border-bottom: 1px solid color-mix(in srgb, var(--ws-line) 60%, transparent) !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; padding: 14px 0 !important; margin: 0 !important; }
body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap .world-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; cursor: pointer; min-height: 44px; }
body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap .world-disc { width: auto !important; height: auto !important; min-width: 1.4em; background: none !important; border: 0 !important; box-shadow: none !important; font: 12px var(--ws-mono) !important; color: var(--ws-dim) !important; }
body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap .world-disc::before, body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap .world-disc::after { display: none !important; }
body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap .world-title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 18px; color: var(--ws-text); }
body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap .world:not([open]) .world-title { color: var(--ws-dim); }
body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap .world-lock { font-size: 12px; color: var(--ws-dim); }
body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap .dots { gap: 16px; padding: 12px 0 4px 2.4em; }
body[data-game=python].ws-hub-calm:not(.ws-on) #worldMap .next-tag { background: none !important; color: var(--ws-text) !important; box-shadow: none !important; font-size: 11px; }
body.ws-hub-calm:not(.ws-on) .topbar.game-status { background: transparent !important; border: 0 !important; box-shadow: none !important; padding-inline: 0 !important; }
body.ws-calm.ws-on .ws-dash { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; padding: 0 !important; }
/* Visible control boundaries (WCAG 1.4.11) for the quiet toggles. */
body.ws-calm.ws-on .ws-sheet-btn { border: 1px solid var(--ws-dim) !important; border-radius: 6px; padding: 4px 12px; }
body.ws-hub-calm:not(.ws-on) .ws-hub-more { border: 1px solid var(--ws-dim); border-radius: 8px; padding: 12px 16px; }
body.ws-on .ws-explorer-btn { white-space: nowrap; flex: none; }
body[data-game=python].ws-hub-calm:not(.ws-on):not(.ws-hub-open) #pyModes #weakBtn { display: none !important; }

/* SQL prerequisites remain in the play column, never in a brief or Inspector fold. */
body[data-game=sql] #deepUI { margin: 16px 0; padding-block: 12px; border-block: 1px solid var(--mt-line-solid); }
body[data-game=sql] #deepUI[hidden], body[data-game=sql] #deepUI [hidden] { display: none !important; }
body[data-game=sql] #deepUI .choices { grid-template-columns: minmax(0, 1fr); gap: 8px; }
body[data-game=sql] #deepUI button { min-height: 44px; white-space: normal; overflow-wrap: break-word; color: var(--mt-text); background: var(--mt-surface-2); border: 1px solid var(--mt-text-dim); font: inherit; padding: 10px 12px; border-radius: 6px; text-align: left; }
body[data-game=sql] .sql-lock-message { color: var(--mt-text); background: var(--mt-surface-2); padding: 12px; margin: 8px 0; font: 14px/1.6 var(--font-body); }
body[data-game=sql] .sql-lock-message[hidden] { display: none; }
body[data-game=sql] #sqlBox:disabled { opacity: 1; color: var(--mt-text-dim); }
body[data-game=sql] #sqlBox::placeholder { color: var(--mt-text-dim); opacity: 1; }
body[data-game=sql] .ws-status-badge { color: var(--mt-gold); font: 700 12px/1.5 var(--font-mono); border: 1px solid var(--mt-gold); padding: 3px 7px; border-radius: 6px; white-space: nowrap; }
body[data-game=sql] .sql-wins-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--mt-gold); background: color-mix(in srgb, var(--mt-gold) 12%, var(--mt-surface, transparent)); border: 2px solid var(--mt-gold); border-radius: 999px; padding: 2px 4px 2px 12px; box-shadow: 0 0 14px color-mix(in srgb, var(--mt-gold) 35%, transparent); white-space: nowrap; line-height: 1; }
body[data-game=sql] .sql-wins-badge .wins-num { font: 800 1.75em/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--mt-gold); }
body[data-game=sql] .sql-wins-badge small { font: 700 11px/1 var(--font-mono); letter-spacing: .12em; color: var(--mt-text); }
body[data-game=sql] .sql-wins-badge .wins-today { font: 700 12px/1 var(--font-mono); color: var(--mt-text); border: 1px solid var(--mt-gold); border-radius: 999px; padding: 5px 9px; }
body[data-game=sql] .wins-dial { margin-top: 10px; }
body[data-game=sql] .wins-play { display: flex; width: fit-content; margin: 0 0 10px; }
body[data-game=sql]:not(.ws-on) .wins-play { display: none; }
body[data-game=sql] .finish-wins { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 10px 0; }
body[data-game=sql] .finish-wins b { font: 800 26px/1.2 var(--font-display, serif); color: var(--mt-gold); }
body[data-game=sql] .finish-wins span { font: 700 14px/1.4 var(--font-mono); color: var(--mt-text); }
body[data-game=sql] .ws-kv .ws-win-row { font-weight: 800; color: var(--mt-gold); }
body[data-game=sql] #toast.toast-win { font-weight: 800; color: var(--mt-gold); border: 2px solid var(--mt-gold); letter-spacing: .06em; }
body[data-game=sql] #toast.toast-win .toast-check { color: var(--mt-ok); }
body[data-game=sql] #toast.toast-milestone { font-size: 24px; padding: 14px 24px; box-shadow: 0 0 24px color-mix(in srgb, var(--mt-gold) 50%, transparent); }
body[data-game=sql].ws-calm.ws-on .topbar > #winsBadge { display: inline-flex !important; }
body[data-game=sql].ws-calm.ws-on .ws-status-items > .ws-status-badge { display: inline-flex !important; overflow: visible; flex: none; }
body[data-game=sql].ws-calm.ws-on .ws-status-items { flex-wrap: wrap; overflow: visible; gap: 4px 12px; white-space: normal; }
body[data-game=sql].sql-win-tick :is(.sql-wins-badge, .ws-status-badge) { animation: sqlWinGlow .65s ease-out; }
body[data-game=sql].sql-win-tick .sql-wins-badge .wins-num { display: inline-block; animation: sqlWinPop .65s ease-out; }
@keyframes sqlWinGlow { 40% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--mt-gold) 45%, transparent), 0 0 28px var(--mt-gold); } }
@keyframes sqlWinPop { 35% { transform: scale(1.45); } }
body[data-game=sql].ws-on #toast { bottom: calc(var(--ws-bar-h) + 16px); pointer-events: none; }
body[data-game=sql].sql-deep-locked :is(.ws-inspector, .ws-explorer-panel) { visibility: hidden !important; display: none !important; }
@media (max-width: 819px) {
  body[data-game=sql].ws-on { --ws-bar-h: 92px; }
  body[data-game=sql].ws-on .ws-statusbar { --ws-bar-h: 92px; }
  body[data-game=sql].ws-on .ws-status-items { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { body[data-game=sql].sql-win-tick :is(.sql-wins-badge, .ws-status-badge, .sql-wins-badge .wins-num) { animation: none; } }

/* Python Forge wins: same badge as SQL, mapped to forge brass. */
body[data-game=python] .ws-status-badge { color: var(--brass); font: 700 12px/1.5 var(--font-mono); border: 1px solid var(--brass); padding: 3px 7px; border-radius: 6px; white-space: nowrap; }
body[data-game=python] .py-wins-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--brass); background: color-mix(in srgb, var(--brass) 12%, var(--surface, transparent)); border: 2px solid var(--brass); border-radius: 999px; padding: 2px 4px 2px 12px; box-shadow: 0 0 14px color-mix(in srgb, var(--brass) 35%, transparent); white-space: nowrap; line-height: 1; }
body[data-game=python] .py-wins-badge .wins-num { font: 800 1.75em/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--brass); }
body[data-game=python] .py-wins-badge small { font: 700 11px/1 var(--font-mono); letter-spacing: .12em; color: var(--fg); }
body[data-game=python] .py-wins-badge .wins-today { font: 700 12px/1 var(--font-mono); color: var(--fg); border: 1px solid var(--brass); border-radius: 999px; padding: 5px 9px; }
body[data-game=python] .wins-dial { margin-top: 10px; }
body[data-game=python] .wins-play { display: flex; width: fit-content; margin: 0 0 10px; }
body[data-game=python]:not(.ws-on) .wins-play { display: none; }
body[data-game=python] .finish-wins { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 10px 0; }
body[data-game=python] .finish-wins b { font: 800 26px/1.2 var(--font-display, serif); color: var(--brass); }
body[data-game=python] .finish-wins span { font: 700 14px/1.4 var(--font-mono); color: var(--fg); }
body[data-game=python] .ws-kv .ws-win-row { font-weight: 800; color: var(--brass); }
body[data-game=python] #toast.toast-win { font-weight: 800; color: var(--brass); border: 2px solid var(--brass); letter-spacing: .06em; }
body[data-game=python] #toast.toast-win .toast-check { color: var(--ok); }
body[data-game=python] #toast.toast-milestone { font-size: 24px; padding: 14px 24px; box-shadow: 0 0 24px color-mix(in srgb, var(--brass) 50%, transparent); }
body[data-game=python].ws-calm.ws-on .topbar > #winsBadge { display: inline-flex !important; }
body[data-game=python].ws-calm.ws-on .ws-status-items > .ws-status-badge { display: inline-flex !important; overflow: visible; flex: none; }
body[data-game=python].ws-calm.ws-on .ws-status-items { flex-wrap: wrap; overflow: visible; gap: 4px 12px; white-space: normal; }
body[data-game=python].py-win-tick :is(.py-wins-badge, .ws-status-badge) { animation: pyWinGlow .65s ease-out; }
body[data-game=python].py-win-tick .py-wins-badge .wins-num { display: inline-block; animation: pyWinPop .65s ease-out; }
@keyframes pyWinGlow { 40% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brass) 45%, transparent), 0 0 28px var(--brass); } }
@keyframes pyWinPop { 35% { transform: scale(1.45); } }
body[data-game=python].ws-on #toast { bottom: calc(var(--ws-bar-h) + 16px); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { body[data-game=python].py-win-tick :is(.py-wins-badge, .ws-status-badge, .py-wins-badge .wins-num) { animation: none; } }
body[data-game=python] #toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 18px; font: 14px var(--font-mono); }
body[data-game=python].ws-on #toast { bottom: calc(var(--ws-bar-h, 48px) + 16px); }
body[data-game=python] .finish-wins:empty { display: none; }
body[data-game=python] .py-ref-sec { margin: 10px 0 0; } body[data-game=python] .py-ref-sec b { display: block; font: 600 12px var(--font-mono); color: var(--fg-dim); text-transform: uppercase; letter-spacing: .08em; } body[data-game=python] #revealSolutionBtn { margin-top: 12px; }

/* Focus sound picker stays reachable during calm play, like the wins badge. */
body.ws-calm.ws-on .topbar > .focus-sound-toggle { display: inline-flex !important; }
body.ws-calm.ws-on .topbar > .focus-sound-toggle > span { display: none; }
body.ws-calm.ws-on .topbar > .focus-sound-toggle { min-height: 36px; padding: 0 4px; }
body.ws-calm.ws-on .topbar > .focus-sound-toggle button { min-width: 36px; min-height: 36px; font-size: 12px; }
body[data-game=python].ws-hub-calm:not(.ws-on):not(.ws-hub-open) .topbar .session-setup .diff-group{display:flex!important}
