:root {
  --green-deep: #0b2e1d;
  --green-mid: #114a2c;
  --red: #b3122c;
  --red-bright: #d81e3d;
  --gold: #d4af37;
  --gold-soft: #f1d98b;
  --cream: #faf6ec;
  --ink: #0d1a12;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--green-deep);
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--cream);
  -webkit-tap-highlight-color: transparent;
}

.scene {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 20% 0%, rgba(212, 175, 55, 0.18), transparent 55%),
    radial-gradient(circle at 80% 100%, rgba(179, 18, 44, 0.2), transparent 55%),
    linear-gradient(180deg, var(--green-deep), #081f14 60%, #061a10);
  overflow: hidden;
}

.masthead {
  text-align: center;
  margin-bottom: 18px;
  z-index: 2;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.masthead h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  color: var(--cream);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.masthead .sub {
  margin: 8px 0 0;
  font-size: 0.95rem;
  color: rgba(250, 246, 236, 0.75);
  max-width: 32ch;
  margin-inline: auto;
}

.stage {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 480px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.screen.is-active {
  display: flex;
}

/* Fullscreen camera: covers the entire viewport, nothing but the shutter button */
body.camera-fullscreen .masthead,
body.camera-fullscreen .footer,
body.camera-fullscreen .snow {
  display: none;
}

body.camera-fullscreen .scene,
body.camera-fullscreen .stage {
  padding: 0;
  max-width: none;
}

.screen-camera-full.is-active {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100vw;
  height: 100dvh;
  display: block;
}

.screen-camera-full .camera-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.hero-frame {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(212, 175, 55, 0.5);
  background: #06150d;
}

.hero-frame-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.camera-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(212, 175, 55, 0.45);
}

.camera-wrap video,
.camera-wrap canvas,
.camera-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-wrap video {
  visibility: hidden;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: 100%;
}

.btn {
  font: inherit;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--red-bright), var(--red));
  color: var(--cream);
  box-shadow: 0 10px 24px rgba(179, 18, 44, 0.45);
  width: 100%;
  max-width: 320px;
}

.btn-icon {
  font-size: 1.1rem;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cream);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 12px 18px;
}

.btn-capture {
  position: absolute;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--cream);
  border: 5px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.3), 0 4px 18px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
  z-index: 101;
  cursor: pointer;
}

.btn-capture:active {
  transform: translateX(-50%) scale(0.92);
}

.hint {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(250, 246, 236, 0.6);
}

.error-box {
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 28px 22px;
  max-width: 340px;
}

.error-box p {
  margin: 0 0 18px;
  line-height: 1.5;
}

.footer {
  z-index: 2;
  margin-top: 18px;
  font-size: 0.85rem;
  color: rgba(250, 246, 236, 0.55);
}

/* lightweight CSS snow */
.snow {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.snow::before,
.snow::after {
  content: "";
  position: absolute;
  inset: -10% -10%;
  background-image:
    radial-gradient(2px 2px at 10% 10%, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 30% 40%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 55% 20%, rgba(255,255,255,0.7), transparent),
    radial-gradient(2px 2px at 70% 60%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 85% 15%, rgba(255,255,255,0.7), transparent),
    radial-gradient(2px 2px at 95% 80%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 15% 75%, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 45% 90%, rgba(255,255,255,0.5), transparent);
  background-repeat: repeat;
  background-size: 220px 220px;
  animation: snowfall 14s linear infinite;
}

.snow::after {
  background-size: 300px 300px;
  opacity: 0.6;
  animation-duration: 22s;
  animation-direction: reverse;
}

@keyframes snowfall {
  from { transform: translateY(-10%); }
  to { transform: translateY(10%); }
}

@media (prefers-reduced-motion: reduce) {
  .snow::before,
  .snow::after {
    animation: none;
  }
}
