:root {
  color-scheme: light;
  --espresso: #503427;
  --coffee: #6b442f;
  --caramel: #b8835d;
  --rose: #a85f68;
  --paper: #fffaf3;
  --cream: #f4eadc;
  --ink: #39281f;
  --muted: #806b5b;
  --lace: #d7bfa4;
  --shadow: 0 26px 70px rgba(8, 4, 2, 0.42);
  font-family: 'Cairo', sans-serif;
  background: #24150f;
  color: var(--ink);
}

* { box-sizing: border-box; }
.lock-screen { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 22px; background: radial-gradient(ellipse at 20% 10%, rgba(168, 95, 104, 0.18), transparent 36%), radial-gradient(ellipse at 80% 90%, rgba(184, 131, 93, 0.2), transparent 38%), #24150f; }
.lock-screen[hidden] { display: none; }
.lock-card { width: min(100%, 420px); padding: 36px 28px 28px; border: 1px solid rgba(215, 191, 164, 0.7); border-radius: 26px; background: var(--paper); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38); text-align: center; }
.lock-flower { display: grid; width: 58px; height: 58px; place-items: center; margin: 0 auto 14px; border: 1px solid #e8d5bf; border-radius: 50%; background: #f7ebdd; font-size: 28px; }
.lock-kicker { margin: 0; color: var(--rose); font-size: 13px; font-weight: 700; }
.lock-card h1 { margin: 3px 0 0; color: var(--espresso); font-size: 34px; font-weight: 800; }
.lock-copy { margin: 8px 0 20px; color: #705747; font-size: 16px; font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
#unlock-code { width: min(100%, 230px); height: 56px; border: 1px solid #d6c0a9; border-radius: 15px; background: #fffdf9; color: var(--espresso); font: 800 24px/1 'DM Sans', sans-serif; letter-spacing: 0.42em; text-align: center; direction: ltr; }
#unlock-code:focus-visible { outline: 3px solid #c69068; outline-offset: 3px; }
.lock-error { margin: 9px 0 0; color: #9d3949; font-size: 13px; font-weight: 700; }
.lock-error[hidden] { display: none; }
.unlock-button { min-width: 180px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; padding: 12px 22px; border: 0; border-radius: 999px; background: var(--coffee); color: #fffaf3; font: 800 15px/1.4 'Cairo', sans-serif; cursor: pointer; }
.unlock-button:hover { background: var(--espresso); }
.lock-hint { margin: 14px 0 0; color: #927968; font-size: 12px; font-weight: 600; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 10% 18%, rgba(168, 95, 104, 0.13), transparent 30%),
    radial-gradient(ellipse at 90% 82%, rgba(184, 131, 93, 0.16), transparent 34%),
    repeating-linear-gradient(135deg, rgba(255, 239, 218, 0.018) 0 1px, transparent 1px 9px),
    #24150f;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.page-shell { width: min(100% - 34px, 880px); margin-inline: auto; padding: 26px 0 34px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; color: #f6e6d3; font-size: 15px; font-weight: 800; text-decoration: none; }
.wordmark-icon { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(230, 204, 174, 0.32); border-radius: 50%; background: rgba(255, 250, 243, 0.08); color: #d58b91; font-size: 21px; }
.senior-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid rgba(230, 204, 174, 0.28); border-radius: 999px; background: rgba(255, 250, 243, 0.08); color: #f0d9bd; font: 700 10px/1 'DM Sans', sans-serif; letter-spacing: 0.11em; white-space: nowrap; }
.chip-flower { color: var(--rose); font-size: 14px; }

.letter-card { overflow: hidden; border: 1px solid rgba(107, 68, 47, 0.18); border-radius: 30px; background: var(--paper); box-shadow: var(--shadow); }
.lace-strip { position: relative; height: 26px; border-block: 1px solid rgba(168, 95, 104, 0.24); background-color: #f4e9da; background-image: radial-gradient(circle at 8px 1px, transparent 5px, var(--lace) 5.6px, var(--lace) 6.1px, transparent 6.7px), radial-gradient(circle at 0 9px, transparent 5px, rgba(168, 95, 104, 0.46) 5.6px, rgba(168, 95, 104, 0.46) 6.1px, transparent 6.7px), repeating-linear-gradient(90deg, rgba(168, 95, 104, 0.12) 0 1px, transparent 1px 8px); background-size: 16px 24px, 16px 24px, 8px 100%; }
.lace-strip::after { position: absolute; inset-inline: 10px; top: 10px; height: 6px; border-block: 1px dotted rgba(168, 95, 104, 0.55); content: ''; }
.lace-bottom { transform: rotate(180deg); }
.hero-visual { position: relative; height: clamp(220px, 38vw, 340px); margin: 0; overflow: hidden; background: linear-gradient(135deg, #6b442f, #c28b69 58%, #ead7c2); }
.hero-visual img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 52%; }
.hero-shade { position: absolute; inset: 28% 0 0; background: linear-gradient(0deg, rgba(47, 30, 22, 0.63), transparent); pointer-events: none; }
.hero-caption { position: absolute; right: clamp(18px, 4vw, 34px); bottom: 18px; display: flex; align-items: center; gap: 8px; color: #fffaf3; font-size: 14px; font-weight: 700; text-shadow: 0 1px 8px rgba(40, 25, 18, 0.42); }
.hero-caption span { font-size: 18px; }
.hero-seal { position: absolute; top: 16px; left: 18px; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(255, 250, 243, 0.7); border-radius: 50%; background: rgba(255, 250, 243, 0.82); color: var(--rose); font-size: 24px; box-shadow: 0 6px 20px rgba(54, 35, 24, 0.16); }

.letter-content { padding: 30px clamp(22px, 6vw, 58px) 32px; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: var(--rose); font-size: 13px; font-weight: 700; }
.eyebrow span { color: var(--caramel); }
.coffee-character { width: fit-content; max-width: 100%; display: flex; align-items: center; gap: 12px; margin: 21px auto 25px; padding: 8px 13px 8px 9px; border: 1px solid rgba(107, 68, 47, 0.14); border-radius: 20px; background: #f8f0e5; text-align: right; }
.coffee-character img { width: 70px; height: 70px; flex: 0 0 auto; border: 2px solid #fffaf3; border-radius: 15px; object-fit: cover; object-position: center; box-shadow: 0 2px 8px rgba(60, 39, 27, 0.16); }
.character-copy { display: grid; gap: 1px; }
.character-kicker { color: var(--muted); font-size: 10px; font-weight: 600; }
.character-copy strong { color: var(--espresso); font: 700 13px/1.3 'DM Sans', sans-serif; direction: ltr; text-align: right; }
.character-copy strong span { color: var(--rose); }
.character-coffee { margin-inline-start: 3px; color: var(--caramel); font-size: 18px; }
.song-card { width: min(100%, 360px); margin: -8px auto 22px; border: 1px solid rgba(168, 95, 104, 0.24); border-radius: 18px; background: #fbf2e9; text-align: right; }
.song-card summary { display: flex; align-items: center; gap: 10px; padding: 10px 13px; color: var(--espresso); cursor: pointer; list-style: none; }
.song-card summary::-webkit-details-marker { display: none; }
.song-note { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #f1dbe0; color: var(--rose); font-size: 19px; }
.song-title { display: grid; gap: 1px; }
.song-title strong { font-size: 12px; font-weight: 800; }
.song-title small { color: var(--muted); font: 600 10px/1.4 'DM Sans', sans-serif; }
.song-action { margin-inline-start: auto; padding: 6px 10px; border-radius: 999px; background: var(--coffee); color: #fffaf3; font-size: 10px; font-weight: 700; white-space: nowrap; }
.song-player { padding: 0 9px 9px; }
.song-player iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; }
.song-hint { margin: 8px 5px; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.7; text-align: center; }
.song-fallbacks { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 8px 0 2px; }
.song-fallback { padding: 7px 11px; border: 1px solid rgba(107, 68, 47, 0.16); border-radius: 999px; background: #f4eadc; color: var(--espresso); font-size: 11px; font-weight: 700; text-decoration: none; }
.song-fallback:hover, .song-fallback:focus-visible { background: #ead7c2; outline: 2px solid #c69068; outline-offset: 2px; }

.message-panel { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 8px; }
.stage-counter { margin-bottom: 8px; color: #9b7c64; font: 700 11px/1 'DM Sans', sans-serif; letter-spacing: 0.14em; direction: ltr; }
.stage-counter span { margin-inline: 5px; color: var(--rose); }
#stage-title { max-width: 100%; margin: 0; color: var(--espresso); font-size: clamp(31px, 6vw, 46px); font-weight: 800; line-height: 1.42; text-wrap: balance; }
#stage-title:focus { outline: none; }
.stage-copy { max-width: 590px; margin: 13px auto 0; color: #705747; font-size: clamp(17px, 3vw, 21px); font-weight: 600; line-height: 1.95; text-wrap: pretty; }
.final-cat { display: block; width: min(250px, 70vw); height: auto; aspect-ratio: 4 / 3; margin: 12px auto 0; border: 2px solid #f1dfcb; border-radius: 16px; object-fit: cover; box-shadow: 0 8px 22px rgba(80, 52, 39, 0.15); }
.final-cat[hidden] { display: none; }
.is-arriving #stage-title, .is-arriving .stage-copy { animation: letter-arrive 420ms cubic-bezier(0.2, 0.75, 0.25, 1) both; }
.is-arriving .stage-copy { animation-delay: 70ms; }
@keyframes letter-arrive { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }

.progress-dots { display: flex; justify-content: center; gap: 8px; margin: 19px auto 20px; }
.progress-dot { width: 7px; height: 7px; border-radius: 999px; background: #decdb9; transition: width 240ms ease, background-color 240ms ease; }
.progress-dot.is-active { width: 22px; background: var(--rose); }
.next-button { min-width: 168px; display: inline-flex; align-items: center; justify-content: center; gap: 18px; padding: 13px 22px; border: 0; border-radius: 999px; background: var(--coffee); color: #fffaf3; box-shadow: 0 9px 20px rgba(80, 52, 39, 0.2); font-size: 16px; font-weight: 800; cursor: pointer; transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease; }
.next-button:hover { transform: translateY(-2px); background: var(--espresso); box-shadow: 0 12px 24px rgba(80, 52, 39, 0.23); }
.next-button:active { transform: translateY(0) scale(0.98); }
.next-button:focus-visible { outline: 3px solid #d6a982; outline-offset: 4px; }
.button-arrow { font-size: 19px; line-height: 1; }
.button-arrow[hidden] { display: none; }
.tiny-signoff { margin: 19px 0 0; color: #927968; font-size: 12px; font-weight: 600; }
.tiny-signoff span { padding-inline: 4px; color: var(--rose); }
.page-footer { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 18px; color: #e4cfb7; font-size: 13px; font-weight: 700; }
.page-footer span { color: #d58b91; }

@media (max-width: 520px) {
  .page-shell { width: min(100% - 22px, 460px); padding-top: 14px; }
  .lock-card { padding: 30px 21px 24px; }
  .lock-card h1 { font-size: 30px; }
  .topbar { margin-bottom: 12px; }
  .letter-card { border-radius: 23px; }
  .lace-strip { height: 20px; background-size: 14px 18px, 14px 18px, 8px 100%; }
  .hero-visual { height: clamp(205px, 58vw, 270px); }
  .hero-caption { right: 16px; bottom: 13px; font-size: 12px; }
  .hero-seal { width: 36px; height: 36px; top: 12px; left: 12px; font-size: 21px; }
  .letter-content { padding: 23px 19px 25px; }
  .eyebrow { font-size: 12px; }
  .coffee-character { margin: 16px auto 20px; }
  .coffee-character img { width: 64px; height: 64px; }
  .message-panel { min-height: 174px; }
  .stage-copy { line-height: 1.85; }
  .tiny-signoff { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
