/* Keep the chamber's prismatic language; give the experiment the most space. */
[hidden], .hidden, dialog:not([open]) { display: none !important; }
* { user-select: auto; }
body { height: 100dvh; }
button, summary, canvas { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--prismatic-cyan); outline-offset: 4px; }
button:disabled { opacity: .45; cursor: default; box-shadow: none; }
header { height: auto; min-height: 76px; flex-wrap: wrap; gap: 14px; padding: 16px 22px; flex-shrink: 0; }
.brand { gap: 10px; }
.brand-title { font-size: 1.25rem; letter-spacing: -.03em; text-transform: none; background: none; -webkit-text-fill-color: currentColor; }
.brand-tag { border: 0; background: none; text-transform: none; letter-spacing: 0; font-size: .78rem; padding: 0; color: #aebcd4; }
.brand-prism { width: 23px; height: 23px; animation: none; }
.header-actions { flex-wrap: wrap; gap: 6px; }
.btn { min-height: 40px; font-size: .8rem; letter-spacing: 0; padding: 8px 12px; justify-content: center; }
.btn:hover { box-shadow: none; }
.btn.active, .btn.primary { border-color: #38bdf8; background: #17384b; box-shadow: none; }
#btn-catalog { display: none; }
.workspace { min-height: 0; grid-template-columns: 240px minmax(0, 1fr); }
body.has-instruments .workspace { grid-template-columns: 240px minmax(0, 1fr) 285px; }
.sidebar-left, .sidebar-right { min-width: 0; gap: 22px; padding: 20px 14px; }
.catalog-intro { color: #aebcd4; font-size: .8rem; line-height: 1.5; }
.section-title { letter-spacing: .03em; text-transform: none; font-size: .85rem; color: #ced9eb; margin-bottom: 4px; }
.trial-btn { min-height: 42px; padding: 9px 10px; font-size: .78rem; border-radius: 5px; }
.trial-btn.active { border-color: #38bdf8; background: #153045; color: #fff; }
.trial-stars { font-size: .78rem; flex-shrink: 0; }
details summary { cursor: pointer; font-weight: 600; font-size: .86rem; padding: 8px 0; color: #d4e0f2; }
details[open] summary { margin-bottom: 8px; }
.tool-btn { min-height: 48px; }
.tool-name { display: block; font-size: .8rem; }
.tool-desc { display: block; font-size: .73rem; line-height: 1.4; margin-top: 3px; }
.palette-btn { min-height: 40px; font-size: .76rem; }
.editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.panel-note { font-size: .77rem; line-height: 1.5; color: #aebcd4; }
.viewport-container { min-width: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: start; overflow: auto; }
.trial-brief { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 22px 26px 16px; }
.scene-kind { color: #b0a7d9; font-size: .77rem; margin-bottom: 6px; }
h1 { font-size: clamp(1.35rem, 2.1vw, 2rem); letter-spacing: -.025em; line-height: 1.12; text-wrap: balance; }
#scene-instruction { max-width: 65ch; margin-top: 10px; font-size: .88rem; line-height: 1.5; color: #b9c8dd; }
.scene-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.trial-strip { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 12px 26px; border-block: 1px solid var(--glass-border); font-size: .78rem; color: #b9c8dd; }
.trial-strip strong { color: #e7effb; font-variant-numeric: tabular-nums; }
#trial-status { color: #6dd9bd; }
.arena { position: relative; flex: 1 0 360px; min-height: 360px; background: #090c16; }
#sim-canvas, #webgl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#sim-canvas { touch-action: none; }
#webgl-canvas { pointer-events: none; }
.viewport-overlay-frame { border-radius: 4px; inset: 8px; }
.stage-footer { border-top: 1px solid var(--glass-border); padding: 14px 26px 18px; background: #0d1122; }
#first-move { color: #b9c8dd; font-size: .82rem; line-height: 1.5; }
.launch-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin: 10px 0; }
.launch-row label { flex: 1 1 145px; font-size: .78rem; color: #b9c8dd; }
.launch-row output { float: right; color: #f8fafc; font-variant-numeric: tabular-nums; }
.launch-row input { display: block; width: 100%; margin-top: 10px; min-height: 22px; }
.thrust-controls { display: flex; gap: 8px; margin-top: 12px; }
.thrust-controls button { min-width: 48px; min-height: 44px; font-size: 1.1rem; }
.thrust-controls button:active { background: #17384b; }
.victory-banner { top: 22px; width: min(90%, 460px); padding: 16px; pointer-events: auto; }
.victory-title { font-size: 1.15rem; }
.victory-sub { font-size: .8rem; line-height: 1.5; }
#victory-stars { color: var(--prismatic-amber); margin: 8px 0; font-size: 1.2rem; }
#btn-next-trial { margin: 8px auto 0; }
#scene-error { padding: 16px 26px; background: #351e32; color: #ffd5eb; line-height: 1.5; }
.modal-overlay { width: 100%; max-width: none; height: 100dvh; max-height: none; border: 0; color: var(--text-main); margin: 0; }
.modal-overlay::backdrop { background: #070913d9; }
.modal-box { width: min(94vw, 960px); max-height: 90dvh; }
.modal-header { gap: 15px; }
#hud-toast { max-width: min(92vw, 560px); text-align: center; font-size: .85rem; line-height: 1.5; z-index: 100; }
#transfer-dialog { width: min(92vw, 660px); margin: auto; padding: 24px; color: #f8fafc; background: #0d1122; border: 1px solid #44516c; border-radius: 12px; }
#transfer-dialog::backdrop { background: #070913dc; }
.transfer-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.transfer-heading h2 { font-size: 1.25rem; }
#transfer-dialog label { display: block; margin: 20px 0 8px; font-size: .85rem; }
#transfer-text { width: 100%; resize: vertical; padding: 12px; background: #070913; color: #f8fafc; border: 1px solid #44516c; border-radius: 4px; font: .85rem/1.5 monospace; }
#transfer-error { color: #ffadc9; margin: 12px 0; line-height: 1.5; }
@media (max-width: 1200px) {
  .brand-tag { display: none; }
  body.has-instruments .workspace { grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar-right { grid-column: 1 / -1; max-height: 400px; border-top: 1px solid var(--glass-border); }
  body.has-instruments .workspace { overflow-y: auto; }
  body.has-instruments .viewport-container { min-height: 660px; }
}
@media (max-width: 900px) {
  body { height: auto; min-height: 100dvh; overflow: auto; }
  header { padding: 14px 16px; }
  .header-actions { width: 100%; }
  #btn-catalog { display: flex; }
  .workspace, body.has-instruments .workspace { display: flex; flex-direction: column; overflow: visible; }
  .viewport-container { order: 0; min-height: 650px; overflow: visible; }
  .sidebar-left { display: none; order: 1; max-height: 65dvh; border-top: 1px solid var(--glass-border); }
  body.catalog-open .sidebar-left { display: flex; }
  .sidebar-right { order: 2; max-height: none; }
  .trial-brief { padding: 20px 16px 14px; }
  .trial-strip { padding: 12px 16px; gap: 8px 15px; }
  .arena { min-height: 250px; flex: none; height: clamp(250px, 65vw, 520px); }
  .stage-footer { padding: 14px 16px; }
  .btn { min-height: 44px; }
  .modal-box { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

* { scrollbar-width: thin; scrollbar-color: #3c4962 #0d1122; }
