:root {
  color-scheme: light;
  --ink: #301d2d;
  --muted: #796b72;
  --paper: #fbf7f4;
  --paper-deep: #f1e7e4;
  --white: #fffdfa;
  --rose: #9b4d68;
  --rose-dark: #71364e;
  --blush: #e9bbb2;
  --peach: #f5d7c7;
  --gold: #b99063;
  --line: rgba(66, 37, 54, 0.12);
  --shadow: 0 22px 65px rgba(65, 39, 53, 0.11);
  --radius: 26px;
  --serif: Georgia, 'Times New Roman', 'Songti SC', 'SimSun', serif;
  --sans: Inter, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 5%, rgba(232, 187, 178, 0.34), transparent 29rem),
    radial-gradient(circle at 88% 72%, rgba(185, 144, 99, 0.12), transparent 28rem),
    var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(155, 77, 104, 0.25);
  outline-offset: 2px;
}
.hidden { display: none !important; }

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(4px); pointer-events: none; }
.ambient-one { width: 22rem; height: 22rem; background: rgba(231, 179, 170, 0.15); top: 13%; left: -10rem; }
.ambient-two { width: 28rem; height: 28rem; background: rgba(116, 63, 87, 0.08); bottom: -12rem; right: -8rem; }

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--rose);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(22rem, 35rem) 1fr; }
.login-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 7vw, 6.5rem);
  overflow: hidden;
  background: rgba(255, 253, 250, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 16px 0 70px rgba(41, 23, 35, 0.1);
}
.login-card h1 { margin: 0; font: 400 clamp(3.5rem, 7vw, 6.8rem)/0.9 var(--serif); letter-spacing: -0.06em; }
.login-card h1 em { color: var(--rose); font-weight: 400; }
.login-intro { max-width: 29rem; margin: 2rem 0 2.5rem; color: var(--muted); line-height: 1.9; }
.login-quote {
  display: grid;
  place-items: end start;
  min-height: 100vh;
  padding: 7vw;
  background:
    linear-gradient(155deg, rgba(31, 17, 29, 0.78), rgba(67, 33, 55, 0.42)),
    radial-gradient(circle at 62% 30%, #b16a79 0, #5a324d 35%, #271824 75%);
  color: #fff6f0;
}
.login-quote blockquote { margin: 0; font: 400 clamp(1.5rem, 3vw, 2.7rem)/1.6 var(--serif); }
.constellation span { position: absolute; width: 5px; height: 5px; background: var(--gold); border-radius: 50%; box-shadow: 0 0 16px var(--gold); }
.constellation span:nth-child(1) { top: 10%; left: 16%; }
.constellation span:nth-child(2) { top: 20%; right: 18%; }
.constellation span:nth-child(3) { top: 36%; left: 10%; }
.constellation span:nth-child(4) { bottom: 18%; right: 13%; }
.constellation span:nth-child(5) { bottom: 8%; left: 32%; }

.stack-form, .modal form, .settings-form, .password-form { display: grid; gap: 1rem; }
label { display: grid; gap: 0.5rem; color: var(--ink); font-size: 0.84rem; font-weight: 700; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.92rem 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
textarea { resize: vertical; line-height: 1.65; }
input:hover, textarea:hover, select:hover { border-color: rgba(155, 77, 104, 0.38); }
input:focus, textarea:focus, select:focus { border-color: var(--rose); background: white; box-shadow: 0 0 0 4px rgba(155, 77, 104, 0.08); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 2.9rem;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.3rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { color: white; background: var(--ink); box-shadow: 0 12px 28px rgba(48, 29, 45, 0.2); }
.button-primary:hover { background: var(--rose-dark); box-shadow: 0 14px 32px rgba(113, 54, 78, 0.28); }
.button-ghost { color: var(--ink); background: rgba(255,255,255,0.62); border: 1px solid var(--line); }
.button-danger { color: #8d2f45; background: #f8e3e4; }
.button-wide { width: 100%; }
.text-button { border: 0; background: none; color: var(--rose); font-weight: 800; cursor: pointer; }
.form-error { min-height: 1.2rem; margin: 0; color: #a52846; font-size: 0.85rem; }
.form-message { min-height: 1.2rem; margin: 0; color: #46734b; font-size: 0.85rem; }
.privacy-note { margin-top: 1.3rem; color: var(--muted); font-size: 0.78rem; text-align: center; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  padding: 0 clamp(1.2rem, 5vw, 5rem);
  background: rgba(251, 247, 244, 0.82);
  border-bottom: 1px solid rgba(69, 39, 54, 0.08);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 0.8rem; border: 0; background: none; cursor: pointer; text-align: left; }
.brand-mark { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; color: white; background: var(--ink); font: 1.2rem var(--serif); }
.brand b { display: block; font: 600 1rem var(--serif); }
.brand small { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.55rem; letter-spacing: 0.15em; }
.desktop-nav { display: flex; gap: 1.7rem; }
.nav-item { position: relative; padding: 0.7rem 0; border: 0; background: none; color: var(--muted); cursor: pointer; font-weight: 700; }
.nav-item::after { content: ''; position: absolute; height: 2px; left: 50%; right: 50%; bottom: 0; background: var(--rose); transition: 180ms ease; }
.nav-item.active { color: var(--ink); }
.nav-item.active::after { left: 0; right: 0; }
.top-actions { display: flex; align-items: center; gap: 0.7rem; }
.icon-button { width: 2.55rem; height: 2.55rem; border-radius: 50%; border: 1px solid var(--line); background: white; cursor: pointer; font-size: 1.25rem; }
.profile-button { display: flex; gap: 0.55rem; align-items: center; border: 0; background: none; cursor: pointer; }
.profile-button span { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--peach); color: var(--rose-dark); }

.content-shell { width: min(1180px, calc(100% - 2.4rem)); margin: 0 auto; padding: clamp(1.6rem, 4vw, 4rem) 0 7rem; }
.page { display: none; animation: pageIn 280ms ease both; }
.active-page { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 1rem; }
.hero-card {
  position: relative;
  min-height: 30rem;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4.5rem);
  border-radius: 34px;
  background: linear-gradient(135deg, #392334, #6f3d58 62%, #a76578);
  color: #fff9f5;
  box-shadow: var(--shadow);
}
.hero-card::after { content: ''; position: absolute; inset: 0; opacity: 0.16; background-image: radial-gradient(#fff 0.7px, transparent 0.7px); background-size: 18px 18px; }
.hero-copy { position: relative; z-index: 2; max-width: 37rem; }
.hero-copy .eyebrow { color: #efc7bb; }
.hero-copy h1 { margin: 0; font: 400 clamp(3.7rem, 8vw, 7rem)/0.95 var(--serif); letter-spacing: -0.06em; }
.hero-copy h1 i { color: var(--blush); font-weight: 400; }
.hero-copy > p:not(.eyebrow) { max-width: 34rem; margin: 1.7rem 0 2rem; color: #eadde2; line-height: 1.8; }
.hero-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.hero-card .button-primary { background: #fff8f2; color: var(--ink); }
.hero-card .button-ghost { background: transparent; color: white; border-color: rgba(255,255,255,0.3); }
.orbit-art { position: absolute; right: -3rem; top: 50%; width: 24rem; height: 24rem; transform: translateY(-50%); opacity: 0.82; }
.orbit { position: absolute; inset: 12%; border: 1px solid rgba(255,255,255,0.25); border-radius: 50%; transform: rotate(-23deg) scaleY(0.48); }
.orbit-b { inset: 0; transform: rotate(42deg) scaleY(0.55); }
.planet { position: absolute; display: grid; place-items: center; border-radius: 50%; box-shadow: 0 0 34px rgba(255,222,207,0.36); }
.planet-a { width: 7rem; height: 7rem; left: 38%; top: 35%; color: #71364e; background: linear-gradient(145deg, #f9d7c9, #d68b92); font-size: 2rem; }
.planet-b { width: 1.2rem; height: 1.2rem; top: 12%; right: 15%; background: #f7d7a9; }
.planet-c { width: 0.7rem; height: 0.7rem; bottom: 18%; left: 20%; background: white; }
.counter-card { display: grid; place-items: center; align-content: center; padding: 2rem; text-align: center; border-radius: 34px; background: var(--white); box-shadow: var(--shadow); }
.counter-card > p:first-child { margin: 0; color: var(--muted); }
.counter-card strong { margin: 0.5rem 0 -0.5rem; color: var(--rose); font: 400 6rem/1 var(--serif); }
.counter-card > span { color: var(--gold); font: 1.2rem var(--serif); }
.counter-rule { width: 3rem; height: 1px; margin: 2rem 0 1.3rem; background: var(--line); }
.counter-card > p:last-child { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.6; }

.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin: 1rem 0 4.5rem; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,0.55); }
.stats-strip div { display: grid; place-items: center; gap: 0.25rem; padding: 1.3rem 0.8rem; }
.stats-strip div + div { border-left: 1px solid var(--line); }
.stats-strip strong { font: 500 1.6rem var(--serif); }
.stats-strip span { color: var(--muted); font-size: 0.74rem; }
.section-heading, .page-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; }
.section-heading h2, .page-heading h1 { margin: 0; font: 500 clamp(2rem, 4vw, 3.4rem)/1.1 var(--serif); }
.page-heading { margin-bottom: 2rem; }
.page-heading > div > p:last-child { margin: 0.8rem 0 0; color: var(--muted); }
.memory-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.4rem; }
.memory-tile { position: relative; min-height: 20rem; display: flex; align-items: end; overflow: hidden; border-radius: 23px; background: #ddd; box-shadow: 0 12px 35px rgba(50,34,43,0.1); }
.memory-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 400ms ease; }
.memory-tile:hover img { transform: scale(1.04); }
.memory-tile::after { content: ''; position: absolute; inset: 28% 0 0; background: linear-gradient(transparent, rgba(27,18,24,0.82)); }
.memory-tile-copy { position: relative; z-index: 2; padding: 1.4rem; color: white; }
.memory-tile-copy h3 { margin: 0.25rem 0; font: 500 1.5rem var(--serif); }
.memory-tile-copy small { opacity: 0.76; }
.memory-placeholder { background: linear-gradient(145deg, #c99095, #6d4058); }
.memory-placeholder::before { content: '♡'; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,0.3); font: 5rem var(--serif); }
.empty-state { grid-column: 1 / -1; padding: 4rem 1.5rem; border: 1px dashed rgba(83,50,67,0.25); border-radius: 24px; text-align: center; color: var(--muted); background: rgba(255,255,255,0.35); }
.empty-state span { display: block; margin-bottom: 0.7rem; color: var(--rose); font: 3rem var(--serif); }
.home-lower-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1rem; margin-top: 4rem; }
.card-panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,253,250,0.78); box-shadow: 0 16px 45px rgba(64,37,51,0.07); }
.next-event { padding: 2rem; }
.next-event h2 { margin: 0; font: 500 1.5rem var(--serif); }
.next-event strong { display: inline-block; margin: 1.6rem 0 0; color: var(--rose); font: 4.5rem/1 var(--serif); }
.next-event > span { color: var(--muted); }
.next-event > p:last-child { color: var(--muted); font-size: 0.8rem; }
.quote-card { position: relative; display: grid; place-items: center; align-content: center; min-height: 18rem; overflow: hidden; padding: 2rem; text-align: center; background: var(--ink); color: #fff9f5; }
.quote-card p { max-width: 32rem; font: 400 clamp(1.5rem, 3vw, 2.2rem)/1.6 var(--serif); }
.quote-card small { color: #dcb6ad; letter-spacing: 0.18em; }
.quote-mark { position: absolute; top: -1rem; left: 1rem; color: rgba(255,255,255,0.08); font: 12rem/1 var(--serif); }

.toolbar { display: flex; gap: 0.7rem; margin-bottom: 2rem; }
.search-box { position: relative; flex: 1; display: flex; align-items: center; }
.search-box span { position: absolute; left: 1rem; color: var(--muted); font-size: 1.2rem; }
.search-box input { padding-left: 2.8rem; }
.toolbar select { width: auto; min-width: 9rem; }
.timeline { display: grid; gap: 1.2rem; }
.timeline-item { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1.5rem; }
.timeline-date { padding-top: 1.2rem; color: var(--muted); font-size: 0.85rem; text-align: right; }
.timeline-date strong { display: block; color: var(--rose); font: 500 2rem var(--serif); }
.timeline-card { overflow: hidden; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); }
.timeline-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.timeline-photo { display: block; min-width: 0; padding: 0; border: 0; overflow: hidden; background: var(--paper-deep); cursor: zoom-in; }
.timeline-photo img { display: block; width: 100%; height: 18rem; object-fit: cover; transition: transform 220ms ease, filter 220ms ease; }
.timeline-photo:hover img { transform: scale(1.025); filter: brightness(0.94); }
.timeline-photo:focus-visible { position: relative; z-index: 1; outline: 3px solid var(--rose); outline-offset: -3px; }
.timeline-copy { padding: 1.5rem; }
.timeline-meta { display: flex; gap: 0.7rem; align-items: center; color: var(--muted); font-size: 0.75rem; }
.mood-pill { padding: 0.3rem 0.7rem; border-radius: 99px; background: var(--paper-deep); color: var(--rose-dark); }
.timeline-copy h2 { margin: 0.8rem 0 0.5rem; font: 500 2rem var(--serif); }
.timeline-copy p { white-space: pre-wrap; color: #5d5057; line-height: 1.8; }
.card-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.card-actions small { color: var(--muted); }
.delete-button { border: 0; background: none; color: #a64c5e; cursor: pointer; font-size: 0.78rem; }

.journal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.journal-card { position: relative; min-height: 18rem; padding: 2rem; overflow: hidden; }
.journal-card::after { content: ''; position: absolute; top: 0; right: 0; width: 3rem; height: 3rem; background: linear-gradient(225deg, var(--paper-deep) 50%, transparent 51%); }
.journal-card time { color: var(--rose); font-size: 0.75rem; letter-spacing: 0.1em; }
.journal-card h2 { margin: 0.8rem 0 1rem; font: 500 1.8rem var(--serif); }
.markdown { color: #5f5158; line-height: 1.75; }
.markdown h1, .markdown h2, .markdown h3 { font-family: var(--serif); }
.markdown ul { padding-left: 1.3rem; }

.wish-progress { display: grid; grid-template-columns: 9rem 1fr; align-items: center; gap: 1.5rem; padding: 1.5rem 2rem; margin-bottom: 1.2rem; }
.wish-progress strong { display: block; color: var(--rose); font: 2.5rem var(--serif); }
.wish-progress span { color: var(--muted); font-size: 0.75rem; }
.progress-track { height: 0.65rem; overflow: hidden; border-radius: 99px; background: var(--paper-deep); }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--rose), var(--blush)); transition: width 350ms ease; }
.progress-0 { width: 0% !important; }
.progress-10 { width: 10% !important; }
.progress-20 { width: 20% !important; }
.progress-30 { width: 30% !important; }
.progress-40 { width: 40% !important; }
.progress-50 { width: 50% !important; }
.progress-60 { width: 60% !important; }
.progress-70 { width: 70% !important; }
.progress-80 { width: 80% !important; }
.progress-90 { width: 90% !important; }
.progress-100 { width: 100% !important; }
.wish-list { display: grid; gap: 0.75rem; }
.wish-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; padding: 1.2rem 1.4rem; border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.wish-check { width: 1.8rem; height: 1.8rem; border: 1px solid var(--blush); border-radius: 50%; background: white; cursor: pointer; }
.wish-item.completed { opacity: 0.62; }
.wish-item.completed .wish-check { color: white; background: var(--rose); }
.wish-item.completed h3 { text-decoration: line-through; }
.wish-item h3 { margin: 0; font: 600 1.1rem var(--serif); }
.wish-item p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.82rem; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(18rem, 0.8fr); gap: 1rem; }
.settings-form { padding: 2rem; }
.settings-form h2, .security-panel h2, .trash-panel h2 { margin: 0; font: 500 1.5rem var(--serif); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.settings-side { display: grid; align-content: start; gap: 1rem; }
.security-panel { display: flex; gap: 1rem; padding: 1.4rem; }
.security-panel p { margin: 0.5rem 0 0; color: var(--muted); line-height: 1.6; font-size: 0.82rem; }
.password-form { padding: 1.4rem; }
.password-form h2 { margin: 0; font: 500 1.5rem var(--serif); }
.password-hint { margin: 0; color: var(--muted); line-height: 1.65; font-size: 0.82rem; }
.big-icon { display: grid; place-items: center; flex: 0 0 auto; width: 3rem; height: 3rem; border-radius: 50%; color: white; background: var(--rose); }
.trash-panel { padding: 1.4rem; }
.section-heading.compact { align-items: center; }
.trash-item { display: flex; justify-content: space-between; gap: 1rem; padding: 0.8rem 0; border-top: 1px solid var(--line); }
.trash-item:first-child { margin-top: 1rem; }
.trash-item span { color: var(--muted); font-size: 0.8rem; }
.restore-button { border: 0; background: none; color: var(--rose); font-weight: 800; cursor: pointer; }

.modal { width: min(42rem, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 26px; color: var(--ink); background: var(--white); box-shadow: 0 28px 90px rgba(30,18,26,0.34); }
.modal::backdrop { background: rgba(34, 22, 31, 0.6); backdrop-filter: blur(7px); }
.modal form { padding: clamp(1.4rem, 4vw, 2.3rem); }
.modal-small { width: min(32rem, calc(100% - 2rem)); }
.modal-heading { display: flex; justify-content: space-between; align-items: start; }
.modal-heading h2 { margin: 0; font: 500 2rem var(--serif); }
.modal-close { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 1.3rem; }
.upload-box { padding: 1rem; border: 1px dashed rgba(155, 77, 104, 0.4); border-radius: 16px; background: rgba(245,215,199,0.2); }
.upload-box input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-box b { padding: 0.8rem; border-radius: 12px; text-align: center; color: var(--rose); background: white; cursor: pointer; }
.upload-box small { color: var(--muted); font-weight: 400; }
.photo-preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.photo-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.photo-viewer { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; color: white; background: rgba(18, 12, 17, 0.96); }
.photo-viewer[open] { display: block; }
.photo-viewer::backdrop { background: rgba(18, 12, 17, 0.96); }
.photo-viewer-shell { position: relative; width: 100%; height: 100%; }
.photo-viewer-stage { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 0.8rem; width: 100%; height: 100%; margin: 0; padding: max(4.5rem, env(safe-area-inset-top)) clamp(4rem, 8vw, 8rem) max(1.25rem, env(safe-area-inset-bottom)); box-sizing: border-box; touch-action: pan-y; }
.photo-viewer-stage img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.photo-viewer-stage figcaption { min-height: 1.4rem; color: rgba(255,255,255,0.78); text-align: center; font-size: 0.86rem; }
.photo-viewer-close, .photo-viewer-nav { position: absolute; z-index: 2; display: grid; place-items: center; border: 1px solid rgba(255,255,255,0.22); border-radius: 50%; color: white; background: rgba(30,20,28,0.7); backdrop-filter: blur(10px); cursor: pointer; }
.photo-viewer-close { top: max(1rem, env(safe-area-inset-top)); right: max(1rem, env(safe-area-inset-right)); width: 2.8rem; height: 2.8rem; font-size: 1.8rem; }
.photo-viewer-nav { top: 50%; width: 3.5rem; height: 3.5rem; transform: translateY(-50%); font-size: 2.4rem; }
.photo-viewer-previous { left: max(1rem, env(safe-area-inset-left)); }
.photo-viewer-next { right: max(1rem, env(safe-area-inset-right)); }
.photo-viewer-close:hover, .photo-viewer-nav:hover { background: rgba(128,65,88,0.8); }
.photo-viewer-close:focus-visible, .photo-viewer-nav:focus-visible { outline: 3px solid white; outline-offset: 3px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 2rem; max-width: calc(100% - 2rem); padding: 0.85rem 1.2rem; border-radius: 99px; color: white; background: var(--ink); box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 1rem); pointer-events: none; transition: 220ms ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-nav { display: none; }

@media (max-width: 850px) {
  .login-view { grid-template-columns: 1fr; }
  .login-card { min-height: 100vh; padding: 2rem; }
  .login-quote { display: none; }
  .desktop-nav, .profile-button b { display: none; }
  .topbar { padding: 0 1rem; }
  .content-shell { width: min(100% - 1.4rem, 44rem); padding-top: 1.1rem; }
  .hero-grid, .settings-grid { grid-template-columns: 1fr; }
  .hero-card { min-height: 32rem; align-items: end; padding: 2rem 1.5rem; }
  .orbit-art { right: -5rem; top: 36%; }
  .counter-card { min-height: 16rem; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .stats-strip div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .stats-strip div:nth-child(4) { border-top: 1px solid var(--line); }
  .memory-preview-grid, .journal-grid, .home-lower-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; gap: 0.45rem; }
  .timeline-date { padding: 0; text-align: left; }
  .timeline-date strong { display: inline; margin-right: 0.4rem; font-size: 1.2rem; }
  .page-heading { align-items: start; }
  .page-heading > .button { flex: 0 0 auto; }
  .mobile-nav {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    min-height: 68px;
    padding: 0.4rem max(0.5rem, env(safe-area-inset-right)) calc(0.4rem + env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255,253,250,0.94);
    backdrop-filter: blur(18px);
  }
  .mobile-nav button { display: grid; place-items: center; gap: 0.1rem; border: 0; color: var(--muted); background: none; font-size: 0.66rem; }
  .mobile-nav button span { font-size: 1.2rem; }
  .mobile-nav button.active { color: var(--rose); }
  .mobile-nav .mobile-add { align-self: start; width: 3.3rem; height: 3.3rem; margin: -1.3rem auto 0; border-radius: 50%; color: white; background: var(--ink); font-size: 1.8rem; box-shadow: 0 10px 24px rgba(48,29,45,0.28); }
}

@media (max-width: 540px) {
  .brand small, #quick-add { display: none; }
  .hero-copy h1 { font-size: clamp(3.5rem, 19vw, 5.4rem); }
  .orbit-art { opacity: 0.5; }
  .page-heading { display: grid; }
  .page-heading > .button { justify-self: start; }
  .toolbar { display: grid; }
  .toolbar select { width: 100%; }
  .two-columns { grid-template-columns: 1fr; }
  .timeline-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline-photo img { height: 14rem; }
  .photo-viewer-stage { padding-inline: 0.75rem; }
  .photo-viewer-nav { width: 2.8rem; height: 2.8rem; font-size: 2rem; }
  .photo-viewer-previous { left: 0.75rem; }
  .photo-viewer-next { right: 0.75rem; }
  .wish-progress { grid-template-columns: 1fr; }
  .wish-item { grid-template-columns: auto 1fr; }
  .wish-item .delete-button { grid-column: 2; justify-self: start; }
}

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