:root {
  --bg-1: #221512;
  --bg-2: #0e0908;
  --bg-3: #3b2a1e;
  --gold: #d8b088;
  --paper: rgba(255, 255, 255, 0.08);
  --shadow: rgba(0, 0, 0, 0.46);
  --text: #f3e9df;
  --muted: rgba(243, 233, 223, 0.74);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(142, 101, 68, 0.24), transparent 30%),
    linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 42%, var(--bg-3) 100%);
  color: var(--text);
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "Times New Roman", serif;
}

body {
  user-select: none;
}

#screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(40,24,16,0.9), rgba(12,9,8,0.96));
}

#ambient {
  position: absolute;
  inset: -8%;
  background-size: cover;
  background-position: center;
  filter: blur(70px) saturate(1.2) brightness(0.7);
  opacity: 0.24;
  transform: scale(1.08);
  transition: background-image 0.9s ease, opacity 0.9s ease;
  pointer-events: none;
}

#grain {
  position: absolute;
  inset: -15%;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.13) 0 0.7px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.08) 0 1px, transparent 1.3px),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,0.1) 0 0.8px, transparent 1.2px);
  background-size: 18px 18px;
  mix-blend-mode: screen;
  animation: grainShift 11s steps(10) infinite alternate;
}

@keyframes grainShift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-1%, 1%) scale(1.04); }
  100% { transform: translate(1%, -1%) scale(1.03); }
}

#stage {
  position: absolute;
  inset: 0;
  padding: clamp(18px, 3vh, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-layout {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  gap: clamp(14px, 1.3vw, 26px);
  align-items: stretch;
}

.slide-layout.single {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.slide-layout.pair {
  grid-template-columns: 1.12fr 0.88fr;
  grid-template-rows: 1fr;
}

.slide-layout.triple {
  grid-template-columns: 0.9fr 1.1fr 0.8fr;
  grid-template-rows: 1fr;
}

.photo-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.photo-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  filter: saturate(1.08) contrast(1.08) brightness(0.92);
  transform: scale(1.01);
  background: rgba(13, 10, 9, 0.42);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.slide-layout.single .photo-card {
  transform: none;
}

.slide-layout.pair .card-0 {
  transform: rotate(-1.4deg) translateY(1.6vh);
}

.slide-layout.pair .card-1 {
  transform: rotate(1.1deg) translateY(-1.8vh);
}

.slide-layout.triple .card-0 {
  transform: rotate(-1.7deg) translateY(1.4vh);
}

.slide-layout.triple .card-1 {
  transform: translateY(-0.9vh);
}

.slide-layout.triple .card-2 {
  transform: rotate(1.5deg) translateY(1.2vh);
}

.slide-layout.single .card-0,
.slide-layout.pair .card-0,
.slide-layout.pair .card-1,
.slide-layout.triple .card-0,
.slide-layout.triple .card-1,
.slide-layout.triple .card-2 {
  min-width: 0;
}

.photo-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(0,0,0,0.08));
  mix-blend-mode: screen;
  pointer-events: none;
}

.start-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 9, 8, 0.28);
  backdrop-filter: blur(2px);
  z-index: 50;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

body.started .start-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-panel {
  text-align: center;
  padding: clamp(24px, 3vw, 44px) clamp(28px, 4vw, 54px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px;
  background: rgba(17, 11, 10, 0.3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
}

.eyebrow {
  margin: 0 0 16px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}

.start-panel h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 56px);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text);
}

#startButton {
  margin-top: 26px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(216, 176, 136, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.12em;
  padding: 14px 30px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

#startButton:hover {
  background: rgba(216, 176, 136, 0.16);
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .slide-layout.pair {
    grid-template-columns: 1fr 1fr;
  }

  .slide-layout.triple {
    grid-template-columns: 1fr 1fr;
  }

  .slide-layout.triple .card-1 {
    grid-column: 1 / -1;
  }
}
