/* DamnCam design tokens + base styles.
   Task 1 scaffold: token layer + base reset. Screen-specific styles land in
   later tasks. Kept in a plain stylesheet so the shipped app remains a single
   static HTML file with no build step. */

:root {
  /* Surfaces */
  --bg: #F5F2EE;
  --surface: #FFFFFF;

  /* Ink + muted */
  --ink: #1A1A1A;
  --muted: #9A9A8E;

  /* Accent system. --accent matches --ink by design; --accent-pop is the
     single neon reserved for recording state. */
  --accent: #1A1A1A;
  --accent-pop: #C8FF00;

  /* Structure */
  --border: #E8E4DF;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;

  /* Type families */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-ui: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root,
#screen {
  min-height: 100%;
}

/* -----------------------------------------------------------------------
   Onboarding_Screen
   iOS-native feel: hero branding area + bottom sheet card with icon
   circles and pill CTA. Warm beige bg, clean white sheet, lots of air.
   -------------------------------------------------------------------- */

.onboarding {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

/* Hero — top half with branding */
.onboarding__hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: calc(env(safe-area-inset-top, 0px) + 40px) 24px 24px;
  position: relative;
}

/* Decorative camera lens */
.onboarding__lens {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e8e4df, #d4d0cb);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    inset 0 2px 4px rgba(255, 255, 255, 0.6);
}

.onboarding__lens-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--ink), #333);
  box-shadow:
    inset 0 4px 12px rgba(0, 0, 0, 0.4),
    0 0 0 4px rgba(255, 255, 255, 0.15);
  position: relative;
}

.onboarding__lens-inner::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 14px;
  width: 16px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(-30deg);
}

.onboarding__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(52px, 14vw, 80px);
  line-height: 0.9;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.onboarding__tagline {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.35em;
  color: var(--muted);
  text-transform: uppercase;
}

/* Bottom sheet card — slides up from the bottom */
.onboarding__sheet {
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 12px 24px calc(env(safe-area-inset-bottom, 0px) + 24px);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.08);
  animation: sheetUp 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) both;
  position: relative;
}

@keyframes sheetUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Pill handle at the top of the sheet */
.onboarding__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 16px;
}

/* Sheet header — icon + label pill */
.onboarding__sheet-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 12px;
}

.onboarding__sheet-icon {
  font-size: 14px;
  color: var(--ink);
}

.onboarding__sheet-label {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.01em;
}

/* Sheet title */
.onboarding__sheet-title {
  margin: 0 0 20px 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.15;
}

/* Feature icon circles row */
.onboarding__icons {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 24px;
}

.onboarding__icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.onboarding__icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--ink);
  transition: all 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.onboarding__icon-circle:hover {
  background: var(--surface);
  border-color: var(--ink);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.onboarding__icon-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* CTA row — text left, arrow circle right */
.onboarding__cta-slot {
  width: 100%;
}

.onboarding__cta {
  width: 100%;
  padding: 4px 4px 4px 24px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1),
    box-shadow 0.2s ease;
  box-shadow: 0 4px 16px rgba(26, 26, 26, 0.15);
}

.onboarding__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(26, 26, 26, 0.22);
}

.onboarding__cta:active {
  transform: scale(0.98);
}

.onboarding__cta:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.onboarding__cta-label {
  padding: 14px 0;
}

.onboarding__cta-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.onboarding__cta:hover .onboarding__cta-arrow {
  background: rgba(255, 255, 255, 0.25);
}

.onboarding__insecure {
  margin: 0;
  padding: 18px 24px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

/* Remove old card styles that are no longer used */
.onboarding__cards,
.onboarding__card,
.onboarding__card-title,
.onboarding__card-body {
  display: none;
}

/* -----------------------------------------------------------------------
   Camera_Screen — Task 4.1
   Full-bleed black viewfinder with a warm-white bottom bar floating over
   the video. No rotation yet (Spin_Engine lands in Task 10); the video is
   simply `object-fit: cover` over the live stream.
   -------------------------------------------------------------------- */

.camera {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
}

.camera__video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  z-index: 0;
  /* Ensure transforms don't cause iOS rendering issues */
  -webkit-transform: translateZ(0);
  transform-origin: center center;
}

.camera__video[hidden] {
  display: none !important;
}

/* Top-right recording indicator — frosted pill with pulsing dot. */
.camera__rec {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  z-index: 10;
}

.camera__rec[hidden] {
  display: none;
}

.camera__rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.25);
  animation: recDotPulse 1.2s ease-in-out infinite;
}

@keyframes recDotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.25); }
  50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(255, 59, 48, 0.12); }
}

.camera__timer {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
}

/* Bottom bar: frosted glass surface floating over the video. */
.camera__bottom {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.18);
  display: grid;
  grid-template-columns: 52px 1fr 72px 44px;
  gap: 10px;
  align-items: center;
  z-index: 10;
}

/* Gallery thumbnail: rounded square with subtle border. */
.camera__thumb {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: linear-gradient(135deg, #ddd 0%, #bbb 100%);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.camera__thumb:hover {
  transform: scale(1.05);
}

/* Mode pills — Spin / Dual / PiP. Active pill gets a filled look. */
.camera__modes {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.camera__mode-pill {
  padding: 7px 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.camera__mode-pill.is-active {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Shutter: layered ring design for that analog camera feel. */
.camera__shutter {
  width: 72px;
  height: 72px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--ink);
  cursor: pointer;
  box-shadow:
    inset 0 0 0 4px #fff,
    inset 0 0 0 6px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.12);
  justify-self: center;
  transition: all 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.camera__shutter:hover {
  transform: scale(1.04);
  box-shadow:
    inset 0 0 0 4px #fff,
    inset 0 0 0 6px rgba(0, 0, 0, 0.06),
    0 4px 16px rgba(0, 0, 0, 0.18);
}

.camera__shutter:active {
  transform: scale(0.95);
}

.camera__shutter:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

/* Recording state — morph to rounded square with neon pop. */
.camera__shutter.is-recording {
  border-radius: var(--radius-sm);
  background: var(--accent-pop);
  border-color: var(--accent-pop);
  box-shadow:
    inset 0 0 0 3px var(--accent-pop),
    0 0 0 4px rgba(200, 255, 0, 0.2),
    0 4px 20px rgba(200, 255, 0, 0.3);
  animation: shutterPulse 1.5s ease-in-out infinite;
}

@keyframes shutterPulse {
  0%, 100% { box-shadow: inset 0 0 0 3px var(--accent-pop), 0 0 0 4px rgba(200, 255, 0, 0.2), 0 4px 20px rgba(200, 255, 0, 0.3); }
  50% { box-shadow: inset 0 0 0 3px var(--accent-pop), 0 0 0 8px rgba(200, 255, 0, 0.12), 0 4px 24px rgba(200, 255, 0, 0.4); }
}

/* Disabled state when MediaRecorder unsupported. */
.camera__shutter.is-disabled {
  opacity: 0.3;
  cursor: default;
  transform: none;
}

/* White flash overlay — fades in then out over 250ms on every successful
   save (requirement 7.5). Pointer-events: none so it never intercepts
   taps on the bottom bar sitting above it. */
.camera__flash {
  position: absolute;
  inset: 0;
  background: #fff;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.camera__flash[hidden] {
  display: none;
}

.camera__flash.is-flashing {
  opacity: 1;
}

/* Gallery thumb preview — looping muted video fills the button. */
.camera__thumb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

/* Filter icon: frosted circle with a subtle glow on hover. */
.camera__filter-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  font-size: 20px;
  color: var(--ink);
  cursor: pointer;
  justify-self: end;
  transition: all 0.2s ease;
}

.camera__filter-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.06);
}

/* -----------------------------------------------------------------------
   Gallery_Screen — Task 7.2
   Full-screen dark overlay mounted on top of the live Camera_Screen (the
   camera's MediaStream keeps running underneath). 3-column 9:16 grid with
   per-item mode badges, plus a sub-overlay full-screen preview with
   share/download actions.
   -------------------------------------------------------------------- */

.gallery {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px
    calc(env(safe-area-inset-bottom, 0px) + 16px);
}

.gallery__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 16px;
}

.gallery__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #fff;
}

.gallery__close,
.gallery__preview-close {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.gallery__close:hover,
.gallery__preview-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.gallery__grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  overflow-y: auto;
  align-content: start;
}

.gallery__item {
  position: relative;
  padding: 0;
  border: none;
  background: #111;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.gallery__item-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.gallery__item-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 3px 8px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
}

.gallery__empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
}

/* Full-screen preview sub-overlay. Stacks above `.gallery` at a higher
   z-index so it covers the grid but sits inside the same dark host. */
.gallery__preview {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px
    calc(env(safe-area-inset-bottom, 0px) + 16px);
}

.gallery__preview-header {
  display: flex;
  justify-content: flex-end;
  padding: 4px 4px 12px;
}

.gallery__preview-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.gallery__preview-video {
  max-height: 100%;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.gallery__preview-actions {
  display: flex;
  gap: 12px;
  padding-top: 16px;
}

.gallery__preview-action {
  flex: 1;
  padding: 14px 16px;
  background: #fff;
  color: var(--ink);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.gallery__preview-action:disabled {
  opacity: 0.45;
  cursor: default;
}

.gallery__preview-action--download {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* -----------------------------------------------------------------------
   Camera_Screen — Spin UI (Tasks 11.1 / 11.2 / 11.3)
   Orientation_Pill, pulse ring, arc indicator, and manual ↺/↻ fallback.
   All four are absolute overlays above the viewfinder and below the
   bottom bar (which keeps its own shadow), each with `pointer-events: none`
   where they must not intercept taps (pill, pulse, arc).
   -------------------------------------------------------------------- */

/* Orientation_Pill — frosted pill with spring entrance animation. */
.camera__pill {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 72px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
  animation: pillFadeIn 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes pillFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.9); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.camera__pill[hidden] {
  display: none;
}

/* Pulse ring — center, scale 0.7 → 1.8, opacity 1 → 0, 500ms
   (requirement 2.5). Rendered as a fixed-size ring that the
   `.is-pulsing` class animates outward via CSS transition. */
.camera__pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140px;
  height: 140px;
  margin-left: -70px;
  margin-top: -70px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  opacity: 1;
  transform: scale(0.7);
  pointer-events: none;
  transition: transform 0.5s ease-out, opacity 0.5s ease-out;
  z-index: 4;
}

.camera__pulse[hidden] {
  display: none;
}

.camera__pulse.is-pulsing {
  transform: scale(1.8);
  opacity: 0;
}

/* Arc indicator — top-left 44×44 SVG host with a small moving dot.
   Hidden when `hasGyro === false` (requirements 2.6 / 12.2). */
.camera__arc {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  left: 16px;
  width: 44px;
  height: 44px;
  pointer-events: none;
  z-index: 3;
}

.camera__arc[hidden] {
  display: none;
}

.camera__arc svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Manual ↺/↻ rotate cluster — shown when `hasGyro === false`
   (requirements 2.7 / 12.2). Absolutely positioned just above the
   bottom bar, horizontally centered, with a 12px gap between the two
   48px circle buttons so it doesn't fight the existing bottom-bar
   grid. */
.camera__manual {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 112px);
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 3;
}

.camera__manual[hidden] {
  display: none;
}

.camera__manual-btn {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.camera__manual-btn:hover {
  background: rgba(0, 0, 0, 0.65);
  transform: scale(1.08);
}

.camera__manual-btn:active {
  transform: scale(0.92);
  background: rgba(0, 0, 0, 0.75);
}


/* -----------------------------------------------------------------------
   Dual_Renderer — Task 13.1
   Side-by-side H + V composite, mounted inside `.camera` as a sibling to
   the main <video>. The renderer sets inline widths + transforms on the
   two <video> children; this block paints the shared frame (position,
   labels, divider) and keeps the host on top of the black camera
   background.
   -------------------------------------------------------------------- */

.dual {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
  z-index: 2;
}

.dual__video {
  width: 100%;
  background: #000;
  object-fit: cover;
  -webkit-transform: translateZ(0);
}

.dual__video--h {
  overflow: hidden;
}

.dual__video--v {
  overflow: hidden;
}

/* Horizontal divider between top and bottom halves */
.dual__divider {
  position: absolute;
  left: 0;
  right: 0;
  top: 35%;
  height: 2px;
  width: 100% !important;
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 2;
}

.dual__label {
  position: absolute;
  padding: 4px 12px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  pointer-events: none;
  z-index: 2;
}

/* front label: top-left of the top section */
.dual__label--h {
  left: 12px;
  top: 8px;
}

/* back label: just below the divider */
.dual__label--v {
  left: 12px;
  top: calc(35% + 8px);
}

/* -----------------------------------------------------------------------
   Gallery_Screen — Task 13.3
   Dual-mode export crop buttons. Visually distinct from the primary
   Share action so the user reads them as "optional tooling" rather than
   the main affordance.
   -------------------------------------------------------------------- */

.gallery__preview-action--crop-landscape,
.gallery__preview-action--crop-portrait {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* -----------------------------------------------------------------------
   PiP_Renderer — Task 14.3
   Back cam fills the viewfinder as a full-bleed <video>; the front cam
   sits in a draggable 110×150 rounded button inset mirrored via
   `transform: scaleX(-1)`. The renderer sets the position / border /
   transform inline (those need to change on drag); the rules below pick
   up the visual polish — cursor feedback, stacking, safe-area aware
   positioning for the default bottom-left corner.
   -------------------------------------------------------------------- */

.pip {
  position: absolute;
  inset: 0;
  background: #000;
  overflow: hidden;
  z-index: 2;
}

.pip__back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.pip__inset {
  /* Position / width / height / border / borderRadius are set inline by
     the renderer because they change on drag. The rules here give the
     inset its resting look — box-shadow for depth, grab cursor for
     discoverability, and a higher z-index so it floats above the back
     cam video. */
  z-index: 3;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.pip__inset.is-dragging {
  cursor: grabbing;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.pip__inset-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Mirror the front cam so it reads like a handheld mirror instead of a
     raw sensor feed. The renderer also sets this inline — duplicating it
     here keeps the rule visible when the mode ships. */
  transform: scaleX(-1);
}

.camera__mode-pill.is-disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* -----------------------------------------------------------------------
   Filter_Picker — Task 18.1 / 18.2 / 18.3
   Slide-up sheet with blurred backdrop, 2-column masonry grid of live
   filter thumbnails, and selection state (ink border + ✓ badge).
   Requirements: 6.1, 6.2, 6.3, 6.4, 6.5, 6.6
   -------------------------------------------------------------------- */

/* Full-screen overlay container — sits above the gallery z-index. */
.filter-picker {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Blurred dark backdrop (req 6.1): backdrop-filter blur + 40% dark. */
.filter-picker__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Bottom-anchored sheet at 70vh, scrollable, warm white surface. */
.filter-picker__sheet {
  position: relative;
  z-index: 1;
  height: 70vh;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow-y: auto;
  animation: filterSheetSlideUp 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes filterSheetSlideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Flex header with title + close button. */
.filter-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}

/* "Filters" in Instrument Serif. */
.filter-picker__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--ink);
}

/* Close ✕ button — same style as gallery close. */
.filter-picker__close {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* 2-column CSS grid with 10px gap, 16px padding (req 6.2). */
.filter-picker__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 16px 16px;
}

/* Filter card button: white bg, rounded-16, subtle shadow. */
.filter-picker__card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
}

/* Alternating aspect ratios via data-shape (req 6.2). */
.filter-picker__card[data-shape="tall"] {
  aspect-ratio: 3 / 4;
}

.filter-picker__card[data-shape="square"] {
  aspect-ratio: 1 / 1;
}

/* Selected card: 2px solid ink border (req 6.5). */
.filter-picker__card.is-selected {
  border-color: var(--ink);
}

/* Canvas thumbnail filling the card top. */
.filter-picker__thumb {
  width: 100%;
  flex: 1;
  display: block;
  object-fit: cover;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* Checkmark ✓ badge top-right — hidden unless .is-selected (req 6.5). */
.filter-picker__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--ink);
  border-radius: 50%;
}

.filter-picker__card.is-selected .filter-picker__badge {
  display: flex;
}

/* Filter name in Instrument Serif 15px (req 6.4). */
.filter-picker__name {
  padding: 8px 10px 2px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
}

/* Mood tags in DM Sans 11px muted letter-spaced (req 6.4). */
.filter-picker__tags {
  padding: 0 10px 10px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
}


/* -----------------------------------------------------------------------
   Toast — AppShell toast notification
   Frosted pill that slides in from the bottom.
   -------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 120px);
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: rgba(26, 26, 26, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  animation: toastIn 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.92); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* -----------------------------------------------------------------------
   Filter display canvas — full-bleed sibling to the main video.
   Shown when a non-`none` filter is active in Spin mode.
   -------------------------------------------------------------------- */

.camera__filter-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  pointer-events: none;
}

.camera__filter-canvas[hidden] {
  display: none !important;
  visibility: hidden;
}

/* -----------------------------------------------------------------------
   Smooth transitions for all interactive elements
   -------------------------------------------------------------------- */

.camera__mode-pill.is-disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* Gallery items get a subtle hover lift */
.gallery__item {
  transition: transform 0.2s ease;
}

.gallery__item:hover {
  transform: scale(1.02);
}

/* Gallery preview actions get hover states */
.gallery__preview-action:hover:not(:disabled) {
  opacity: 0.85;
}

.gallery__preview-action--download:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}
