:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101419;
  color: #e6edf3;
  --cyan: #66e4dc;
  --coral: #ff987f;
  --muted: #9aa8b6;
  --border: #2b3541;
}
* { box-sizing: border-box; }
body { margin: 0; padding: 32px; max-width: 1540px; margin-inline: auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { color: var(--cyan); font-size: 11px; letter-spacing: 3px; margin: 0; font-weight: 700; }
.header-controls { display: flex; align-items: center; gap: 20px; }
.mode-control, .quick-starts { display: flex; align-items: center; gap: 8px; }
.mode-control label, .quick-starts-label { color: var(--muted); font-size: 10px; white-space: nowrap; }
.quick-starts { border-left: 1px solid var(--border); padding-left: 20px; }
h1 { margin: 0; font-size: 30px; letter-spacing: -1px; font-weight: 600; }
.intro, .hint, .stage-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
.intro { font-size: 14px; margin: 0; }
main { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 24px; align-items: start; }
.stage-panel { background: #151c24; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; position: sticky; top: 24px; }
.stage-heading { display: flex; justify-content: space-between; padding: 20px 24px 0; font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 20px; }
#clock { color: var(--muted); font-variant-numeric: tabular-nums; }
#stage { display: block; width: 100%; aspect-ratio: 1; max-height: 70vh; }
.grid { stroke: #34404e; fill: none; stroke-width: 1; }
#hand-orbit { stroke-dasharray: 4 7; }
.origin { fill: #8190a0; stroke: none; }
.cyan { color: var(--cyan); }
.coral { color: var(--coral); }
.cyan-stroke { stroke: var(--cyan); }
.coral-stroke { stroke: var(--coral); }
.cyan-fill { fill: var(--cyan); }
.coral-fill { fill: var(--coral); }
.trail { fill: none; stroke-width: 1.6; opacity: 0.45; }
.hand-trail { stroke-dasharray: 3 4; }
.chain { stroke-width: 2; }
.hand { fill: #151c24; stroke-width: 2.5; }
.head { stroke-width: 0; }
.assistance-guide { fill: none; stroke-dasharray: 3 4; stroke-width: 1.5; opacity: 0.6; }
.playback { display: flex; align-items: center; gap: 10px; padding: 12px 24px; border-top: 1px solid var(--border); }
button, select { font: inherit; border-radius: 7px; padding: 9px 12px; }
button { cursor: pointer; color: #102525; background: var(--cyan); border: 1px solid transparent; font-size: 12px; font-weight: 600; }
button:hover { filter: brightness(1.12); }
.secondary { background: #202a35; color: #d7e1eb; border-color: #354251; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
.timeline { display: flex; align-items: center; gap: 12px; flex: 1; color: var(--muted); font-size: 12px; min-width: 0; }
.timeline input { min-width: 0; }
.stage-note { padding: 0 24px 14px; margin: 0; text-align: center; }
aside { background: #151c24; border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
h2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 0 0 12px; }
.section-note, .field-note { color: var(--muted); font-size: 10px; font-weight: 400; }
.field-note { margin: 16px 0 0; }
.control-section > .slider-label:first-of-type { margin-top: 0; }
.control-section + .control-section, .poi-controls + .control-section { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 20px; }
.slider-label { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 12px; margin-top: 16px; }
.slider-label output { font-variant-numeric: tabular-nums; color: var(--cyan); }
input[type="range"] { width: 100%; accent-color: var(--cyan); margin: 10px 0 0; cursor: pointer; }
.timeline input { margin: 0; }
.hint { margin: 8px 0 0; }
.presets { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.poi-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.control-subgroup { margin-top: 20px; }
#live-poi-controls:not(:empty) { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 16px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
fieldset label { display: block; font-size: 11px; color: #b7c3d0; margin-bottom: 7px; }
fieldset .slider-label { display: flex; }
select { display: block; width: 100%; background: #202a35; border: 1px solid #354251; color: #e6edf3; font-size: 11px; padding: 8px 4px; margin-bottom: 16px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 12px; }
input[type="checkbox"] { accent-color: var(--cyan); }
.panel-tabs { display: flex; border-bottom: 1px solid var(--border); margin: -4px 0 20px; }
.panel-tab { flex: 1; border-radius: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); }
.panel-tab[aria-selected="true"] { border-bottom-color: var(--cyan); color: var(--cyan); }
.panel-tab:hover { background: #202a35; filter: none; }
.panel-tab:focus-visible { outline-offset: -2px; }
.combined-controls { margin-top: 20px; }
.separate-controls > .slider-label:first-child { margin-top: 12px; }
.timing-control { margin-top: 20px; }
.timing-control legend { display: flex; align-items: center; gap: 8px; }
.timing-options { display: flex; gap: 16px; }
.timing-options label { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid #354251; border-radius: 7px; background: #202a35; color: #b7c3d0; font-size: 12px; cursor: pointer; }
.timing-options input { accent-color: var(--cyan); }
.convention { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 20px; }
#model { width: auto; margin-bottom: 0; font-size: 12px; padding: 9px; }
#gravity-control { margin-bottom: 16px; }
#share-controls { margin-top: 24px; font-size: 12px; }
#share-url { display: block; width: 100%; margin-top: 8px; padding: 10px; background: #202a35; color: #e6edf3; border: 1px solid var(--border); border-radius: 7px; }
#edit-link { position: fixed; top: 16px; right: 16px; z-index: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px; text-decoration: none; font-size: 12px; }
#url-error { color: var(--coral); }
body.viewer { padding: 0; max-width: none; }
.viewer > header, .viewer aside, .viewer .stage-heading, .viewer .playback, .viewer #share-controls { display: none; }
.viewer main { display: block; }
.viewer .stage-panel { position: static; border: 0; border-radius: 0; }
.viewer #stage { height: 100dvh; max-height: none; }
@media (max-width: 900px) {
  body { padding: 20px; }
  main { grid-template-columns: minmax(0, 1fr); }
  .stage-panel { position: static; }
  header { align-items: start; flex-direction: column; gap: 10px; }
  .header-controls { flex-wrap: wrap; }
  #stage { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
