/* ============================================================
   ROOT & DESIGN TOKENS
   ============================================================ */
:root {
  --red:           #E63946;
  --red-dark:      #C1121F;
  --red-muted:     rgba(230, 57, 70, 0.18);
  --bg:            #141414;
  --surface:       #1E1C1A;
  --cream:         #F4EBD0;
  --cream-muted:   #9A8C78;
  --white:         #FFFFFF;

  --font-display:  'Playfair Display', Georgia, serif;
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --thread-w:      40px;
  --pad-x:         20px;
  --pad-safe-top:  max(20px, env(safe-area-inset-top));
  --pad-safe-bot:  max(20px, env(safe-area-inset-bottom));
  --content-left:  calc(var(--thread-w) + var(--pad-x));

  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:   cubic-bezier(0.45, 0, 0.55, 1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--cream);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.hidden { display: none !important; }
[hidden]  { display: none !important; }

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
  min-height: 100dvh;
  min-height: 100vh;
}

/* ============================================================
   PASSWORD SCREEN
   ============================================================ */
.screen--password {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: var(--pad-safe-top) 40px var(--pad-safe-bot);
}

.pw-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 300px;
}

.pw-thread-icon {
  width: 44px;
  height: 90px;
  animation: pw-sway 4s ease-in-out infinite;
}

@keyframes pw-sway {
  0%, 100% { transform: rotate(-3deg); }
  50%       { transform: rotate(3deg); }
}

.pw-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cream-muted);
}

#pw-form {
  display: flex;
  width: 100%;
  border-bottom: 1px solid rgba(244, 235, 208, 0.3);
  transition: border-color 0.3s;
}

#pw-form:focus-within {
  border-color: var(--red);
}

.pw-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  padding: 12px 0;
  min-height: 48px;
}

.pw-input::placeholder { color: var(--cream-muted); }

.pw-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 48px;
  color: var(--cream);
  transition: color 0.3s;
  flex-shrink: 0;
}

.pw-btn:hover,
.pw-btn:active { color: var(--red); }

.pw-btn svg { width: 20px; height: 20px; }

.pw-error {
  font-size: 0.8rem;
  color: var(--red);
  letter-spacing: 0.05em;
  min-height: 1.2em;
  text-align: center;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s, transform 0.3s;
}

.pw-error.visible {
  opacity: 1;
  transform: none;
}

/* ============================================================
   STORY SCREEN
   ============================================================ */
.screen--story {
  position: relative;
}

/* ============================================================
   RED THREAD SVG
   ============================================================ */
.thread-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--thread-w);
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: visible;
}

/* ============================================================
   SCENES CONTAINER
   ============================================================ */
.scenes {
  position: relative;
  z-index: 1;
}

/* ============================================================
   SHARED SCENE STYLES
   ============================================================ */
.scene {
  position: relative;
  padding-top: 80px;
  padding-bottom: 80px;
  padding-left: var(--content-left);
  padding-right: max(var(--pad-x), env(safe-area-inset-right));
}

/* Entrance animation base */
.scene > .scene-inner {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.scene.scene--visible > .scene-inner {
  opacity: 1;
  transform: none;
}

/* ============================================================
   MODULE: HERO
   ============================================================ */
.scene-hero {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: var(--pad-safe-top);
  padding-bottom: max(60px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.scene-hero .hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}

.scene-hero .hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(20,20,20,0.95) 0%, rgba(20,20,20,0.4) 60%, transparent 100%);
}

.scene-hero > .scene-inner {
  position: relative;
  z-index: 1;
}

.hero-tag {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 9vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--cream);
  margin-bottom: 16px;
}

.hero-subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 4vw, 1.3rem);
  line-height: 1.5;
  color: var(--cream-muted);
  margin-bottom: 32px;
}

.hero-scroll-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cream-muted);
}

.hero-scroll-hint .scroll-line {
  width: 32px;
  height: 1px;
  background: var(--red);
}

/* ============================================================
   MODULE: CHAPTER
   ============================================================ */
.scene-chapter {
  min-height: 60vh;
  display: flex;
  align-items: center;
  background: var(--surface);
}

.chapter-number {
  font-family: var(--font-display);
  font-size: clamp(5rem, 22vw, 8rem);
  font-weight: 700;
  color: rgba(230, 57, 70, 0.08);
  line-height: 1;
  margin-bottom: -20px;
  user-select: none;
  position: relative;
  left: -8px;
}

.chapter-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--cream);
  margin-bottom: 16px;
}

.chapter-title em {
  color: var(--red);
  font-style: inherit;
}

.chapter-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--cream-muted);
}

.chapter-rule {
  width: 32px;
  height: 2px;
  background: var(--red);
  margin-bottom: 20px;
  transform-origin: left;
}

/* ============================================================
   MODULE: IMAGE SLIDER
   ============================================================ */
.scene-image-slider {
  padding-left: 0;
  padding-right: 0;
  padding-top: 60px;
  padding-bottom: 60px;
  overflow: hidden;
}

.scene-image-slider .scene-inner {
  width: 100%;
}

.slider-header {
  padding-left: var(--content-left);
  padding-right: var(--pad-x);
  margin-bottom: 20px;
}

.slider-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 4px;
}

.slider-wrap {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 12px;
  padding-left: var(--content-left);
  padding-right: var(--pad-x);
}

.slider-wrap::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 calc(100% - var(--content-left) - var(--pad-x));
  scroll-snap-align: start;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--surface);
}

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

.slide-caption-wrap {
  padding: 0 var(--content-left) 0 var(--content-left);
  margin-top: 16px;
}

.slide-caption {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--cream-muted);
  font-style: italic;
}

.slider-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  padding: 0 var(--content-left);
}

.slider-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(244, 235, 208, 0.25);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s;
}

.slider-dot.active {
  background: var(--red);
  transform: scale(1.3);
}

/* ============================================================
   MODULE: VIDEO
   ============================================================ */
.scene-video {
  padding-left: 0;
  padding-right: 0;
}

.scene-video .scene-inner {
  width: 100%;
}

.video-header {
  padding-left: var(--content-left);
  padding-right: var(--pad-x);
  margin-bottom: 20px;
}

.video-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cream);
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-wrap video,
.video-wrap iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-caption {
  padding: 12px var(--content-left);
  font-size: 0.85rem;
  color: var(--cream-muted);
  font-style: italic;
  line-height: 1.5;
}

/* ============================================================
   MODULE: QUOTE
   ============================================================ */
.scene-quote {
  min-height: 60vh;
  display: flex;
  align-items: center;
  background: var(--bg);
}

.quote-mark {
  font-family: var(--font-display);
  font-size: 6rem;
  line-height: 0.6;
  color: var(--red);
  margin-bottom: 20px;
  display: block;
  user-select: none;
}

.quote-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.3rem, 6vw, 2rem);
  line-height: 1.45;
  color: var(--cream);
  margin-bottom: 24px;
}

.quote-author {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red);
}

/* ============================================================
   MODULE: TEXT BLOCK
   ============================================================ */
.scene-text-block {
  background: var(--surface);
}

.text-block-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 6vw, 2rem);
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 20px;
  line-height: 1.25;
}

.text-block-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--cream-muted);
}

.text-block-content p + p {
  margin-top: 1em;
}

/* ============================================================
   MODULE: CAMERA FINALE
   ============================================================ */
.scene-camera {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--pad-safe-top);
  padding-bottom: var(--pad-safe-bot);
  background: var(--bg);
}

.camera-idle {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.camera-tag {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--red);
}

.camera-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--cream);
}

.camera-message {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--cream-muted);
}

.camera-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: var(--red);
  color: #fff;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  transition: background 0.2s, transform 0.1s;
  min-height: 50px;
  align-self: flex-start;
}

.camera-btn:active { background: var(--red-dark); transform: scale(0.97); }

.camera-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Camera live view */
.camera-live {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.camera-live.active { display: flex; }

.camera-viewfinder {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror front camera */
}

.camera-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.camera-frame::before,
.camera-frame::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: var(--red);
  border-style: solid;
}

.camera-frame::before {
  top: 16px;
  left: 16px;
  border-width: 2px 0 0 2px;
  border-radius: 4px 0 0 0;
}

.camera-frame::after {
  bottom: 16px;
  right: 16px;
  border-width: 0 2px 2px 0;
  border-radius: 0 0 4px 0;
}

.camera-shutter {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--cream);
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}

.camera-shutter:active { transform: scale(0.92); }

.camera-shutter-inner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--cream);
  pointer-events: none;
}

/* Camera countdown */
.camera-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 700;
  color: var(--cream);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 5;
}

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

/* Camera result */
.camera-result {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.camera-result.active { display: flex; }

.camera-photo-preview {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}

.camera-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-continue-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--red);
  color: #fff;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s, transform 0.1s;
  min-height: 50px;
}

.camera-continue-btn:active {
  background: var(--red-dark);
  transform: scale(0.97);
}

/* ============================================================
   MODULE: THREAD FINALE
   ============================================================ */
.scene-thread-finale {
  min-height: 100dvh;
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
  background: #000;
  position: relative;
  display: flex;
  flex-direction: column;
}

.scene-thread-finale .scene-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: none;
}

.finale-canvas-wrap {
  flex: 1;
  position: relative;
  min-height: 60vh;
}

.finale-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.finale-photo-zoom {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
}

.finale-photo-zoom img {
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--red);
  transform: scale(3);
  opacity: 0;
  transition: transform 1.4s var(--ease-out), opacity 0.5s ease;
}

.finale-photo-zoom.zoomed-out img {
  transform: scale(1);
  opacity: 1;
}

.finale-text {
  padding: 32px var(--content-left) max(32px, env(safe-area-inset-bottom));
  text-align: left;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: 2s;
}

.finale-text.visible {
  opacity: 1;
  transform: none;
}

.finale-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 8vw, 2.8rem);
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 12px;
  line-height: 1.1;
}

.finale-subtitle {
  font-size: 0.9rem;
  color: var(--cream-muted);
  line-height: 1.6;
}

/* ============================================================
   UTILITY: RED ACCENT LINE
   ============================================================ */
.red-rule {
  width: 32px;
  height: 2px;
  background: var(--red);
  display: block;
  margin-bottom: 16px;
}

/* ============================================================
   LOADING SPINNER (auth decryption)
   ============================================================ */
.pw-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(244, 235, 208, 0.2);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.pw-spinner.active { display: block; }

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

/* ============================================================
   SCREEN TRANSITION
   ============================================================ */
.screen--story {
  animation: story-in 0.6s var(--ease-out) both;
}

@keyframes story-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   VIEWER LOGIN SCREEN
   ============================================================ */
.screen--viewer {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4ead0;
  color: #1a1614;
  padding: var(--pad-safe-top) 40px var(--pad-safe-bot);
}

.vw-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 300px;
}

.vw-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
}

.vw-headline {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a1614;
  text-align: center;
  margin: 0;
}

.vw-subline {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: #6b5c4e;
  text-align: center;
  margin: 0;
  line-height: 1.5;
}

.screen--viewer .pw-input {
  color: #1a1614;
  border-bottom-color: rgba(26, 22, 20, 0.3);
}

.screen--viewer .pw-input:focus {
  border-bottom-color: var(--red);
}

.screen--viewer .pw-input::placeholder {
  color: rgba(26, 22, 20, 0.35);
}

.screen--viewer .pw-btn {
  color: #1a1614;
}

.screen--viewer .pw-btn:hover,
.screen--viewer .pw-btn:active {
  color: var(--red);
}

.screen--viewer .pw-error {
  color: var(--red);
}

/* ============================================================
   PASSWORD SCREEN — CELEBRATION
   ============================================================ */
.pw-celebration {
  font-size: 3.5rem;
  line-height: 1;
  animation: pw-sway 4s ease-in-out infinite;
}

.pw-headline {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cream);
  text-align: center;
  line-height: 1.3;
  margin: 0;
}

/* ============================================================
   CAMERA — UPLOAD STATUS & RETAKE
   ============================================================ */
.camera-upload-status {
  font-size: 0.8rem;
  color: var(--cream-muted);
  text-align: center;
  min-height: 1.2em;
  margin: 4px 0 0;
}

.camera-result-btns {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
}

.camera-retake-btn {
  background: none;
  border: 1px solid rgba(244, 235, 208, 0.3);
  color: var(--cream-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 10px 24px;
  border-radius: 24px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.camera-retake-btn:hover,
.camera-retake-btn:active {
  border-color: var(--cream-muted);
  color: var(--cream);
}

/* ============================================================
   SELFIE DISPLAY (viewer mode)
   ============================================================ */
.scene-selfie-display {
  padding: 60px var(--side-pad);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.selfie-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--cream);
  text-align: center;
  margin: 0;
}

.selfie-frame {
  width: 100%;
  max-width: 340px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(244, 235, 208, 0.05);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.selfie-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.selfie-placeholder {
  color: var(--cream-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px;
}

.selfie-caption {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--cream-muted);
  text-align: center;
  font-style: italic;
  margin: 0;
}

/* ============================================================
   THREAD FINALE — SHARE BUTTON
   ============================================================ */
.finale-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding: 14px 28px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s 0.3s var(--ease-out), transform 0.5s 0.3s var(--ease-out),
              background 0.2s;
}

.finale-share-btn.visible {
  opacity: 1;
  transform: none;
}

.finale-share-btn:active { background: var(--red-dark); transform: scale(0.97); }

.finale-share-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ============================================================
   MODULE: CAPTURE MOMENT
   ============================================================ */
.scene-capture {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--pad-safe-top);
  padding-bottom: var(--pad-safe-bot);
  background: var(--bg);
}

.capture-idle {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.capture-tag {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--red);
}

.capture-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--cream);
}

.capture-description {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--cream-muted);
}

.capture-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: var(--red);
  color: #fff;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  transition: background 0.2s, transform 0.1s;
  min-height: 50px;
  align-self: flex-start;
}

.capture-btn:active { background: var(--red-dark); transform: scale(0.97); }

.capture-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Capture live view */
.capture-live {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.capture-live.active { display: flex; }

.capture-viewfinder {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}

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

.capture-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.capture-frame::before,
.capture-frame::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: var(--red);
  border-style: solid;
}

.capture-frame::before {
  top: 16px;
  left: 16px;
  border-width: 2px 0 0 2px;
  border-radius: 4px 0 0 0;
}

.capture-frame::after {
  bottom: 16px;
  right: 16px;
  border-width: 0 2px 2px 0;
  border-radius: 0 0 4px 0;
}

/* Countdown overlay */
.capture-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 700;
  color: var(--cream);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 5;
}

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

/* REC indicator */
.capture-rec {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--red);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.3s;
}

.capture-rec.active {
  opacity: 1;
  animation: rec-blink 1.2s ease-in-out infinite;
}

@keyframes rec-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

/* Shutter button */
.capture-shutter {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--cream);
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
  flex-shrink: 0;
}

.capture-shutter:active { transform: scale(0.92); }

.capture-shutter:disabled { opacity: 0.4; cursor: not-allowed; }

.capture-shutter-inner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--cream);
  pointer-events: none;
}

/* Capture result */
.capture-result {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.capture-result.active { display: flex; }

.capture-photo-preview {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}

.capture-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.capture-upload-status {
  font-size: 0.8rem;
  color: var(--cream-muted);
  text-align: center;
  min-height: 1.2em;
  margin: 4px 0 0;
}

.capture-result-btns {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.capture-continue-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--red);
  color: #fff;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s, transform 0.1s;
  min-height: 50px;
}

.capture-continue-btn:active {
  background: var(--red-dark);
  transform: scale(0.97);
}

.capture-retake-btn {
  background: none;
  border: 1px solid rgba(244, 235, 208, 0.3);
  color: var(--cream-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 10px 24px;
  border-radius: 24px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.capture-retake-btn:hover,
.capture-retake-btn:active {
  border-color: var(--cream-muted);
  color: var(--cream);
}

/* ============================================================
   MODULE: MEDIA GALLERY
   ============================================================ */
.scene-media-gallery {
  background: var(--surface);
  padding-left: 0;
  padding-right: 0;
  padding-top: 60px;
  padding-bottom: 60px;
  overflow: hidden;
}

.scene-media-gallery .scene-inner {
  width: 100%;
}

.gallery-header {
  padding-left: var(--content-left);
  padding-right: var(--pad-x);
  margin-bottom: 20px;
}

.gallery-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 6vw, 2rem);
  font-weight: 700;
  color: var(--cream);
  line-height: 1.2;
}

.gallery-wrap {
  width: 100%;
}

.gallery-slider {
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
}

.gallery-slider::-webkit-scrollbar { display: none; }

.gallery-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg);
  overflow: hidden;
}

.gallery-slide-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-slide-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  z-index: 10;
}

.gallery-slide-delete:hover { background: rgba(230, 57, 70, 0.8); }
.gallery-slide-delete:active { transform: scale(0.9); }

.gallery-add-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 235, 208, 0.04);
  border: 2px dashed rgba(244, 235, 208, 0.2);
}

.gallery-add-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.gallery-add-btn:hover { background: var(--red-dark); }
.gallery-add-btn:active { transform: scale(0.93); }

.gallery-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding-top: 12px;
  padding-bottom: 4px;
}

.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(244, 235, 208, 0.25);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s;
}

.gallery-dot--active {
  background: var(--red);
  transform: scale(1.3);
}

.gallery-empty {
  padding: 40px var(--content-left);
  font-size: 0.9rem;
  color: var(--cream-muted);
  font-style: italic;
  text-align: center;
}

/* ============================================================
   MODULE: GREETING VIDEOS
   ============================================================ */
.scene-greeting-videos {
  background: var(--bg);
  padding-left: 0;
  padding-right: 0;
  padding-top: 60px;
  padding-bottom: 60px;
  overflow: hidden;
}

.scene-greeting-videos .scene-inner {
  width: 100%;
  position: relative;
}

.greeting-header {
  padding-left: var(--content-left);
  padding-right: var(--pad-x);
  margin-bottom: 20px;
}

.greeting-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 6vw, 2rem);
  font-weight: 700;
  color: var(--cream);
  line-height: 1.2;
}

.greeting-container {
  position: relative;
  width: 100%;
}

.greeting-slider {
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  height: 70vw;
  max-height: 520px;
  min-height: 240px;
}

.greeting-slider::-webkit-scrollbar { display: none; }

.greeting-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  position: relative;
  overflow: hidden;
  background: #000;
}

.greeting-video-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Description overlay */
.greeting-desc {
  position: absolute;
  max-width: 80%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.45);
  font-family: var(--font-display);
  font-size: clamp(1rem, 4vw, 1.4rem);
  font-style: italic;
  color: var(--cream);
  line-height: 1.4;
  pointer-events: none;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Description positions */
.desc-pos-0 { bottom: 24px; left: 16px; }
.desc-pos-1 { top: 24px; right: 16px; text-align: right; }
.desc-pos-2 { bottom: 24px; left: 50%; transform: translateX(-50%); text-align: center; }
.desc-pos-3 { top: 24px; left: 16px; }
.desc-pos-4 { bottom: 24px; right: 16px; text-align: right; }

/* Animated units — hidden by default */
.desc-char,
.desc-word {
  display: inline-block;
  opacity: 0;
}

/* ---- Fall animation ---- */
@keyframes char-fall {
  from { opacity: 0; transform: translateY(-28px) rotate(-4deg); }
  to   { opacity: 1; transform: translateY(0) rotate(0deg); }
}

.greeting-desc.active.desc-anim-fall .desc-char {
  animation: char-fall 0.5s var(--ease-out) both;
}

/* ---- Slide animation ---- */
@keyframes word-slide {
  from { opacity: 0; transform: translateX(-32px); }
  to   { opacity: 1; transform: translateX(0); }
}

.greeting-desc.active.desc-anim-slide .desc-word {
  animation: word-slide 0.55s var(--ease-out) both;
}

/* ---- Zoom animation ---- */
@keyframes word-zoom {
  from { opacity: 0; transform: scale(0); }
  to   { opacity: 1; transform: scale(1); }
}

.greeting-desc.active.desc-anim-zoom .desc-word {
  animation: word-zoom 0.5s var(--ease-out) both;
}

/* ---- Rise animation ---- */
@keyframes char-rise {
  from { opacity: 0; transform: translateY(28px) rotate(4deg); }
  to   { opacity: 1; transform: translateY(0) rotate(0deg); }
}

.greeting-desc.active.desc-anim-rise .desc-char {
  animation: char-rise 0.5s var(--ease-out) both;
}

/* ---- Scatter animation ---- */
@keyframes char-scatter {
  from {
    opacity: 0;
    transform: translate(var(--sx, 0px), var(--sy, 0px)) rotate(var(--sr, 0deg)) scale(0.6);
  }
  to {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
}

.greeting-desc.active.desc-anim-scatter .desc-char {
  animation: char-scatter 0.6s var(--ease-out) both;
}

/* Navigation arrows */
.greeting-prev,
.greeting-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: var(--cream);
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 20;
  transition: background 0.2s, transform 0.1s;
  user-select: none;
}

.greeting-prev { left: 8px; }
.greeting-next { right: 8px; }

.greeting-prev:hover,
.greeting-next:hover { background: rgba(230, 57, 70, 0.7); }

.greeting-prev:active,
.greeting-next:active { transform: translateY(-50%) scale(0.9); }

/* Dots */
.greeting-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding-top: 12px;
  padding-bottom: 4px;
}

.greeting-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(244, 235, 208, 0.25);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s;
}

.greeting-dot--active {
  background: var(--red);
  transform: scale(1.3);
}

/* Owner add button */
.greeting-add-btn {
  position: absolute;
  top: 0;
  right: var(--pad-x);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 30;
  transition: background 0.2s, transform 0.1s;
}

.greeting-add-btn:hover { background: var(--red-dark); }
.greeting-add-btn:active { transform: scale(0.93); }

/* Add panel */
.greeting-add-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid rgba(244, 235, 208, 0.12);
  border-radius: 12px;
  padding: 20px;
  margin: 0 var(--pad-x) 16px;
  z-index: 25;
}

.greeting-add-panel input[type="file"] {
  color: var(--cream-muted);
  font-size: 0.85rem;
}

.greeting-add-panel textarea {
  background: rgba(244, 235, 208, 0.06);
  border: 1px solid rgba(244, 235, 208, 0.15);
  border-radius: 8px;
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.greeting-add-panel textarea:focus {
  border-color: var(--red);
}

.greeting-add-submit {
  padding: 10px 20px;
  background: var(--red);
  color: #fff;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-start;
}

.greeting-add-submit:hover { background: var(--red-dark); }
.greeting-add-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.greeting-add-cancel {
  background: none;
  border: 1px solid rgba(244, 235, 208, 0.2);
  color: var(--cream-muted);
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  align-self: flex-start;
}

.greeting-add-cancel:hover { border-color: var(--cream-muted); color: var(--cream); }

.greeting-add-status {
  font-size: 0.8rem;
  color: var(--cream-muted);
  min-height: 1.2em;
}

/* Empty state */
.greeting-empty {
  padding: 40px var(--content-left);
  font-size: 0.9rem;
  color: var(--cream-muted);
  font-style: italic;
  text-align: center;
}
