:root {
  --ink: #f7f3f7;
  --muted: #aaa8c1;
  --muted-bright: #d1cde0;
  --navy: #090b27;
  --navy-soft: #10143b;
  --purple: #2b2057;
  --purple-deep: #18133d;
  --blush: #f4a9be;
  --blush-soft: #f9d4de;
  --lavender: #c8bdf6;
  --lavender-soft: #e9e4ff;
  --line: rgba(234, 226, 253, .16);
  --line-strong: rgba(234, 226, 253, .3);
  --card: rgba(23, 21, 66, .78);
  --danger: #ff9ca6;
  --shadow: 0 24px 80px rgba(0, 0, 0, .24);
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  --radius-lg: 28px;
  --radius-md: 18px;
  --max: 1120px;
}

* { box-sizing: border-box; }
*[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--navy);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -4;
  pointer-events: none;
  background:
    radial-gradient(circle at 74% 8%, rgba(91, 68, 152, .24), transparent 27rem),
    radial-gradient(circle at 14% 54%, rgba(56, 32, 102, .2), transparent 31rem),
    linear-gradient(145deg, #080a25 0%, #0d1033 46%, #17133b 100%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  opacity: .25;
  background-image: linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blush); outline-offset: 4px; }
::selection { background: var(--blush); color: var(--navy); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.site-shell { min-height: 100vh; position: relative; }
.starfield { position: fixed; inset: 0; z-index: -2; pointer-events: none; overflow: hidden; }
.starfield span { position: absolute; width: 2px; height: 2px; background: var(--lavender-soft); border-radius: 50%; opacity: .5; animation: twinkle 5s ease-in-out infinite alternate; }
.starfield span:nth-child(1) { left: 8%; top: 15%; animation-delay: -.5s; }
.starfield span:nth-child(2) { left: 18%; top: 62%; width: 3px; height: 3px; animation-delay: -2s; }
.starfield span:nth-child(3) { left: 31%; top: 22%; animation-delay: -4s; }
.starfield span:nth-child(4) { left: 44%; top: 82%; width: 3px; height: 3px; animation-delay: -1.4s; }
.starfield span:nth-child(5) { left: 57%; top: 13%; animation-delay: -3.2s; }
.starfield span:nth-child(6) { left: 69%; top: 47%; animation-delay: -1s; }
.starfield span:nth-child(7) { left: 78%; top: 74%; width: 3px; height: 3px; animation-delay: -2.8s; }
.starfield span:nth-child(8) { left: 88%; top: 24%; animation-delay: -4.4s; }
.starfield span:nth-child(9) { left: 94%; top: 58%; animation-delay: -1.8s; }
.starfield span:nth-child(10) { left: 4%; top: 88%; animation-delay: -3.8s; }
.starfield span:nth-child(11) { left: 52%; top: 41%; width: 3px; height: 3px; animation-delay: -.8s; }
.starfield span:nth-child(12) { left: 27%; top: 91%; animation-delay: -2.5s; }
@keyframes twinkle { from { opacity: .18; transform: scale(.7); } to { opacity: .8; transform: scale(1.25); } }

.topbar { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; min-height: 84px; padding: 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; position: relative; z-index: 5; }
.wordmark { text-decoration: none; text-transform: uppercase; letter-spacing: .17em; font-size: 10px; color: var(--muted-bright); display: inline-flex; align-items: center; gap: 10px; }
.wordmark-mark { color: var(--blush); font-size: 18px; line-height: 1; }
.account-area { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.account-status { max-width: 180px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.account-button { min-height: 38px; padding: 9px 13px; font-size: 10px; }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; color: var(--lavender-soft); background: rgba(255,255,255,.04); transition: background .25s ease, border-color .25s ease, transform .25s ease; }
.icon-button:hover { background: rgba(244,169,190,.12); border-color: rgba(244,169,190,.5); transform: translateY(-2px); }
.section-shell { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; }
.welcome { min-height: calc(100svh - 84px); display: grid; align-items: center; grid-template-columns: 1fr; position: relative; padding: 62px 0 86px; }
.welcome-copy { position: relative; z-index: 1; max-width: 620px; }
.eyebrow { margin: 0 0 15px; color: var(--blush); text-transform: uppercase; letter-spacing: .19em; font-size: 10px; font-weight: 700; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.04em; line-height: .96; }
h1 { font-size: clamp(3.8rem, 16vw, 7.6rem); margin-bottom: 26px; }
h2 { font-size: clamp(3rem, 10vw, 5.8rem); margin-bottom: 22px; }
h3 { font-family: var(--serif); font-size: 1.55rem; font-weight: 400; letter-spacing: -.02em; }
em { color: var(--blush); font-style: italic; }
.lead { max-width: 470px; color: var(--lavender-soft); font-family: var(--serif); font-size: clamp(1.35rem, 3vw, 1.72rem); line-height: 1.25; margin-bottom: 14px; }
.intro, .section-intro { max-width: 560px; color: var(--muted); font-size: 14px; }
.welcome .intro { margin-bottom: 32px; }
.primary-button, .secondary-button, .danger-button { min-height: 48px; border-radius: 99px; border: 1px solid transparent; padding: 12px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 16px; font-weight: 700; font-size: 12px; letter-spacing: .02em; transition: transform .25s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease; }
.primary-button { color: var(--navy); background: var(--blush); box-shadow: 0 14px 34px rgba(244,169,190,.16); }
.primary-button:hover { transform: translateY(-3px); box-shadow: 0 18px 38px rgba(244,169,190,.26); }
.button-arrow { font-size: 18px; font-weight: 400; line-height: 1; }
.secondary-button { color: var(--lavender-soft); background: rgba(255,255,255,.05); border-color: var(--line-strong); }
.secondary-button:hover { transform: translateY(-2px); background: rgba(200,189,246,.1); border-color: var(--lavender); }
.text-button { color: var(--muted-bright); background: none; border: 0; padding: 5px 0; font-size: 12px; text-decoration: underline; text-decoration-color: rgba(244,169,190,.4); text-underline-offset: 4px; }
.text-button:hover { color: var(--blush-soft); }
.danger-button { color: #190d25; background: var(--danger); }
.welcome-art { min-height: 300px; display: grid; place-items: center; position: relative; margin-top: 42px; }
.glow-heart { width: 180px; height: 180px; display: grid; place-items: center; border-radius: 50%; color: var(--blush-soft); font-family: var(--serif); font-size: 128px; line-height: .7; padding-bottom: 12px; text-shadow: 0 0 14px rgba(244,169,190,.8), 0 0 60px rgba(244,169,190,.55); background: radial-gradient(circle, rgba(244,169,190,.15), transparent 68%); animation: breathe 5.4s ease-in-out infinite; }
.orbit { position: absolute; border: 1px solid rgba(200,189,246,.2); border-radius: 50%; transform: rotate(-24deg); }
.orbit-one { width: 248px; height: 100px; }
.orbit-two { width: 330px; height: 148px; transform: rotate(32deg); border-color: rgba(244,169,190,.16); }
.art-star { position: absolute; color: var(--lavender); font-family: var(--serif); }
.art-star-a { top: 18%; left: 26%; font-size: 23px; }
.art-star-b { top: 23%; right: 16%; font-size: 31px; }
.art-star-c { bottom: 15%; left: 14%; font-size: 17px; color: var(--blush); }
.art-star-d { bottom: 22%; right: 23%; font-size: 28px; }
@keyframes breathe { 0%, 100% { transform: scale(.97); opacity: .85; } 50% { transform: scale(1.04); opacity: 1; } }
.scroll-hint { position: absolute; bottom: 25px; left: 0; display: flex; align-items: center; gap: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-size: 9px; }
.scroll-hint span { display: block; width: 26px; height: 1px; background: var(--blush); }

.universe-content[hidden] { display: none; }
.section-nav { position: sticky; top: 0; z-index: 4; padding: 11px 0; background: rgba(9,11,39,.84); backdrop-filter: blur(16px); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-nav-inner { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; display: flex; overflow-x: auto; gap: 24px; scrollbar-width: none; }
.section-nav-inner::-webkit-scrollbar { display: none; }
.section-nav a { white-space: nowrap; color: var(--muted); text-decoration: none; font-size: 11px; transition: color .2s ease; }
.section-nav a:hover, .section-nav a.active { color: var(--blush-soft); }
.content-section { padding-top: 110px; padding-bottom: 120px; border-bottom: 1px solid var(--line); }
.section-kicker { display: flex; align-items: center; gap: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .17em; font-size: 9px; margin-bottom: 24px; }
.section-kicker span:first-child { color: var(--blush); }
.section-kicker span:last-child { display: flex; align-items: center; gap: 15px; }
.section-kicker span:last-child::before { content: ""; display: block; height: 1px; width: 24px; background: var(--line-strong); }
.section-heading-row { display: flex; flex-direction: column; gap: 20px; margin-bottom: 14px; }
.section-actions { display: flex; gap: 18px; flex-wrap: wrap; }
.letter-section { max-width: 900px; }
.letter-card { position: relative; margin-top: 38px; padding: 28px 24px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: linear-gradient(145deg, rgba(35,25,75,.82), rgba(17,19,55,.72)); box-shadow: var(--shadow); overflow: hidden; }
.letter-card::before { content: ""; position: absolute; width: 190px; height: 190px; right: -70px; top: -70px; border-radius: 50%; background: rgba(244,169,190,.11); filter: blur(2px); }
.letter-card-top, .letter-card-bottom { display: flex; justify-content: space-between; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 9px; }
.letter-card-top span:last-child { color: var(--blush); font-size: 16px; }
.letter-body { min-height: 320px; padding: 46px 0 34px; white-space: pre-line; color: var(--lavender-soft); font-family: var(--serif); font-size: clamp(1.2rem, 3.2vw, 1.58rem); line-height: 1.65; }
.letter-progress { height: 2px; margin-bottom: 18px; background: rgba(255,255,255,.09); }
.letter-progress span { display: block; height: 100%; width: 0; background: var(--blush); transition: width .2s linear; }

.memory-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 34px; }
.memory-card { min-height: 270px; display: flex; flex-direction: column; justify-content: space-between; position: relative; padding: 22px; border-radius: var(--radius-md); background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.memory-card.has-photo { background-size: cover; background-position: center; }
.memory-card.has-photo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,9,28,.17), rgba(8,9,28,.92)); }
.memory-card > * { position: relative; z-index: 1; }
.memory-date, .memory-actions, .timeline-date { text-transform: uppercase; letter-spacing: .14em; font-size: 9px; color: var(--muted); }
.memory-card h3 { margin: 12px 0 8px; color: var(--lavender-soft); }
.memory-card p { color: var(--muted-bright); font-size: 13px; margin-bottom: 18px; }
.memory-card .memory-actions { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.card-action { background: none; border: 0; color: var(--muted-bright); text-decoration: underline; text-decoration-color: rgba(244,169,190,.35); text-underline-offset: 3px; padding: 0; font-size: 10px; }
.card-action.delete { color: var(--danger); }

.empty-state { padding: 60px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); text-align: center; margin-top: 28px; }
.empty-icon { display: block; color: var(--blush); font-size: 30px; margin-bottom: 10px; }
.empty-state h3 { margin-bottom: 4px; }
.empty-state p { color: var(--muted); font-size: 13px; }

.surprise-section { padding-bottom: 140px; }
.surprise-layout { display: grid; grid-template-columns: 1fr; gap: 35px; align-items: end; }
.surprise-card { position: relative; min-height: 280px; display: flex; flex-direction: column; justify-content: center; padding: 34px; border: 1px solid rgba(244,169,190,.35); border-radius: var(--radius-lg); background: radial-gradient(circle at 78% 20%, rgba(244,169,190,.19), transparent 32%), rgba(44,28,76,.72); box-shadow: var(--shadow); }
.quote-mark { position: absolute; top: 12px; left: 25px; color: rgba(244,169,190,.45); font-family: var(--serif); font-size: 75px; line-height: 1; }
.surprise-card p { max-width: 460px; margin: 20px 0 24px; color: var(--blush-soft); font-family: var(--serif); font-size: clamp(1.7rem, 5vw, 2.65rem); line-height: 1.13; letter-spacing: -.04em; }
.surprise-caption { color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-size: 9px; }

.timeline { margin-top: 38px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 10px; width: 1px; background: var(--line-strong); }
.timeline-item { display: grid; grid-template-columns: 32px 1fr; gap: 18px; padding-bottom: 40px; }
.timeline-dot { position: relative; z-index: 1; width: 17px; height: 17px; border: 1px solid var(--blush); border-radius: 50%; background: var(--navy); box-shadow: 0 0 0 6px var(--navy); margin-top: 4px; }
.timeline-date { color: var(--blush); margin-bottom: 9px; }
.timeline-item h3 { margin-bottom: 7px; color: var(--lavender-soft); }
.timeline-item p { margin-bottom: 12px; color: var(--muted); font-size: 13px; max-width: 600px; }
.timeline-actions { display: flex; gap: 14px; }

.soft-tag { align-self: start; color: var(--lavender); border: 1px solid rgba(200,189,246,.27); border-radius: 99px; padding: 7px 11px; font-size: 9px; text-transform: uppercase; letter-spacing: .11em; }
.quiz-card { max-width: 790px; margin-top: 34px; padding: 25px 21px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: rgba(15,18,52,.68); }
.quiz-question { padding: 0 0 26px; margin-bottom: 25px; border-bottom: 1px solid var(--line); }
.quiz-question:last-child { margin-bottom: 0; }
.quiz-question legend { margin-bottom: 15px; color: var(--lavender-soft); font-family: var(--serif); font-size: 1.28rem; line-height: 1.2; }
.quiz-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px 13px; margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted-bright); cursor: pointer; transition: border .2s ease, background .2s ease; }
.quiz-option:hover { border-color: var(--lavender); background: rgba(200,189,246,.07); }
.quiz-option input { accent-color: var(--blush); margin-top: 4px; }
.quiz-footer { padding-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.quiz-result { margin: 0; color: var(--blush-soft); font-family: var(--serif); }

.final-section { text-align: center; display: flex; flex-direction: column; align-items: center; position: relative; overflow: hidden; }
.final-section .eyebrow { margin-bottom: 20px; }
.final-orbit { position: relative; width: 120px; height: 78px; margin-bottom: 30px; }
.final-orbit::before, .final-orbit::after { content: ""; position: absolute; inset: 14px -25px; border: 1px solid rgba(244,169,190,.25); border-radius: 50%; transform: rotate(25deg); }
.final-orbit::after { transform: rotate(-25deg); border-color: rgba(200,189,246,.2); }
.final-orbit span { position: absolute; inset: 18px; border-radius: 50%; background: radial-gradient(circle, rgba(244,169,190,.34), transparent 66%); }
.final-orbit i { position: relative; color: var(--blush); font-style: normal; font-size: 36px; line-height: 78px; }
.final-note { max-width: 670px; color: var(--lavender-soft); font-family: var(--serif); font-size: clamp(1.45rem, 4vw, 2.1rem); line-height: 1.28; }
.final-actions { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin: 25px 0 32px; }
.local-note { max-width: 550px; color: var(--muted); font-size: 11px; }
.local-note span { color: var(--blush); font-size: 17px; vertical-align: -2px; }
.site-footer { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; padding: 25px 0 38px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }

.app-dialog { width: min(640px, calc(100% - 28px)); max-height: min(90svh, 850px); padding: 0; color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: #16143f; box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.app-dialog::backdrop { background: rgba(2,3,16,.77); backdrop-filter: blur(8px); }
.dialog-card { padding: 25px 21px; overflow-y: auto; max-height: min(90svh, 850px); }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; align-items: start; margin-bottom: 12px; }
.dialog-header h2 { font-size: clamp(2.4rem, 9vw, 3.8rem); margin-bottom: 0; }
.dialog-header .icon-button { flex: 0 0 auto; }
.dialog-intro { color: var(--muted); font-size: 13px; }
label { display: block; color: var(--muted-bright); font-size: 12px; margin: 16px 0; }
label > span:first-child, label > span + span:not(.label-hint) { color: var(--blush); }
.label-hint { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
input, textarea { display: block; width: 100%; margin-top: 7px; color: var(--ink); background: rgba(7,8,27,.58); border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 13px; outline: 0; }
input:focus, textarea:focus { border-color: var(--blush); box-shadow: 0 0 0 3px rgba(244,169,190,.1); }
textarea { resize: vertical; min-height: 90px; }
input[type="file"] { padding: 9px; color: var(--muted); }
input[type="file"]::file-selector-button { color: var(--navy); background: var(--lavender); border: 0; border-radius: 99px; padding: 7px 10px; margin-right: 8px; font-size: 11px; }
.form-error { min-height: 21px; color: var(--danger); font-size: 12px; margin: 8px 0; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 12px; padding-top: 12px; }
.photo-preview { display: flex; gap: 12px; align-items: center; margin: -3px 0 12px; }
.photo-preview img { width: 62px; height: 62px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-strong); }
.studio-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.reset-details { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 17px; color: var(--muted); font-size: 12px; }
.reset-details summary { color: var(--muted-bright); cursor: pointer; }
.reset-details p { margin: 12px 0; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translate(-50%, 22px); width: max-content; max-width: calc(100% - 36px); padding: 12px 17px; color: var(--navy); background: var(--lavender-soft); border-radius: 99px; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; box-shadow: 0 12px 40px rgba(0,0,0,.28); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 640px) {
  .topbar, .section-shell, .section-nav-inner, .site-footer { width: min(var(--max), calc(100% - 72px)); }
  .welcome { padding-top: 90px; }
  .memory-grid { grid-template-columns: repeat(2, 1fr); }
  .quiz-card, .dialog-card { padding: 34px; }
  .studio-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .topbar { align-items: flex-start; }
  .account-area { gap: 7px; }
  .account-status { display: none; }
  .account-button { min-height: 34px; padding: 8px 10px; }
  .account-area .icon-button { width: 36px; height: 36px; }
}
@media (min-width: 860px) {
  .topbar, .section-shell, .section-nav-inner, .site-footer { width: min(var(--max), calc(100% - 112px)); }
  .welcome { min-height: calc(100svh - 84px); grid-template-columns: 1.15fr .85fr; gap: 50px; padding: 40px 0 76px; }
  .welcome-art { min-height: 520px; margin-top: 0; }
  .glow-heart { width: 245px; height: 245px; font-size: 170px; }
  .orbit-one { width: 340px; height: 142px; }
  .orbit-two { width: 480px; height: 212px; }
  .section-heading-row { flex-direction: row; justify-content: space-between; align-items: end; }
  .memory-grid { grid-template-columns: repeat(3, 1fr); }
  .surprise-layout { grid-template-columns: .82fr 1.18fr; gap: 90px; }
  .surprise-card { min-height: 360px; }
  .section-nav-inner { justify-content: space-between; gap: 16px; }
  .letter-card { padding: 40px 45px; }
}
@media (min-width: 1100px) { .topbar, .section-shell, .section-nav-inner, .site-footer { width: min(var(--max), calc(100% - 40px)); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
