* { box-sizing:border-box; }
[hidden] { display:none !important; }
:root {
  color-scheme:light;
  --paper:#faf9f5; --card:#fffefa; --ink:#342d3e; --muted:#6b606f;
  --edge:#dcd3da; --plum:#65467a; --gold:#a47731;
}
body { margin:0; background:var(--paper); color:var(--ink); font:1rem/1.5 Nunito,"Segoe UI",sans-serif; }
a { color:var(--plum); text-underline-offset:.19em; }
button { font:inherit; cursor:pointer; }
:is(button, a, summary):focus-visible { outline:3px solid #9d78ab; outline-offset:4px; }
.lead-lab .workspace { display:grid; grid-template-columns:minmax(0,2.15fr) minmax(265px,1fr); align-items:start; gap:clamp(15px,2vw,28px); margin-bottom:48px; }
#bench,.notes { min-width:0; background:var(--card); border:1px solid var(--edge); border-radius:12px; box-shadow:0 3px 0 #e3dce373; }
#bench { overflow:hidden; }
.window { position:relative; background:#c4bdb1; }
#scene { display:block; width:100%; height:auto; aspect-ratio:4/3; }
.compact { z-index:2; position:absolute; right:10px; top:10px; min-height:44px; display:inline-flex; align-items:center; gap:7px; color:#fff; background:#242426dc; border:1px solid #ffffff78; border-radius:8px; padding:5px 11px; font-weight:700; font-size:.875rem; }
.compact.zoom { left:10px; right:auto; }
.compact.zoom[aria-pressed=true] { color:#372640; background:#fffcf3; }
.compact:hover:enabled { background:#121215eb; }
.compact.zoom[aria-pressed=true]:hover { background:#ede5ef; }
.corners { display:block; width:14px; height:14px; background:
  linear-gradient(currentColor,currentColor) top left/5px 1.5px,
  linear-gradient(currentColor,currentColor) top left/1.5px 5px,
  linear-gradient(currentColor,currentColor) top right/5px 1.5px,
  linear-gradient(currentColor,currentColor) top right/1.5px 5px,
  linear-gradient(currentColor,currentColor) bottom left/5px 1.5px,
  linear-gradient(currentColor,currentColor) bottom left/1.5px 5px,
  linear-gradient(currentColor,currentColor) bottom right/5px 1.5px,
  linear-gradient(currentColor,currentColor) bottom right/1.5px 5px; background-repeat:no-repeat; }
.controls { padding:clamp(13px,1.8vw,22px); }
.readout h2 { font-size:1.13rem; margin:0 0 2px; }
.readout p { margin:0; color:#514954; line-height:1.4; max-width:70ch; }
.buttons { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:12px; }
.buttons button { min-height:44px; border-radius:8px; padding:8px 16px; font-weight:800; line-height:1.25; }
.buttons .primary { color:#fff; border:1px solid #563965; background:var(--plum); }
.buttons .primary:hover { background:#503660; }
.buttons .primary:disabled,.buttons .primary[aria-disabled=true] { cursor:default; border-color:#dad2dc; background:#ece7ed; color:#66596b; box-shadow:none; }
.buttons .reset { border:1px solid #d7cadb; background:#faf6fa; color:#5b4867; }
.buttons .reset:hover { background:#f0e8f2; }
.notes { padding:clamp(16px,2vw,27px); }
.notes h2 { margin:0; font-size:1.28rem; line-height:1.2; }
.notes .empty { color:var(--muted); margin:14px 0 0; }
#notes { margin:0; padding:0; list-style:none; }
#notes li { padding:14px 0 15px 15px; position:relative; border-bottom:1px dashed #e4dce2; }
#notes li::before { content:""; position:absolute; top:21px; left:0; width:6px; height:6px; border-radius:50%; background:#ad8446; }
#notes li:last-child { border-bottom:0; }
#notes h3,.theory h3 { margin:0 0 3px; font-size:1rem; }
#notes p,.theory p { margin:0; color:#544b56; line-height:1.42; }
.theory { border-top:1px solid var(--edge); margin-top:18px; }
.theory summary { padding:12px 0 3px; cursor:pointer; font-weight:800; color:var(--plum); min-height:44px; }
.theory>div { padding:5px 0 0; }
.theory h3:not(:first-child) { margin-top:14px; }
.theory .equation { margin:4px 0 9px; padding:6px 10px; border-left:3px solid #b6904e; background:#f8f2df; font-weight:800; letter-spacing:.01em; }
.theory .source { margin-top:14px; font-size:.875rem; }
.lab-full { overflow:hidden; }
.lab-full .lead-lab .app > .workspace { display:block; }
.lab-full .lead-lab .notes { display:none; }
.lab-full #bench { position:fixed; z-index:100; inset:0; overflow:auto; display:grid; grid-template-rows:minmax(0,1fr) auto; border:0; border-radius:0; padding-bottom:env(safe-area-inset-bottom); }
.lab-full .window { min-height:0; }
.lab-full #scene { width:100%; height:100%; }
.lab-full .controls { padding:10px max(15px,env(safe-area-inset-right)) 10px max(15px,env(safe-area-inset-left)); }
.lab-full .buttons { margin-top:6px; }
@media(min-width:820px) and (max-height:850px) {
  .window { height:clamp(275px,52vh,580px); }
  #scene { height:100%; }
  .lab-full .window { height:auto; }
}
@media(max-width:790px) {
  .lead-lab .workspace { grid-template-columns:1fr; }
  .notes { padding:16px 18px; }
}
@media(max-width:480px) {
  .buttons button { padding-inline:12px; }
  .compact { top:6px; right:6px; }
  .compact.zoom { left:6px; }
  .window { max-height:48svh; }
  #scene { max-height:48svh; }
  .lab-full .window,.lab-full #scene { max-height:none; }
}
@media(max-height:510px) and (orientation:landscape) {
  .lab-full #bench { grid-template-columns:minmax(0,1.9fr) minmax(205px,1fr); grid-template-rows:1fr; }
  .lab-full .controls { display:flex; flex-direction:column; justify-content:center; }
}
