/* Resonance Print · one layout system for all three studios.
   Loaded last. Owns the shell (sidebar + stage card), the instrument grid
   (image + control deck) and the type floor. Colours and component looks
   stay in the earlier files; geometry lives here only.

   Rule of the stage: the image is a square that always fits the window
   (limited by width and by height). Width the image cannot use goes to
   the control deck, then to even margins on both sides, never to a gap
   on one side. */

:root{
  --side-w: clamp(272px, 17.5vw, 344px);
  --deck-min: 320px;
  --deck-max: clamp(380px, 30vw, 620px);
  --stage-gap: clamp(16px, 1.4vw, 30px);
  --stage-pad: clamp(18px, 2vw, 44px);
  --card-margin: clamp(10px, 1vw, 22px);
  /* Height the square may use: window minus card margin, stage padding,
     plate head and frame. Keeps the whole circle visible while scrolling. */
  --plate-chrome: calc(12.5rem + 2.2vw);
  --plate-max: max(320px, calc(100dvh - var(--plate-chrome)));
  --type-floor: 11px;
  --shell-bg: #e9e7e0;
  --side-bg: #f2f0e9;
  --card-bg: #fcfaf5;
  --rule: #d8d6cc;
  --ink-strong: #142333;
  --ink-soft: #3f4f5c;
  --accent-ui: #345c66;
}

/* ---------- Shell ---------- */
html body.with-side{
  display:grid;
  grid-template-columns:var(--side-w) minmax(0,1fr);
  min-height:100vh;
  background:var(--shell-bg) url("./assets/honeycomb.svg?v=3ffaa204") repeat;
  color:var(--ink-strong);
  font-family:Inter,"Helvetica Neue",Arial,sans-serif;
}
html body.with-side > .side{
  width:auto;
  position:sticky;top:0;height:100vh;
  display:flex;flex-direction:column;gap:18px;
  padding:26px clamp(18px,1.4vw,26px) 18px;
  background:var(--side-bg);
  border-right:1px solid var(--rule);
  overflow-y:auto;
}
html body .side-brand{display:grid;gap:6px;padding-bottom:16px;border-bottom:1px solid var(--rule)}
html body .side-brand .side-club{font:400 12px/1.4 Inter,Arial,sans-serif!important;letter-spacing:.02em;color:var(--ink-soft)}
html body .side-brand .side-term{font:600 11px/1.3 var(--mono,monospace);letter-spacing:.08em;color:#5a6873}
html body .side-brand .side-title{margin-top:0;font:700 clamp(21px,1.35vw,26px)/1.15 Inter,Arial,sans-serif!important;letter-spacing:-.02em;color:var(--ink-strong)}
html body .side-brand small{font:500 11px/1.5 var(--mono,monospace);letter-spacing:.06em;color:#5a6873}
html body .side-nav{display:grid;gap:4px}
html body .side-nav a{display:flex;gap:12px;align-items:center;padding:11px 12px;border-radius:6px;font-size:clamp(15px,.95vw,17px);line-height:1.3;color:var(--ink-strong);text-decoration:none}
html body .side-nav a span:first-child{width:18px;flex:none;text-align:center;color:#075b91}
html body .side-nav a:hover,html body .side-nav a:focus-visible{background:#fff}
html body .side-nav a[aria-current="page"]{background:#fff;box-shadow:inset 3px 0 0 var(--accent-ui);font-weight:600}
html body .side-block summary{padding:14px 4px;font-size:clamp(14.5px,.9vw,16px);line-height:1.35;font-weight:600;gap:12px}
html body .side-block p,html body .side-block li{font-size:clamp(14px,.85vw,15.5px);line-height:1.6}
html body .side-block > :not(summary){margin:2px 4px 18px}
html body .side-foot{margin-top:auto;display:grid;gap:12px;padding:14px 0 18px;border-top:1px solid var(--rule);position:sticky;bottom:-18px;z-index:2;background:var(--side-bg)}
html body .side-foot .volume{font-size:14px}
html body .side-foot .ui-lang button{padding:10px 0;font-size:14px}

/* The stage card fills everything right of the sidebar. No fixed max
   width, so there is no empty strip of background on wide screens. */
html body.with-side > main{
  container:stage / inline-size;
  min-width:0;max-width:none;width:auto;
  margin:var(--card-margin);
  padding:0 var(--stage-pad) calc(var(--stage-pad) * .8);
  background:var(--card-bg);
  border:1px solid #e1ded5;border-radius:18px;
  box-shadow:0 16px 45px #1f293714;
}

/* ---------- Intro: compact, same in every studio ---------- */
html body.with-side .intro{
  display:flex;align-items:end;justify-content:space-between;gap:var(--stage-gap) 3rem;
  padding:clamp(20px,2.2vw,36px) 0 clamp(16px,1.6vw,26px);
  margin:0 auto;max-width:var(--stage-w,none);
}
html body.with-side .intro .eyebrow{font:500 12px/1.4 var(--mono,monospace);letter-spacing:.14em;color:#5a6873;margin:0}
html body.with-side .intro h1{margin:8px 0 0;font:700 clamp(2rem,2.6vw,3.2rem)/1.08 Inter,Arial,sans-serif;letter-spacing:-.035em;color:var(--ink-strong)}
html body.with-side .intro .thesis{margin:0;max-width:34ch;font-size:clamp(14px,.95vw,17px);line-height:1.55;color:var(--ink-soft);text-align:right}

/* ---------- Instrument: square image + control deck ---------- */
html body.with-side .instrument,
html body.with-side .word-instrument{
  display:grid!important;
  /* The image column is sized first (as large as the window height and
     the deck minimum allow); the deck then takes what is left, up to its
     maximum; any remainder becomes equal margins on both sides. */
  grid-template-columns:
    min(calc(var(--plate-max) + 30px), calc(100% - var(--deck-min) - var(--stage-gap)))
    minmax(var(--deck-min), var(--deck-max))!important;
  justify-content:center;
  align-items:start;
  gap:var(--stage-gap)!important;
  margin-top:0;
}
html body.with-side .plate-shell{min-width:0;position:sticky;top:var(--card-margin)}
html body.with-side .control-deck{min-width:0}

/* The square: as large as the column allows, never taller than the window. */
html body.with-side #instrument .plate-window{
  width:min(100%, var(--plate-max));
  height:auto;aspect-ratio:1/1;
  min-height:0;max-height:none;
  margin-inline:auto;
}
/* The trace view is wide, not square: full column width, bounded height. */
html[data-word-view="frequency"] body.with-side #instrument .word-instrument .plate-window,
html body.with-side #instrument .word-instrument[data-view="frequency"] .plate-window{
  width:100%;aspect-ratio:2/1;max-height:min(60dvh, var(--plate-max));
}

/* Deck readability: no squeezed micro type. */
html body.with-side .control-deck{padding:clamp(16px,1.3vw,24px)}
html body.with-side .mode-map-grid{gap:clamp(6px,.6vw,10px)}
html body.with-side .mode-map-grid canvas{max-width:none}
html body.with-side .mode-map-grid small,
html body.with-side .note-bank button small,
html body.with-side .tune-row .scale span,
html body.with-side .deck-bottom,
html body.with-side .deck-status,
html body.with-side .model-basis .eyebrow,
html body.with-side .mode-map .eyebrow,
html body.with-side .deck-heading .eyebrow{font-size:var(--type-floor)!important;line-height:1.35}
html body.with-side .plate-formula,
html body.with-side .plate-formula *,
html body.with-side .tune-row label,
html body.with-side .tune-row label *,
html body.with-side .strike-button small,
html body.with-side .strike-button kbd,
html body.with-side .deck-bottom *,
html body.with-side .mic-strip,
html body.with-side .mic-strip button,
html body.with-side .mic-strip span,
html body.with-side .wave-moments button,
html body.with-side .wave-moments button span,
html body.with-side .spectrum-row span,
html body.with-side .plate-head,
html body.with-side .plate-foot,
html body.with-side .plate-overlay{font-size:var(--type-floor)!important;line-height:1.4;gap:8px 14px;flex-wrap:wrap}
html body.with-side .study-menu summary,
html body.with-side .view-switch button,
html body.with-side .lab-view-switch button{font-size:12px!important;padding:7px 11px;letter-spacing:.03em}
html body.with-side .view-legend,
html body.with-side .mapping,
html body.with-side .instruction{line-height:1.6}

/* Large screens: the deck and the type grow with the stage. */
@media (min-width:2000px){
  :root{--deck-max:clamp(520px,26vw,1000px);--type-floor:12.5px}
  html body.with-side .control-deck{font-size:110%}
}

/* ---------- Narrow stage (tablets, small laptops, phones) ---------- */
@container stage (max-width: 820px){
  html body.with-side .instrument,html body.with-side .word-instrument{grid-template-columns:minmax(0,1fr)!important}
  html body.with-side .plate-shell{position:static}
}

@media (max-width:1000px){
  html body.with-side{display:block}
  html body.with-side > .side{
    position:sticky;top:0;z-index:20;height:auto;max-height:100vh;
    display:grid;grid-template-columns:1fr auto;align-items:center;gap:10px 12px;
    padding:12px 16px;border-right:0;border-bottom:1px solid var(--rule);
    box-shadow:0 1px 0 var(--rule);
  }
  html body .side-brand{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;padding:0;border:0}
  html body .side-brand .side-title{margin:0;font-size:18px!important}
  html body .side-brand .side-term,html body .side-brand small{display:none}
  html body .side-nav{display:flex!important;grid-column:1/-1;gap:6px}
  html body .side-nav a{flex:1 1 0;min-width:0;justify-content:center;padding:10px 8px;border:1px solid var(--rule);background:#fff;font-size:14px;text-align:center}
  html body .side-nav a[aria-current="page"]{background:var(--ink-strong);color:#fff;box-shadow:none}
  html body .side-nav a[aria-current="page"] span{color:#fff}
  html body.with-side > main{margin:10px;border-radius:14px}
  :root{--plate-chrome:12rem}
}

@media (max-width:640px){
  :root{--stage-pad:14px;--stage-gap:14px;--plate-chrome:10rem}
  html body.with-side .intro{display:block;padding:18px 0 14px}
  html body.with-side .intro .thesis{text-align:left;margin-top:10px;max-width:none}
  html body.with-side .intro h1{font-size:clamp(1.9rem,8vw,2.4rem)}
  html body .side-nav a{font-size:13px;padding:9px 4px;gap:6px}
  html body .side-nav a span:first-child{display:none}
  html body.with-side > main{margin:8px;padding-inline:var(--stage-pad)}
  /* On a phone the square takes the full width; it is narrower than the
     window is tall, so it is always fully visible. */
  html body.with-side #instrument .plate-window{width:100%}
}

/* ---------- Light studies: same stage grammar ---------- */
html body.with-side .light-lab{
  display:grid;
  grid-template-columns:minmax(0,1fr) clamp(var(--deck-min), 28%, 500px);
  gap:var(--stage-gap);align-items:start;border-top:0;padding-top:0;
}
html body.with-side .light-stage{
  min-width:0;display:flex;flex-direction:column;gap:10px;
  padding:13px;border:1px solid #d5d7cc;border-radius:17px;background:#eeeade;
}
html body.with-side .light-stage-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
html body.with-side .light-stage-head .eyebrow{font:600 var(--type-floor)/1.3 var(--mono,monospace);letter-spacing:.08em;color:#5a6873;margin:0}
html body.with-side .light-presentation{display:flex;gap:5px;margin:0;padding:0}
html body.with-side .light-presentation button{min-height:0;padding:7px 11px;border:1px solid #bdc8bd;border-radius:4px;background:#faf8f0;color:var(--accent-ui);font:600 12px/1.3 Inter,Arial,sans-serif;cursor:pointer}
html body.with-side .light-presentation button[aria-pressed="true"]{background:var(--accent-ui);border-color:var(--accent-ui);color:#fff}
html body.with-side .light-comparison{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:clamp(10px,1vw,16px)}
html body.with-side .light-comparison figure{container-type:inline-size;margin:0;padding:10px;border:1px solid #d6d1c4;border-radius:9px;background:#f5f0e5;min-width:0;display:flex;flex-direction:column;gap:6px}
html body.with-side .light-image-head{display:flex;align-items:flex-end;justify-content:space-between;gap:10px;height:auto;min-height:0;padding:0}
html body.with-side .light-image-head h3{margin:0;font:500 13px/1.3 Inter,Arial,sans-serif;color:var(--ink-soft)}
html body.with-side .light-image-head h3 b{display:inline-grid;place-items:center;width:22px;height:22px;margin-right:4px;border-radius:50%;background:var(--accent-ui);color:#fff;font-size:12px}
html body.with-side .light-aperture{display:flex;flex-direction:column;align-items:flex-end;gap:3px;min-width:0;flex:0 1 auto}
html body.with-side .light-image-head h3{white-space:nowrap}
html body.with-side .light-aperture small{font:600 var(--type-floor)/1 var(--mono,monospace);letter-spacing:.06em;text-transform:uppercase;color:#5a6873}
html body.with-side .light-comparison [data-mask]{display:block;width:clamp(84px,40cqw,150px);height:auto;aspect-ratio:360/110;max-width:100%;float:none;margin:0;border:1px solid #d6d1c4;border-radius:4px}
html body.with-side .light-frame{display:grid;place-items:center;min-height:0}
html body.with-side .light-comparison [data-image]{display:block;width:100%;height:auto;aspect-ratio:1/1;border-radius:4px;background:#f5f0e5}
html body.with-side .light-comparison figcaption{min-height:0;padding:0 2px;font-size:12.5px;line-height:1.45;color:var(--ink-soft)}
html body.with-side .light-comparison [data-profile]{display:block;width:100%;height:auto;aspect-ratio:600/175;max-height:none;margin:0}
html body.with-side .light-equation{margin:0 4px;font:400 15px/1.5 "Source Serif 4",Georgia,serif;color:var(--ink-strong);max-width:none}
html body.with-side .light-equation span{margin-left:8px;font:400 12.5px/1.5 Inter,Arial,sans-serif;color:var(--ink-soft)}

html body.with-side .light-deck{display:flex;flex-direction:column;gap:12px;padding:clamp(16px,1.3vw,24px);border:1px solid #dadfd5;border-radius:15px;background:#f7f6f0}
html body.with-side .light-deck .eyebrow{font:600 var(--type-floor)/1.3 var(--mono,monospace);letter-spacing:.12em;text-transform:uppercase;color:#5a6873;margin:4px 0 0}
html body.with-side .light-presets{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
html body.with-side .light-presets button{display:grid;gap:2px;text-align:left;padding:9px 11px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:var(--ink-strong);cursor:pointer}
html body.with-side .light-presets button:last-child{grid-column:1/-1}
html body.with-side .light-presets b{font:600 13.5px/1.3 Inter,Arial,sans-serif}
html body.with-side .light-presets small{font:400 12px/1.35 Inter,Arial,sans-serif;color:var(--ink-soft)}
html body.with-side .light-presets button:hover{border-color:#075b91}
html body.with-side .light-presets button[aria-pressed="true"]{background:#075b91;border-color:#075b91;color:#fff}
html body.with-side .light-presets button[aria-pressed="true"] small{color:#dbe8f2}
html body.with-side .light-deck .light-observation{margin:0;padding:12px 14px;border-left:3px solid #075b91;background:#fff;border-radius:0 8px 8px 0;font:400 15px/1.55 "Source Serif 4",Georgia,serif;color:var(--ink-strong);max-width:none;min-height:0}
html body.with-side .light-deck .light-controls{display:grid;grid-template-columns:1fr;gap:10px}
html body.with-side .light-deck .light-control label{display:flex;justify-content:space-between;gap:8px;font:600 13px/1.4 Inter,Arial,sans-serif;color:var(--ink-strong)}
html body.with-side .light-deck .light-control output{font-weight:400;color:var(--ink-soft);white-space:nowrap}
html body.with-side .light-deck .light-control select{min-height:2.4rem;border:1px solid #cbd5e1;border-radius:8px;background:#fff;padding:.35rem .6rem;color:var(--ink-strong);font:14px Inter,Arial,sans-serif;width:100%}
html body.with-side .light-deck .light-control input[type=range]{height:1.6rem;width:100%;accent-color:#075b91}
html body.with-side .light-deck .light-status,
html body.with-side .light-deck .light-art-note,
html body.with-side .light-deck .light-display-note{margin:0;font:400 12.5px/1.55 Inter,Arial,sans-serif;color:var(--ink-soft);min-height:0;max-width:none}
html body.with-side .light-deck .light-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr)) max-content;gap:6px;margin:0}
html body.with-side .light-deck .light-actions button{width:100%;min-height:2.6rem;padding:.55rem .7rem;border:1px solid #075b91;border-radius:8px;background:#075b91;color:#fff;font:600 13px/1.25 Inter,Arial,sans-serif;cursor:pointer}
html body.with-side .light-deck .light-actions .light-secondary{background:#fff;color:#075b91}
html body.with-side .light-deck .light-actions button:disabled{opacity:.5;cursor:default}
html body.with-side .light-deck .light-actions button{font-size:12.5px;padding-inline:4px}
@media(max-width:360px){
  html body.with-side .light-deck .light-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  html body.with-side .light-deck .light-actions [data-reset]{grid-column:1/-1}
}
html body.with-side .light-deck .deck-panel > :not(summary){margin:0 0 12px}
html body.with-side .light-presets button{padding:7px 10px}
html body.with-side .side .sources{margin:0 4px 12px;padding-left:18px;font-size:14px;line-height:1.55}
html body.with-side .side .light-credit{font-size:13.5px;color:var(--ink-soft)}
html body.with-side .light-deck > *{flex-shrink:0}
html body.light-page .side-toggle{display:none}
@media (max-width:1000px){
  html body.light-page .side-toggle{display:inline-block;grid-column:2;grid-row:1;padding:7px 12px;border:1px solid #9fb8ca;border-radius:6px;background:#fff;color:var(--ink-strong);font:600 13px Inter,Arial,sans-serif;cursor:pointer}
  html body.light-page .side-toggle[aria-expanded="true"]{background:var(--ink-strong);color:#fff}
  html body.light-page .side-more{display:none;grid-column:1/-1;overflow-y:auto;max-height:calc(100vh - 120px)}
  html body.light-page .side.open .side-more{display:flex;flex-direction:column}
}
html body.with-side.is-embedded{display:block}
html body.with-side.is-embedded > .side{display:none}

@container stage (max-width: 860px){
  html body.with-side .light-lab{grid-template-columns:minmax(0,1fr)}
}
@container stage (max-width: 520px){
  html body.with-side .light-comparison{grid-template-columns:minmax(0,1fr)}
}

/* ---------- One colour for every selected toggle ---------- */
:root{--pick:#075b91}
html body.with-side .voice-switch input:checked + span{background:var(--pick)!important;border-color:var(--pick)!important;color:#fff!important}
html body.with-side .ui-lang button[aria-pressed=true]{background:var(--pick)!important;border-color:var(--pick)!important;color:#fff!important}
html body.with-side .view-switch button[aria-pressed=true],
html body.with-side .lab-view-switch button[aria-pressed=true],
html body.with-side .light-presentation button[aria-pressed="true"]{background:var(--pick)!important;border-color:var(--pick)!important;color:#fff!important}
@media (max-width:1000px){
  html body .side-nav a[aria-current="page"]{background:var(--pick);border-color:var(--pick)}
}

/* ---------- Sidebar: info grows, footer sits at the bottom (all pages) ---------- */
@media (min-width:1001px){
  html body.with-side .side-more{display:flex;flex-direction:column;gap:14px;flex:1 1 auto;min-height:0}
}

/* ---------- Lab deck: exclusive sections ---------- */
html body.with-side .deck-panel{border-top:1px solid var(--rule)}
html body.with-side .view-notes > summary,
html body.with-side .deck-panel > summary{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:11px 2px;list-style:none;cursor:pointer;font:600 var(--type-floor)/1.3 var(--mono,monospace);letter-spacing:.12em;text-transform:uppercase;color:#3f4f5c}
html body.with-side .view-notes > summary::-webkit-details-marker,
html body.with-side .deck-panel > summary::-webkit-details-marker{display:none}
html body.with-side .view-notes > summary::after,
html body.with-side .deck-panel > summary::after{content:"+";font:400 18px/1 Inter,Arial,sans-serif;color:var(--pick)}
html body.with-side .view-notes[open] > summary::after,
html body.with-side .deck-panel[open] > summary::after{content:"−"}
html body.with-side .view-notes{border-bottom:1px solid var(--rule)}
html body.with-side .view-notes > summary{padding-top:0}
html body.with-side .view-notes .view-legend{margin:0 0 10px;font-size:13px;line-height:1.55}
html body.with-side .deck-panel[open] > summary{color:var(--ink-strong)}
html body.with-side .deck-panel > :not(summary){margin-bottom:12px}
html body.with-side .deck-panel .mic-strip{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px 10px;margin:0 0 12px;padding:0;border:0;border-radius:0;background:none;box-shadow:none}
html body.with-side .deck-panel .mic-strip .mic-copy,
html body.with-side .deck-panel .mic-strip #mic-help{grid-column:1/-1;margin:0}
html body.with-side .deck-panel .plate-formula{position:static;display:grid;gap:2px;padding:10px 12px;border:1px solid var(--rule);border-radius:8px;background:#fff;color:var(--ink-strong);font-family:var(--mono,monospace);font-size:12px!important}
html body.with-side .deck-panel .mapping{font-size:13px;line-height:1.55}
html body.with-side .deck-panel .model-basis{margin-top:0}
html body.with-side .control-deck .deck-bottom{border-top:1px solid var(--rule);padding-top:10px;margin-top:0}

/* ---------- Desktop: one screen, no page scroll ----------
   The page is exactly the window. The card takes the full height; the
   image area takes whatever height is left after the compact intro; the
   control deck scrolls inside itself when its content is taller. */
@media (min-width:1100px) and (min-height:600px){
  :root{--intro-h:clamp(58px,7.2vh,84px);--shell-pad:13px}
  html body.with-side:not(.is-embedded){height:100vh;height:100dvh;overflow:hidden}
  html body.with-side:not(.is-embedded) > .side{height:100vh;height:100dvh}
  html body.with-side:not(.is-embedded) > main{
    container:stage / size;
    height:calc(100dvh - 2 * var(--card-margin));
    display:flex;flex-direction:column;overflow:hidden;
    padding:0 var(--stage-pad) var(--stage-gap);
  }
  html body.with-side:not(.is-embedded) .intro{flex:none;width:auto;max-width:none;height:var(--intro-h);margin:0;padding:0;align-items:center;gap:2rem}
  html body.with-side:not(.is-embedded) .intro .eyebrow{font-size:11px;letter-spacing:.12em}
  html body.with-side:not(.is-embedded) .intro h1{margin-top:4px;font-size:clamp(1.5rem,1.9vw,2.6rem)}
  html body.with-side:not(.is-embedded) .intro .thesis{font-size:clamp(13px,.82vw,16px);line-height:1.45;max-width:40ch}
  html body.with-side:not(.is-embedded) .footnote{display:none}
  html body.with-side:not(.is-embedded) .room{flex:1 1 0;min-height:0}
  html body.with-side:not(.is-embedded) .room.labor{display:flex}
  html body.with-side:not(.is-embedded) #einzelton{flex:1 1 0;min-height:0}

  /* Square = the smaller of (height left for it) and (width left after the
     deck minimum). Column widths follow from it, so the stage panel hugs
     the square and the deck takes the rest up to its maximum. */
  html body.with-side:not(.is-embedded) .instrument,
  html body.with-side:not(.is-embedded) .word-instrument{
    --sq:max(260px, min(calc(100cqh - var(--intro-h) - var(--chrome)), calc(100cqw - var(--deck-min) - var(--stage-gap) - 2 * var(--shell-pad) - 2px)));
    grid-template-columns:calc(var(--sq) + 2 * var(--shell-pad) + 2px) minmax(var(--deck-min), var(--deck-max))!important;
    grid-template-rows:minmax(0,1fr);
    height:100%;min-height:0;align-items:stretch;justify-content:center;
  }
  html body.with-side:not(.is-embedded) .word-instrument{--chrome:calc(36px + 64px + 2 * var(--shell-pad) + 2px + 20px)}
  html body.with-side:not(.is-embedded) #einzelton{--chrome:calc(36px + 26px + 2 * var(--shell-pad) + 2px + 20px)}
  html body.with-side:not(.is-embedded) .plate-shell{
    position:relative;top:auto;height:100%;min-height:0;overflow:hidden;
    display:flex;flex-direction:column;gap:10px;padding:var(--shell-pad);
  }
  html body.with-side:not(.is-embedded) .plate-head{flex:none;min-height:0;height:36px;margin:0;align-items:center;flex-wrap:nowrap}
  html body.with-side:not(.is-embedded) #instrument .plate-window{flex:none;width:100%;max-width:none;margin:0}
  html body.with-side:not(.is-embedded) .plate-foot{flex:none;margin:0}
  html body.with-side:not(.is-embedded) .lab-view-switch{display:flex;gap:4px;margin:0 0 0 auto}
  html body.with-side:not(.is-embedded) #einzelton .plate-head{gap:10px}
  html body.with-side:not(.is-embedded) #einzelton .plate-head > span:first-child{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
  html body.with-side:not(.is-embedded) #einzelton #mode-label{white-space:nowrap}

  /* Under the word square: moments and spectrum share one row. */
  html body.with-side:not(.is-embedded) .plate-strip{
    flex:1 0 64px;min-height:64px;display:grid;
    grid-template-columns:auto minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;
    grid-template-areas:"moments spec" "moments foot";gap:4px 12px;
  }
  html body.with-side:not(.is-embedded) .plate-strip .wave-moments{grid-area:moments;margin:0;align-self:stretch;display:flex;gap:6px;align-items:stretch;flex-wrap:nowrap}
  html body.with-side:not(.is-embedded) .plate-strip .wave-moments[hidden]{display:none}
  html body.with-side:not(.is-embedded) .plate-strip .wave-moments button{padding:4px 6px;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
  html body.with-side:not(.is-embedded) .plate-strip .wave-moments canvas{width:30px;height:30px}
  html body.with-side:not(.is-embedded) .plate-strip .spectrum-row{grid-area:spec;margin:0;display:grid;grid-template-rows:auto minmax(0,1fr);gap:3px;min-height:0}
  html body.with-side:not(.is-embedded) .plate-strip .spectrum-row canvas{width:100%;height:100%;min-height:24px}
  html body.with-side:not(.is-embedded) .plate-strip .plate-foot{grid-area:foot}
  html body.with-side:not(.is-embedded) .plate-strip .wave-moments[hidden] ~ .plate-foot,
  html body.with-side:not(.is-embedded) .plate-strip .wave-moments[hidden] ~ .spectrum-row{grid-column:1/-1}
  html body.with-side:not(.is-embedded) .plate-strip .plate-foot,
  html body.with-side:not(.is-embedded) .plate-strip .plate-foot span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.3}

  /* Trace view: the wide drawing uses the whole stage column. */
  html body.with-side:not(.is-embedded) .word-instrument[data-view="frequency"],
  html[data-word-view="frequency"] body.with-side:not(.is-embedded) .word-instrument{grid-template-columns:minmax(0,1fr) minmax(var(--deck-min), var(--deck-max))!important}
  html body.with-side:not(.is-embedded) .word-instrument[data-view="frequency"] .plate-window,
  html[data-word-view="frequency"] body.with-side:not(.is-embedded) .word-instrument .plate-window{aspect-ratio:2/1;max-height:none}

  /* Decks: full height, own scroll, nothing cut off. */
  html body.with-side:not(.is-embedded) .control-deck,
  html body.with-side:not(.is-embedded) .light-deck{height:100%;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-gutter:stable}
  html body.with-side:not(.is-embedded) .word-deck .view-notes{margin:0 0 14px;padding:0 0 12px;border-bottom:1px solid var(--rule)}
  html body.with-side:not(.is-embedded) .word-deck .view-legend{margin:0;font-size:13px;line-height:1.55}
  html body.with-side:not(.is-embedded) .control-deck .plate-formula{position:static;display:grid;gap:2px;margin:12px 0;padding:10px 12px;border:1px solid var(--rule);border-radius:8px;background:#fff;color:var(--ink-strong);font-family:var(--mono,monospace);font-size:12px!important}
  html body.with-side:not(.is-embedded) .control-deck .mic-strip{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px 10px;margin:14px 0 0;padding:12px 0 0;border:0;border-top:1px solid var(--rule);border-radius:0;background:none;box-shadow:none}
  html body.with-side:not(.is-embedded) .control-deck .mic-strip .mic-copy{grid-column:1/-1}
  html body.with-side:not(.is-embedded) .control-deck .mic-strip #mic-help{grid-column:1/-1;margin:0;font-size:12.5px}

  /* Light: the two prints fill the stage height; the curves take the rest. */
  html body.with-side:not(.is-embedded) .light-lab{flex:1 1 0;min-height:0;height:100%;grid-template-columns:minmax(0,1fr) clamp(var(--deck-min), 28%, 500px);grid-template-rows:minmax(0,1fr);align-items:stretch}
  html body.with-side:not(.is-embedded) .light-stage{height:100%;min-height:0;overflow:hidden}
  html body.with-side:not(.is-embedded) .light-comparison{flex:1 1 0;min-height:0;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr)}
  html body.with-side:not(.is-embedded) .light-comparison figure{min-height:0;overflow:hidden}
  html body.with-side:not(.is-embedded) .light-frame{flex:0 1 auto;width:100%;aspect-ratio:1/1;min-height:120px;container-type:size}
  html body.with-side:not(.is-embedded) .light-comparison [data-image]{width:min(100cqw,100cqh);height:min(100cqw,100cqh)}
  html body.with-side:not(.is-embedded) .light-comparison figcaption{flex:none}
  html body.with-side:not(.is-embedded) .light-comparison [data-profile]{flex:none}
  html body.with-side:not(.is-embedded) .light-comparison figure{justify-content:center}
  html body.with-side:not(.is-embedded) .light-equation{flex:none}
}
@media (min-width:1100px) and (min-height:600px){
  /* Decks are flex columns; the open lab section takes the free height. */
  html body.with-side:not(.is-embedded) .control-deck{display:flex;flex-direction:column;gap:10px}
  html body.with-side:not(.is-embedded) .control-deck > *{flex:none;margin-top:0;margin-bottom:0}
  html body.with-side:not(.is-embedded) #einzelton .control-deck{overflow-y:auto}
  html body.with-side:not(.is-embedded) #einzelton .instruction{font-size:15px;line-height:1.35}
  /* Fallback: fixed-size thumbnails. */
  html body.with-side:not(.is-embedded) #einzelton .mode-map-grid{gap:5px}
  html body.with-side:not(.is-embedded) #einzelton .mode-map-grid button{padding:4px 2px;gap:1px}
  html body.with-side:not(.is-embedded) #einzelton .mode-map-grid canvas{width:100%;max-width:60px;height:auto;aspect-ratio:1/1}
  /* Where details content can be laid out, the open section fills the deck
     and the thumbnails grow or shrink with the free height. */
  @supports selector(::details-content){
    html body.with-side:not(.is-embedded) #einzelton .deck-panel[open]{flex:1 1 0;min-height:140px;display:flex;flex-direction:column}
    html body.with-side:not(.is-embedded) #einzelton .deck-panel[open]::details-content{flex:1 1 0;min-height:0;display:flex;flex-direction:column}
    html body.with-side:not(.is-embedded) #einzelton .deck-panel[open] > .mode-map{flex:1 1 0;min-height:0;display:flex;flex-direction:column;gap:6px;margin:0 0 4px}
    html body.with-side:not(.is-embedded) #einzelton .mode-map-grid{flex:1 1 0;min-height:0;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));grid-auto-rows:0;overflow:hidden}
    html body.with-side:not(.is-embedded) #einzelton .mode-map-grid button{min-height:0;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;overflow:hidden;container-type:size}
    html body.with-side:not(.is-embedded) #einzelton .mode-map-grid canvas{flex:none;width:min(100cqw - 6px, 100cqh - 32px);height:min(100cqw - 6px, 100cqh - 32px);max-width:none;max-height:none;aspect-ratio:1/1;border-radius:50%}
    html body.with-side:not(.is-embedded) #einzelton .mode-map > small{flex:none}
  }

  /* Word deck: labels beside inputs, the two ways to make sound side by side,
     A and B side by side, downloads in two columns. */
  html body.with-side:not(.is-embedded) .word-deck .word-steps{display:grid;gap:14px;margin:0;padding:0}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li{margin:0;padding:0}
  html body.with-side:not(.is-embedded) .word-deck .word-steps{grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:10px}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(-n+2){display:contents}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(n+3){grid-column:1/-1}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(1) > .step-title{grid-column:1;grid-row:1;margin:0}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(1) > .lang-picker{grid-column:1;grid-row:2;margin:-8px 0 0}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(2) > .step-title{grid-column:2;grid-row:1;margin:0}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(2) > .word-input{grid-column:2;grid-row:2;margin:-8px 0 0}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(2) > .word-chips{grid-column:1/-1;grid-row:3;margin:-6px 0 0}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(2) > .word-note{grid-column:1/-1;grid-row:4;margin:-8px 0 0}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(3){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px 10px;align-items:start}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(3) > *{grid-column:1/-1;margin:0}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(3) > .speak-button{grid-column:1}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(3) > .mic-input{grid-column:2;grid-row:auto;margin:0}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(3) > .or-line{display:none}
  html body.with-side:not(.is-embedded) .word-deck .speak-button{order:3}
  html body.with-side:not(.is-embedded) .word-deck .mic-input{order:4}
  html body.with-side:not(.is-embedded) .word-deck #word-hint{order:5}
  html body.with-side:not(.is-embedded) .word-deck .record-row button.record-button{min-height:44px;width:100%;font-size:13px;line-height:1.2;white-space:normal;padding-inline:8px}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(3) > .speak-button{min-height:44px;font-size:15px;white-space:nowrap;padding-inline:8px}
  html body.with-side:not(.is-embedded) .word-deck .record-row{gap:4px}
  html body.with-side:not(.is-embedded) .word-deck .file-pick{display:block;margin-top:4px}
  html body.with-side:not(.is-embedded) .word-deck .slots{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  html body.with-side:not(.is-embedded) .word-deck .word-downloads{display:grid;grid-template-columns:1fr 1fr;gap:6px}
  html body.with-side:not(.is-embedded) .word-deck .word-downloads > *{margin:0;width:100%}
  html body.with-side:not(.is-embedded) .word-deck .word-downloads .primary-download{grid-column:1/-1}
  html body.with-side:not(.is-embedded) .word-deck .word-downloads > [hidden]{display:none}
  html body.with-side:not(.is-embedded) .word-deck .view-notes{margin:0;padding:0}
  html body.with-side:not(.is-embedded) .word-deck .word-chips{gap:4px}
  html body.with-side:not(.is-embedded) .word-deck .word-chips button{padding:3px 9px;font-size:12.5px}
  html body.with-side:not(.is-embedded) .word-deck .word-note,
  html body.with-side:not(.is-embedded) .word-deck #word-hint,
  html body.with-side:not(.is-embedded) .word-deck .voice-note{font-size:12px;line-height:1.45;margin:0}
  html body.with-side:not(.is-embedded) .word-deck .slot{grid-template-columns:minmax(0,1fr) 36px!important;gap:4px}
  html body.with-side:not(.is-embedded) .word-deck .slot-show{grid-template-columns:34px minmax(0,1fr)!important;gap:2px 8px;padding:6px 8px;min-height:0}
  html body.with-side:not(.is-embedded) .word-deck .slot-play{width:34px;height:34px;align-self:center}
  html body.with-side:not(.is-embedded) .word-deck .slot-show canvas{width:34px;height:34px}
  html body.with-side:not(.is-embedded) .word-deck .slot-word{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
  html body.with-side:not(.is-embedded) .word-deck .slot-lang{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}

  /* Spectrum strip: label above the drawing, meta below, nothing on top. */
  html body.with-side:not(.is-embedded) .plate-strip .spectrum-row{grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto minmax(0,1fr)!important;overflow:hidden}
  html body.with-side:not(.is-embedded) .plate-strip .spectrum-row > span{line-height:1.2}
  html body.with-side:not(.is-embedded) .plate-strip .spectrum-row canvas{border:1px solid #d6d1c4;border-radius:4px;background:#f5f0e5}
  html body.with-side:not(.is-embedded) .plate-strip{display:block;flex:none;min-height:0;height:18px}
  html body.with-side:not(.is-embedded) .word-instrument{--chrome:calc(36px + 18px + 2 * var(--shell-pad) + 2px + 20px)}
  html body.with-side:not(.is-embedded) .word-instrument{--deck-min:clamp(400px,29vw,520px)}
  html body.with-side:not(.is-embedded) #einzelton .instruction{font-size:14px}
  html body.with-side:not(.is-embedded) .side-brand .side-club{font-size:12.5px!important}
}
@media (min-width:1100px) and (min-height:600px) and (max-height:760px){
  html body.with-side:not(.is-embedded) .intro .thesis{display:none}
}

html body .side-links a{font-size:14px;line-height:1.4;color:#075b91;text-decoration:none}
html body .side-links a:hover,html body .side-links a:focus-visible{text-decoration:underline}
@media (max-width:1000px){html body .side-links{display:none}}
html body.light-page .ui-lang{display:grid;grid-template-columns:1fr 1fr;gap:4px}
html body.light-page .ui-lang button{min-width:44px;padding:10px 0;border:1px solid #cbd5e1;border-radius:4px;background:#fff;color:#142333;font:600 14px Inter,Arial,sans-serif;letter-spacing:.04em;cursor:pointer}
html body.light-page .ui-lang button[aria-pressed=true]{background:#111;border-color:#111;color:#fff;cursor:default}
html body.light-page .ui-lang button:focus-visible{outline:2px solid #167db4;outline-offset:2px}
/* Short desktop windows: a one-line title row gives the stage more height. */
@media (min-width:1100px) and (min-height:600px) and (max-height:820px){
  :root{--intro-h:46px}
  html body.with-side:not(.is-embedded) .intro .eyebrow{display:none}
  html body.with-side:not(.is-embedded) .intro h1{margin:0;font-size:1.6rem}
  html body.with-side:not(.is-embedded) .word-deck .word-steps{row-gap:10px}
  html body.with-side:not(.is-embedded) .control-deck{gap:8px;padding-block:14px}
}

/* ---------- Moments of the recording: in the word deck ---------- */
html body.with-side .moments-block{display:grid;gap:6px}
html body.with-side .moments-block:has(> .wave-moments[hidden]){display:none}
html body.with-side .moments-block .eyebrow{font:600 var(--type-floor)/1.3 var(--mono,monospace);letter-spacing:.12em;text-transform:uppercase;color:#5a6873}
html body.with-side .moments-block .wave-moments{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin:0}
html body.with-side .moments-block .wave-moments[hidden]{display:none!important}
html body.with-side .moments-block .wave-moments button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:58px;padding:5px 4px;font-size:12px!important;line-height:1.2}
html body.with-side .moments-block .wave-moments button canvas{width:34px;height:34px;border-radius:50%}
html body.with-side .moments-block .wave-moments button[aria-pressed="true"]{border-color:var(--pick);box-shadow:inset 0 0 0 1px var(--pick)}

/* ---------- Light deck: type that grows with the window ---------- */
@media (min-width:1100px) and (min-height:600px){
  html body.with-side:not(.is-embedded) .light-deck{gap:clamp(10px,1.3vh,18px)}
  html body.with-side:not(.is-embedded) .light-deck .eyebrow,
  html body.with-side:not(.is-embedded) .light-deck .deck-panel > summary{font-size:clamp(11.5px,1.25vh,14px)}
  html body.with-side:not(.is-embedded) .light-presets b{font-size:clamp(14px,1.6vh,18px)}
  html body.with-side:not(.is-embedded) .light-presets small{font-size:clamp(12px,1.3vh,15px)}
  html body.with-side:not(.is-embedded) .light-presets button{padding:clamp(7px,1vh,13px) clamp(10px,1vw,14px)}
  html body.with-side:not(.is-embedded) .light-deck .light-observation{font-size:clamp(15px,1.75vh,20px)}
  html body.with-side:not(.is-embedded) .light-deck .light-control label{font-size:clamp(13px,1.4vh,16px)}
  html body.with-side:not(.is-embedded) .light-deck .light-status{font-size:clamp(12.5px,1.3vh,15px)}
  html body.with-side:not(.is-embedded) .light-deck .light-actions button{font-size:clamp(12.5px,1.35vh,15px);min-height:clamp(40px,4.6vh,52px)}
  /* The brightness curve takes the height the square image leaves free. */
  html body.with-side:not(.is-embedded) .light-comparison [data-profile]{flex:1 1 0;min-height:96px;max-height:320px;height:0;aspect-ratio:auto}
  html body.with-side:not(.is-embedded) .light-comparison figcaption{font-size:clamp(12.5px,1.3vh,15px)}
}

/* ---------- Desktop windows up to 950 px high: compact chrome ---------- */
@media (min-width:1100px) and (min-height:600px) and (max-height:950px){
  :root{--intro-h:46px}
  html body.with-side:not(.is-embedded) .intro .eyebrow{display:none}
  html body.with-side:not(.is-embedded) .intro h1{margin:0;font-size:1.55rem}
  html body.with-side:not(.is-embedded) .intro .thesis{max-width:60%;font-size:12.5px;line-height:1.35}
  html body.with-side:not(.is-embedded) .intro .thesis[data-room]{display:none}
  html body[data-room="wort"].with-side:not(.is-embedded) .intro .thesis[data-room="wort"],
  html body[data-room="labor"].with-side:not(.is-embedded) .intro .thesis[data-room="labor"]{display:block}
  /* Word deck: the script hint appears while typing a word. */
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(2):not(:focus-within) > .word-note{display:none}
  html body.with-side:not(.is-embedded) .word-deck .word-steps{row-gap:10px}
  html body.with-side:not(.is-embedded) .moments-block{grid-template-columns:auto minmax(0,1fr);align-items:center;gap:8px}
  html body.with-side:not(.is-embedded) .moments-block .eyebrow{writing-mode:horizontal-tb;max-width:6.5em;line-height:1.25}
  html body.with-side:not(.is-embedded) .moments-block .wave-moments button{min-height:44px;flex-direction:row;gap:5px;padding:4px}
  html body.with-side:not(.is-embedded) .moments-block .wave-moments button canvas{width:26px;height:26px}
  /* Lab deck: two rows of five larger figures instead of three small rows. */
  html body.with-side:not(.is-embedded) #einzelton .note-bank button{min-height:0;padding:6px 2px}
  html body.with-side:not(.is-embedded) #einzelton .strike-button{min-height:0;padding-block:8px}
  html body.with-side:not(.is-embedded) #einzelton .mode-map-grid{grid-template-rows:repeat(2,minmax(0,1fr))!important}
  html body.with-side:not(.is-embedded) #einzelton .mode-map-grid > :nth-child(n+11){display:none!important}
}
@media (min-width:1100px) and (min-height:600px) and (max-height:800px){
  html body.with-side:not(.is-embedded) #einzelton .instruction{display:none}
  html body.with-side:not(.is-embedded) .word-deck .voice-note{display:none}
}
@media (min-width:1100px) and (min-height:600px) and (max-height:1050px){
  html body.with-side:not(.is-embedded) .word-deck .word-chips > span:first-child{display:none}
  html body.with-side:not(.is-embedded) .word-deck .word-steps > li:nth-child(3) > .speak-button,
  html body.with-side:not(.is-embedded) .word-deck .record-row button.record-button{min-height:40px;padding-block:4px}
  html body.with-side:not(.is-embedded) .word-deck .file-pick{margin-top:2px;font-size:12px;line-height:1.2}
  html body.with-side:not(.is-embedded) .moments-block .eyebrow{max-width:none}
  html body.with-side:not(.is-embedded) .moments-block{grid-template-columns:minmax(0,1fr)}
  html body.with-side:not(.is-embedded) .moments-block .wave-moments button{min-height:36px}
  html body.with-side:not(.is-embedded) .word-deck .word-downloads{grid-template-columns:repeat(3,minmax(0,1fr))}
  html body.with-side:not(.is-embedded) .word-deck .word-downloads .primary-download{grid-column:auto}
  html body.with-side:not(.is-embedded) .word-deck .word-downloads > button{min-height:40px;padding:5px 6px;font-size:12.5px;line-height:1.2}
}
@media (min-width:1100px) and (min-height:600px) and (max-height:760px){
  html body.with-side:not(.is-embedded) .word-deck{padding-block:10px;gap:7px}
  html body.with-side:not(.is-embedded) .word-deck .word-steps{row-gap:7px}
  html body.with-side:not(.is-embedded) .word-deck .slot-show{padding:4px 6px}
  html body.with-side:not(.is-embedded) .word-deck .slot-show canvas{width:28px;height:28px}
  html body.with-side:not(.is-embedded) .word-deck .view-notes > summary{padding-block:4px 8px}
  html body.with-side:not(.is-embedded) .word-deck .word-input,
  html body.with-side:not(.is-embedded) .word-deck #lang-input{min-height:38px;padding-block:6px}
  html body.with-side:not(.is-embedded) .word-deck .word-downloads > button{min-height:36px}
  html body.with-side:not(.is-embedded) .moments-block .wave-moments button{min-height:32px}
  html body.with-side:not(.is-embedded) .word-deck .voice-switch label span{padding-block:7px}
}
@media (min-width:1100px) and (min-height:600px) and (max-height:800px){
  html body.with-side:not(.is-embedded) .light-presets small{display:none}
  html body.with-side:not(.is-embedded) .light-deck{gap:8px;padding-block:12px}
}

/* ---------- Sidebar info: one look on every page (as on Light Studies) ---------- */
html body.with-side .side-info{display:grid;gap:2px;border:0}
html body.with-side .side-block{border:0!important}
html body.with-side .side-block > summary{display:flex!important;justify-content:flex-start!important;align-items:center;gap:10px;padding:12px 2px!important;list-style:none;cursor:pointer;font:600 clamp(15px,.95vw,16.5px)/1.3 Inter,Arial,sans-serif!important;color:var(--ink-strong)}
html body.with-side .side-block > summary::-webkit-details-marker{display:none}
html body.with-side .side-block > summary::marker{content:""}
html body.with-side .side-block > summary::after{content:none!important}
html body.with-side .side-block > summary::before{content:"";flex:none;width:0;height:0;border-style:solid;border-width:5px 0 5px 8px;border-color:transparent transparent transparent var(--ink-strong);transition:transform .15s}
html body.with-side .side-block[open] > summary::before{transform:rotate(90deg)}
html body.with-side .side-block > :not(summary){margin:0 2px 14px 20px!important}
html body.with-side .side-block p,
html body.with-side .side-block li{font-size:clamp(14px,.85vw,15.5px);line-height:1.6;color:#334155}
html body.with-side .side-block .side-sub{margin-top:18px!important;margin-bottom:6px!important;font:600 var(--type-floor)/1.3 var(--mono,monospace)!important;letter-spacing:.12em;text-transform:uppercase;color:#5a6873}
html body.with-side .side-block .howto{padding-left:1.2em}

/* Footer: volume, a thin rule, then DE/EN. */
html body.with-side .side-foot{gap:0!important}
html body.with-side .side-foot .volume{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:12px;margin:0;padding:0 0 12px;font-size:14px;color:var(--ink-soft)}
html body.with-side .side-foot .volume input{width:100%;accent-color:var(--pick)}
html body.with-side .side-foot .ui-lang{display:grid!important;grid-template-columns:1fr 1fr;gap:6px;padding-top:12px;border-top:1px solid var(--rule)}
html body.with-side .side-foot > .ui-lang:first-child{padding-top:0;border-top:0}
html body.with-side .side-foot .ui-lang button{padding:10px 0;border-radius:6px;font:600 14px Inter,Arial,sans-serif}
@media (max-width:1000px){
  html body.with-side .side-foot{position:sticky;bottom:0;padding:12px 0 14px}
  html body.with-side .side-toggle[aria-expanded="true"]{background:var(--pick)!important;border-color:var(--pick)!important;color:#fff!important}
  html body.with-side .side-more{gap:6px}
}

/* ---------- Phones: the open info is a full-screen layer ---------- */
@media (max-width:1000px){
  html body.with-side > .side.open{
    position:fixed;inset:0;z-index:50;height:100vh;height:100dvh;max-height:none;
    grid-template-rows:auto auto minmax(0,1fr);align-content:stretch;overflow:hidden;
  }
  html body.with-side > .side.open .side-more{display:flex;flex-direction:column;max-height:none;min-height:0;overflow-y:auto;overscroll-behavior:contain}
  html body.with-side > .side.open .side-foot{margin-top:auto;position:sticky;bottom:0;padding:10px 0 calc(10px + env(safe-area-inset-bottom))}
  /* Volume and language share one row. */
  html body.with-side .side-foot:has(.volume){grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:14px}
  html body.with-side .side-foot:has(.volume) .volume{padding:0;grid-template-columns:auto minmax(0,1fr);gap:8px;font-size:13px}
  html body.with-side .side-foot:has(.volume) .ui-lang{padding-top:0;border-top:0;grid-template-columns:52px 52px}
  html body.with-side .side-foot .ui-lang button{padding:9px 0}
}
@media (max-width:1000px){html body.with-side:has(> .side.open){overflow:hidden}}

/* ---------- Sidebar info per room ---------- */
html body[data-room="wort"] .side-info [data-room="labor"],
html body[data-room="labor"] .side-info [data-room="wort"]{display:none!important}

/* ==========================================================================
   Large screens: scale the whole interface, not only the image.
   One factor --s grows with width AND height. Every DOM part of the
   interface (sidebar, title row, plate heads and strips, decks, light
   captions) is zoomed by --s, so text, spacing and controls keep their
   proportions. Canvases are not zoomed; they size themselves. Columns and
   chrome heights are multiplied by --s, so the one-screen fit still holds.
   Below 2200 x 1200 nothing changes.
   ========================================================================== */
:root{--s:1}
@media (min-width:2200px) and (min-height:1200px){:root{--s:1.25}}
@media (min-width:2450px) and (min-height:1380px){:root{--s:1.4}}
@media (min-width:3000px) and (min-height:1650px){:root{--s:1.6}}
@media (min-width:3400px) and (min-height:1900px){:root{--s:1.8}}

@media (min-width:2200px) and (min-height:1200px){
  :root{
    --side-w:calc(296px * var(--s));
    --deck-min:calc(330px * var(--s));
    --deck-max:calc(560px * var(--s));
    --intro-h:calc(76px * var(--s));
    --type-floor:11px;
  }
  /* Sidebar: zoomed as a whole; its height is divided so it still ends at the window bottom. */
  html body.with-side:not(.is-embedded) > .side{zoom:var(--s);height:calc(100dvh / var(--s))}
  /* Title row: the row keeps its scaled height, its content is zoomed. */
  html body.with-side:not(.is-embedded) .intro > *{zoom:var(--s)}
  /* Decks: the grid track is already scaled; the content is zoomed inside it. */
  html body.with-side:not(.is-embedded) .control-deck,
  html body.with-side:not(.is-embedded) .light-deck{zoom:var(--s);font-size:100%}
  html body.with-side:not(.is-embedded) .word-instrument{--deck-min:calc(420px * var(--s))}
  html body.with-side:not(.is-embedded) .light-lab{grid-template-columns:minmax(0,1fr) clamp(var(--deck-min), 28%, var(--deck-max))}
  /* Plate heads, strips and overlays around the image. */
  html body.with-side:not(.is-embedded) .plate-head,
  html body.with-side:not(.is-embedded) .plate-strip,
  html body.with-side:not(.is-embedded) #einzelton .plate-foot,
  html body.with-side:not(.is-embedded) .plate-overlay{zoom:var(--s)}
  html body.with-side:not(.is-embedded) .word-instrument{--chrome:calc((36px + 18px) * var(--s) + 2 * var(--shell-pad) + 2px + 20px)}
  html body.with-side:not(.is-embedded) #einzelton{--chrome:calc((36px + 26px) * var(--s) + 2 * var(--shell-pad) + 2px + 20px)}
  /* Light studies: captions and heads around the computed images. */
  html body.with-side:not(.is-embedded) .light-stage-head,
  html body.with-side:not(.is-embedded) .light-image-head,
  html body.with-side:not(.is-embedded) .light-comparison figcaption,
  html body.with-side:not(.is-embedded) .light-equation{zoom:var(--s)}
  /* Inside zoomed parts, use the laptop type sizes; the zoom does the growing. */
  html body.with-side:not(.is-embedded) .light-deck .eyebrow,
  html body.with-side:not(.is-embedded) .light-deck .deck-panel > summary{font-size:12px}
  html body.with-side:not(.is-embedded) .light-presets b{font-size:14.5px}
  html body.with-side:not(.is-embedded) .light-presets small{font-size:12.5px}
  html body.with-side:not(.is-embedded) .light-presets button{padding:8px 11px}
  html body.with-side:not(.is-embedded) .light-deck .light-observation{font-size:16px}
  html body.with-side:not(.is-embedded) .light-deck .light-control label{font-size:13.5px}
  html body.with-side:not(.is-embedded) .light-deck .light-status{font-size:13px}
  html body.with-side:not(.is-embedded) .light-deck .light-actions button{font-size:13px;min-height:42px}
  html body.with-side:not(.is-embedded) .light-deck{gap:12px}
  html body.with-side:not(.is-embedded) .light-comparison figcaption{font-size:12.5px}
  html body.with-side:not(.is-embedded) .side-brand .side-title{font-size:24px!important}
  html body.with-side:not(.is-embedded) .side-nav a{font-size:16px}
  html body.with-side:not(.is-embedded) .side-block > summary{font-size:15.5px!important}
  html body.with-side:not(.is-embedded) .side-block p,
  html body.with-side:not(.is-embedded) .side-block li{font-size:14.5px}
  html body.with-side:not(.is-embedded) .intro h1{font-size:2.6rem}
  html body.with-side:not(.is-embedded) .intro .thesis{font-size:15px}
}
