/* clip — brand: Quiet Paper, Loud Stripe. Paper surface, ink borders, hard
   offset shadows, discrete hard-stop color bands only. No blended gradients,
   no emoji UI, custom SVG icons only. The segmented Orbit ring is decorative
   brand art; the everyday record control is deliberately plainer. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --paper: #f5f0e5;
  --cream: #fffaf0;
  --ink: #1e1a17;
  --muted: #655f58;
  --rule: #d9d0c1;
  --red: #e54838;
  --orange: #ef8d21;
  --yellow: #f7cb36;
  --green: #4ea969;
  --blue: #299ed7;
  --violet: #7662d5;
  --pink: #df73a8;
  --shadow: 7px 7px 0 var(--ink);
  --small-shadow: 4px 4px 0 var(--ink);
  --focus: #1c6ee8;
}

html { background: var(--paper); }
body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-rounded, "Avenir Next", Avenir, Inter, system-ui, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

/* stripe bar */
.stripe { height: 7px; background: linear-gradient(90deg, var(--red) 0 14.28%, var(--orange) 14.28% 28.56%, var(--yellow) 28.56% 42.84%, var(--green) 42.84% 57.12%, var(--blue) 57.12% 71.4%, var(--violet) 71.4% 85.7%, var(--pink) 85.7% 100%); }

/* topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  text-decoration: none;
  min-height: 30px;
}
.brand-mark { width: 25px; height: 25px; flex: none; }
.brand-wordmark {
  position: relative;
  display: inline-block;
  font-family: ui-rounded, "Avenir Next Rounded", "Avenir Next", Avenir, Inter, system-ui, sans-serif;
  font-size: 1.42rem;
  font-weight: 950;
  line-height: .9;
  letter-spacing: -.085em;
}
.brand-i { position: relative; }
.brand-i::before {
  content: "";
  position: absolute;
  top: -.13em;
  left: 50%;
  width: .28em;
  height: .28em;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 1.5px var(--paper);
  transform: translateX(-50%);
}
.brand:hover .brand-wordmark { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.topbar-nav a { color: var(--muted); text-decoration: none; font-size: .85rem; font-weight: 800; }
.topbar-nav a:hover { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; }
.workspace-control { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .72rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.workspace-control select { width: auto; min-width: 138px; min-height: 34px; padding: 5px 28px 5px 8px; border-width: 2px; font: inherit; letter-spacing: 0; text-transform: none; color: var(--ink); }

.home-main, .watch-main, .components-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 20px 90px;
}

/* ---- landing page: wild Orbit hero + copy + steps ---- */
.landing-main { max-width: 1080px; margin: 0 auto; padding: clamp(20px, 5vw, 56px) 20px 90px; }
.landing-hero {
  display: flex;
  align-items: center;
  gap: clamp(28px, 5vw, 60px);
  padding: clamp(12px, 3vw, 28px) 0 clamp(40px, 6vw, 64px);
  flex-wrap: wrap;
}
.orbit-decorative { flex: none; }
.orbit-wild {
  width: clamp(200px, 26vw, 320px);
  filter: drop-shadow(10px 10px 0 var(--yellow));
}
.orbit-decorative .orbit-hero-center {
  position: absolute; inset: 22%;
  display: grid; place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: var(--small-shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.orbit-decorative .orbit-hero-center:hover {
  transform: translate(-3px, -3px);
  box-shadow: 7px 7px 0 var(--ink);
}
.landing-hero-text { flex: 1 1 380px; min-width: 280px; }
.cx-eyebrow {
  display: inline-block; margin-bottom: 14px; padding: 5px 9px;
  border: 2px solid var(--ink); background: var(--yellow);
  font: 900 .72rem ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase;
}
.landing-hero-text h1 {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  letter-spacing: -.05em;
  line-height: .96;
}
.landing-lede { margin-top: 16px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.15rem); max-width: 460px; line-height: 1.5; }
.landing-cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 26px; }
.btn-cta {
  display: inline-block; padding: 13px 20px;
  border: 3px solid var(--ink); background: var(--red); color: var(--cream);
  font-weight: 900; text-decoration: none; letter-spacing: -.01em;
  box-shadow: var(--small-shadow);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.btn-cta:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); color: var(--cream); }
.fawnroad-note { margin-top: 16px; color: var(--muted); font-size: .82rem; max-width: 440px; }
.btn-quiet-light {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--muted);
  font-size: .8rem; font-weight: 800;
}
.btn-quiet-light:hover { background: var(--ink); color: var(--cream); }

.landing-steps {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  padding-top: clamp(24px, 4vw, 40px); border-top: 2px solid var(--ink);
}
.landing-step { padding: 20px; border: 2px solid var(--ink); background: var(--cream); box-shadow: var(--small-shadow); }
.landing-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin-bottom: 10px;
  border: 2px solid var(--ink); border-radius: 50%; background: var(--yellow);
  font-weight: 900; font-size: .85rem;
}
.landing-step h2 { font-size: 1.05rem; letter-spacing: -.02em; margin-bottom: 6px; }
.landing-step p { color: var(--muted); font-size: .88rem; line-height: 1.45; }

.landing-proof {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: clamp(28px, 5vw, 60px);
  padding-top: clamp(48px, 7vw, 76px);
}
.landing-proof-text { flex: 1 1 380px; min-width: 280px; }
.landing-proof-text h2 { margin-top: 10px; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.03em; line-height: 1.12; }
.landing-proof-player { flex: 1 1 420px; min-width: 280px; max-width: 520px; aspect-ratio: 16 / 10; }
.landing-proof-mock { display: grid; place-items: center; width: 100%; height: 100%; }
.landing-proof-screen {
  position: relative;
  width: 62%; aspect-ratio: 16 / 10;
  border: 2px solid #56504a;
  display: grid; place-items: center;
}
.landing-proof-bubble {
  position: absolute; right: -9%; bottom: -14%;
  width: 34%; aspect-ratio: 1;
  border: 2px solid #56504a; border-radius: 50%;
  background: #0c0b0a;
}
@media (max-width: 720px) {
  .landing-proof { flex-direction: column; text-align: center; }
  /* flex-basis (380px/420px, sized for row layout's width) would otherwise
     be read as a height hint once flex-direction flips to column, forcing
     dead space under any block shorter than that basis. */
  .landing-proof-text, .landing-proof-player { flex: none; width: 100%; }
  .landing-proof-text { text-align: center; }
  .landing-proof-text .landing-lede { margin-left: auto; margin-right: auto; }
}

.privacy-note { color: var(--muted); font-size: .8rem; font-style: italic; }

/* toast */
.toast {
  /* Above the full-screen mobile recording overlay (body.is-recording
     .preview-box, z-index: 60) — a toast is an ephemeral, attention-grabbing
     notification and must never render invisibly underneath ANY other UI
     state, including full-screen mode. */
  position: fixed; left: 50%; bottom: 28px; z-index: 100;
  padding: 10px 16px;
  border: 2px solid var(--ink); background: var(--ink); color: var(--cream);
  font-weight: 800; font-size: .88rem;
  transform: translate(-50%, 16px) scale(.9); opacity: 0;
  transition: transform 220ms cubic-bezier(.34,1.56,.64,1), opacity 180ms ease;
  pointer-events: none;
}
.toast.toast-show { transform: translate(-50%, 0) scale(1); opacity: 1; }

/* ---- shared Orbit ring (decorative + used again on /components) ---- */
.orbit {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  place-items: center;
}
.orbit-guide {
  position: absolute; inset: 11%;
  border: 2px dashed var(--ink);
  border-radius: 50%;
  opacity: .35;
}
.orbit-ticks {
  position: absolute; inset: 0;
  border: 3px solid var(--ink);
  border-radius: 50%;
  animation: orbit-spin 27s linear infinite;
}
.orbit[data-state="armed"] .orbit-ticks { animation-duration: 34s; }
.orbit[data-state="recording"] .orbit-ticks { animation-duration: 20s; }
.orbit[data-state="paused"] .orbit-ticks { animation-play-state: paused; opacity: .55; }
.orbit[data-state="error"] .orbit-ticks { animation-play-state: paused; opacity: .4; }
@keyframes orbit-spin { to { transform: rotate(360deg); } }

.tick {
  position: absolute; top: 50%; left: 50%;
  width: 9px; height: 24px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  transform-origin: 50% 50%;
}
.tick:nth-child(6n+1) { background: var(--red); }
.tick:nth-child(6n+2) { background: var(--orange); }
.tick:nth-child(6n+3) { background: var(--yellow); }
.tick:nth-child(6n+4) { background: var(--green); }
.tick:nth-child(6n+5) { background: var(--blue); }
.tick:nth-child(6n) { background: var(--pink); }

/* ---- record hero: a single focused column. Device selection now lives in
   a <dialog> opened on demand ("only needed once"), so the persistent
   2-column gear sidebar is gone — the whole flow is preview, toggles,
   details, in one line of sight. */
.record-hero-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 640px;
  margin: 0 auto;
}
.capture-block { display: flex; flex-direction: column; gap: 16px; }
.details-block { display: flex; flex-direction: column; gap: 10px; }

.preview-box {
  position: relative;
  /* Explicit width, not just aspect-ratio stretch: once recording starts the
     only child is the absolutely-positioned <canvas> (the placeholder is
     hidden), which contributes zero intrinsic size. A flex item with no
     in-flow content and only a max-width upper bound can collapse instead
     of stretching — width:100% removes that ambiguity. */
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 3px solid var(--ink);
  background: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: aspect-ratio 160ms ease, max-width 160ms ease;
}
.preview-box[data-mode="camera"] { aspect-ratio: var(--camera-aspect-ratio, 16 / 9); }
.preview-placeholder {
  /* Absolutely positioned (not a grid item centered in the full box) with a
     reserved bottom clearance — on a short mobile 16:9 box, text centered
     across the FULL box height collides with the record button/timer bar
     that's absolutely pinned to the bottom. */
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  color: #cfc6b6;
  text-align: center;
  padding: 24px 24px 88px;
}
.preview-placeholder span { max-width: 320px; }
.preview-placeholder svg { color: #6d6459; flex: none; }
.preview-placeholder span { font-size: .88rem; line-height: 1.4; }
.preview-screen-action, .change-screen-btn, .preview-close-btn {
  border: 2px solid var(--cream);
  background: var(--cream);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  padding: 7px 10px;
}
.preview-screen-action:hover, .change-screen-btn:hover, .preview-close-btn:hover { background: var(--yellow); }
.change-screen-btn.active { background: var(--yellow); }
.change-screen-btn, .preview-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
}
.change-screen-btn svg, .preview-close-btn svg { flex: none; }
.preview-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; background: #000; transition: opacity 180ms ease; }

.screen-preview-video, .camera-preview-video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; transition: opacity 180ms ease; }
.screen-preview-video { object-fit: contain; }
.camera-preview-video { object-fit: cover; }
@property --bubble-hue {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}
.preview-box[data-preview-bubble="true"][data-mode="screen"] #camera-preview-video,
.preview-box[data-preview-bubble="true"][data-mode="camera"] #camera-preview-video-2 {
  inset: auto;
  width: auto; height: auto; max-width: none; aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid hsl(var(--bubble-hue) 76% 54%);
  box-shadow: var(--small-shadow);
  z-index: 1;
  animation: bubble-hue-cycle 28s linear infinite;
  cursor: grab;
  touch-action: none;
}
.preview-canvas.bubble-interactive { cursor: grab; touch-action: none; }
.is-bubble-dragging { cursor: grabbing !important; }
@keyframes bubble-hue-cycle { to { --bubble-hue: 360; } }

/* SC-42: cursor:grab above only ever reads on a desktop mouse hovering the
   bubble -- touch has no hover state, so a phone/tablet user got zero visual
   sign the circle overlaying their screen share was draggable at all. This
   small dot-pill sits inside the bubble's own box (mirrors its left/top/
   width/height/transform in applyPreviewBubble(), see there) so it's always
   present regardless of input method, not just discoverable by accident. */
.bubble-grab-hint {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 9px;
  pointer-events: none;
}
.bubble-grab-hint-pill {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(20, 17, 15, .5);
}
.bubble-grab-hint-pill span { width: 3px; height: 3px; border-radius: 50%; background: var(--cream); flex: none; }
/* One-time attention pulse the first time a bubble ever appears (gated by
   localStorage in app.ts) -- the dot-pill itself stays put permanently as
   the actual affordance; this just makes sure a first-time user's eye
   actually lands on it once instead of it blending into the video. Animates
   the INNER pill, not .bubble-grab-hint itself: that outer element's own
   `transform` is live-set to translate(-50%,-50%) by applyPreviewBubble()
   for positioning, and a CSS animation on the same property replaces that
   base value outright rather than composing with it -- animating it here
   detached the whole hint from the bubble for the pulse's duration. */
.bubble-grab-hint.is-first-time .bubble-grab-hint-pill { animation: bubble-grab-hint-pulse 1200ms ease-in-out 2; }
@keyframes bubble-grab-hint-pulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.14); }
}
@media (prefers-reduced-motion: reduce) {
  .bubble-grab-hint.is-first-time .bubble-grab-hint-pill { animation: none; }
}

/* SC-41: source-switch micro-state. flip-camera/dual-camera/device-dialog
   changes stop the OLD stream's tracks but deliberately leave its last
   frame sitting in the video/canvas element (srcObject untouched, not
   hidden) instead of tearing down to #preview-placeholder while the
   replacement stream is acquired -- the dim + badge below (driven by
   #preview-box[data-switching]) is what tells the user that gap is an
   intentional transition, not the preview silently breaking. */
.preview-box[data-switching="true"] .camera-preview-video:not(.hidden),
.preview-box[data-switching="true"] .preview-canvas { opacity: .78; }
.preview-switching-badge {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 2px solid var(--ink);
  background: var(--cream);
  color: var(--ink);
  box-shadow: var(--small-shadow);
  font-weight: 800;
  font-size: .74rem;
  letter-spacing: .01em;
  pointer-events: none;
}
.preview-box[data-switching="true"] .preview-switching-badge { display: inline-flex; }
.preview-switching-dot {
  width: 8px; height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  animation: preview-switching-pulse 900ms ease-in-out infinite;
}
@keyframes preview-switching-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .3; transform: scale(.6); }
}

/* SC-29: .preview-controls holds exactly two child groups -- record+timer
   and the camera-mode buttons -- pushed to opposite ends via space-between,
   each internally tight (gap: 8px) so the grouping itself reads as the
   separation instead of relying on evenly-divided N-1 gaps across flat
   siblings (which produced no visual distinction between the two groups
   and actively misread as one flat row once button count changed). */
.preview-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(to top, rgba(10,9,8,.72), rgba(10,9,8,0));
}
.preview-controls-record-group,
.preview-controls-camera-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Positioning context for the SC-28 dual-camera notice, which anchors
   itself to #dual-camera-btn's immediate parent (see showDualCameraNotice()
   in app.ts) -- that parent is this group now, not .preview-controls. */
.preview-controls-camera-group { position: relative; }
/* When every camera-mode button (and pause/resume) is hidden -- the record+
   timer-only state, before any source is chosen -- space-between leaves the
   record group pinned to the left edge with dead space where the camera
   group would be. Centering it there reads more intentional. */
.preview-controls:not(:has(.preview-controls-camera-group .change-screen-btn:not(.hidden))) {
  justify-content: center;
}
/* SC-42: everything left of this is "what's being shown" (select/change
   screen, flip camera, dual camera bubble) -- pause/resume is the only
   recording-state control sharing this row, and sat directly beside
   dual-camera-btn with no visual break, reading as just one more source
   button. Auto-hides via :has() when pause-resume-btn itself is hidden
   (i.e. before recording starts) so it never renders as a trailing stub. */
.preview-controls-divider {
  width: 2px;
  align-self: stretch;
  margin: 3px 0;
  background: rgba(255, 250, 240, .3);
  flex: none;
}
.preview-controls-divider:has(+ #pause-resume-btn.hidden) { display: none; }
.record-btn-small {
  flex: none;
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: var(--small-shadow);
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
.record-btn-small:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.record-btn-small:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.record-btn-small:disabled { opacity: .55; cursor: wait; }
.preview-box[data-state="armed"] .record-btn-small { background: var(--yellow); }
.preview-box[data-state="recording"] .record-btn-small { background: var(--red); }
.preview-box[data-state="paused"] .record-btn-small { background: var(--orange); }
.preview-box[data-state="error"] .record-btn-small { background: #f9d4ca; border-color: var(--red); border-width: 4px; }

.record-glyph-small { display: grid; place-items: center; }
.record-dot-small { width: 18px; height: 18px; border-radius: 50%; background: var(--red); }
.preview-box[data-state="recording"] .record-dot-small,
.preview-box[data-state="paused"] .record-dot-small,
.preview-box[data-state="error"] .record-dot-small { display: none; }
.stop-square-small { display: none; width: 16px; height: 16px; background: var(--cream); border-radius: 2px; }
.preview-box[data-state="recording"] .stop-square-small,
.preview-box[data-state="paused"] .stop-square-small { display: block; }
.error-mark { display: none; }
.preview-box[data-state="error"] .error-mark { display: block; }

.preview-controls .button-timer {
  padding: 5px 9px;
  border: 2px solid var(--ink);
  background: var(--cream);
  color: var(--ink);
  font: 900 .85rem ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}
.recording-indicator { display: none; }
.preview-close-btn { position: absolute; top: 16px; right: 16px; z-index: 3; }
.preview-box[data-state="paused"] .recording-indicator-dot { animation-play-state: paused; }
.record-status { max-width: 460px; }
.record-status strong { display: block; font-size: 1.02rem; }
.record-status span { display: block; margin-top: 3px; color: var(--muted); font-size: .87rem; }

/* what-to-record toggles: replaces the old explicit 3-way mode picker.
   Screen/Camera/Mic are independent switches — flip Camera on for a live
   preview, flip Screen off to go camera-only, etc. */
.toggle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.toggle-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track {
  position: relative;
  width: 40px; height: 24px;
  border: 2px solid var(--ink);
  background: var(--cream);
  transition: background-color 140ms ease;
  flex: none;
}
.toggle-track::before {
  content: "";
  position: absolute; top: 1px; left: 1px;
  width: 16px; height: 16px;
  background: var(--ink);
  transition: transform 140ms ease;
}
.toggle-switch input:checked + .toggle-track { background: var(--yellow); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(16px); }
.toggle-switch input:focus-visible + .toggle-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.toggle-switch input:disabled + .toggle-track { opacity: .5; cursor: not-allowed; }
.toggle-label { font-size: .85rem; font-weight: 800; }
.device-change-btn {
  margin-left: auto;
  padding: 7px 11px;
  border: 2px solid var(--ink);
  background: var(--cream);
  font-size: .78rem; font-weight: 800;
}
.device-change-btn:hover { background: var(--yellow); }

/* title/description */
.title-desc-row { display: grid; gap: 8px; }
.title-desc-row label { font-size: .78rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.title-desc-row label span { text-transform: none; font-weight: 600; letter-spacing: 0; }
.title-desc-row input, .title-desc-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  background: var(--cream);
  font-weight: 600;
  resize: vertical;
}

/* ---- device dialog: native <dialog>, opened on demand ("only needed
   once") instead of a persistent sidebar. ::backdrop dims the page; the
   panel itself keeps the old dark device-panel look. */
.device-dialog {
  display: none;
  flex-direction: column; gap: 16px;
  width: min(420px, calc(100vw - 32px));
  padding: clamp(22px, 3vw, 30px);
  /* Ink border/shadow on an ink background is invisible against itself, and
     nearly invisible again against the black recording canvas behind it --
     this is the one dark-fill card in the system, so its border/shadow use
     cream (matching its text) instead of the usual ink-on-cream pairing, to
     stay visible against both the dialog's own fill and the canvas. */
  border: 3px solid var(--cream);
  background: var(--ink);
  color: var(--cream);
  box-shadow: 7px 7px 0 var(--cream);
  /* The global `* { margin: 0 }` reset (author stylesheet) overrides the
     UA stylesheet's dialog:modal { margin: auto } centering rule — author
     origin always wins over UA origin regardless of specificity. Restore
     it explicitly or the dialog pins to the top-left corner. */
  margin: auto;
}
.device-dialog[open] { display: flex; }
.device-dialog::backdrop { background: rgba(20, 17, 14, .55); }
.device-dialog h2 { font-size: 1.05rem; letter-spacing: -.02em; }
.device-dialog > p.panel-intro { margin-top: -8px; color: #cfc6b6; font-size: .85rem; line-height: 1.45; }
.device-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 11px; align-items: start; }
.device-icon {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border: 2px solid var(--cream);
  background: var(--yellow);
  color: var(--ink); font-weight: 900;
}
.device-icon.cam { background: var(--green); }
.device-icon.mic { background: var(--pink); }
.device-field label { display: block; margin-bottom: 6px; font-size: .78rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.device-field small { display: block; margin-top: 5px; color: #b9b6ac; font-size: .74rem; line-height: 1.35; }

select {
  width: 100%; min-height: 42px;
  padding: 8px 34px 8px 10px;
  border: 2px solid var(--cream);
  border-radius: 0;
  color: var(--ink);
  background: var(--cream);
  font-weight: 700;
  text-overflow: ellipsis;
}
select:disabled { opacity: .6; }

.device-status {
  min-height: 20px;
  padding: 9px 11px;
  border-left: 3px solid var(--green);
  background: #2c261f;
  color: #eee3d0;
  font-size: .8rem; line-height: 1.4;
}
.device-status[data-tone="warn"] { border-left-color: var(--orange); }
.device-status[data-tone="error"] { border-left-color: var(--red); }
.device-status:empty { display: none; }

/* SC-28: dedicated notice for the dual-camera-unavailable fallback, anchored
   to #dual-camera-btn itself (see showDualCameraNotice() in app.ts). Exists
   because #device-status -- this message's usual home -- is hidden entirely
   by is-studio's mobile CSS below, which is already active by the time a
   user could tap the dual-camera button. Lives inside .preview-controls,
   which stays visible under is-studio, so the reason stays visible several
   seconds later. Same dark warn palette as .device-status (not a new visual
   language), floated above the button like .toast. */
.dual-camera-notice {
  position: absolute;
  z-index: 6;
  bottom: 100%;
  left: 50%;
  margin-bottom: 8px;
  transform: translate(-50%, 6px);
  width: max-content;
  max-width: min(220px, calc(100vw - 64px));
  padding: 9px 11px;
  border-left: 3px solid var(--orange);
  background: #2c261f;
  color: #eee3d0;
  font-weight: 800;
  font-size: .74rem;
  line-height: 1.4;
  box-shadow: var(--small-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}
.dual-camera-notice.dual-camera-notice-show { opacity: 1; transform: translate(-50%, 0); }
.dual-camera-notice:empty { display: none; }

.fallback-confirm {
  display: none;
  align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 11px;
  border: 2px solid var(--orange);
  background: #332a1a;
}
.fallback-confirm.active { display: flex; }
.fallback-confirm span { font-size: .82rem; color: var(--cream); }
.btn-quiet {
  padding: 8px 11px;
  border: 2px solid var(--cream);
  color: var(--cream);
  background: transparent;
  font-size: .78rem; font-weight: 800;
}
.btn-quiet:hover { color: var(--ink); background: var(--yellow); }

.permission-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-outline {
  padding: 9px 12px;
  border: 2px solid var(--cream);
  color: var(--cream);
  background: transparent;
  font-size: .8rem; font-weight: 800;
}
.btn-outline:hover { color: var(--ink); background: var(--cream); }

/* ---- HUD (recording stats) ---- */
.hud {
  display: none;
  margin-top: 24px;
  padding: 20px;
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: var(--small-shadow);
}
body.is-recording .hud, body.is-finishing .hud { display: block; }
.hud-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hud-row-link a { color: var(--blue); text-decoration: underline; text-decoration-thickness: 2px; font-family: ui-monospace, monospace; font-size: 14px; word-break: break-all; }
.hud-link-note { padding: 3px 7px; border: 2px solid var(--ink); background: var(--yellow); color: var(--ink); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.hud-copy { border: 2px solid var(--ink); background: var(--paper); padding: 4px 9px; font-size: 12px; font-weight: 800; }
.hud-copy:hover { background: var(--yellow); }
.hud-stats { gap: 22px; padding-top: 10px; border-top: 2px solid var(--rule); }
.hud-stat { display: inline-flex; flex-direction: column; gap: 2px; }
.hud-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
#hud-inflight[data-state="busy"] { color: var(--green); font-weight: 800; }
.hud-finishing-note { display: none; margin-top: 12px; padding: 8px 10px; border: 2px dashed var(--ink); color: var(--muted); font-size: .85rem; }
body.is-finishing .hud-finishing-note { display: block; }

/* recovery banner */
.recovery-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border: 3px solid var(--ink); background: var(--yellow);
  padding: 14px 16px; margin-bottom: 22px;
  box-shadow: var(--small-shadow);
}
.btn-secondary {
  background: var(--ink); color: var(--cream); border: 2px solid var(--ink);
  padding: 9px 14px; font-size: 14px; font-weight: 800;
}
.btn-secondary:hover { background: var(--cream); color: var(--ink); }

/* library: video-preview tiles instead of a list row */
.workspace-roster { margin-top: 36px; padding: 14px 16px; border: 2px solid var(--ink); background: var(--cream); box-shadow: var(--small-shadow); }
.workspace-roster-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.workspace-roster-heading p { font-size: .78rem; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.workspace-roster-heading span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.workspace-member-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.workspace-member-chip { display: grid; place-items: center; width: 38px; height: 38px; overflow: hidden; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); color: var(--ink); font-size: .78rem; font-weight: 950; line-height: 1; }
.workspace-member-chip img { display: block; width: 100%; height: 100%; object-fit: cover; }
.library { margin-top: 40px; }
.library-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.library h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 12px; }
.library-heading-row h2 { margin-bottom: 0; }
.library-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.library-tile {
  border: 2px solid var(--ink);
  background: var(--cream);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.library-tile:hover { transform: translate(-2px, -2px); box-shadow: var(--small-shadow); }
.library-link { display: block; color: var(--ink); text-decoration: none; }
.library-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  border-bottom: 2px solid var(--ink);
  overflow: hidden;
  display: grid; place-items: center;
}
.library-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.library-thumb-fallback {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 8px;
  padding: 14px;
  background: repeating-linear-gradient(135deg, var(--paper) 0 10px, var(--cream) 10px 20px);
  color: var(--ink);
  text-align: center;
}
.library-thumb-fallback svg { color: var(--red); }
.library-thumb-fallback span { font-size: .72rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.library-thumb .status-dot { position: absolute; top: 8px; right: 8px; }
.library-thumb-icon { color: #8a8175; }
.library-body { padding: 11px 12px; }
.library-title { display: block; font-weight: 800; font-size: .92rem; }
.library-meta { margin-top: 4px; color: var(--muted); font-size: 12px; }
.library-attribution { display: block; margin-top: 5px; color: var(--ink); font-size: 12px; font-weight: 800; }
.library-empty { grid-column: 1 / -1; color: var(--muted); padding: 16px 14px; border: 2px dashed var(--rule); text-align: center; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 2px solid var(--ink); background: var(--muted); }
.status-recording { background: var(--red); }
.status-processing { background: var(--yellow); }
.status-ready { background: var(--green); }
.status-failed { background: var(--red); }
.status-expired { background: var(--muted); }

/* ---- auth gate: shown before the record flow until a clip account exists ---- */
.auth-gate { display: flex; justify-content: center; padding: clamp(20px, 6vw, 60px) 0; }
.auth-gate-card {
  width: min(420px, 100%);
  padding: clamp(24px, 4vw, 34px);
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: var(--shadow);
}
.auth-home-link {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 22px;
  color: var(--muted); font-size: .78rem; font-weight: 900; text-decoration: none;
}
.auth-home-link svg { width: 17px; height: 17px; flex: none; }
.auth-home-link:hover { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.auth-gate-card h1 { font-size: clamp(1.5rem, 3vw, 1.9rem); letter-spacing: -.03em; }
.auth-gate-lede { margin-top: 10px; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.auth-error { margin-top: 16px; padding: 9px 11px; border: 2px solid var(--red); background: #fbe3de; color: #8f2415; font-size: .84rem; }
.auth-submit { display: block; margin-top: 22px; width: 100%; text-align: center; border: none; text-decoration: none; }
.auth-gate-note { margin-top: 18px; color: var(--muted); font-size: .78rem; line-height: 1.45; }

/* ---- account chip (topbar) ---- */
.account-chip { display: inline-flex; align-items: center; gap: 10px; }
.account-chip #account-name { color: var(--ink); font-size: .85rem; font-weight: 800; }

footer.site-footer { max-width: 980px; margin: 0 auto; padding: 20px 20px 50px; color: var(--muted); font-size: .78rem; }
footer.site-footer a { text-decoration: underline; text-decoration-thickness: 2px; }
footer.site-footer a:hover { color: var(--red); }

/* ---- watch page ---- */
.watch-topbar-actions { display: flex; gap: 10px; align-items: center; }
.watch-main h1 { font-size: clamp(1.2rem, 3vw, 1.6rem); margin-bottom: 6px; letter-spacing: -.02em; }
.watch-title-editable { cursor: text; width: fit-content; }
.watch-title-editable:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.watch-title-input {
  display: block; width: min(100%, 640px); margin: 0 0 6px; padding: 1px 7px;
  border: 2px solid var(--ink); background: var(--cream); border-radius: 0;
  font: 800 clamp(1.2rem, 3vw, 1.6rem)/1.2 ui-rounded, "Avenir Next", Avenir, Inter, system-ui, sans-serif; letter-spacing: -.02em;
}
.watch-description { color: var(--muted); font-size: .92rem; margin: 18px 0 0; max-width: 640px; }
.player-shell {
  position: relative;
  background: #0c0b0a;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
  /* Set to the real recording's width/height ratio once known (see
     applyPlayerAspect() in watch.ts) — mirrors the --camera-aspect-ratio
     pattern the record page already uses for the live camera preview.
     Falls back to 16:9 before real dimensions are known, or if the
     recording genuinely never reports them. */
  aspect-ratio: var(--player-aspect-ratio, 16 / 9);
  display: grid; place-items: center;
  transition: aspect-ratio 160ms ease;
}
/* A strict 16:9 + overflow:hidden box is correct for framing actual video,
   but a state message (recording/processing/failed/expired/missing — see
   showState() in watch.ts) is prose plus a recovery button, and can be
   taller than 16:9 leaves room for on a narrow viewport. Clipping it with
   overflow:hidden silently hides the "Record your own" CTA instead of
   showing it — let the shell grow to fit while a state is showing. */
.player-shell:has(.state-panel:not(.hidden)) { aspect-ratio: auto; min-height: 260px; overflow: visible; }
/* object-fit: contain is the actual fix — width/height:100% alone stretches
   a portrait recording to fill a still-16:9-by-default shell before the
   aspect-ratio custom property above catches up, and is a safe fallback
   even if the real ratio is ever wrong/unavailable. */
.player { width: 100%; height: 100%; display: block; object-fit: contain; }
.stream-embed { border: none; }
.player-controls {
  position: absolute; inset: auto 0 0; z-index: 2; padding: 28px 14px 12px;
  color: var(--cream); background: linear-gradient(to top, rgba(10,9,8,.9), rgba(10,9,8,0));
  opacity: 1; transition: opacity 180ms ease;
}
.player-shell.player-controls-idle .player-controls { opacity: 0; pointer-events: none; }
.player-progress-wrap { position: relative; height: 16px; display: grid; align-items: center; }
.player-progress-track { position: absolute; left: 0; right: 0; height: 6px; background: rgba(245,239,225,.35); cursor: pointer; }
.player-buffered, .player-progress-played { position: absolute; left: 0; top: 0; height: 100%; }
.player-buffered { background: rgba(245,239,225,.58); }
.player-progress-played { background: var(--red); }
.player-scrubber { position: absolute; inset: 0; width: 100%; margin: 0; opacity: 0; cursor: pointer; }
.player-scrubber:disabled { cursor: default; }
.player-duration-unknown .player-buffered { animation: unknown-buffer 1.4s ease-in-out infinite; }
@keyframes unknown-buffer { 50% { width: 56%; } }
.player-control-row { display: flex; align-items: center; gap: 9px; margin-top: 5px; }
.player-control-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border: 2px solid var(--cream); border-radius: 0;
  background: transparent; color: var(--cream);
}
.player-control-button svg { flex: none; }
.player-control-button:hover { background: var(--cream); color: var(--ink); }
.player-volume { width: 72px; accent-color: var(--red); }
.player-time { font: 900 .78rem ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.player-fullscreen { margin-left: auto; }

/* ---- watch page: unambiguous LIVE chip + DVR scrub bar + Go Live (SC-134) ----
   Twitch/YouTube-Live-style layering: a floating LIVE chip pinned to the
   video itself, independent of .player-controls' idle fade (see
   .player-controls-idle above) so "this is LIVE" never disappears just
   because the cursor sat still -- the old inline badge lived inside that
   fading control row, which was exactly the "too subtle" problem this
   replaces. A live-tinted, gently pulsing progress track with a pinned edge
   marker shows where "now" is; a Go Live button (in the always-fading
   control row, same as the other transport controls) only appears once
   playback has actually fallen behind that edge. All of it is driven purely
   by classes from client/watch.ts (chip-show / is-live / go-live-show) and
   goes fully inert -- not just visually hidden, non-interactive too -- the
   instant liveMode ends (stopLiveWatch()/showPlayer()), so a finished
   recording gets the plain VOD bar back with nothing left behind. */
.player-live-chip {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px 5px 8px; border: 2px solid var(--ink);
  background: var(--red); color: var(--cream);
  font: 900 .74rem ui-rounded, "Avenir Next", Avenir, Inter, system-ui, sans-serif;
  text-transform: uppercase; letter-spacing: .05em;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transform: translateY(-6px) scale(.92);
  transition: opacity 220ms ease, transform 220ms cubic-bezier(.16, .84, .44, 1);
}
.player-live-chip.chip-show { opacity: 1; transform: none; }
.player-live-chip-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--cream);
  animation: pulse-dot 1.2s ease-in-out infinite;
}

/* The live edge sits at a fixed 100% of the track because the track's own
   denominator (effectiveDuration()) IS liveRecordedSoFar() while liveMode is
   true -- "now" and "the right edge of the bar" are the same position by
   construction, no per-frame math needed here. What moves is the played dot
   underneath it, per its normal width calc in updatePlayerUi(). */
.player-progress-track.is-live {
  animation: live-track-glow 2.4s ease-in-out infinite;
}
@keyframes live-track-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(229, 72, 56, .4); }
  50% { box-shadow: 0 0 0 1px rgba(229, 72, 56, .85), 0 0 8px rgba(229, 72, 56, .5); }
}
.player-live-edge {
  position: absolute; right: 0; top: 50%; width: 3px; height: 14px;
  transform: translate(1px, -50%); background: var(--red); border-radius: 2px;
  opacity: 0; transition: opacity 200ms ease; pointer-events: none;
}
.player-progress-track.is-live .player-live-edge { opacity: 1; }

.player-go-live {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 10px; height: 28px; border: 2px solid var(--red); border-radius: 999px;
  background: transparent; color: var(--cream);
  font: 900 .7rem ui-rounded, "Avenir Next", Avenir, Inter, system-ui, sans-serif;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
  opacity: 0; transform: translateY(4px) scale(.94); pointer-events: none;
  transition: opacity 200ms ease, transform 200ms cubic-bezier(.16, .84, .44, 1), background 140ms ease;
}
.player-go-live.go-live-show { opacity: 1; transform: none; pointer-events: auto; }
.player-go-live:hover { background: var(--red); }
.player-go-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse-dot 1.2s ease-in-out infinite; }
.state-panel { display: grid; justify-items: center; gap: 14px; text-align: center; color: var(--cream); padding: 40px 24px; }

/* ---- watch page: connecting overlay + fake progress tease (SC-90 follow-up) ----
   Covers the gap between "status says ready" and "a real frame is actually
   decoded" -- previously the player-shell just went black with zero
   feedback for however long that took (see docs/specs/clip-mvp/plan/09-
   dvr-player-loading-feedback.md). The ring's progress is driven entirely
   from client/watch.ts (an eased tween toward 99.9%, never 100 on its own)
   -- this file only styles the track/fill/label, it never decides the
   percentage. */
.connecting-overlay {
  position: absolute; inset: 0; z-index: 3;
  display: grid; justify-items: center; align-content: center; gap: 16px;
  background: #0c0b0a; color: var(--cream);
  opacity: 1; transition: opacity 240ms ease;
}
.connecting-overlay.connecting-fade-out { opacity: 0; pointer-events: none; }
.connecting-ring { position: relative; width: 92px; height: 92px; display: grid; place-items: center; }
.connecting-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.connecting-ring-track { fill: none; stroke: rgba(245, 239, 225, 0.2); stroke-width: 6; }
.connecting-ring-progress {
  fill: none; stroke: var(--yellow); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 276.46; stroke-dashoffset: 276.46;
}
/* Only the final snap-to-100 gets a CSS transition (see finishConnecting()
   in watch.ts) -- every frame before that is hand-tweened via
   requestAnimationFrame so the deceleration curve is exact, not whatever a
   single fixed-duration CSS easing would produce for an unpredictable
   real-world wait. */
.connecting-ring-progress.connecting-snap {
  transition: stroke-dashoffset 280ms cubic-bezier(0.16, 0.84, 0.44, 1);
}
.connecting-pct {
  position: absolute; font: 900 0.92rem ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.connecting-label { font-size: 0.85rem; letter-spacing: 0.02em; color: #d9cfbd; }

.playback-error.state-panel { position: absolute; inset: 0; z-index: 4; background: #0c0b0a; }

.click-to-play {
  position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px 11px 16px; border: 3px solid var(--cream); border-radius: 999px;
  background: rgba(10, 9, 8, 0.72); color: var(--cream);
  font: 900 0.85rem ui-rounded, "Avenir Next", Avenir, Inter, system-ui, sans-serif;
  letter-spacing: 0.02em;
}
.click-to-play:hover { background: var(--cream); color: var(--ink); }
.state-icon { display: grid; place-items: center; width: 64px; height: 64px; border: 3px solid var(--cream); border-radius: 50%; }
.state-panel strong { font-size: 1.05rem; }
.state-panel p { max-width: 420px; color: #d9cfbd; font-size: .9rem; line-height: 1.45; }
.state-panel .live-progress { display: flex; gap: 6px; margin-top: 4px; }
.state-panel .live-progress span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse-dot 1.2s ease-in-out infinite; }
.state-panel .live-progress span:nth-child(2) { animation-delay: .15s; }
.state-panel .live-progress span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse-dot { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.watch-meta { color: var(--muted); font-size: 13px; margin-top: 14px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.expiry-note { padding: 3px 8px; border: 2px solid var(--ink); background: var(--yellow); font-weight: 800; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }

@media (max-width: 860px) {
  .landing-hero { justify-content: flex-start; gap: 44px; }
  .landing-steps { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; row-gap: 6px; }
  .topbar-nav { display: flex; width: 100%; min-width: 0; align-items: center; justify-content: flex-end; gap: 6px; }
  .topbar-nav a[href="/components"] { display: none; }
  .workspace-control > span { display: none; }
  .workspace-control select { width: min(132px, 36vw); min-width: 0; }
  .account-chip { min-width: 0; gap: 6px; }
  .account-chip #account-name { max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-chip .btn-quiet-light { white-space: nowrap; }
  .home-main, .watch-main, .components-main, .landing-main { padding: 24px 14px 70px; }
  .device-dialog { padding: 20px 16px; }
  .toggle-switch { min-height: 44px; }
  .device-change-btn {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-left: 0;
  }
  .preview-screen-action, .change-screen-btn { min-height: 44px; }
  /* This leaves room for the toggle row below a portrait preview on common phone heights.
     width:100% on the base rule pins a definite width that aspect-ratio can't shrink, so
     the clamp has to compute width itself from the height cap: for a target height H and
     ratio R = width/height, the corresponding width is H*R. min(100%, ...) keeps this a
     no-op for landscape ratios whose natural (100%-wide) height already fits under 55vh. */
  .preview-box { max-height: 55vh; width: min(100%, calc(55vh * var(--camera-aspect-ratio, 1.7778))); margin: 0 auto; }
  /* Width here is pinned back to 100% (not just aspect-ratio to 3/2) because
     --camera-aspect-ratio can transiently still hold a stale ratio from a
     just-stopped stream while the placeholder is shown (e.g. stopCameraPreview()
     runs before applyCaptureModeUI() clears the var) -- letting the width
     formula above keep reading it would produce a small, wrongly-proportioned
     box instead of the intended full-width 3:2 placeholder. */
  .preview-box:has(#preview-placeholder:not(.hidden)) { aspect-ratio: 3 / 2; width: 100%; }
  .preview-controls { flex-wrap: wrap; gap: 8px; }
  body.is-studio .preview-controls { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  body.is-studio { overflow: hidden; }
  body.is-studio .preview-box {
    position: fixed;
    /* inset:0 with no explicit width/height lets a position:fixed box size
       itself against the browser's actual current viewport -- confirmed via
       a real phone screenshot that plain 100vw/100vh resolve to the LARGE
       viewport (as if the address bar/toolbar were fully collapsed), so a
       100vh-tall box extends past what's actually visible whenever that
       toolbar is showing (the common case), hiding everything anchored to
       its bottom edge -- record/stop, timer, camera-switching buttons, all
       of it -- behind the browser's own chrome. height: 100dvh is a second,
       purpose-built line of defense for the same problem (100vh kept first
       as a fallback for browsers that don't understand dvh, since dvh wins
       when both are declared and supported). */
    inset: 0;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    aspect-ratio: auto;
    z-index: 60;
    border: none;
    box-shadow: none;
    margin: 0;
  }
  body.is-studio .topbar,
  body.is-studio .record-status,
  body.is-studio .toggle-row,
  body.is-studio .device-status,
  body.is-studio .details-block,
  body.is-studio #hud,
  body.is-studio .library,
  body.is-studio .site-footer { display: none; }
  body.is-recording .recording-indicator {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border: 2px solid var(--cream);
    background: var(--ink);
    color: var(--cream);
    font: 900 .7rem ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: .03em;
    text-transform: uppercase;
  }
  body.is-studio:not(.is-recording):not(.is-finishing) .preview-close-btn {
    top: 16px;
    right: 16px;
    display: inline-flex;
  }
  .recording-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    animation: pulse-dot 1.2s ease-in-out infinite;
  }
  .player-control-button { width: 44px; height: 44px; }
  .player-control-row { flex-wrap: wrap; }
  .hud-copy, .btn-quiet-light { min-height: 44px; }
  .landing-hero { flex-direction: column; text-align: center; justify-content: center; gap: 32px; }
  .orbit-wild { width: clamp(180px, 60vw, 240px); margin-bottom: 12px; }
  .landing-hero-text { text-align: center; }
  .landing-lede, .fawnroad-note { margin-left: auto; margin-right: auto; }
  .landing-cta-row { justify-content: center; }
  .hud-stats { gap: 14px; row-gap: 10px; }
  .library-meta { text-align: left; margin-left: 0; width: 100%; }
  .library-link { flex-wrap: wrap; }
  .record-btn-small { width: 60px; height: 60px; }
  .player-volume { display: none; }
  .player-controls { padding: 24px 10px 9px; }
}

/* The utility Components link is useful in wider development views, but at
   320px it competes with the actual product action. Keep the Clip lockup and
   sign-in action on one deliberate, stable header row instead of allowing a
   stranded utility link to create a second row. */
@media (max-width: 320px) {
  .topbar { flex-wrap: nowrap; gap: 6px; padding-inline: 12px; }
  .topbar-nav { margin-left: auto; min-width: 0; }
  .topbar-nav > a[href="/components"] { display: none; }
  .topbar-nav .btn-quiet-light { min-height: 38px; padding-inline: 9px; font-size: .72rem; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .orbit-ticks, .camera-preview-video, .state-panel .live-progress span, .recording-indicator-dot, .preview-switching-dot { animation: none !important; }
  .record-btn-small:hover:not(:disabled), .record-btn-small:active:not(:disabled) { transform: none; }
  .orbit-decorative .orbit-hero-center:hover { transform: none; }
  .toast, .dual-camera-notice { transition: opacity 180ms ease; }
  .player-duration-unknown .player-buffered { animation: none; }
  .player-live-chip-dot, .player-go-live-dot { animation: none !important; }
  .player-progress-track.is-live { animation: none; }
  .player-live-chip, .player-go-live { transition: opacity 180ms ease; }
  * { scroll-behavior: auto !important; }
}
