:root {
  --ink: #1a2420;
  --ink-soft: rgba(26, 36, 32, 0.72);
  --paper: #f7f1e6;
  --amber: #c4783a;
  --amber-deep: #9a5a28;
  --teal: #2f5c56;
  --teal-deep: #1e3d39;
  --glow: rgba(232, 196, 140, 0.55);
  --font-display: "Literata", "Times New Roman", serif;
  --font-body: "Nunito", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--paper);
  background: var(--teal-deep);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Atmosphere ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 70% at 70% 10%, #e8b86d 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 15% 80%, #3d7a72 0%, transparent 50%),
    linear-gradient(165deg, #1a3532 0%, #2a4f48 38%, #6b4a2e 72%, #c4783a 100%);
  animation: sky-drift 28s ease-in-out infinite alternate;
}

.sky__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  pointer-events: none;
}

.sky__glow--a {
  width: min(55vw, 420px);
  height: min(55vw, 420px);
  top: 8%;
  right: 12%;
  background: var(--glow);
  animation: float-a 18s var(--ease) infinite alternate;
}

.sky__glow--b {
  width: min(45vw, 340px);
  height: min(45vw, 340px);
  bottom: 12%;
  left: 8%;
  background: rgba(95, 168, 158, 0.4);
  animation: float-b 22s var(--ease) infinite alternate;
}

.sky__haze {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 120%, rgba(26, 36, 32, 0.55), transparent 55%),
    linear-gradient(to top, rgba(26, 53, 50, 0.35), transparent 40%);
  pointer-events: none;
}

.sky__particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@keyframes sky-drift {
  from {
    filter: saturate(1) brightness(1);
  }
  to {
    filter: saturate(1.08) brightness(1.05);
  }
}

@keyframes float-a {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(-4%, 6%);
  }
}

@keyframes float-b {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(5%, -4%);
  }
}

/* ---------- Sound ---------- */

.sound {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 20;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  background: transparent;
  border: 1px solid rgba(247, 241, 230, 0.35);
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

.sound:hover,
.sound[aria-pressed="true"] {
  background: rgba(247, 241, 230, 0.12);
  border-color: rgba(247, 241, 230, 0.6);
}

/* ---------- Stage / panels ---------- */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(36rem, calc(100% - 2 * clamp(1.5rem, 4vw, 3rem)));
  text-align: left;
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.55s ease;
}

.panel[hidden] {
  display: block;
  visibility: hidden;
  pointer-events: none;
}

.panel.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

.panel.is-leaving {
  opacity: 0;
  visibility: visible;
  z-index: 1;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 241, 230, 0.7);
}

.display {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(3rem, 10.5vw, 5.1rem);
  font-weight: 560;
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--paper);
}

.display--sm {
  font-size: clamp(2.3rem, 7.5vw, 3.6rem);
}

.display em {
  font-style: italic;
  font-weight: 400;
  color: #f0d4a8;
}

.lead {
  margin: 0 0 2rem;
  max-width: 30ch;
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.6;
  color: rgba(247, 241, 230, 0.85);
}

.cta,
.choice {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--teal-deep);
  background: var(--paper);
  border: none;
  padding: 0.95rem 1.75rem;
  cursor: pointer;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease);
}

.cta:hover,
.choice:hover {
  transform: translateY(-2px);
  background: #fff8ee;
}

.cta:active,
.choice:active {
  transform: translateY(0);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.choice {
  min-width: 6.5rem;
  background: transparent;
  color: var(--paper);
  border: 1px solid rgba(247, 241, 230, 0.4);
}

.choice:hover,
.choice.is-picked {
  background: rgba(247, 241, 230, 0.95);
  color: var(--teal-deep);
  border-color: transparent;
}

.lights-hint {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: rgba(247, 241, 230, 0.55);
}

/* Breath */

.breath {
  position: relative;
  width: 7.5rem;
  height: 7.5rem;
  border: 1px solid rgba(247, 241, 230, 0.35);
  border-radius: 50%;
  background: rgba(247, 241, 230, 0.06);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  overflow: hidden;
}

.breath__ring {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(to top, rgba(232, 184, 109, 0.55), rgba(240, 212, 168, 0.2));
  transition: height 0.05s linear;
  pointer-events: none;
}

.breath__label {
  position: relative;
  z-index: 1;
}

.breath.is-done {
  border-color: rgba(240, 212, 168, 0.7);
  background: rgba(247, 241, 230, 0.14);
}

/* Bloom */

.bloom {
  width: 7rem;
  height: 7rem;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.bloom__plant {
  display: block;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 50% 42%, #f0d4a8 0 12%, transparent 13%),
    radial-gradient(circle at 50% 28%, rgba(232, 184, 109, 0.9) 0 10%, transparent 11%),
    radial-gradient(circle at 38% 38%, rgba(247, 241, 230, 0.75) 0 9%, transparent 10%),
    radial-gradient(circle at 62% 38%, rgba(247, 241, 230, 0.75) 0 9%, transparent 10%),
    linear-gradient(to top, #3d7a72 0%, #3d7a72 38%, transparent 38%);
  background-repeat: no-repeat;
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 8px 100%;
  background-position: center, center, center, center, center bottom;
  transform: scale(0.45);
  transform-origin: center bottom;
  transition: transform 0.45s var(--ease), filter 0.45s var(--ease);
  filter: saturate(0.85);
}

.bloom[data-stage="1"] .bloom__plant {
  transform: scale(0.65);
}

.bloom[data-stage="2"] .bloom__plant {
  transform: scale(0.85);
}

.bloom[data-stage="3"] .bloom__plant {
  transform: scale(1);
  filter: saturate(1.1) brightness(1.05);
}

.bloom--flower .bloom__plant {
  background:
    radial-gradient(circle at 50% 40%, #f0d4a8 0 10%, transparent 11%),
    radial-gradient(circle at 50% 22%, #e8a0a8 0 14%, transparent 15%),
    radial-gradient(circle at 28% 38%, #e8a0a8 0 14%, transparent 15%),
    radial-gradient(circle at 72% 38%, #e8a0a8 0 14%, transparent 15%),
    radial-gradient(circle at 35% 58%, #e8a0a8 0 12%, transparent 13%),
    radial-gradient(circle at 65% 58%, #e8a0a8 0 12%, transparent 13%),
    linear-gradient(to top, #3d7a72 0%, #3d7a72 36%, transparent 36%);
  background-repeat: no-repeat;
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 8px 100%;
  background-position: center, center, center, center, center, center, center bottom;
}

.bloom--candle .bloom__plant {
  background:
    radial-gradient(ellipse at 50% 18%, #fff4c8 0 18%, #e8b86d 19% 34%, transparent 35%),
    linear-gradient(to top, #f7f1e6 0%, #f7f1e6 48%, transparent 48%),
    linear-gradient(to top, #c4783a 0%, #c4783a 12%, transparent 12%);
  background-repeat: no-repeat;
  background-size: 40% 40%, 18px 55%, 28px 14%;
  background-position: center 8%, center 55%, center 92%;
}

.bloom--lamp .bloom__plant {
  background:
    radial-gradient(circle at 50% 30%, rgba(240, 212, 168, 0.95) 0 22%, transparent 23%),
    radial-gradient(circle at 50% 38%, rgba(232, 184, 109, 0.55) 0 40%, transparent 41%),
    linear-gradient(to top, #2f5c56 0%, #2f5c56 28%, transparent 28%);
  background-repeat: no-repeat;
  background-size: 100% 100%, 100% 100%, 10px 100%;
  background-position: center, center, center bottom;
}

/* Seal */

.seal {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  border: none;
  background: transparent;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.seal__wax {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #e8b86d, #9a5a28 70%);
  box-shadow: 0 0 0 6px rgba(154, 90, 40, 0.25);
  transition: transform 0.45s var(--ease), opacity 0.45s var(--ease);
}

.seal.is-open .seal__wax {
  transform: scale(1.15);
  opacity: 0.35;
}

.seal-note {
  margin: 1.25rem 0 0;
  max-width: 28ch;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.45;
  color: #f0d4a8;
}

.seal-note[hidden] {
  display: none;
}

.wish {
  margin: 0 0 1.5rem;
  max-width: 34ch;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(1.4rem, 3.6vw, 1.85rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.5;
  color: #f0d4a8;
}

.closing {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(247, 241, 230, 0.72);
}

.refresh-hint {
  margin: 0;
  max-width: 34ch;
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(247, 241, 230, 0.48);
}

/* Collectible lights (quest targets) */

.orb {
  position: fixed;
  z-index: 5;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #fff8e8, #e8b86d 45%, #c4783a 100%);
  box-shadow: 0 0 18px rgba(232, 184, 109, 0.55);
  animation: orb-pulse 2.4s ease-in-out infinite;
  transition: transform 0.25s var(--ease), opacity 0.4s var(--ease);
}

.orb--spark {
  background: radial-gradient(circle at 35% 30%, #fff8e8, #e8b86d 45%, #c4783a 100%);
}

.orb--star {
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 0;
  background: #f0d4a8;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  box-shadow: 0 0 14px rgba(240, 212, 168, 0.55);
}

.orb--drop {
  width: 16px;
  height: 22px;
  margin: -11px 0 0 -8px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: linear-gradient(180deg, #c5e4ef 0%, #5a9bb0 100%);
  box-shadow: 0 0 14px rgba(90, 155, 176, 0.45);
}

.orb--snow {
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  background:
    linear-gradient(#f7f1e6, #f7f1e6) center/2px 100% no-repeat,
    linear-gradient(#f7f1e6, #f7f1e6) center/100% 2px no-repeat,
    radial-gradient(circle, rgba(247, 241, 230, 0.95) 0 35%, transparent 36%);
  box-shadow: 0 0 12px rgba(247, 241, 230, 0.5);
}

.orb--petal {
  width: 20px;
  height: 14px;
  margin: -7px 0 0 -10px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(135deg, #f3c1c8, #d97884);
  box-shadow: 0 0 12px rgba(217, 120, 132, 0.4);
  transform: rotate(-20deg);
}

.orb:hover {
  transform: scale(1.25);
}

.orb--petal:hover {
  transform: rotate(-20deg) scale(1.25);
}

.orb.is-caught {
  opacity: 0;
  transform: scale(2);
  pointer-events: none;
}

.orb--numbered {
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--teal-deep);
  display: grid;
  place-items: center;
}

.orb--numbered.is-wrong {
  animation: orb-shake 0.28s ease;
}

.orb--chase {
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  transition: left 0.35s var(--ease), top 0.35s var(--ease), transform 0.25s var(--ease), opacity 0.4s var(--ease);
}

@keyframes orb-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.25);
  }
}

@keyframes orb-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

/* Timing mini-game */

.timing {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.1rem;
  width: min(100%, 22rem);
}

.timing__track {
  position: relative;
  width: 100%;
  height: 1.35rem;
  border: 1px solid rgba(247, 241, 230, 0.35);
  background: rgba(26, 53, 50, 0.35);
  overflow: hidden;
}

.timing__zone {
  position: absolute;
  left: 38%;
  width: 24%;
  top: 0;
  bottom: 0;
  background: rgba(232, 184, 109, 0.35);
}

.timing__marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  margin-left: -2px;
  background: #f7f1e6;
  left: 0;
}

.timing.is-miss .timing__track {
  animation: orb-shake 0.28s ease;
}

.timing.is-success .timing__zone {
  background: rgba(240, 212, 168, 0.55);
}

/* Pairs mini-game */

.pairs {
  display: grid;
  grid-template-columns: repeat(3, minmax(4.2rem, 5.2rem));
  gap: 0.65rem;
}

.pairs__card {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(247, 241, 230, 0.35);
  background: rgba(247, 241, 230, 0.08);
  color: var(--paper);
  cursor: pointer;
  font-size: 1.35rem;
  padding: 0;
  perspective: 400px;
}

.pairs__back,
.pairs__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.pairs__face {
  opacity: 0;
  transform: scale(0.85);
}

.pairs__card.is-open .pairs__back,
.pairs__card.is-matched .pairs__back {
  opacity: 0;
}

.pairs__card.is-open .pairs__face,
.pairs__card.is-matched .pairs__face {
  opacity: 1;
  transform: scale(1);
}

.pairs__card.is-matched {
  border-color: rgba(240, 212, 168, 0.65);
  background: rgba(240, 212, 168, 0.16);
}

@media (max-width: 520px) {
  .choices {
    flex-direction: column;
  }

  .choice {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sky,
  .sky__glow,
  .orb,
  .panel {
    animation: none !important;
    transition: none !important;
  }
}
