/* Full-screen motion lab interface. */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Instrument+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --paper: #171918;
  --paper-light: #f2eee8;
  --stage: #191c1b;
  --ink: #f2eee8;
  --muted: #9b9993;
  --line: rgba(242, 238, 232, 0.16);
  --signal: #e9873f;
  --signal-soft: #3b281c;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Instrument Sans', 'Helvetica Neue', sans-serif;
  --chrome: rgba(10, 11, 11, 0.96);
  --chrome-raised: rgba(28, 29, 27, 0.97);
  --chrome-muted: rgba(211, 207, 199, 0.68);
  --control-accent: #e9873f;
  --control-accent-soft: rgba(233, 135, 63, 0.18);
  --chrome-border: rgba(242, 238, 232, 0.13);
  --chrome-divider: rgba(242, 238, 232, 0.12);
  --chrome-heading: rgba(211, 207, 199, 0.52);
  --chrome-hover: rgba(242, 238, 232, 0.06);
  --chrome-active: rgba(17, 19, 18, 0.96);
  --chrome-active-text: #f2a06f;
  --chrome-shadow: 0 20px 48px rgba(0, 0, 0, 0.42), 0 2px 6px rgba(0, 0, 0, 0.24);
  --prompt-bg: rgba(10, 11, 11, 0.94);
  --prompt-text: #f2eee8;
  --prompt-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
}

html[data-theme='light'] {
  --paper: #e8e9e3;
  --paper-light: #f3f4ef;
  --stage: #f0eee6;
  --ink: #171916;
  --muted: #686c64;
  --line: rgba(23, 25, 22, 0.18);
  --signal: #ee5b38;
  --signal-soft: #f9d8cd;
  --chrome: rgba(225, 223, 214, 0.96);
  --chrome-raised: rgba(249, 247, 241, 0.94);
  --chrome-muted: rgba(76, 72, 65, 0.76);
  --control-accent: #ee5b38;
  --control-accent-soft: rgba(238, 91, 56, 0.14);
  --chrome-border: rgba(23, 25, 22, 0.16);
  --chrome-divider: rgba(23, 25, 22, 0.12);
  --chrome-heading: rgba(76, 72, 65, 0.58);
  --chrome-hover: rgba(23, 25, 22, 0.06);
  --chrome-active: rgba(238, 91, 56, 0.12);
  --chrome-active-text: #b93d22;
  --chrome-shadow: 0 20px 48px rgba(76, 61, 47, 0.16), 0 2px 6px rgba(72, 62, 52, 0.09);
  --prompt-bg: rgba(249, 247, 241, 0.94);
  --prompt-text: #171916;
  --prompt-shadow: 0 8px 24px rgba(76, 61, 47, 0.18);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  height: 100%;
}

body {
  margin: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(242, 238, 232, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 238, 232, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button, a { font: inherit; }
a { color: inherit; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

::selection { background: var(--signal-soft); }

.lab-shell {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

.viewer-panel {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--paper-light);
  box-shadow: none;
}

.viewer-layout {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.category-panel {
  position: absolute;
  left: 18px;
  top: 50%;
  z-index: 5;
  width: 188px;
  max-height: calc(100% - 36px);
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: linear-gradient(145deg, var(--chrome-raised), var(--chrome));
  border: 1px solid var(--chrome-border);
  border-radius: 10px;
  box-shadow: var(--chrome-shadow);
  backdrop-filter: blur(18px) saturate(0.82);
  transform: translateY(-50%);
  transition: transform 260ms ease, opacity 200ms ease;
}

/* Collapse: the panel slides off the left edge; the handle below stays behind
   to bring it back. Chrome only moves — the canvas underneath never resizes,
   so the camera and layout are untouched. .is-instant suppresses the slide for
   the restored-from-sessionStorage first paint, so a returning visitor's
   hidden panel is simply hidden rather than seen leaving. */
.category-panel.is-collapsed {
  transform: translate(-240px, -50%);
  opacity: 0;
  pointer-events: none;
}

.category-panel.is-instant,
.panel-toggle.is-instant {
  transition: none;
}

/* The handle: a slim vertical pill in the panel's own chrome, parked on its
   right edge, sliding to the screen edge when the panel hides. The chevron is
   inline SVG stroked with currentColor, flipped by the collapsed state. */
.panel-toggle {
  position: absolute;
  left: 214px;
  top: 50%;
  z-index: 5;
  width: 20px;
  height: 64px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--chrome-border);
  border-radius: 10px;
  color: var(--chrome-muted);
  background: linear-gradient(145deg, var(--chrome-raised), var(--chrome));
  box-shadow: var(--chrome-shadow);
  backdrop-filter: blur(18px) saturate(0.82);
  cursor: pointer;
  transform: translateY(-50%);
  transition: left 260ms ease, color 150ms ease;
}

.panel-toggle:hover { color: var(--ink); }

.panel-toggle svg {
  width: 8px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 260ms ease;
}

.panel-toggle.is-collapsed { left: 10px; }
.panel-toggle.is-collapsed svg { transform: rotate(180deg); }

.category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 7px 10px;
  border-bottom: 1px solid var(--chrome-divider);
  color: var(--chrome-heading);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.category-heading strong {
  color: var(--control-accent);
  font-size: 10px;
  font-weight: 500;
}

.category-theme {
  flex: 0 0 auto;
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 7px 9px 5px;
  border: 0;
  border-top: 1px solid var(--chrome-divider);
  border-radius: 0;
  color: var(--chrome-heading);
  background: transparent;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.015em;
  text-align: left;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.category-theme:hover { color: var(--ink); background: var(--chrome-hover); }

.category-theme .theme-value {
  gap: 7px;
  padding: 3px 4px 3px 8px;
  border: 1px solid var(--control-accent);
  border-radius: 999px;
  color: var(--ink);
  background: var(--control-accent-soft);
  font-size: 12px;
  font-weight: 600;
}

.category-theme .theme-swatch {
  width: 20px;
  height: 20px;
  border-color: var(--control-accent);
}

.example-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 7px;
  overflow-y: auto;
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.example-sidebar::-webkit-scrollbar { display: none; }

.example-item {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  min-height: 34px;
  max-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--chrome-muted);
  cursor: pointer;
  text-align: left;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.example-item:hover { color: var(--ink); background: var(--chrome-hover); }
.example-item.has-group-gap { margin-top: 8px; }
.example-item:focus-visible,
.status-control:focus-visible,
.dock-control:focus-visible { outline-color: var(--control-accent); }
.example-item.active {
  color: var(--chrome-active-text);
  background: var(--chrome-active);
  border-color: var(--control-accent);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(242, 160, 111, 0.1);
}
.example-name { font-size: 13px; font-weight: 500; letter-spacing: -0.005em; }
.example-count {
  display: none;
}

.viewer-wrapper {
  position: relative;
  min-width: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--stage);
}

.viewer-wrapper canvas { display: block; }

.viewer-wrapper .lil-gui {
  position: absolute;
  top: 12px;
  right: 12px;
  transform-origin: top right;
  z-index: 3;
  --background-color: var(--chrome);
  --title-background-color: rgba(242, 238, 232, 0.08);
  --text-color: #f2eee8;
  --title-text-color: #f2eee8;
  --widget-color: rgba(242, 238, 232, 0.13);
  --focus-color: var(--control-accent);
  --width: 210px;
  --name-width: 55%;
  --widget-height: 20px;
  --padding: 6px;
  --spacing: 6px;
  font-size: 12px;
  border: 1px solid var(--chrome-border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(18px) saturate(0.7);
  will-change: transform;
}

.viewer-wrapper .lil-gui.root > .title {
  text-align: left;
}

.interactive-viewer-page .viewer-wrapper .lil-gui { display: none; }

.control-bar,
.control-dock {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  color: var(--chrome-muted);
  background: linear-gradient(145deg, var(--chrome-raised), var(--chrome));
  border: 1px solid rgba(242, 238, 232, 0.13);
  border-radius: 15px;
  box-shadow: var(--chrome-shadow);
  backdrop-filter: blur(18px) saturate(0.84);
}

.control-bar {
  top: 12px;
  right: 12px;
  width: 194px;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 11px 12px;
  border-radius: 10px;
}

.control-status {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 16px;
  padding: 0 2px 5px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
}

.control-status > span { color: rgba(211, 207, 199, 0.48); letter-spacing: 0.015em; }
.control-status > strong {
  overflow: hidden;
  color: var(--paper-light);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-control .theme-value {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(226, 221, 213, 0.7);
  font-size: 10px;
  transition: color 150ms ease;
}

.theme-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(242, 238, 232, 0.28);
  border-radius: 50%;
  background: #191c1b;
  box-shadow: inset 0 0 0 3px rgba(242, 238, 232, 0.08);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.theme-control:hover .theme-value { color: var(--paper-light); }
.theme-control:focus-visible { outline-color: var(--control-accent); }
html[data-theme='light'] .theme-swatch {
  border-color: rgba(23, 25, 22, 0.24);
  background: #f0eee6;
  box-shadow: inset 0 0 0 3px rgba(23, 25, 22, 0.06);
}

.control-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.status-control {
  width: 100%;
  min-height: 28px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 2px;
  border: 0;
  border-radius: 4px;
  color: rgba(211, 207, 199, 0.48);
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.015em;
  text-align: left;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.status-control:hover {
  color: rgba(226, 221, 213, 0.74);
  background: rgba(242, 238, 232, 0.055);
}

.status-control:focus-visible { outline-offset: 1px; }

.control-switch {
  position: relative;
  justify-self: end;
  width: 34px;
  height: 19px;
  border: 1px solid rgba(211, 207, 199, 0.24);
  border-radius: 999px;
  background: rgba(211, 207, 199, 0.1);
  transition: border-color 160ms ease, background 160ms ease;
}

.control-switch i {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(211, 207, 199, 0.54);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.36);
  transition: transform 160ms ease, background 160ms ease;
}

.status-control.is-active .control-switch {
  border-color: rgba(233, 135, 63, 0.8);
  background: rgba(233, 135, 63, 0.3);
}

.status-control.is-active .control-switch i {
  background: var(--control-accent);
  transform: translateX(15px);
}

.control-dock {
  left: 50%;
  top: 12px;
  bottom: auto;
  max-width: calc(100% - 380px);
  gap: 2px;
  padding: 5px 7px;
  border-radius: 12px;
  transform: translateX(-50%);
}

.dock-control {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 7px 2px 3px;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms ease, background 150ms ease;
}

.dock-control:hover { color: var(--paper-light); background: rgba(242, 238, 232, 0.07); }
.dock-control.is-active { color: var(--paper-light); }

.dock-control kbd {
  min-width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border: 1px solid rgba(211, 207, 199, 0.26);
  border-bottom-color: rgba(211, 207, 199, 0.4);
  border-radius: 6px;
  color: rgba(226, 221, 213, 0.72);
  background: rgba(211, 207, 199, 0.1);
  box-shadow: inset 0 -1px 0 rgba(242, 238, 232, 0.08);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
}

.dock-control.is-active kbd {
  color: var(--paper-light);
  border-color: rgba(233, 135, 63, 0.7);
  background: var(--control-accent-soft);
}

.dock-control span,
.dock-hint {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.dock-project {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  margin-left: 6px;
  padding: 0 7px 0 10px;
  border-left: 1px solid rgba(211, 207, 199, 0.18);
  color: var(--chrome-muted);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease;
}

.dock-project:hover { color: var(--paper-light); }
.dock-project:focus-visible { outline-color: var(--control-accent); }

.dock-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
  white-space: nowrap;
}

.orbit-icon,
.zoom-icon {
  position: relative;
  width: 16px;
  height: 16px;
  display: inline-block;
  border: 1px solid rgba(211, 207, 199, 0.38);
  border-radius: 50%;
}

.orbit-icon::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 1px;
  width: 5px;
  height: 5px;
  border-top: 1px solid var(--paper-light);
  border-right: 1px solid var(--paper-light);
  transform: rotate(18deg);
}

.zoom-icon { border-radius: 7px; }
.zoom-icon::before { content: ''; position: absolute; left: 7px; top: 2px; width: 1px; height: 4px; background: rgba(211, 207, 199, 0.62); }

html[data-theme='light'] body {
  background:
    linear-gradient(rgba(23, 25, 22, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 25, 22, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

html[data-theme='light'] .example-item:hover,
html[data-theme='light'] .dock-control:hover {
  color: var(--ink);
  background: var(--chrome-hover);
}

html[data-theme='light'] .example-item { color: var(--muted); }

html[data-theme='light'] .control-status > span,
html[data-theme='light'] .status-control { color: var(--ink); }
html[data-theme='light'] .control-status > strong,
html[data-theme='light'] .dock-control.is-active { color: var(--ink); }
html[data-theme='light'] .status-control:hover { color: var(--ink); background: rgba(112, 101, 88, 0.08); }
html[data-theme='light'] .theme-control .theme-value { color: var(--muted); }
html[data-theme='light'] .theme-control:hover .theme-value { color: var(--ink); }
html[data-theme='light'] .category-theme .theme-value { color: var(--ink); }

html[data-theme='light'] .control-switch {
  border-color: rgba(72, 66, 58, 0.27);
  background: rgba(93, 84, 74, 0.1);
}
html[data-theme='light'] .control-switch i { background: rgba(72, 66, 58, 0.46); }

html[data-theme='light'] .dock-control kbd {
  color: rgba(66, 62, 55, 0.72);
  border-color: rgba(72, 66, 58, 0.25);
  border-bottom-color: rgba(72, 66, 58, 0.4);
  background: rgba(93, 84, 74, 0.08);
  box-shadow: inset 0 -1px 0 rgba(72, 66, 58, 0.08);
}
html[data-theme='light'] .dock-control.is-active kbd {
  color: var(--ink);
  border-color: rgba(238, 91, 56, 0.66);
}
html[data-theme='light'] .dock-project { border-left-color: rgba(23, 25, 22, 0.17); }
html[data-theme='light'] .dock-project:hover { color: var(--ink); }
html[data-theme='light'] .orbit-icon,
html[data-theme='light'] .zoom-icon { border-color: rgba(23, 25, 22, 0.36); }
html[data-theme='light'] .orbit-icon::after { border-color: var(--ink); }
html[data-theme='light'] .zoom-icon::before { background: rgba(23, 25, 22, 0.58); }

html[data-theme='light'] .viewer-label {
  border-color: rgba(23, 25, 22, 0.15);
  background: rgba(243, 244, 239, 0.76);
}
html[data-theme='light'] .viewer-label::after { background: linear-gradient(to bottom, transparent, rgba(23, 25, 22, 0.38)); }
html[data-theme='light'] .viewer-pin { box-shadow: 0 0 0 2px rgba(243, 244, 239, 0.68); }
html[data-theme='light'] #loading-overlay { color: var(--ink); background: rgba(240, 238, 230, 0.88); }
html[data-theme='light'] #drop-hint { color: var(--signal); background: rgba(249, 216, 205, 0.88); }
html[data-theme='light'] .drop-note { color: rgba(23, 25, 22, 0.56); }
html[data-theme='light'] .drop-note span { border-color: rgba(23, 25, 22, 0.24); }

#viewer-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }

.viewer-label {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 250px;
  padding: 5px 9px;
  border: 1px solid rgba(242, 238, 232, 0.15);
  border-radius: 3px;
  color: var(--ink);
  background: rgba(18, 19, 18, 0.88);
  backdrop-filter: blur(4px);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  will-change: transform;
  animation: label-in 180ms ease-out both;
}

.viewer-label::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  margin-left: var(--leader-x, 0px);
  margin-top: var(--leader-y, 0px);
  width: 1px;
  height: var(--leader, 0px);
  background: linear-gradient(to bottom, transparent, rgba(242, 238, 232, 0.38));
  transform-origin: top center;
  transform: rotate(var(--leader-angle, 0rad));
}

.viewer-pin {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 2px rgba(18, 19, 18, 0.72);
  will-change: transform;
  animation: label-in 180ms ease-out both;
}

/* Full-screen prompts are hover feedback, not persistent annotations. The rig
   itself identifies the target, so the usual leader and pin are unnecessary. */
.interactive-viewer-page .viewer-label::after,
.interactive-viewer-page .viewer-pin {
  display: none !important;
}

.interactive-viewer-page .viewer-label {
  max-width: 280px;
  padding: 9px 12px 10px;
  border: 0;
  border-left: 3px solid var(--signal);
  border-radius: 4px;
  color: var(--prompt-text);
  background: var(--prompt-bg);
  backdrop-filter: blur(10px);
  box-shadow: var(--prompt-shadow);
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
}

@keyframes label-in { from { opacity: 0; } }

#loading-overlay,
#drop-hint {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  color: var(--paper-light);
  background: rgba(17, 19, 19, 0.94);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--signal); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

#drop-hint { display: none; margin: 14px; border: 1px dashed var(--signal); color: var(--paper-light); background: rgba(59, 40, 28, 0.94); }

.drop-note {
  position: absolute;
  bottom: 16px;
  right: 18px;
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(211, 207, 199, 0.58);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.drop-note span {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(211, 207, 199, 0.26);
  border-radius: 50%;
  font-size: 13px;
}

@media (max-width: 900px) {
  .viewer-layout { aspect-ratio: auto; }
  /* The panel is the bottom strip here — primary navigation, never hidden.
     Neutralize any collapsed state carried over from a desktop-width session. */
  .panel-toggle { display: none; }
  .category-panel.is-collapsed {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
  .category-panel {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    max-height: none;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 5px;
    transform: none;
  }
  .category-heading { display: none; }
  .example-sidebar { flex: 1 1 auto; width: auto; flex-direction: row; padding-top: 0; overflow-x: auto; overflow-y: hidden; }
  .category-theme {
    flex: 0 0 42px;
    width: 42px;
    min-height: 38px;
    align-self: stretch;
    display: grid;
    place-items: center;
    padding: 0;
    border-top: 0;
    border-left: 1px solid var(--chrome-divider);
  }
  .category-theme > span:first-child,
  .category-theme .theme-name { display: none; }
  .category-theme .theme-value {
    justify-self: center;
    gap: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .category-theme .theme-swatch { width: 20px; height: 20px; }
  .category-panel .category-theme { display: none; }
  .drop-note { display: none; }
  .control-dock {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    top: calc(max(8px, env(safe-area-inset-top)) + 163px);
    bottom: auto;
    max-width: none;
    overflow-x: auto;
    scrollbar-width: none;
    transform: none;
  }
  .control-bar {
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    width: min(194px, calc(100% - 16px));
  }
  .control-dock::-webkit-scrollbar { display: none; }
  .dock-hint { display: none; }
  .example-item { width: auto; min-width: max-content; min-height: 38px; max-height: 38px; padding: 0 11px; }
  .example-item.has-group-gap { margin-top: 0; margin-left: 8px; }
  .example-item.active { padding-left: 11px; }
  .example-name { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .viewer-wrapper { height: 100vh; height: 100dvh; min-height: 0; }
}

@media (max-width: 560px) {
  .viewer-wrapper { height: 100vh; height: 100dvh; min-height: 0; }
  .category-panel {
    left: max(6px, env(safe-area-inset-left));
    right: max(6px, env(safe-area-inset-right));
    bottom: max(6px, env(safe-area-inset-bottom));
    width: auto;
    padding: 4px;
    border-radius: 12px;
  }
  .example-sidebar {
    min-width: 0;
    width: auto;
    scroll-snap-type: x proximity;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
  }
  .example-item {
    min-height: 44px;
    max-height: 44px;
    padding: 0 11px;
    scroll-snap-align: start;
  }
  .example-item.active { padding-left: 11px; }
  .example-name { font-size: 11px; }
  .viewer-label { max-width: 180px; font-size: 9px; padding: 4px 7px; }
  .control-dock {
    top: calc(max(8px, env(safe-area-inset-top)) + 96px);
    bottom: auto;
    padding: 5px 6px;
    border-radius: 12px;
  }
  .control-bar {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    width: auto;
    padding: 8px;
    border-radius: 12px;
  }
  .control-status {
    grid-template-columns: auto 1fr;
    padding: 0 4px 7px;
  }
  .control-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }
  .status-control {
    min-width: 0;
    min-height: 48px;
    grid-template-columns: 1fr;
    grid-template-rows: auto 20px;
    align-content: center;
    gap: 4px;
    padding: 5px 6px;
    font-size: 10px;
  }
  .status-control > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .control-switch { justify-self: start; }
  .dock-control { min-height: 32px; padding: 2px 7px 2px 3px; }
  .dock-control kbd { min-width: 24px; height: 24px; font-size: 9px; }
  .dock-control span { font-size: 10px; }
}

@media (max-height: 520px) and (max-width: 900px) {
  .example-sidebar { max-height: none; }
  .example-item { min-height: 30px; max-height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
