/* ─────────────────────────────────────────
   VARIABLES & RESET
───────────────────────────────────────── */
:root {
  --bg: #F5F4F0;
  --fg: #1C1B18;
  --gray-100: #EEEDEA;
  --gray-200: #D8D7D3;
  --gray-400: #9E9D99;
  --gray-600: #5C5B57;
  --white: #FFFFFF;

  --font-serif: 'Sacramento', Georgia, serif;
  --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --radius: 14px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────
   BACK BUTTON
───────────────────────────────────────── */
.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10;
  background: none;
  border: 1px solid #ccc;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--fg);
  transition: all 0.2s ease;
}

.back-btn:hover {
  border-color: #ccc;
  background: #f5f5f5;
}

/* ─────────────────────────────────────────
   SCREEN SYSTEM
───────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: safe center;
  justify-content: safe center;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
  z-index: 1;
}

.screen.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
  z-index: 2;
}

.screen.exit {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

/* ─────────────────────────────────────────
   BUTTONS
───────────────────────────────────────── */
.btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--fg);
  color: var(--white);
  border: none;
}

.btn-primary:hover {
  background: #333;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  background: var(--fg);
}

.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid #ccc;
  box-shadow: none;
  outline: none;
}

.btn-secondary:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.invisible {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.3s var(--ease) !important;
}

.invisible.visible {
  opacity: 1 !important;
  pointer-events: all !important;
}

/* ─────────────────────────────────────────
   SCREEN LABEL
───────────────────────────────────────── */
.screen-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--fg);
  margin-bottom: 20px;
  text-align: center;
}

/* ─────────────────────────────────────────
   SCREEN 1: ONBOARDING
───────────────────────────────────────── */
#screen-onboarding {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.onboard-left {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 0;
  margin-right: -120px;
  z-index: 1;
}


.welcome-doodle {
  width: 340px;
  height: 340px;
  flex-shrink: 0;
  overflow: hidden;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  transform: rotate(-6deg);
  opacity: 1;

  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.welcome-doodle:hover {
  transform: rotate(-2deg) scale(1.05);
  opacity: 1;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.welcome-doodle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: normal;
}

@keyframes doodleEntrance {
  from {
    opacity: 0;
    transform: translateX(-30px) rotate(-12deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) rotate(-6deg) scale(1);
  }
}

@media (max-width: 900px) {
  .onboard-left,
  .onboard-right {
    display: none;
  }
  #screen-onboarding {
    grid-template-columns: 1fr;
  }
  .camera-illustration {
    max-width: calc(100% - 48px);
    transform-origin: center center;
    animation: float-mobile 4s ease-in-out infinite;
    margin-left: -15px;
  }
  @keyframes float-mobile {
    0%   { transform: translateY(0)   rotate(0deg);    }
    25%  { transform: translateY(-4px) rotate(0.3deg);  }
    50%  { transform: translateY(-8px) rotate(0deg);    }
    75%  { transform: translateY(-4px) rotate(-0.3deg); }
    100% { transform: translateY(0)   rotate(0deg);    }
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .welcome-doodle {
    width: 200px;
    height: 200px;
  }
}

.onboard-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
  gap: 0;
}

.camera-illustration {
  width: 380px;
  height: auto;
  color: var(--fg);
  margin-bottom: 24px;
  animation: float 4s ease-in-out infinite;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.camera-illustration:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
  animation-play-state: paused;
}

@keyframes float {
  0% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-4px) rotate(0.3deg); }
  50% { transform: translateY(-8px) rotate(0deg); }
  75% { transform: translateY(-4px) rotate(-0.3deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(28, 27, 24, 0.15); }
  50% { box-shadow: 0 0 0 10px rgba(28, 27, 24, 0); }
}

#btn-start {
  animation: btnPulse 2.5s ease-in-out infinite;
  animation-delay: 1.5s;
}

#btn-start:hover {
  animation-play-state: paused;
}

.curtain {
  transform-origin: 149px 66px;
  animation: curtainGust 4s ease-in-out infinite;
  animation-delay: 2s;
}

@keyframes curtainGust {
  0%  { transform: skewX(0deg); }
  10% { transform: skewX(-5deg); }
  18% { transform: skewX(3deg); }
  24% { transform: skewX(-2deg); }
  30% { transform: skewX(1deg); }
  35% { transform: skewX(0deg); }
  100% { transform: skewX(0deg); }
}

.title {
  font-family: 'Sacramento', var(--font-serif);
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  margin-bottom: 28px;
  color: #000;
}

.dot {
  color: var(--gray-400);
}

.tagline {
  font-size: 15px;
  font-weight: 300;
  color: var(--gray-600);
  letter-spacing: 0.01em;
  margin-bottom: 52px;
}

/* ─────────────────────────────────────────
   SCREEN 2: CAMERA ACCESS
───────────────────────────────────────── */
.camera-access-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 480px;
  padding: 24px;
}

.preview-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--gray-200);
}

.preview-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.access-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  padding: 24px;
  text-align: center;
  transition: opacity 0.35s var(--ease);
}

.access-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.access-icon {
  width: 56px;
  height: 56px;
  color: var(--fg);
}

.access-overlay-text {
  font-size: 14px;
  color: var(--gray-600);
  max-width: 200px;
  line-height: 1.5;
}

/* ─────────────────────────────────────────
   SCREEN 3: FILTER SELECTION
───────────────────────────────────────── */
.filters-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 60px 20px 0;
  gap: 0;
}

.filters-preview-wrap {
  /* Same portrait sizing formula as the shooting viewport */
  position: relative;
  width: min(calc(100vw - 80px), calc((100svh - 300px) * 3 / 4));
  aspect-ratio: 3 / 4;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: var(--radius);
}

.filters-preview-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1) scale(1.43);
  transition: filter 0.3s var(--ease);
}

/* Suppress iOS Safari native media controls overlay */
.filters-preview-wrap video::-webkit-media-controls,
.camera-viewport video::-webkit-media-controls {
  display: none !important;
}

.filters-preview-wrap video::-webkit-media-controls-enclosure,
.camera-viewport video::-webkit-media-controls-enclosure {
  display: none !important;
}

.filters-preview-wrap video.filter-bw {
  filter: grayscale(100%);
}

/* ── Flash Mode toggle button ── */
.flash-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.85);
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
  z-index: 10;
}

.flash-btn svg {
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.flash-btn:active {
  transform: scale(1.1);
}

.flash-btn.flash-active {
  background: #FFD700;
  color: var(--fg);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.35), 0 0 14px rgba(255, 215, 0, 0.55);
}

/* ── UI dim overlay (contrast punch for flash mode) ── */
/* z-index: 100 — below print/gif overlays (200, 300) and flash overlay (9999) */
#ui-dim-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000000;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
  transition: opacity 300ms var(--ease);
}

/* ── Flash mode overlay ── */
#flash-overlay-mode {
  position: fixed;
  inset: 0;
  background: #FFFEF5;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  will-change: opacity;
  transition: opacity 400ms var(--ease);
}

/* ── Flash mode loop (tooltip onboarding) ── */
.flash-mode-loop {
  animation: flashModeLoop 3s ease infinite !important;
  transition: none !important;
}

@keyframes flashModeLoop {
  0%   { opacity: 0;   background-color: #FFFFFF; }
  10%  { opacity: 0.6; background-color: #FFFFFF; }
  15%  { opacity: 1;   background-color: #FFFFFF; }
  30%  { opacity: 0;   background-color: #FFFEF5; }
  100% { opacity: 0;   background-color: #FFFEF5; }
}

/* ── Flash tooltip (flash mode onboarding) ── */
#flash-tooltip {
  position: fixed;
  width: 210px;
  background: #ffffff;
  border-radius: 11px;
  padding: 12px 13px 11px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18), 0 1px 4px rgba(0, 0, 0, 0.08);
  z-index: 10001; /* above flash overlay (9999) and loop animation — always visible */
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  transform: translateY(-6px) scale(0.96);
  transform-origin: top right;
}

#flash-tooltip.ft-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Beak — right offset set dynamically by JS */
#flash-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  right: var(--beak-right, 10px);
  width: 10px;
  height: 10px;
  background: #ffffff;
  transform: rotate(45deg);
  border-radius: 2px;
  box-shadow: -1px -1px 3px rgba(0, 0, 0, 0.06);
}

.ft-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.ft-sun {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ft-title {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: 0.01em;
}

.ft-body {
  font-family: var(--font-sans);
  font-size: 11px;
  color: #3D3D3D;
  line-height: 1.5;
  margin: 0 0 8px;
}

.ft-divider {
  height: 1px;
  background: #EBEBEB;
  margin-bottom: 7px;
}

.ft-protip {
  font-family: var(--font-sans);
  font-size: 10.5px;
  color: #6B6B6B;
  line-height: 1.45;
  margin: 0 0 10px;
}

.ft-protip strong {
  color: #4A4A4A;
  font-weight: 600;
}

.ft-ok {
  display: block;
  width: 100%;
  background: #1C1B18;
  color: var(--white);
  border: none;
  border-radius: 7px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 0;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: opacity 0.15s var(--ease);
}

.ft-ok:active {
  opacity: 0.8;
}

.filters-bottom {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 40px;
  background: var(--bg);
}

.filter-toggle {
  position: relative;
  display: flex;
  width: 200px;
  background: var(--gray-100);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 24px;
}

.toggle-pill {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 96px;
  height: calc(100% - 8px);
  background: var(--fg);
  border-radius: 999px;
  transition: transform 0.25s var(--ease);
  pointer-events: none;
}

.filter-toggle[data-active="color"] .toggle-pill {
  transform: translateX(96px);
}

.toggle-opt {
  position: relative;
  z-index: 1;
  width: 96px;
  padding: 10px 0;
  background: none;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  text-align: center;
  color: var(--gray-400);
  transition: color 0.25s var(--ease);
}

.filter-toggle[data-active="color"] .toggle-opt[data-filter="color"],
.filter-toggle[data-active="bw"]    .toggle-opt[data-filter="bw"] {
  color: var(--bg);
}

/* ─────────────────────────────────────────
   SCREEN 4: SHOOTING
───────────────────────────────────────── */
.shooting-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 16px 20px 20px;
  gap: 0;
}

.shot-counter {
  flex-shrink: 0;
  padding: 12px 0;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--fg);
}

.shot-counter #shot-num {
  color: var(--fg);
  font-weight: 600;
  font-size: 14px;
}

.camera-viewport {
  position: relative;
  /* Portrait 3:4, fits both screen width and height */
  width: min(calc(100vw - 80px), calc((100svh - 260px) * 3 / 4));
  aspect-ratio: 3 / 4;
  flex-shrink: 0;
  background: var(--fg);
  border-radius: var(--radius);
  overflow: hidden;
}

.camera-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1) scale(1.43);
  transition: filter 0.3s var(--ease);
}

.camera-viewport video.filter-bw {
  filter: grayscale(100%);
}

/* ── Flash Mode bolt indicator (shooting screen) ── */
.flash-mode-status {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 30;
  pointer-events: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFD700;
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.35), 0 0 14px rgba(255, 215, 0, 0.55), 0 0 32px rgba(255, 215, 0, 0.3);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.camera-viewport.flash-mode-active .flash-mode-status {
  opacity: 1;
}

/* Commitment cut — fade out at T-400ms before flash */
.camera-viewport.commit-cut .flash-mode-status {
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

/* Hide during processing (all shots done) */
.camera-viewport:has(.processing-overlay.visible) .flash-mode-status {
  opacity: 0;
  transition: none;
}

.nms-bolt {
  width: 15px;
  height: 15px;
  color: var(--fg);
  display: block;
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 27, 24, 0.35);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  pointer-events: none;
}

.countdown-overlay.visible {
  opacity: 1;
}

.countdown-number {
  font-family: var(--font-serif);
  font-size: clamp(80px, 18vmin, 130px);
  font-weight: 400;
  color: var(--white);
  line-height: 1;
  display: block;
}

.countdown-number.pop {
  animation: countPop 0.92s var(--ease-spring) forwards;
}

@keyframes countPop {
  0%   { transform: scale(1.9); opacity: 0; }
  25%  { transform: scale(1);   opacity: 1; }
  75%  { transform: scale(1);   opacity: 1; }
  100% { transform: scale(0.7); opacity: 0; }
}

.flash-overlay {
  position: absolute;
  inset: 0;
  background: var(--white);
  opacity: 0;
  pointer-events: none;
}

.flash-overlay.flash {
  animation: flashAnim 0.38s ease-out forwards;
}

@keyframes flashAnim {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Processing overlay (minimal spinner) ── */
.processing-overlay {
  position: absolute;
  inset: 0;
  background: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease-out;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.processing-overlay.visible {
  opacity: 1;
}

.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.progress-ring {
  width: 72px;
  height: 72px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring svg:first-child {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  animation: spinRing 1.8s linear infinite;
}

.ring-track {
  fill: none;
  stroke: var(--gray-600);
  stroke-width: 2;
}

.ring-fill {
  fill: none;
  stroke: var(--white);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 150;
  stroke-dashoffset: 100;
}

.spinner-icon {
  width: 28px;
  height: 28px;
  filter: invert(1) brightness(2);
}

.spinner-text {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--gray-400);
  animation: spinnerPulse 1.5s ease-in-out infinite;
}

@keyframes spinRing {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spinnerPulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

.shot-strip {
  display: none;
}

.shot-slot {
  width: 45px;
  height: 60px;
  border-radius: 8px;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  overflow: hidden;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease-spring);
}

.shot-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot-slot.filled {
  border-color: var(--fg);
  transform: scale(1.04);
}

/* ─────────────────────────────────────────
   SCREEN 5: TEMPLATE SELECTION
───────────────────────────────────────── */
.templates-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 24px;
  width: 100%;
  max-width: 600px;
  overflow-y: auto;
}

/* ── Hero preview ── */
.template-hero {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 28px;
  display: flex;
  justify-content: center;
}

.hero-frame {
  position: relative;
  width: 100%;
  background: transparent;
  border: none;
  padding: 8px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
}

.hero-canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Clean drop shadow on the canvas itself — no surrounding box, no sprockets */
.hero-canvas-wrap canvas {
  filter:
    drop-shadow(0 3px 8px rgba(28, 27, 24, 0.12))
    drop-shadow(0 1px 2px rgba(28, 27, 24, 0.06));
}

.template-hero .hero-canvas-wrap.strip-wrap {
  display: flex;
}

.template-hero .hero-canvas-wrap.strip-wrap canvas {
  width: auto;
  max-width: 100%;
  max-height: 360px;
  height: auto;
  display: block;
}

/* ── Frame color picker ── */
.frame-color-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.picker-label {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--fg);
}

.color-swatches {
  display: flex;
  gap: 8px;
  align-items: center;
}

.swatch-wrap {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 1.5px solid var(--gray-200);
  transition: box-shadow 0.2s var(--ease);
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  background: transparent;
}

.swatch[data-color="white"] {
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px var(--gray-200);
}

.swatch[data-color="black"]  { background: #000000; }
.swatch[data-color="teal"]   { background: #3A5A6B; border-color: transparent; }
.swatch[data-color="red"]    { background: #C24A3A; border-color: transparent; }
.swatch[data-color="yellow"] { background: #E8C547; border-color: transparent; }

.swatch.active {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg);
  border-color: transparent;
}

.swatch[data-color="white"].active {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg), inset 0 0 0 1px var(--gray-200);
}

.swatch-custom {
  background: transparent;
  border: 1.5px dashed rgba(28, 27, 24, 0.4);
  color: var(--gray-400);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.swatch-custom:hover {
  border-color: var(--fg);
  color: var(--fg);
}

/* ── Print button (full width) ── */
.btn-print-full {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

/* ── Retake link ── */
.retake-link {
  display: inline-block;
  margin: 16px auto 0;
  padding: 6px 8px;
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  transition: color 0.15s var(--ease);
}

.retake-link:hover {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─────────────────────────────────────────
   PRINT OVERLAY
───────────────────────────────────────── */
.print-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.print-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.print-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 24px 16px;
  overflow: visible;
}

.print-inner .screen-label {
  margin-bottom: 0;
}

/* Scene: relative container for everything.
   overflow: visible so doodles + GIF can extend beyond edges.
   The .print-clip-area inside handles vertical clipping for the photo slide. */
.print-scene {
  position: relative;
  width: 320px;
  overflow: visible;
  margin: 8px auto;
  /* height set dynamically by JS */
}

/* Clip area — wraps photo + envelope, clips vertically for slide animation */
.print-clip-area {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Photo — bottom sits 15px inside the envelope opening (222 - 15 = 207) */
.print-photo-wrap {
  position: absolute;
  bottom: 207px;
  left: 50%;
  z-index: 2;
  /* initial/final transform set by JS */
}

#canvas-print {
  display: block;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.18);
  transition: box-shadow 0.3s ease;
}

.print-photo-inner {
  position: relative !important;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.print-photo-inner:hover {
  transform: rotate(-2deg) scale(1.03);
}

.print-photo-inner:hover #canvas-print {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.26);
}

/* Envelope layers */
.env-layer {
  position: absolute;
  left: 0;
  width: 320px;
  display: block;
  pointer-events: none;
}

/* Back: body (222px) + open flap triangle pointing up (123px) = 345px total */
.env-back {
  bottom: 0;
  height: 345px;
  z-index: 1;
}

/* Front: full 222px height, golden fill — masks the photo while it's inside */
.env-front {
  bottom: 0;
  height: 222px;
  z-index: 3;
}

/* ── Closed flap — 3D fold-open animation ── */

/* Flap: curved shape matching the open-flap in env-back (same size, flipped).
   Top edge (hinge) aligns with envelope body top = bottom: 222px.
   Height matches open flap: 123px. So bottom = 222 - 123 = 99px. */
.env-flap {
  bottom: 99px;
  height: 123px;
  z-index: 4; /* above env-front(3), below doodles(10) */
  transform-origin: top center;
  transform: perspective(800px) rotateX(0deg);
}

/* Opening animation — flap folds backward around its top edge.
   Gentle ease-in so it feels like paper being peeled, then accelerates. */
.env-flap.opening {
  animation: flapOpen 1.1s cubic-bezier(0.16, 0.7, 0.3, 1) forwards;
}

@keyframes flapOpen {
  0% {
    transform: perspective(800px) rotateX(0deg);
    opacity: 1;
  }
  20% {
    transform: perspective(800px) rotateX(30deg);
    opacity: 1;
  }
  45% {
    transform: perspective(800px) rotateX(78deg);
    opacity: 1;
  }
  55% {
    transform: perspective(800px) rotateX(95deg);
    opacity: 0.5;
  }
  80% {
    transform: perspective(800px) rotateX(150deg);
    opacity: 0.1;
  }
  100% {
    transform: perspective(800px) rotateX(180deg);
    opacity: 0;
  }
}

/* env-back: hide the curved open-flap portion when sealed */
.env-back.sealed {
  clip-path: inset(36% 0 0 0);
}

.env-back.unsealing {
  animation: revealBackFlap 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes revealBackFlap {
  from { clip-path: inset(36% 0 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* ── Hand-drawn doodles — inside .print-scene, anchored to envelope via bottom ── */
.doodles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: visible;
}

.celebration {
  position: absolute;
  width: 220px;
  height: auto;
  pointer-events: none;
}

/* Left — near the envelope area, low enough to avoid GIF preview overlap */
.celebration-left {
  right: calc(50% + 150px);
  bottom: 130px;
  transform: rotate(-40deg);
}

/* Right — mirrored horizontally */
.celebration-right {
  left: calc(50% + 150px);
  bottom: 130px;
  transform: scaleX(-1) rotate(-40deg);
}

/* Radial clip-path reveal — doodle expands from center outward */
.celebration {
  opacity: 0;
  clip-path: circle(0% at 50% 50%);
  will-change: clip-path, opacity, transform;
}

.print-overlay.active .celebration {
  animation: celebrationReveal 1.4s ease-out forwards;
}

.print-overlay.active .celebration-left {
  animation-delay: 0.5s;
}

.print-overlay.active .celebration-right {
  animation-delay: 0.7s;
}

@keyframes celebrationReveal {
  0% {
    opacity: 0;
    clip-path: circle(0% at 50% 50%);
    transform: rotate(-40deg) scale(0.8);
  }
  10% {
    opacity: 1;
  }
  40% {
    clip-path: circle(30% at 50% 50%);
    transform: rotate(-40deg) scale(0.95);
  }
  70% {
    clip-path: circle(55% at 50% 50%);
    transform: rotate(-40deg) scale(1);
  }
  100% {
    opacity: 1;
    clip-path: circle(75% at 50% 50%);
    transform: rotate(-40deg) scale(1);
  }
}

/* Override for right side to keep the mirror */
.print-overlay.active .celebration-right {
  animation-name: celebrationRevealRight;
}

@keyframes celebrationRevealRight {
  0% {
    opacity: 0;
    clip-path: circle(0% at 50% 50%);
    transform: scaleX(-1) rotate(-40deg) scale(0.8);
  }
  10% {
    opacity: 1;
  }
  40% {
    clip-path: circle(30% at 50% 50%);
    transform: scaleX(-1) rotate(-40deg) scale(0.95);
  }
  70% {
    clip-path: circle(55% at 50% 50%);
    transform: scaleX(-1) rotate(-40deg) scale(1);
  }
  100% {
    opacity: 1;
    clip-path: circle(75% at 50% 50%);
    transform: scaleX(-1) rotate(-40deg) scale(1);
  }
}

/* Action row — fades in after animation */
.env-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  pointer-events: none;
}

.env-actions.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* Same-width buttons */
.env-btn {
  min-width: 140px;
  text-align: center;
}

/* ─────────────────────────────────────────
   SQUIGGLE OVERLAY (on print photo)
───────────────────────────────────────── */
.squiggle-overlay {
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: -6px;
  right: -6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  z-index: 10;
  overflow: visible;
}

.squiggle-overlay.visible {
  opacity: 1;
  pointer-events: all;
  cursor: pointer;
}

.squiggle-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.squiggle-path {
  fill: none;
  stroke: #1C1B18;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 7 4;
  animation: squiggleMarch 1.4s linear infinite;
}

@keyframes squiggleMarch {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -44; }
}

.squiggle-badge {
  position: absolute;
  top: -2px;
  right: -12px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  pointer-events: all;
  transform-origin: center center;
  animation: badgeBreathe 3s ease-in-out infinite;
}

/* Strip view: straddle top edge, overhang right edge of the strip */
.squiggle-badge.layout-strip {
  position: absolute !important;
  left: auto !important;
  top: 0 !important;
  right: -32px !important;
  transform: translateY(-50%) !important;
  width: fit-content !important;
  z-index: 11; /* above squiggle-overlay (z:10) */
  animation: none;
}

/* Mobile guardrail: don't let the badge clip off the right edge */
@media (max-width: 480px) {
  .squiggle-badge.layout-strip {
    right: -12px !important;
  }
}

@keyframes badgeBreathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

.squiggle-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  animation: sparklePop 1.8s ease-in-out infinite;
}

@keyframes sparklePop {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%       { transform: scale(1.2) rotate(15deg); }
}

/* ─────────────────────────────────────────
   GIF FULL-SCREEN OVERLAY
───────────────────────────────────────── */
.gif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.gif-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.gif-overlay img {
  max-width: 80vw;
  max-height: 60vh;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.gif-overlay-actions {
  display: flex;
  gap: 12px;
}

.gif-overlay .btn-secondary {
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}

.gif-overlay .btn-secondary:hover {
  background: rgba(255,255,255,0.1);
}

.gif-overlay .btn-primary {
  background: #fff;
  color: var(--fg);
}

.gif-overlay .btn-primary:hover {
  background: #eee;
}

/* ─────────────────────────────────────────
   DOWNLOAD FORMAT SHEET
───────────────────────────────────────── */

/* Backdrop — blurred so the envelope/strip stays visible but secondary */
.download-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 250;
  display: flex;
  align-items: flex-end;          /* mobile: bottom sheet */
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.download-sheet.active {
  opacity: 1;
  pointer-events: all;
}

/* Card — mobile: bottom sheet, desktop: centered modal */
.download-sheet-inner {
  background: #fff;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 380px;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -4px 40px rgba(0,0,0,0.12);
}

.download-sheet.active .download-sheet-inner {
  transform: translateY(0);
}

/* Desktop: centered modal with scale animation instead of slide */
@media (min-width: 769px) {
  .download-sheet {
    align-items: center;
  }
  .download-sheet-inner {
    border-radius: 24px;
    padding-bottom: 8px;
    transform: translateY(0) scale(0.92);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.3s var(--ease);
    box-shadow: 0 12px 48px rgba(0,0,0,0.18);
  }
  .download-sheet.active .download-sheet-inner {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Header */
.download-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}

/* Drag handle (mobile affordance) */
.download-sheet-header::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #ddd;
}

@media (min-width: 769px) {
  .download-sheet-header::before { display: none; }
}

.download-sheet-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--gray-2);
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  border-radius: 8px;
  transition: background 0.15s;
}

.download-sheet-close:hover {
  background: #f0ede8;
}

/* Option rows */
.dl-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.dl-option:hover {
  background: #fafaf8;
}

.dl-option:active {
  background: #f0ede8;
}

.dl-option + .dl-option {
  border-top: 1px solid #f0ede8;
}

.dl-option.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Save Both button (layout only — uses .btn.btn-secondary styles) */
.dl-both {
  display: block;
  margin: 16px 22px 20px;
  width: calc(100% - 44px);
}

/* Icon containers */
.dl-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dl-icon-photo {
  background: #f0ede8;
  color: var(--fg);
}

.dl-icon-live {
  background: var(--fg);
}

/* Text */
.dl-text h4 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 3px;
}

.dl-text p {
  font-size: 12px;
  color: var(--gray-1);
  line-height: 1.4;
  margin: 0;
}

.dl-format-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f0ede8;
  color: var(--gray-2);
  margin-left: 6px;
  vertical-align: middle;
}

/* Chevron arrow on each option */
.dl-option::after {
  content: '';
  position: absolute;
  right: 22px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--gray-1);
  border-bottom: 2px solid var(--gray-1);
  transform: rotate(-45deg);
  opacity: 0.4;
  transition: opacity 0.15s;
}

.dl-option:hover::after {
  opacity: 0.7;
}

.dl-option.loading::after,
.dl-option.disabled::after {
  display: none;
}

/* Spinner for live option when not ready */
.dl-spinner {
  position: absolute;
  right: 22px;
  display: none;
}

.dl-option.loading .dl-spinner {
  display: block;
}

.dl-option.loading .dl-text h4,
.dl-option.loading .dl-text p {
  opacity: 0.5;
}

.dl-spinner-ring {
  width: 18px;
  height: 18px;
  border: 2px solid #e0ddd8;
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: dlSpin 0.8s linear infinite;
}

@keyframes dlSpin {
  to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 480px) {
  .camera-illustration { width: 280px; }
  .shot-slot { width: 36px; height: 48px; }
  .celebration {
    width: 130px;
  }
  .celebration-left {
    right: calc(50% + 125px);
    bottom: 100px;
  }
  .celebration-right {
    left: calc(50% + 125px);
    bottom: 100px;
  }

  /* Template screen */
  .template-hero {
    max-width: 280px;
  }
  .hero-frame {
    padding: 14px 18px;
    min-height: 240px;
  }
  .template-hero .hero-canvas-wrap.strip-wrap canvas {
    max-height: 300px;
  }
  .color-swatches {
    gap: 4px;
  }
  .swatch-wrap {
    width: 36px;
    height: 36px;
  }

}

/* ── Print overlay: mobile scaling ── */
@media (max-width: 768px) {
  .print-overlay {
    overflow-x: hidden;
  }
  .print-scene {
    transform: scale(0.65);
    transform-origin: top center;
  }
  .env-actions {
    margin-top: 28px;
    gap: 20px;
  }
  .env-btn {
    min-width: 120px;
  }
  .celebration {
    width: 160px;
  }
  .celebration-left {
    right: calc(50% + 140px);
    bottom: 100px;
  }
  .celebration-right {
    left: calc(50% + 140px);
    bottom: 100px;
  }
  .shooting-content {
    justify-content: center;
  }
  /* Mobile zoom: scale(1.2) matches reference — wider than desktop (1.43) but not full wide */
  .filters-preview-wrap video {
    transform: scaleX(-1) scale(1.2);
  }
  .camera-viewport video {
    transform: scaleX(-1) scale(1.2);
  }
}

@media (max-height: 680px) {
  .shooting-content { padding: 8px 16px 12px; }
  .shot-counter { padding: 6px 0; }
  .shot-slot { width: 34px; height: 46px; }

  .templates-content {
    padding: 16px 16px 16px;
  }

  .template-hero {
    margin-bottom: 16px;
    min-height: auto;
  }

  .frame-color-picker {
    margin-bottom: 16px;
  }
}

/* ─────────────────────────────────────────
   COLOR PICKER MODAL
───────────────────────────────────────── */
.color-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.color-picker-modal.active {
  opacity: 1;
  pointer-events: all;
}

.color-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
}

.color-picker-card {
  position: relative;
  width: calc(100% - 32px);
  max-width: 320px;
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  padding: 18px 18px 16px;
  transform: scale(0.96);
  transition: transform 0.25s var(--ease);
}

.color-picker-modal.active .color-picker-card {
  transform: scale(1);
}

.color-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.color-picker-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.1px;
  margin: 0;
}

.color-picker-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-100);
  border: none;
  color: var(--fg);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s var(--ease);
}

.color-picker-close:hover {
  background: var(--gray-200);
}

.color-picker-section-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--gray-400);
  margin: 0 0 10px;
}

.color-picker-presets {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--gray-100);
}

.color-picker-presets .swatch {
  width: 28px;
  height: 28px;
}

/* Custom section: S/L pad + side controls */
.sl-row {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-bottom: 14px;
  align-items: stretch;
}
.sl-side {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  flex: 0 0 90px;
}
.hex-input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0 8px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg);
  background: #F5F4F0;
  text-align: center;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  text-transform: uppercase;
  box-sizing: border-box;
}
.hex-input:focus {
  border-color: var(--fg);
  background: #fff;
}
.hex-input.invalid {
  border-color: #C24A3A;
}

.hue-slider {
  position: relative;
  width: 100%;
  height: 28px;
  border-radius: 999px;
  margin-bottom: 14px;
  background: linear-gradient(
    to right,
    #ff0000 0%,
    #ffa500 17%,
    #ffff00 33%,
    #00cc00 50%,
    #0066ff 67%,
    #6b00b3 83%,
    #ff00b3 100%
  );
  cursor: pointer;
  touch-action: none;
}

.hue-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid var(--fg);
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Saturation/lightness pad */
.sl-pad {
  position: relative;
  flex: 1;
  height: 96px;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
  background: var(--sl-hue, #FF0000);
}
.sl-pad-sat {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to right, #FFFFFF 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}
.sl-pad-light {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to top, #000000 0%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}
.sl-pad-thumb {
  position: absolute;
  top: 50%;
  left: 100%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.color-picker-preview {
  width: 100%;
  flex: 1;
  min-height: 32px;
  border-radius: 8px;
  background: #C24A3A;
  border: 1px solid var(--gray-200);
}

.color-picker-done {
  width: 100%;
}

/* ── Retake bottom sheet ── */
.retake-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 90;
}
.retake-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.retake-sheet {
  position: fixed;
  left: 50%;
  bottom: 16px;
  width: calc(100% - 32px);
  max-width: 420px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 10px 20px 16px;
  transform: translate(-50%, calc(100% + 24px));
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 91;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.retake-sheet.visible {
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.retake-handle {
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: var(--light-gray, #D8D7D3);
  margin: 4px 0 14px;
}

.retake-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 16px;
  text-align: center;
  letter-spacing: -0.1px;
}

.retake-thumbs {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
  margin-bottom: 12px;
}

.retake-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 72px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.retake-thumb-frame {
  position: relative;
  width: 72px;
  height: 96px;
  border-radius: 6px;
  background: #F5F4F0;
  border: 1px solid var(--light-gray, #D8D7D3);
  overflow: hidden;
  transition: border-color 0.15s ease, border-width 0.15s ease;
  box-sizing: border-box;
}
.retake-thumb-frame img,
.retake-thumb-frame canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.retake-thumb-check {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fg);
  display: none;
  align-items: center;
  justify-content: center;
}
.retake-thumb-check::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1.8px solid #fff;
  border-bottom: 1.8px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
  display: block;
}

.retake-thumb-num {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray, #9E9D99);
}

.retake-thumb.selected .retake-thumb-frame {
  border-color: var(--fg);
  border-width: 2.5px;
}
.retake-thumb.selected .retake-thumb-check {
  display: flex;
}
.retake-thumb.selected .retake-thumb-num {
  color: var(--fg);
  font-weight: 600;
}

.retake-cta {
  width: 100%;
  max-width: 280px;
  margin-bottom: 12px;
}
.retake-cta:disabled {
  background: var(--light-gray, #D8D7D3);
  color: var(--gray, #9E9D99);
  cursor: not-allowed;
  box-shadow: none;
}

.retake-divider {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 280px;
  margin-bottom: 12px;
  color: var(--gray, #9E9D99);
  font-size: 12px;
  gap: 12px;
}
.retake-divider::before,
.retake-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--light-gray, #D8D7D3);
}

.retake-startover {
  width: 100%;
  max-width: 280px;
  background: transparent;
  color: var(--fg);
  border: 1.5px solid var(--light-gray, #D8D7D3);
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 10px;
}
.retake-startover:hover {
  background: rgba(0, 0, 0, 0.03);
}

.retake-cancel {
  background: none;
  border: none;
  color: var(--gray, #9E9D99);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
}
.retake-cancel:hover {
  color: var(--fg);
}
