:root {
  --bg1: #2c1738;
  --bg2: #5f3b74;
  --bg3: #8e6aac;
  --lavender: #d9c5ea;
  --soft-lavender: rgba(217, 197, 234, 0.18);
  --frame: #fffafc;
  --text: #ffffff;
  --text-soft: #eee7f6;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, #8a68aa 0%, #5c386f 28%, #2d1839 72%, #1a0f22 100%);
}

body {
  min-height: 100vh;
}

button {
  font: inherit;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

#app {
  width: 100%;
  height: 100%;
}

#start-screen {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.start-card {
  width: min(720px, 92vw);
  background: rgba(31, 16, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.start-card h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
}

.subtitle {
  margin: 0 0 1rem;
  color: var(--text-soft);
  font-size: 1.1rem;
}

#media-summary {
  margin: 1rem 0 1.5rem;
  color: var(--text-soft);
  font-size: 1rem;
}

.start-actions {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

#start-btn,
#fullscreen-btn,
#controls button {
  background: linear-gradient(180deg, #efe4f7 0%, #d7bfee 100%);
  color: #2f1a3d;
  font-weight: 700;
}

#fullscreen-btn.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.tip {
  margin: 1rem auto 0;
  color: #ddd2ea;
  font-size: 0.95rem;
  max-width: 52ch;
  line-height: 1.45;
}

code {
  font-family: Consolas, monospace;
  background: rgba(255, 255, 255, 0.12);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

#slideshow {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#backdrop {
  position: absolute;
  inset: -4%;
  background-size: cover;
  background-position: center;
  filter: blur(30px) brightness(0.42) saturate(1.15);
  transform: scale(1.08);
  transition: background-image 0.8s ease;
}

#slideshow::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(17, 10, 24, 0.2), rgba(17, 10, 24, 0.4)),
    radial-gradient(circle at top, rgba(255,255,255,0.06), transparent 40%);
  pointer-events: none;
}

#hud {
  position: absolute;
  top: 18px;
  left: 22px;
  right: 22px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #f3ecfa;
  font-size: 0.96rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

#slide-counter,
#song-label {
  background: rgba(21, 12, 28, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  backdrop-filter: blur(10px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#song-label {
  max-width: min(52vw, 560px);
  text-align: right;
}

#stage {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 70px 24px 90px;
}

#media-frame {
  width: min(94vw, 1500px);
  height: min(82vh, 900px);
  background: transparent;
  border: 0;
  border-radius: 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

#media-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(118, 78, 145, 0.2);
  border-radius: 14px;
  pointer-events: none;
}

#photo,
#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

#photo.active {
  animation: gentleZoom 8s ease-in-out forwards;
}

@keyframes gentleZoom {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.03);
  }
}

#controls {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

#controls button {
  min-width: 112px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

@media (max-width: 900px) {
  #hud {
    flex-direction: column;
    align-items: flex-start;
  }

  #song-label {
    text-align: left;
    max-width: 100%;
  }

  #media-frame {
    width: 94vw;
    height: 72vh;
  }
}
/* -------------------------------------------------
   PARTY MODE
   Hide all playback UI until the mouse moves
   ------------------------------------------------- */

#song-label {
  display: none !important;
}

#controls,
#slide-counter {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

#slideshow {
  cursor: none;
}

#slideshow.show-ui {
  cursor: default;
}

#slideshow.show-ui #controls,
#slideshow.show-ui #slide-counter {
  opacity: 1;
  pointer-events: auto;
}


/* -------------------------------------------------
   PHOTO ENHANCEMENT
   Gentle improvement for older/scanned photographs
   ------------------------------------------------- */

#photo {
  filter:
    brightness(1.035)
    contrast(1.075)
    saturate(1.055);

  image-rendering: auto;
}


/* slightly richer blurred background */

#backdrop {
  filter:
    blur(30px)
    brightness(0.48)
    saturate(1.15);
}


/* Make the frame disappear into the room a little
   more instead of looking like a web page */

#media-frame {
  border-width: 8px;
  box-shadow:
    0 20px 70px rgba(0, 0, 0, 0.44),
    0 0 35px rgba(213, 185, 235, 0.12);
}
/* ==================================================
   CINEMATIC PHOTO BLENDING
   ================================================== */

#media-frame {
  position: relative;
  overflow: hidden;

  width: min(96vw, 1600px);
  height: min(86vh, 920px);

  background: #23152c;

  /* remove the obvious white picture frame */
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;

  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.45),
    0 0 42px rgba(214, 190, 231, 0.12);
}


/* Enlarged blurred copy of the same photo behind it */

#media-frame::before {
  content: "";
  position: absolute;

  inset: -45px;

  background-image: var(--current-photo);
  background-size: cover;
  background-position: center;

  filter:
    blur(30px)
    brightness(0.54)
    saturate(1.18);

  transform: scale(1.12);

  opacity: 0.96;

  z-index: 0;
}


/* Soft vignette so portrait photos fade naturally into the edges */

#media-frame::after {
  content: "";
  position: absolute;
  inset: 0;

  background-color: var(--photo-wash, rgba(0, 0, 0, 0));
  background-image:
    radial-gradient(
      ellipse at center,
      transparent 48%,
      rgba(31, 17, 39, 0.08) 68%,
      rgba(31, 17, 39, 0.38) 100%
    );

  background-blend-mode: normal;
  box-shadow: inset 0 0 70px rgba(25, 12, 32, 0.18);
  transition: background-color 1.8s ease;

  pointer-events: none;
  z-index: 1;
}


#photo {
  position: relative;
  z-index: 2;

  width: 100%;
  height: 100%;

  object-fit: contain;

  /* no white/cream bars around portrait pictures */
  background: transparent;

  /*
     Enhancement was already done by Python,
     so only a tiny screen adjustment is needed.
  */
  filter:
    brightness(1.01)
    contrast(1.02)
    saturate(1.02);

  image-rendering: auto;
}


/* Videos stay clean and dark */

#video {
  position: relative;
  z-index: 2;
  background: #000;
}

#media-frame.video-mode::after {
  background-color: transparent;
  background-image: none;
  box-shadow: none;
}


/* Slightly more elegant Ken Burns movement */

#photo.active {
  animation: cinematicZoom 8s ease-in-out forwards;
}

@keyframes cinematicZoom {
  from {
    transform: scale(1.002);
  }

  to {
    transform: scale(1.035);
  }
}
/* ==================================================
   LESS MUNDANE PHOTO PRESENTATION
   Random tilt + motion + softer framed look
   ================================================== */

#media-frame {
  position: relative;
  overflow: hidden;
}

/* photo itself */
#photo {
  position: absolute;
  top: 50%;
  left: 50%;

  width: calc(100% - 90px);
  height: calc(100% - 90px);

  object-fit: contain;
  background: transparent;
  padding: 0;
  border-radius: 12px;

  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.34),
    0 3px 10px rgba(0, 0, 0, 0.18);

  transform:
    translate(-50%, -50%)
    rotate(0deg)
    scale(1);

  transform-origin: center center;

  filter:
    brightness(1.01)
    contrast(1.02)
    saturate(1.02);

  z-index: 2;
}

/* keep videos clean */
#video {
  position: relative;
  z-index: 2;
  background: #000;
}

/* layout variations */
#photo.layout-flat {
  --photo-rotate: 0deg;
}

#photo.layout-left {
  --photo-rotate: -2.8deg;
}

#photo.layout-right {
  --photo-rotate: 2.8deg;
}

#photo.layout-soft-left {
  --photo-rotate: -1.5deg;
}

#photo.layout-soft-right {
  --photo-rotate: 1.5deg;
}

/* active state uses chosen rotation */
#photo.active {
  transform:
    translate(-50%, -50%)
    rotate(var(--photo-rotate, 0deg))
    scale(1);
}

/* ----------------------------------
   Entrance / motion styles
   Each one enters in first ~12%
   then slowly settles / zooms
----------------------------------- */

#photo.fx-fade.active {
  animation: photoFade 8s ease-out forwards;
}

#photo.fx-fly-left.active {
  animation: photoFlyLeft 8s ease-out forwards;
}

#photo.fx-fly-right.active {
  animation: photoFlyRight 8s ease-out forwards;
}

#photo.fx-drop.active {
  animation: photoDropIn 8s ease-out forwards;
}

#photo.fx-bounce.active {
  animation: photoBounceIn 8s ease-out forwards;
}

@keyframes photoFade {
  0% {
    opacity: 0;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(0.96);
  }
  12% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(1);
  }
  100% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(1.03);
  }
}

@keyframes photoFlyLeft {
  0% {
    opacity: 0;
    transform:
      translate(calc(-50% - 100px), -50%)
      rotate(calc(var(--photo-rotate, 0deg) - 4deg))
      scale(0.94);
  }
  12% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(1);
  }
  100% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(1.03);
  }
}

@keyframes photoFlyRight {
  0% {
    opacity: 0;
    transform:
      translate(calc(-50% + 100px), -50%)
      rotate(calc(var(--photo-rotate, 0deg) + 4deg))
      scale(0.94);
  }
  12% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(1);
  }
  100% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(1.03);
  }
}

@keyframes photoDropIn {
  0% {
    opacity: 0;
    transform:
      translate(-50%, calc(-50% - 90px))
      rotate(var(--photo-rotate, 0deg))
      scale(0.95);
  }
  12% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(1);
  }
  100% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(1.03);
  }
}

@keyframes photoBounceIn {
  0% {
    opacity: 0;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(0.82);
  }
  8% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(1.05);
  }
  14% {
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(0.99);
  }
  100% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(var(--photo-rotate, 0deg))
      scale(1.03);
  }
}
