:root {
  --bg: #0a0a0a;
  --fg: #f2f0ec;
  --muted: rgba(242, 240, 236, 0.5);
  --faint: rgba(242, 240, 236, 0.28);
  --accent: #c75a3a;
  --accent-soft: rgba(199, 90, 58, 0.22);
  --line: rgba(242, 240, 236, 0.14);
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --track: 0.01em;
  --fade: 1.1s;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 300;
  letter-spacing: var(--track);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  touch-action: manipulation;
}

button { font-family: var(--font); letter-spacing: inherit; }

/* All screens stack in one cell so they can crossfade */
.app {
  position: relative;
  height: 100dvh;
  display: grid;
  overflow: hidden;
}

.screen {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(2rem + var(--safe-t)) 1.75rem calc(2rem + var(--safe-b));
  opacity: 0;
  transition: opacity var(--fade) ease;
  pointer-events: none;
}
.screen > * { width: min(100%, 24rem); }
.screen.in { opacity: 1; pointer-events: auto; }
.screen.out { opacity: 0; pointer-events: none; }
.screen.tappable { cursor: pointer; user-select: none; -webkit-user-select: none; }

/* ── Play ── */
.screen--play > .play-btn { width: 5.25rem; }
.play-btn {
  height: 5.25rem;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #0a0a0a;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
  animation: breathe 3.2s ease-in-out infinite;
}
.play-btn svg { width: 1.9rem; height: 1.9rem; margin-left: 0.25rem; fill: #0a0a0a; }
.play-btn:active, .play-btn.pressed { transform: scale(0.94); }
.play-btn:focus-visible { outline: 1px solid var(--faint); outline-offset: 6px; }

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.10); }
  50% { box-shadow: 0 0 0 14px rgba(255, 255, 255, 0); }
}

/* ── Date ── */
.date-text {
  margin: 0;
  text-align: center;
  font-weight: 300;
  font-size: clamp(2.2rem, 11vw, 3.4rem);
  letter-spacing: 0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

/* ── Story ── */
.story-text {
  margin: 0;
  text-align: center;
  font-weight: 300;
  font-size: clamp(1.3rem, 5.6vw, 1.7rem);
  line-height: 1.55;
  letter-spacing: 0.01em;
}

.tap-hint {
  position: absolute;
  bottom: calc(2.25rem + var(--safe-b));
  left: 0;
  right: 0;
  margin: 0 auto;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--faint);
  opacity: 0;
  animation: hint-in 1.2s ease 2.2s forwards;
}
.screen { position: relative; }
@keyframes hint-in { to { opacity: 1; } }

/* ── Photo ── */
.screen--photo { padding: 0; }
.screen--photo > .photo { width: 100%; }
.photo {
  position: relative;
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
}
.photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  transition: transform 7.5s cubic-bezier(.16,.84,.44,1), filter 0.8s ease;
  will-change: transform;
}
.screen--photo.in .photo img { transform: scale(1); }
.photo:active img, .photo:hover img {
  filter: brightness(1.05);
}
.photo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0) 70%, rgba(0,0,0,0.6) 100%);
}
.photo-caption {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: calc(1.75rem + var(--safe-b));
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.75);
}

/* ── Phrase ── */
.phrase {
  font-size: clamp(1.35rem, 5.4vw, 1.75rem);
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-align: center;
  margin: 0 0 2.5rem;
}
.phrase .blank {
  display: inline-block;
  min-width: 4.5ch;
  border-bottom: 1px solid var(--muted);
  color: var(--accent);
  padding: 0 0.15em;
  transition: border-color 0.4s ease;
}
.phrase .blank.filled { border-color: var(--accent); font-weight: 400; }

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

.choice {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  padding: 1rem 1.1rem;
  border-radius: 999px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.15s;
}
.choice:active { transform: scale(0.98); }
.choice:hover, .choice:focus-visible {
  outline: none;
  border-color: rgba(242, 240, 236, 0.35);
}
.choice:disabled { cursor: default; }
.choice.wrong { animation: shake 0.4s ease; border-color: rgba(199, 90, 58, 0.5); }
.choice.right { border-color: var(--accent); background: var(--accent-soft); }

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

/* ── Moment ── */
.moment-title {
  font-weight: 300;
  font-size: clamp(1.5rem, 6vw, 2rem);
  letter-spacing: 0.02em;
  text-align: center;
  margin: 0 0 0.6rem;
}
.moment-dates {
  text-align: center;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  margin: 0 0 1.75rem;
}
.photo-frame {
  aspect-ratio: 3 / 4;
  max-height: 50dvh;
  overflow: hidden;
  background: #141414;
  margin-bottom: 1.5rem;
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.body-text {
  font-size: 1.05rem;
  line-height: 1.6;
  letter-spacing: 0.01em;
  text-align: center;
  margin: 0 0 2rem;
  color: rgba(242, 240, 236, 0.85);
}
.continue {
  display: block;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  padding: 0.85rem;
  cursor: pointer;
}
.continue:hover, .continue:focus-visible { color: var(--fg); outline: none; }

/* ── Ending ── */
.keepsake { text-align: center; }
.keepsake-card {
  border: 1px solid var(--line);
  padding: 2rem 1.25rem;
  margin-bottom: 1.25rem;
}
.keepsake-card h2 {
  font-weight: 300;
  font-size: 1.7rem;
  letter-spacing: 0.02em;
  margin: 0 0 0.5rem;
}
.keepsake-card p { margin: 0; color: var(--muted); font-size: 0.88rem; letter-spacing: 0.02em; }
.spotify-wrap { margin: 1.25rem 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.hint { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.hint .label { font-size: 0.68rem; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.65rem; }
.hint .text { font-size: 1.05rem; line-height: 1.55; letter-spacing: 0.01em; }
.save-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  font-size: 0.74rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  padding: 0.95rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .play-btn { animation: none; }
  .photo img { transition: none; transform: none; filter: none; }
}


/* typewriter caret */
.tw-caret {
  display: inline-block;
  width: 0.08em;
  height: 1em;
  margin-left: 0.06em;
  background: var(--fg);
  vertical-align: -0.12em;
  animation: blink 0.9s steps(1) infinite;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tw-caret { animation: none; opacity: 0; }
}

/* ── Date (small label variant) ── */
.date-text--small {
  font-size: clamp(1.25rem, 5.6vw, 1.7rem);
  white-space: normal;
  letter-spacing: var(--track);
}


/* ── Fortune cookie (вистинска фотографија, две половини) ── */
.screen--fortune { background: var(--bg); }
.fortune {
  position: relative;
  width: min(100%, 22rem);
  height: 18rem;
  display: grid;
  place-items: center;
}
.cookie {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14.5rem;
  aspect-ratio: 934 / 954;
  transform: translate(-50%, -50%);
  display: flex;
  z-index: 1;
  animation: cookie-breathe 3.6s ease-in-out infinite;
  filter: drop-shadow(0 20px 26px rgba(0, 0, 0, 0.6));
}
.cookie-half {
  display: block;
  height: 100%;
  width: auto;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  transition: transform 1.1s cubic-bezier(.2,.8,.2,1), opacity 1.1s ease;
}
.cookie-half--l { width: 48.29%; transform-origin: 100% 85%; }
.cookie-half--r { width: 51.71%; transform-origin: 0% 85%; }

.fortune.crack .cookie { animation: cookie-crack 0.26s ease; }
.fortune.open .cookie { animation: none; }
.fortune.open .cookie-half--l { transform: translateX(-24%) translateY(3%) rotate(-10deg); opacity: 0.92; }
.fortune.open .cookie-half--r { transform: translateX(24%) translateY(3%) rotate(10deg); opacity: 0.92; }

.slip {
  position: relative;
  z-index: 2;
  width: min(80%, 16rem);
  min-height: 3.6rem;
  padding: 0.95rem 1.1rem;
  background: linear-gradient(180deg, #f8f3e9 0%, #eee4d2 100%);
  color: #1c1a17;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 12px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: scaleX(0.04) scaleY(0.7);
  transition: transform 0.8s cubic-bezier(.2,.8,.2,1), opacity 0.35s ease;
  display: grid;
  place-items: center;
}
.fortune.slip-out .slip { opacity: 1; transform: scaleX(1) scaleY(1); }
.slip-text {
  margin: 0;
  text-align: center;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: 0.01em;
}
.slip-text .tw-caret { background: #1c1a17; }

.fortune-hint {
  position: absolute;
  bottom: calc(2.25rem + var(--safe-b));
  left: 0;
  right: 0;
  margin: 0 auto;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--faint);
  transition: opacity 0.5s ease;
}
.fortune-hint.gone { opacity: 0; }

@keyframes cookie-breathe {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, calc(-50% - 4px)); }
}
@keyframes cookie-crack {
  0%, 100% { transform: translate(-50%, -50%) rotate(0); }
  30% { transform: translate(-50%, -50%) rotate(-2.5deg) scale(0.98); }
  65% { transform: translate(-50%, -50%) rotate(2.5deg) scale(0.98); }
}
@media (prefers-reduced-motion: reduce) {
  .cookie { animation: none; }
  .cookie-half, .slip { transition: none; }
}

/* ── Писмо ── */
.letter-text {
  margin: 0;
  text-align: left;
  font-weight: 300;
  font-size: clamp(1.1rem, 4.6vw, 1.35rem);
  line-height: 1.7;
  letter-spacing: 0.01em;
}

/* ── Крај ── */
.ending-text {
  margin: 0;
  text-align: center;
  font-weight: 300;
  font-size: clamp(1.3rem, 5.6vw, 1.7rem);
  line-height: 1.55;
  letter-spacing: 0.01em;
}
.closing-text {
  margin: 2.25rem 0 0;
  text-align: center;
  font-weight: 300;
  font-size: clamp(1.05rem, 4.4vw, 1.25rem);
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: rgba(242, 240, 236, 0.78);
}
.closing-text::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 1px;
  margin: 0 auto 1.75rem;
  background: var(--accent);
}
.ending-text::after { content: none; }
.keepsake .save-btn { margin-top: 2rem; width: auto; }


/* ── Final love line only ── */
.ending-final {
  text-align: center;
}
.final-love {
  margin: 0;
  text-align: center;
  font-weight: 300;
  font-size: clamp(1.35rem, 6vw, 1.85rem);
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--fg);
}
