:root {
  --parchment: #f4e4bc;
  --forest-deep: #0f2818;
  --fae-gold: #d4af37;
  --fae-gold-light: #f0d060;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  background-color: var(--forest-deep);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--forest-deep);
  overflow-x: hidden;
  overflow-y: auto;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

/* Mobile / portrait: fit poster in viewport, avoid scroll */
@media not ((min-width: 1024px) and (orientation: landscape)) {
  html,
  body {
    height: 100dvh;
    overflow: hidden;
  }

  .main-content {
    height: 100%;
    min-height: 0;
    padding: 0.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .poster-image {
    max-height: calc(
      100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 1rem
    );
    max-width: 100%;
    width: auto;
    margin: 0 auto;
  }

  .mute-btn {
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
    right: calc(0.75rem + env(safe-area-inset-right));
  }
}

.forest-bg {
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(8, 18, 10, 0.75) 100%),
    linear-gradient(180deg, rgba(10, 22, 14, 0.35) 0%, rgba(5, 12, 8, 0.55) 100%),
    url("../assets/images/forest-bg.png") center / cover no-repeat fixed;
}

.vignette::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
  z-index: 0;
}

.font-cinzel {
  font-family: "Cinzel", serif;
}

.font-cinzel-decorative {
  font-family: "Cinzel Decorative", serif;
}

.bg-forest-deep {
  background-color: var(--forest-deep);
}

/* Welcome popup */
#welcome-popup {
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#welcome-popup.popup-exit {
  opacity: 0;
  visibility: hidden;
}

.popup-card {
  background: linear-gradient(145deg, rgba(26, 71, 42, 0.95), rgba(15, 40, 24, 0.98));
  border: 2px solid var(--fae-gold);
  box-shadow:
    0 0 40px rgba(212, 175, 55, 0.25),
    inset 0 0 30px rgba(0, 0, 0, 0.35);
}

.popup-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  pointer-events: none;
}

.popup-title {
  font-family: "Cinzel Decorative", serif;
  font-size: clamp(1.25rem, 4vw, 1.65rem);
  line-height: 1.35;
  color: var(--parchment);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  margin: 0 0 1.25rem;
}

.popup-subtitle {
  font-family: "Cinzel", serif;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  line-height: 1.6;
  color: rgba(244, 228, 188, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  margin: 0 0 2rem;
  letter-spacing: 0.04em;
}

.btn-continue {
  font-family: "Cinzel", serif;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #f0d060 0%, #c9a227 45%, #a8841a 100%);
  color: var(--forest-deep);
  border: 2px solid #f8e8a0;
  box-shadow:
    0 4px 16px rgba(212, 175, 55, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  cursor: pointer;
}

.btn-continue:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow:
    0 8px 24px rgba(212, 175, 55, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-continue:active {
  transform: translateY(0);
}

/* Main content */
.main-content {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  transition: opacity 0.8s ease;
}

.main-content.content-enter {
  opacity: 1 !important;
}

.poster-image {
  display: block;
  width: 100%;
  max-width: 42rem;
  height: auto;
  object-fit: contain;
  object-position: top center;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Desktop landscape: full-width poster, top-aligned, scroll if taller than viewport */
@media (min-width: 1024px) and (orientation: landscape) {
  html,
  body {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .main-content {
    min-height: 100dvh;
    padding: 0;
  }

  .poster-image {
    width: 100vw;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
  }
}

/* Mute button */
.mute-btn {
  z-index: 2;
  background: rgba(15, 40, 24, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: var(--fae-gold-light);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.mute-btn:hover {
  background: rgba(26, 71, 42, 0.9);
  border-color: var(--fae-gold);
}
