:root { color-scheme: dark; --lab-accent: #e9b86a; }
* { box-sizing: border-box; }
body { font-family: ui-sans-serif, system-ui, -apple-system, sans-serif; }
button, select, input { font: inherit; }
button, select { min-height: 36px; border-radius: 8px !important; }
button { cursor: pointer; }
button:hover { filter: brightness(1.15); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #7bc9d2; outline-offset: 3px;
}
input[type="range"], input[type="checkbox"] { accent-color: var(--lab-accent); }
.lab-flat { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 20px; padding: 24px; width: 100%; height: auto; min-height: 100dvh; overflow: auto; }
.lab-flat > canvas, .lab-flat #canvas-container { flex: 1 1 480px; min-width: 0; max-width: 760px; }
.lab-flat canvas { display: block; max-width: 100%; height: auto; object-fit: contain; }
.lab-flat #panel { flex: 0 1 320px; width: 320px; max-width: 100%; min-width: 0; height: auto; padding: 20px; background: #111923; border: 1px solid #2b3746; border-radius: 16px; }
.lab-flat #panel h1 { font-size: 22px; margin: 0 0 6px; }
.lab-flat #panel .sub { font-size: 13px; line-height: 1.5; }
.lab-flat label { line-height: 1.6; }
.lab-flat .note { font-size: 12px; line-height: 1.65; }
.lab-flat .readout { line-height: 1.6; overflow-wrap: anywhere; }
.lab-flat #canvas-container { display: block; height: auto; padding: 0; }
.lab-flat #container { max-width: 100%; }
.lab-flat .display-row { flex-wrap: wrap; justify-content: center; }
.lab-flat .display-row canvas { flex: 0 1 auto; }
canvas { touch-action: none; }
.lab-home { position: fixed; top: 8px; right: 12px; z-index: 100; color: var(--lab-accent, var(--accent, #f3d39f)); background: #151d29; border: 1px solid #40516b; padding: 7px 12px; border-radius: 8px; text-decoration: none; font-size: 12px; }
.standalone-lab.lab-flat { padding-top: 52px; }
.lab-webgl #ui-container { padding: 12px; }
.lab-webgl #panel { overflow-y: auto; }
.lab-webgl #panel > * { flex-shrink: 0; }
.standalone-lab.lab-webgl #ui-container { padding-top: 48px; }
.lab-keypad { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; pointer-events: auto; }
.lab-keypad button { background: #202832; color: #edf1f5; border: 1px solid #465461; padding: 6px 10px; font-size: 12px; }
#lab-error { position: fixed; z-index: 200; inset: auto 12px 12px; background: #3c1e28; border: 1px solid #ed8294; color: #fff; padding: 16px; border-radius: 12px; font: 14px/1.5 system-ui; }
@media (max-width: 720px) {
  .lab-flat { padding: 12px; gap: 12px; flex-direction: column; align-items: center; }
  .lab-flat > canvas, .lab-flat #canvas-container { flex: none; width: 100%; }
  .lab-flat > div { max-width: 100%; }
  .lab-flat #panel { flex: none; width: 100%; }
  .lab-flat .display-row { gap: 12px; }
  .lab-webgl #title-bar { font-size: 13px; padding: 10px; }
  .lab-webgl #status-message, .lab-webgl #subtitle { font-size: 12px; }
  .lab-webgl #footer-bar { font-size: 10px; padding: 8px; }
  .lab-webgl #panel { width: calc(100vw - 24px); max-width: 420px; max-height: 40dvh; top: auto; bottom: 12px; left: 12px; background: #111923f5; border: 1px solid #344255; border-radius: 14px; }
  .lab-keypad { gap: 4px; }
  button, select { min-height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Match the Time Observatory disclosure while fitting each world's controls. */
.world-model-notes {
  width: 100%; min-width: 0; margin-top: 16px; border: 1px solid #293842;
  border-radius: 12px; background: #111b23; color: #afc0cc;
  font: 12px/1.8 ui-sans-serif, system-ui, sans-serif; text-align: left;
  pointer-events: auto; user-select: text; overflow-wrap: anywhere;
}
.world-model-notes > summary {
  cursor: pointer; color: var(--lab-accent, var(--accent, #e9b86a)); font-size: 13px; padding: 12px 14px;
  min-height: 44px; border-radius: 12px;
}
summary:focus-visible { outline: 2px solid #7bc9d2; outline-offset: 2px; }
.world-model-notes > summary:hover { background: #1a2730; }
.world-model-content { padding: 0 14px 16px; }
.world-model-content h2 { font-size: 15px; line-height: 1.5; color: #e6edf0; margin: 4px 0 12px; }
.world-model-content h3 { font-size: 12px; color: #e6edf0; margin: 18px 0 6px; }
.world-model-content p { font-size: 12px; line-height: 1.8; margin: 8px 0; }
.world-model-content .world-model-equation { font-family: ui-monospace, monospace; color: var(--lab-accent, var(--accent, #eed2a6)); }
#footer-bar:has(.world-model-notes) { max-width: min(800px, 100%); min-width: 0; }
#footer-bar .world-model-content { max-height: min(38dvh, 360px); overflow-y: auto; overscroll-behavior: contain; }
#hypercube-panel .world-model-notes { padding-top: 0; }
#hypercube-panel .world-model-content h2 { font-size: 15px; }
