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

:root {
  --bg:           #07070d;
  --text:         #f0e8d8;
  --text-muted:   #8a7a6a;
  --accent:       #c4a882;
  --accent-glow:  rgba(196,168,130,.12);
  --accent-border:rgba(196,168,130,.22);
}

html { height: 100%; height: -webkit-fill-available; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

#stars { position: fixed; inset: 0; z-index: 0; }

/* ── PASSWORD ─────────────────────────────── */

#password-screen {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  transition: opacity 1s ease;
}

.pw-content {
  display: flex; flex-direction: column; align-items: center;
  gap: 1.6rem; padding: 2rem 1.5rem;
  max-width: 320px; width: 100%; text-align: center;
}

.pw-label {
  font-family: 'Inter', sans-serif; font-weight: 300;
  font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-muted); line-height: 1.7;
}

.pw-form { display: flex; flex-direction: column; align-items: center; gap: 1.4rem; width: 100%; }

.pw-field { width: 100%; border-bottom: 1px solid var(--accent-border); padding-bottom: .5rem; }

.pw-field input {
  width: 100%; background: transparent; border: none; outline: none;
  text-align: center; font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem; letter-spacing: .35em; color: var(--text);
  caret-color: var(--accent); -webkit-appearance: none;
}

.pw-field input::placeholder { color: var(--text-muted); opacity: .5; }

#pw-submit {
  width: 50px; height: 50px; border-radius: 50%;
  border: 1px solid var(--accent-border); background: var(--accent-glow);
  color: var(--accent); font-size: 1.2rem; cursor: pointer;
  transition: all .3s ease;
  display: flex; align-items: center; justify-content: center;
}
#pw-submit:hover, #pw-submit:active { background: var(--accent); color: var(--bg); border-color: var(--accent); transform: scale(1.05); }

#pw-error { font-family: 'Inter', sans-serif; font-size: .72rem; letter-spacing: .1em; color: #c47070; min-height: 1em; }

.pw-field.shake { animation: shake .38s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-7px); }
  40%     { transform: translateX(7px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}

/* ── APP ────────────────────────────────── */

#app { position: fixed; inset: 0; z-index: 1; opacity: 0; transition: opacity .8s ease; }
#app.visible { opacity: 1; }

#progress-bar {
  position: fixed; top: 0; left: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  z-index: 100; transition: width .5s ease; width: 0%;
}

#audio-toggle {
  position: fixed;
  bottom: max(1.25rem, env(safe-area-inset-bottom, 1.25rem));
  right: 1.25rem; z-index: 50;
  font-size: 1rem; line-height: 1; color: var(--text-muted);
  background: transparent; border: none; cursor: pointer;
  opacity: .45; transition: opacity .3s; padding: .5rem;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
#audio-toggle:hover { opacity: .85; }
#audio-toggle.muted { opacity: .18; }

/* ── SCENES ─────────────────────────────── */

.scene {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .9s ease;
  padding:
    max(1.5rem, env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
}
.scene.active { opacity: 1; pointer-events: all; }

.scene-content {
  width: 100%; max-width: 680px;
  display: flex; flex-direction: column; align-items: center;
  gap: 1.3rem; text-align: center;
}
.scene-content.narrow { max-width: 510px; }

/* ── TYPOGRAPHY ──────────────────────────── */

.label {
  font-family: 'Inter', sans-serif; font-weight: 300;
  font-size: .7rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--text-muted);
}

.name-title {
  font-family: 'Cormorant Garamond', serif; font-weight: 300;
  font-size: clamp(3.2rem, 16vw, 7rem); letter-spacing: .04em; line-height: 1.05;
}

.subtitle {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(1rem, 4.5vw, 1.3rem); color: var(--text-muted); line-height: 1.65;
}

.letter-text {
  font-family: 'Cormorant Garamond', serif; font-weight: 300;
  font-size: clamp(1.1rem, 4.8vw, 1.42rem); line-height: 1.85; color: var(--text);
}
.letter-text.italic, .letter-text em { font-style: italic; color: var(--accent); }
.letter-text.big { font-size: clamp(1.35rem, 6vw, 1.9rem); font-weight: 400; line-height: 1.35; }

.question-prompt {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(1rem, 4.2vw, 1.25rem); color: var(--text-muted); margin-top: .15rem;
}
.question-prompt.big { font-size: clamp(1.2rem, 5.2vw, 1.6rem); color: var(--text); }

/* ── BUTTONS ─────────────────────────────── */

.next-btn {
  font-family: 'Inter', sans-serif; font-weight: 300;
  font-size: .8rem; letter-spacing: .1em; color: var(--accent);
  background: var(--accent-glow); border: 1px solid var(--accent);
  padding: 0 2rem; height: 48px; min-width: 130px; border-radius: 2px;
  cursor: pointer; transition: all .3s ease; margin-top: .15rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.next-btn.ghost { background: transparent; border-color: var(--accent-border); }
.next-btn:hover, .next-btn:active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* ── CHOICES ─────────────────────────────── */

.choices { display: flex; gap: .7rem; flex-wrap: wrap; justify-content: center; margin-top: .2rem; width: 100%; }
.choices.vertical { flex-direction: column; align-items: center; max-width: 200px; }

.choice-btn {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1rem, 4.2vw, 1.1rem); color: var(--text-muted);
  background: transparent; border: 1px solid var(--accent-border);
  padding: 0 1.4rem; height: 48px; min-width: 120px; border-radius: 2px;
  cursor: pointer; transition: all .3s ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.choices:not(.vertical) .choice-btn { flex: 1 1 auto; max-width: 240px; }
.choices.vertical .choice-btn { width: 100%; }
.choice-btn:hover, .choice-btn:active { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }
.choice-btn.selected { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.choice-btn:disabled { cursor: default; opacity: .45; }

/* ── DISCOVERY GRID ──────────────────────── */

.discovery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem; width: 100%; max-width: 380px;
}

.disc-btn {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(.95rem, 3.8vw, 1.08rem); color: var(--text-muted);
  background: transparent; border: 1px solid var(--accent-border);
  padding: .75rem .5rem; border-radius: 4px; cursor: pointer;
  transition: all .35s ease; min-height: 52px;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.disc-btn:hover, .disc-btn:active { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }
.disc-btn.revealed { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); opacity: .6; cursor: default; }

.disc-msg-area {
  min-height: 4.5rem; width: 100%; max-width: 380px;
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(1rem, 4.2vw, 1.2rem); color: var(--accent);
  line-height: 1.7; opacity: 0; transition: opacity .5s ease;
  text-align: center; padding: 0 .25rem;
}
.disc-msg-area.show { opacity: 1; }

.disc-counter {
  font-family: 'Inter', sans-serif; font-size: .68rem;
  letter-spacing: .15em; text-transform: uppercase;
  color: var(--text-muted); opacity: .55;
}

.disc-continue { opacity: 0; pointer-events: none; transition: opacity .5s ease .2s; }
.disc-continue.visible { opacity: 1; pointer-events: auto; }

/* ── REVEAL LIST (regrets / confessions) ─── */

.reveal-list {
  display: flex; flex-direction: column; gap: 1.1rem;
  width: 100%; text-align: left;
}

.reveal-item {
  display: flex; gap: .75rem; align-items: flex-start;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.05rem, 4.5vw, 1.3rem); line-height: 1.75; color: var(--text);
  opacity: 0; transform: translateY(10px);
  transition: opacity .65s ease, transform .65s ease;
}
.reveal-item.show { opacity: 1; transform: translateY(0); }

.reveal-bullet { color: var(--accent); flex-shrink: 0; margin-top: .1em; }

/* ── FINAL ─────────────────────────────── */

.final-signature {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: 1rem; color: var(--text-muted); margin-top: .2rem;
}

.end-heart { font-size: 3.5rem; color: var(--accent); animation: pulse 2.8s ease infinite; }

/* ── ANIMATIONS ──────────────────────────── */

.fade-in { opacity: 0; animation: fadeIn 1s ease .4s forwards; }
.delay-1 { animation-delay: 1s; }
.delay-2 { animation-delay: 1.8s; }
.delay-3 { animation-delay: 2.5s; }

@keyframes fadeIn { to { opacity: 1; } }
@keyframes pulse  { 0%,100%{transform:scale(1);opacity:.9} 50%{transform:scale(1.08);opacity:.55} }

/* ── MOBILE ──────────────────────────────── */

@media (min-width: 480px) {
  .discovery-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 390px) {
  .scene-content { gap: 1rem; }
  .choices:not(.vertical) { flex-direction: column; align-items: center; }
  .choices:not(.vertical) .choice-btn { max-width: 100%; width: 100%; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .scene-content { gap: .65rem; }
  .name-title    { font-size: clamp(2rem, 10vw, 3.5rem); }
  .scene         { align-items: flex-start; padding-top: .75rem; overflow-y: auto; }
}
