:root {
  --bg-cinema: #090808;
  --ivory: #fbf8f3;
  --champagne: #e6cba8;
  --champagne-soft: rgba(230, 203, 168, 0.35);
  --glass-bg: rgba(14, 11, 10, 0.44);
  --glass-border: rgba(230, 203, 168, 0.28);
  --font-zh: "Noto Serif TC", "Songti TC", serif;
  --font-en: "Playfair Display", Georgia, serif;
  --transition-sec: 1.8s;
  --slide-sec: 7s;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-cinema);
  color: var(--ivory);
  font-family: var(--font-zh);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at center, #181412 0%, #090808 100%);
}

#app.cursor-hidden {
  cursor: none;
}

/* ========================
   Cinema Stage & Double Buffer
   ======================== */
.cinema-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.slide-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 1;
  transition: opacity var(--transition-sec) cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
  overflow: hidden;
}

.slide-layer.is-active {
  opacity: 1;
  z-index: 2;
}

/* Full-bleed single landscape or cover */
.slide-full {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.slide-full .photo-main {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 24%;
  display: block;
  will-change: transform;
}

.slide-full.is-landscape .photo-main {
  object-position: center center;
}

/* Smart Diptych (2 portrait photos filling 16:9 like a luxury wedding movie) */
.slide-diptych {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #090808;
}

.diptych-panel {
  position: relative;
  flex: 1 1 50%;
  height: 100%;
  overflow: hidden;
}

.diptych-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
  will-change: transform;
}

.diptych-divider {
  position: relative;
  width: 3px;
  flex: 0 0 3px;
  background: linear-gradient(
    to bottom,
    rgba(230, 203, 168, 0.08) 0%,
    rgba(230, 203, 168, 0.45) 50%,
    rgba(230, 203, 168, 0.08) 100%
  );
  z-index: 3;
}

/* Single portrait with dreamy ambient blurred backdrop */
.slide-ambient {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ambient-backdrop {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  filter: blur(38px) brightness(0.46) saturate(1.15);
  transform: scale(1.06);
  z-index: 1;
}

.ambient-foreground-wrap {
  position: relative;
  z-index: 2;
  height: 100%;
  max-width: 92vw;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(230, 203, 168, 0.22);
}

.ambient-foreground {
  height: 100%;
  width: auto;
  max-width: 92vw;
  object-fit: contain;
  display: block;
  will-change: transform;
}

/* ========================
   Ken Burns Cinematic Motions
   ======================== */
.kb-zoom-in {
  animation: kbZoomIn calc(var(--slide-sec) + var(--transition-sec) + 1.5s) ease-out forwards;
}
.kb-zoom-out {
  animation: kbZoomOut calc(var(--slide-sec) + var(--transition-sec) + 1.5s) ease-out forwards;
}
.kb-pan-left {
  animation: kbPanLeft calc(var(--slide-sec) + var(--transition-sec) + 1.5s) ease-out forwards;
}
.kb-pan-right {
  animation: kbPanRight calc(var(--slide-sec) + var(--transition-sec) + 1.5s) ease-out forwards;
}
.kb-pan-up {
  animation: kbPanUp calc(var(--slide-sec) + var(--transition-sec) + 1.5s) ease-out forwards;
}
.kb-gentle-in {
  animation: kbGentleIn calc(var(--slide-sec) + var(--transition-sec) + 1.5s) ease-out forwards;
}
.kb-gentle-out {
  animation: kbGentleOut calc(var(--slide-sec) + var(--transition-sec) + 1.5s) ease-out forwards;
}

.is-paused .kb-zoom-in,
.is-paused .kb-zoom-out,
.is-paused .kb-pan-left,
.is-paused .kb-pan-right,
.is-paused .kb-pan-up,
.is-paused .kb-gentle-in,
.is-paused .kb-gentle-out {
  animation-play-state: paused;
}

@keyframes kbZoomIn {
  0% { transform: scale(1.0) translate3d(0, 0, 0); }
  100% { transform: scale(1.09) translate3d(-1.2%, -0.8%, 0); }
}
@keyframes kbZoomOut {
  0% { transform: scale(1.1) translate3d(1%, 0.6%, 0); }
  100% { transform: scale(1.01) translate3d(0, 0, 0); }
}
@keyframes kbPanLeft {
  0% { transform: scale(1.07) translate3d(1.8%, 0, 0); }
  100% { transform: scale(1.07) translate3d(-1.8%, -0.6%, 0); }
}
@keyframes kbPanRight {
  0% { transform: scale(1.07) translate3d(-1.8%, 0.4%, 0); }
  100% { transform: scale(1.07) translate3d(1.8%, -0.4%, 0); }
}
@keyframes kbPanUp {
  0% { transform: scale(1.08) translate3d(0, 1.8%, 0); }
  100% { transform: scale(1.04) translate3d(0, -1.2%, 0); }
}
@keyframes kbGentleIn {
  0% { transform: scale(1.0) translate3d(0, 0, 0); }
  100% { transform: scale(1.06) translate3d(0, -0.6%, 0); }
}
@keyframes kbGentleOut {
  0% { transform: scale(1.065) translate3d(0, 0.5%, 0); }
  100% { transform: scale(1.005) translate3d(0, -0.4%, 0); }
}

/* ========================
   Atmospheric Scrims & Bokeh
   ======================== */
.bokeh-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
  opacity: 0.72;
}

.cinema-vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse at top right, rgba(8, 6, 5, 0.58) 0%, rgba(8, 6, 5, 0.18) 28%, transparent 56%),
    linear-gradient(to top, rgba(8, 6, 5, 0.62) 0%, rgba(8, 6, 5, 0.16) 19%, transparent 38%),
    radial-gradient(circle at center, transparent 62%, rgba(0, 0, 0, 0.34) 100%);
}

/* ========================
   Top-Left Chapter Badge
   ======================== */
.top-left-badge {
  position: fixed;
  top: 28px;
  left: 32px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(14, 11, 10, 0.34);
  border: 1px solid rgba(230, 203, 168, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(251, 248, 243, 0.9);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.top-left-badge.is-visible {
  opacity: 1;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--champagne);
  box-shadow: 0 0 8px var(--champagne);
}

.badge-counter {
  font-family: var(--font-en);
  font-size: 12px;
  color: var(--champagne);
  letter-spacing: 0.12em;
  opacity: 0.9;
}

/* ========================
   Top-Right Couple Title + Music Toggle
   ======================== */
.top-right-panel {
  position: fixed;
  top: 20px;
  right: 28px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 8px;
  max-width: 38vw;
}

.top-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.top-right-actions.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--ivory);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 13px;
  letter-spacing: 0.06em;
  transition: all 0.28s ease;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}

.icon-btn:hover {
  background: rgba(230, 203, 168, 0.22);
  border-color: rgba(230, 203, 168, 0.65);
  transform: translateY(-1px);
}

.icon-btn.icon-only {
  width: 40px;
  padding: 0;
  justify-content: center;
}

.icon-btn.is-playing {
  border-color: rgba(230, 203, 168, 0.52);
  background: rgba(24, 19, 15, 0.56);
}

.icon-btn.needs-click {
  border-color: var(--champagne);
  box-shadow: 0 0 0 0 rgba(230, 203, 168, 0.65);
  animation: pulseGold 2.2s infinite;
}

@keyframes pulseGold {
  0% { box-shadow: 0 0 0 0 rgba(230, 203, 168, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(230, 203, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(230, 203, 168, 0); }
}

.sound-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 14px;
  width: 14px;
  justify-content: center;
}

.sound-bars span {
  display: block;
  width: 2.5px;
  background: var(--champagne);
  border-radius: 2px;
  height: 5px;
}

.is-playing .sound-bars span:nth-child(1) { animation: eqBar 0.9s ease-in-out infinite; }
.is-playing .sound-bars span:nth-child(2) { animation: eqBar 0.65s ease-in-out 0.15s infinite; }
.is-playing .sound-bars span:nth-child(3) { animation: eqBar 0.8s ease-in-out 0.3s infinite; }

@keyframes eqBar {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

.couple-title-card {
  padding: 6px 8px 4px;
  border-radius: 12px;
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.couple-subtitle {
  font-family: var(--font-en);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--champagne);
  margin-bottom: 3px;
  opacity: 0.95;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
}

.couple-zh {
  font-family: var(--font-zh);
  font-size: clamp(22px, 2.2vw, 36px);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: 0.14em;
  color: var(--ivory);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.72), 0 1px 3px rgba(0, 0, 0, 0.65);
  white-space: nowrap;
}

.couple-zh .amp {
  font-family: var(--font-en);
  font-style: italic;
  color: var(--champagne);
  margin: 0 0.18em;
  font-weight: 400;
}

.couple-en {
  font-family: var(--font-en);
  font-size: clamp(14px, 1.3vw, 22px);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(251, 248, 243, 0.94);
  margin-top: 2px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.72);
}

.couple-en.is-script {
  font-size: clamp(21px, 2vw, 32px);
  letter-spacing: 0.03em;
  line-height: 1.12;
}

.couple-date-row {
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-en);
  font-size: 13px;
  letter-spacing: 0.24em;
  color: var(--champagne);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
}

.date-line {
  width: 28px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--champagne));
}

/* ========================
   Bottom-Left QR Code Card
   ======================== */
.bottom-left-qr {
  position: fixed;
  left: 32px;
  bottom: 28px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 12px;
  border-radius: 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
}

.qr-frame {
  width: 96px;
  height: 96px;
  padding: 6px;
  background: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.qr-frame img,
.qr-frame canvas {
  width: 84px !important;
  height: 84px !important;
  display: block;
}

.qr-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 155px;
}

.qr-kicker {
  font-family: var(--font-en);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--champagne);
}

.qr-caption {
  font-family: var(--font-zh);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ivory);
  line-height: 1.35;
}

.qr-hint {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 11px;
  color: rgba(251, 248, 243, 0.72);
  line-height: 1.4;
}

/* ========================
   Bottom-Right Guest Messages Carousel
   ======================== */
.bottom-right-messages {
  position: fixed;
  right: 36px;
  bottom: 28px;
  z-index: 15;
  width: min(440px, 38vw);
  min-height: 112px;
  pointer-events: none;
}

.message-card {
  position: relative;
  padding: 18px 24px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(16, 12, 10, 0.58), rgba(24, 18, 14, 0.48));
  border: 1px solid rgba(230, 203, 168, 0.32);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.42);
}

.message-quote-mark {
  position: absolute;
  top: 8px;
  left: 16px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 44px;
  line-height: 1;
  color: rgba(230, 203, 168, 0.28);
  pointer-events: none;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-left: 20px;
}

.message-label {
  font-family: var(--font-en);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--champagne);
}

.message-index {
  font-family: var(--font-en);
  font-size: 11px;
  color: rgba(251, 248, 243, 0.58);
  letter-spacing: 0.1em;
}

.message-body {
  font-family: var(--font-zh);
  font-size: clamp(15px, 1.2vw, 19px);
  line-height: 1.62;
  color: var(--ivory);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
  word-break: break-word;
  white-space: pre-wrap;
  max-height: 130px;
  overflow: hidden;
}

.message-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 14px;
  color: var(--champagne);
  letter-spacing: 0.08em;
}

.message-author-line {
  width: 22px;
  height: 1px;
  background: rgba(230, 203, 168, 0.5);
}

/* Message Vue Transition */
.msg-fade-enter-active,
.msg-fade-leave-active {
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.msg-fade-enter-from {
  opacity: 0;
  transform: translateY(16px);
}
.msg-fade-leave-to {
  opacity: 0;
  transform: translateY(-12px);
}

/* ========================
   Auto-Hiding Cinema Control Bar
   ======================== */
.floating-controls {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(12, 10, 9, 0.68);
  border: 1px solid rgba(230, 203, 168, 0.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.floating-controls.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(251, 248, 243, 0.88);
  font-size: 12px;
  font-family: "Noto Sans TC", sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.ctrl-btn:hover {
  background: rgba(230, 203, 168, 0.2);
  color: var(--champagne);
}

.ctrl-divider {
  width: 1px;
  height: 18px;
  background: rgba(230, 203, 168, 0.22);
  margin: 0 2px;
}

.track-pill {
  font-size: 12px;
  color: rgba(230, 203, 168, 0.9);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px;
}

/* Progress bar hairline at very bottom */
.cinema-progress {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  z-index: 25;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.cinema-progress-fill {
  height: 100%;
  background: linear-gradient(to right, rgba(230, 203, 168, 0.45), var(--champagne));
  transition: width 0.5s ease;
}

/* Empty / Loading State */
.stage-status {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--champagne);
  letter-spacing: 0.16em;
  text-align: center;
  padding: 24px;
}

@media (max-width: 900px) {
  .top-right-panel {
    top: 16px;
    right: 16px;
    max-width: 84vw;
  }
  .bottom-left-qr {
    left: 16px;
    bottom: 16px;
    padding: 8px 12px 8px 8px;
  }
  .qr-frame {
    width: 72px;
    height: 72px;
  }
  .qr-frame img,
  .qr-frame canvas {
    width: 60px !important;
    height: 60px !important;
  }
  .bottom-right-messages {
    right: 16px;
    bottom: 16px;
    width: min(320px, 50vw);
  }
}
