:root {
  --ink: #f7ecdc;
  --ink-2: rgba(247, 236, 220, .72);
  --ink-3: rgba(247, 236, 220, .48);
  --amber: #ffbe7a;
  --amber-2: #ff8f55;
  --night: #070a1a;
  --glass: rgba(16, 15, 36, .42);
  --line: rgba(255, 226, 196, .22);
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, sans-serif;
  --pad: max(20px, env(safe-area-inset-left));
  --bottom: max(56px, calc(env(safe-area-inset-bottom) + 40px));
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.fallback {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 30% at 70% 52%, rgba(255, 150, 100, .45), transparent 70%),
    linear-gradient(#05081a 0%, #15123a 38%, #6b3550 50%, #0a0b1c 51%, #03040c 100%);
}
.no-webgl #stage { display: none; }
.scrim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(4, 6, 18, .55) 0%, rgba(4, 6, 18, 0) 26%),
    linear-gradient(to top, rgba(3, 4, 12, .8) 0%, rgba(3, 4, 12, 0) 34%);
  transition: background .8s;
}
body[data-screen="add"] .scrim, body[data-screen="share"] .scrim, body[data-screen="vault"] .scrim, body[data-screen="chapter"] .scrim { background: rgba(4, 5, 16, .55); }
.grain {
  position: fixed; inset: -50%; z-index: 2; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(5) infinite;
}
@keyframes grain { 0% { transform: translate(0, 0) } 25% { transform: translate(-3%, 2%) } 50% { transform: translate(2%, -3%) } 75% { transform: translate(-2%, -1%) } 100% { transform: translate(0, 0) } }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic--lg { width: 26px; height: 26px; }
.ic--xl { width: 34px; height: 34px; stroke-width: 1.3; }

/* ---------- top bar ---------- */
.top {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) var(--pad) 0;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.mark {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink); text-decoration: none;
  font-family: var(--serif); font-style: italic; font-size: 21px; letter-spacing: .01em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .5);
}
.mark .ic { color: var(--amber); width: 18px; height: 18px; }
body[data-screen="home"] .mark { opacity: 0; }
.dots { display: flex; gap: 7px; position: absolute; left: 50%; transform: translateX(-50%); top: max(24px, calc(env(safe-area-inset-top) + 10px)); opacity: 0; transition: opacity .4s; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 236, 214, .25); transition: background .4s, box-shadow .4s, transform .4s; }
.dots i.on { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.dots i.now { transform: scale(1.35); }
body.in-create .dots { opacity: 1; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
}
.iconbtn--big { width: 56px; height: 56px; }
.iconbtn:disabled { opacity: .3; cursor: default; }

/* ---------- screens ---------- */
#ui { position: fixed; inset: 0; z-index: 10; }
.screen {
  position: absolute; inset: 0;
  height: 100svh;
  display: flex; flex-direction: column;
  padding: calc(max(14px, env(safe-area-inset-top)) + 54px) var(--pad) var(--bottom);
  max-width: 520px; margin: 0 auto;
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity .6s ease, transform .7s cubic-bezier(.2, .7, .2, 1), visibility 0s .7s;
}
.screen.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity .8s ease .15s, transform .9s cubic-bezier(.2, .7, .2, 1) .15s, visibility 0s; }
.actions { margin-top: auto; display: grid; gap: 12px; padding-top: 14px; }
.actions--two { grid-template-columns: 1fr 1fr; }
.actions--two .btn--glow { grid-column: 1 / -1; }

.kicker {
  margin: 0 0 6px; font-size: 12px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--amber); font-weight: 600;
  text-shadow: 0 0 18px rgba(255, 170, 100, .35);
}
.display {
  font-family: 'Monsieur La Doulaise', 'Pinyon Script', cursive; font-weight: 400;
  font-size: clamp(72px, 21vw, 150px); line-height: 1.12; letter-spacing: 0; white-space: nowrap;
  margin: 2px 0 -.16em; color: #fff4e6;
}
/* written-on in warm ink, then a slow candle shimmer */
.display .word {
  display: inline-block; padding: .14em .3em .26em;
  background: linear-gradient(100deg, #fff3e2 0%, #ffdcae 30%, #ffffff 46%, #ffc98c 60%, #fff1dc 80%, #ffe0b6 100%);
  background-size: 260% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 168, 100, .5)) drop-shadow(0 2px 12px rgba(0, 0, 0, .6));
  -webkit-mask-image: linear-gradient(90deg, #000 42%, transparent 58%); mask-image: linear-gradient(90deg, #000 42%, transparent 58%);
  -webkit-mask-size: 300% 100%; mask-size: 300% 100%;
  -webkit-mask-position: 100% 0; mask-position: 100% 0;
}
.screen.is-on .display .word { animation: ink 2.6s cubic-bezier(.45, .1, .3, 1) 1s forwards, shimmer 7s ease-in-out 3.6s infinite; }
@keyframes ink { to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
@keyframes shimmer { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
.lead {
  text-wrap: balance; max-width: 22em;
  font-family: var(--serif); font-size: 23px; line-height: 1.25; color: var(--ink-2);
  margin: 16px 0 0; color: #f4e6d2; text-shadow: 0 1px 2px rgba(0, 0, 0, .7), 0 0 22px rgba(4, 5, 16, .95);
}
.reveal { opacity: 0; transform: translateY(10px); }
.screen.is-on .reveal { animation: rev 1.2s cubic-bezier(.2, .7, .2, 1) var(--d, 0s) forwards; }
@keyframes rev { to { opacity: 1; transform: none; } }

.home__title::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: 46%; width: 150%; height: 140%;
  transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(closest-side, rgba(5, 6, 18, .62), rgba(5, 6, 18, .3) 55%, transparent);
}
.home__title { position: relative; isolation: isolate; }
.screen--home { text-align: center; padding-top: calc(max(14px, env(safe-area-inset-top)) + 9svh); }
.home__title { display: grid; justify-items: center; width: 100%; }

.title {
  font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 8.6vw, 42px); line-height: 1.05;
  margin: 0 0 18px; text-align: center; color: #fff4e6;
  text-shadow: 0 2px 22px rgba(0, 0, 0, .6);
}
.title--name {
  font-family: 'Pinyon Script', var(--serif); font-style: normal; font-weight: 400; margin: 0;
  font-size: clamp(40px, 11vw, 54px); line-height: 1.15; padding: 0 .15em;
  color: #fff3e2; text-shadow: 0 0 26px rgba(255, 170, 110, .45), 0 2px 16px rgba(0, 0, 0, .65);
}

/* ---------- buttons ---------- */
.btn {
  min-height: 60px; border-radius: 999px; border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 26px; font-weight: 600; font-size: 17px; letter-spacing: .01em;
  text-decoration: none; position: relative; isolation: isolate;
  transition: transform .2s, box-shadow .3s, opacity .3s;
}
.btn:active { transform: scale(.97); }
.btn--glow {
  color: #2a1307;
  background: radial-gradient(120% 140% at 50% 0%, #fff0d6 0%, #ffc888 45%, #ff9a5c 100%);
  box-shadow: 0 0 0 1px rgba(255, 220, 170, .6) inset, 0 10px 40px -6px rgba(255, 140, 70, .65), 0 0 60px -10px rgba(255, 170, 100, .7);
}
.btn--glow::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  background-size: 250% 100%; animation: sheen 4.5s ease-in-out infinite; mix-blend-mode: soft-light;
}
@keyframes sheen { 0%, 60% { background-position: 120% 0 } 100% { background-position: -120% 0 } }
.btn--ghost {
  color: var(--ink); background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  min-height: 52px; font-size: 15px; padding: 0 16px;
}
.btn--small { min-height: 40px; padding: 0 16px; font-size: 14px; color: #2a1307; background: var(--amber); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.is-busy { pointer-events: none; }
.btn.is-busy::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(42, 19, 7, .3); border-top-color: #2a1307; animation: spin .8s linear infinite;
}
.btn.is-busy .ic { display: none; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- forms ---------- */
.screen--form .hero-space { flex: 0 0 24svh; }
.screen--form .hero-space--short { flex-basis: 12svh; }
.form { display: grid; gap: 12px; }
.form--top { padding-top: 2svh; }
.field {
  width: 100%; min-height: 56px; border-radius: 16px;
  border: 1px solid var(--line); background: rgba(10, 10, 28, .55);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 14px 18px; font-size: 18px; color: var(--ink); outline: none;
  transition: border-color .3s, box-shadow .3s, background .3s;
}
.field::placeholder { color: var(--ink-3); }
.field:focus { border-color: rgba(255, 190, 122, .75); box-shadow: 0 0 0 4px rgba(255, 170, 100, .14), 0 0 30px -6px rgba(255, 160, 90, .45); background: rgba(14, 12, 32, .7); }
.field--big { font-family: var(--serif); font-size: 28px; font-style: italic; text-align: center; min-height: 66px; }
.field--area { resize: none; font-family: var(--serif); font-size: 21px; line-height: 1.35; min-height: 110px; }
.field--tall { min-height: 0; flex: 1; }
.count { margin: -4px 4px 0; text-align: right; font-size: 13px; color: var(--ink-3); }
.years { display: grid; grid-template-columns: 1fr 34px 1fr; align-items: end; gap: 8px; }
.yr { display: grid; gap: 6px; }
.yr span { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); text-align: center; font-weight: 600; }
.yr .field { text-align: center; font-family: var(--serif); font-size: 24px; letter-spacing: .06em; }
.yr__line { height: 1px; background: linear-gradient(90deg, transparent, var(--amber), transparent); margin-bottom: 28px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.portrait-pick { display: grid; place-items: center; cursor: pointer; margin-top: 4px; }
.portrait-pick__ring {
  width: min(56vw, 230px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; position: relative; overflow: hidden;
  background: rgba(10, 10, 28, .55); border: 1.5px dashed rgba(255, 200, 150, .5);
  box-shadow: 0 0 60px -10px rgba(255, 160, 90, .5);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .3s;
}
.portrait-pick:active .portrait-pick__ring { transform: scale(.97); }
.portrait-pick__ring img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portrait-pick.has .portrait-pick__ring { border: 2px solid rgba(255, 210, 160, .85); box-shadow: 0 0 0 6px rgba(255, 190, 122, .12), 0 0 80px -6px rgba(255, 160, 90, .75); }
.portrait-pick__empty { display: grid; justify-items: center; gap: 10px; color: var(--ink-2); font-size: 15px; font-weight: 500; }

.addphoto {
  display: inline-flex; align-items: center; gap: 10px; justify-self: start;
  min-height: 48px; padding: 6px 18px 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--glass); color: var(--ink-2); font-size: 15px; font-weight: 500;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.addphoto img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; margin: -2px -10px -2px 4px; }
.addphoto.has { color: var(--amber); border-color: rgba(255, 190, 122, .5); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: grid; justify-items: center; gap: 6px; padding: 20px 10px 18px; border-radius: 22px;
  background: rgba(10, 10, 28, .55); border: 1px solid var(--line); color: var(--ink-2);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: border-color .3s, box-shadow .3s, color .3s, transform .2s;
}
.tile b { font-family: var(--serif); font-size: 23px; font-weight: 500; color: var(--ink); }
.tile small { font-size: 13px; color: var(--ink-3); }
.tile:active { transform: scale(.97); }
.tile.is-on { border-color: rgba(255, 190, 122, .85); color: var(--amber); box-shadow: 0 0 0 4px rgba(255, 170, 100, .12), 0 0 40px -8px rgba(255, 160, 90, .6); }
.dateline { display: grid; gap: 6px; }
.dateline span { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; text-align: center; }
.dateline .field { text-align: center; font-size: 20px; }

/* ---------- lighting ---------- */
.screen--center { justify-content: flex-end; align-items: center; padding-bottom: 22svh; }
.whisper { font-family: var(--serif); font-style: italic; font-size: 26px; color: var(--ink-2); margin: 0; text-shadow: 0 2px 20px rgba(0, 0, 0, .6); }
.whisper::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.6s steps(4) infinite; }
@keyframes dots { 0% { content: "" } 25% { content: "." } 50% { content: ".." } 75% { content: "..." } }

/* ---------- share ---------- */
.screen--share { gap: 18px; }
.screen--share .who { margin-top: auto; }
.who { display: grid; justify-items: center; text-align: center; gap: 6px; }
.who--small { grid-template-columns: auto 1fr; justify-items: start; text-align: left; gap: 16px; align-items: center; }
.who__photo {
  width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 60%, #ffcf95, #c8643a 60%, #43202a);
  background-size: cover; background-position: center;
  box-shadow: 0 0 0 1.5px rgba(255, 215, 170, .8), 0 0 0 7px rgba(255, 190, 122, .1), 0 0 60px -4px rgba(255, 160, 90, .7);
  font-family: var(--serif); font-size: 44px; font-style: italic; color: #2a1307;
  animation: breathe 5s ease-in-out infinite;
}
.who--small .who__photo { width: 72px; height: 72px; font-size: 32px; }
@keyframes breathe { 50% { box-shadow: 0 0 0 1.5px rgba(255, 215, 170, .8), 0 0 0 10px rgba(255, 190, 122, .07), 0 0 80px 0 rgba(255, 160, 90, .8); } }
.sharebox {
  display: grid; gap: 14px; padding: 20px; border-radius: 26px;
  background: rgba(12, 11, 30, .6); border: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.sharebox__lead { margin: 0; font-family: var(--serif); font-size: 22px; line-height: 1.2; }
.linkline {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  min-height: 52px; padding: 0 16px; border-radius: 14px; text-align: left;
  border: 1px dashed rgba(255, 200, 150, .45); background: rgba(255, 190, 122, .07); color: var(--amber);
  font-size: 15px; font-weight: 600;
}
.linkline span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sharebtns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sbtn {
  display: grid; justify-items: center; gap: 6px; padding: 12px 2px 10px; border-radius: 16px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line); color: var(--ink);
  font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.sbtn:active { transform: scale(.96); }
.keeper {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  background: none; border: 0; color: var(--ink-3); font-size: 13.5px; padding: 4px; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- capsule ---------- */
.screen--capsule { text-align: center; }
.screen--capsule .who__photo { width: 112px; height: 112px; }
.screen--capsule .title--name { font-size: clamp(46px, 13vw, 66px); margin-top: 6px; }
.years-show { margin: 0; display: inline-flex; align-items: center; gap: 12px; font-family: var(--serif); font-size: 21px; color: var(--ink-2); letter-spacing: .05em; }
.years-show i { width: 34px; height: 1px; background: linear-gradient(90deg, transparent, var(--amber), transparent); }
.words {
  margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.3; color: var(--ink-2);
  max-width: 30ch; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 14px rgba(0, 0, 0, .7);
}
.cap-mid { margin-top: auto; display: grid; justify-items: center; gap: 10px; }
.countline { margin: 0; font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--amber); font-weight: 600; text-shadow: 0 1px 12px rgba(0, 0, 0, .8); }
.tap-hint { margin: 0; font-size: 14px; color: var(--ink-3); text-shadow: 0 1px 12px rgba(0, 0, 0, .8); }
.locked {
  display: grid; justify-items: center; gap: 4px; padding: 16px 22px; border-radius: 22px;
  background: rgba(12, 11, 30, .55); border: 1px solid var(--line); color: var(--amber);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.locked__date { margin: 4px 0 0; font-family: var(--serif); font-size: 26px; color: var(--ink); }
.locked__count { margin: 0; font-size: 14px; color: var(--ink-2); }
.locked__note { margin: 6px 0 0; font-size: 14px; color: var(--ink); }
.actions--two.solo .btn--ghost { grid-column: 1 / -1; }
.small-link { display: inline-flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--amber); font-size: 14px; font-weight: 600; text-decoration: none; }
.small-link .ic { width: 17px; height: 17px; }
.screen--capsule .actions { padding-top: 16px; }

/* ---------- home: my capsules ---------- */
.mine { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mine a {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-size: 14px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); max-width: 100%;
}
.mine a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine i { width: 30px; height: 30px; border-radius: 50%; flex: none; background: radial-gradient(circle at 50% 60%, #ffcf95, #c8643a 60%, #43202a) center / cover; }

/* ---------- reader ---------- */
.reader {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) var(--pad) var(--bottom);
  background: rgba(5, 6, 16, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fadein .45s ease;
}
@keyframes fadein { from { opacity: 0 } }
.reader__bar { display: flex; justify-content: space-between; align-items: center; max-width: 560px; width: 100%; margin: 0 auto; }
.reader__count { font-size: 13px; letter-spacing: .22em; color: var(--amber); font-weight: 600; }
.reader__track { flex: 1; min-height: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 14px calc(-1 * var(--pad)); }
.reader__track::-webkit-scrollbar { display: none; }
.card {
  flex: 0 0 100%; scroll-snap-align: center; display: flex; justify-content: center; align-items: center;
  padding: 0 var(--pad); min-height: 0;
}
.card__in {
  width: 100%; max-width: 520px; max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 26px 24px 22px; border-radius: 28px; position: relative;
  background: linear-gradient(180deg, rgba(40, 28, 44, .78), rgba(16, 14, 34, .82));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 220, 180, .22);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8), 0 0 60px -30px rgba(255, 160, 90, .6) inset;
}
.card__mark { display: block; width: 26px; height: 26px; color: var(--amber); margin: -4px auto 14px; filter: drop-shadow(0 0 8px rgba(255, 170, 100, .8)); }
.card__photo { width: 100%; max-height: 34svh; object-fit: cover; border-radius: 18px; display: block; margin-bottom: 18px; }
.card__text { font-family: var(--serif); font-size: 24px; line-height: 1.38; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #fff4e6; }
.card__text--empty { font-style: italic; color: var(--ink-2); display: flex; align-items: center; gap: 10px; }
.card__text--empty .ic { color: var(--amber); width: 28px; height: 28px; }
.card__by { margin: 18px 0 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--amber); font-weight: 600; font-size: 15px; }
.card__by small { color: var(--ink-3); font-weight: 500; font-size: 13px; }
.card__hide { margin-top: 14px; display: inline-flex; gap: 8px; align-items: center; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; color: var(--ink-3); font-size: 13px; }
.card.is-hidden .card__in { opacity: .45; }
.reader__nav { display: flex; justify-content: center; gap: 22px; }

/* ---------- toast + alert ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 58px); transform: translate(-50%, -12px);
  padding: 12px 20px; border-radius: 999px; background: #fff0dc; color: #2a1307; font-weight: 600; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; white-space: nowrap;
  box-shadow: 0 10px 40px -10px rgba(255, 150, 80, .7);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.alert {
  position: fixed; z-index: 70; left: var(--pad); right: var(--pad); top: calc(max(14px, env(safe-area-inset-top)) + 54px);
  max-width: 500px; margin: 0 auto; padding: 14px 16px; border-radius: 18px;
  background: #2b1418; border: 1px solid #ff8f6a; color: #ffe6dc;
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8);
}
.alert p { margin: 0; font-size: 15px; }
.alert b { color: #ffb08f; }

/* ---------- capsule action row ---------- */
.row3 { display: flex; gap: 10px; }
.row3 > * { flex: 1; min-width: 0; }
.btn--stack { flex-direction: column; gap: 3px; min-height: 60px; padding: 6px 4px; font-size: 13.5px; border-radius: 20px; }

/* ---------- memory vault ---------- */
.screen--vault { gap: 14px; }
.vault-head { text-align: center; display: grid; justify-items: center; gap: 2px; }
.vault-head .title { margin: 0; }
.title--script { font-family: 'Pinyon Script', var(--serif); font-size: clamp(42px, 12vw, 56px); line-height: 1.15; padding: 0 .15em; text-shadow: 0 0 26px rgba(255, 170, 110, .45), 0 2px 16px rgba(0, 0, 0, .65); }
.vault-sub { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); text-shadow: 0 1px 10px rgba(0, 0, 0, .8); }
.chap-icon { color: var(--amber); filter: drop-shadow(0 0 10px rgba(255, 170, 100, .7)); margin-bottom: 4px; }
.chapters, .plist {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 0 -6px; padding: 4px 6px 10px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14px, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 14px, #000 calc(100% - 22px), transparent);
}
.chapters::-webkit-scrollbar, .plist::-webkit-scrollbar { display: none; }
.chapters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.chap {
  position: relative; overflow: hidden; display: grid; justify-items: start; gap: 4px; text-align: left;
  padding: 14px 14px 16px; border-radius: 20px; min-height: 104px;
  background: rgba(12, 11, 30, .58); border: 1px solid var(--line); color: var(--ink);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: transform .2s, border-color .3s;
}
.chap:active { transform: scale(.97); }
.chap .ic { color: var(--amber); }
.chap b { font-family: var(--serif); font-size: 20px; font-weight: 500; line-height: 1.1; }
.chap small { font-size: 12.5px; color: var(--ink-3); font-weight: 600; letter-spacing: .04em; }
.chap i { position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--p) * 100%); background: linear-gradient(90deg, #ffcf95, #ff8f55); box-shadow: 0 0 10px rgba(255, 150, 80, .8); }
.chap.has { border-color: rgba(255, 190, 122, .45); }
.plist { display: grid; gap: 8px; align-content: start; }
.prow {
  display: flex; align-items: center; gap: 12px; text-align: left; min-height: 58px;
  padding: 12px 14px; border-radius: 16px; color: var(--ink);
  background: rgba(12, 11, 30, .58); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.prow:active { transform: scale(.98); }
.prow .ic { color: var(--ink-3); }
.prow span { flex: 1; font-family: var(--serif); font-size: 19px; line-height: 1.2; }
.prow em { font-style: normal; font-size: 12px; font-weight: 700; min-width: 24px; height: 24px; border-radius: 12px; display: grid; place-items: center; background: var(--amber); color: #2a1307; padding: 0 7px; }
.prow.has { border-color: rgba(255, 190, 122, .4); }
.prow.has .ic { color: var(--amber); }

.askbox {
  display: grid; gap: 8px; padding: 18px 18px 14px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, rgba(60, 36, 44, .7), rgba(18, 15, 36, .7));
  border: 1px solid rgba(255, 200, 150, .35); box-shadow: 0 0 50px -16px rgba(255, 150, 80, .6);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.askbox__chap { margin: 0; font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--amber); font-weight: 700; }
.askbox__q { margin: 0; font-family: var(--serif); font-size: 26px; line-height: 1.18; color: #fff4e6; text-wrap: balance; }
.askbox__tools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--ink-2); font-size: 13.5px; font-weight: 600;
}
.chip .ic { width: 16px; height: 16px; color: var(--amber); }
.addrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.addphoto.is-wanted { color: #2a1307; background: var(--amber); border-color: var(--amber); box-shadow: 0 0 30px -6px rgba(255, 160, 90, .8); }
.addphoto.is-wanted.has { color: #2a1307; }
.card__q { margin: 0 0 14px; font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); font-weight: 700; text-align: center; line-height: 1.5; }
@media (max-height: 700px) {
  .askbox__q { font-size: 22px; }
  .askbox { padding: 14px 14px 12px; }
  .chap { min-height: 92px; padding: 12px; }
}

/* ---------- small phones ---------- */
@media (max-height: 700px) {
  .screen { padding-top: calc(max(10px, env(safe-area-inset-top)) + 48px); }
  .screen--form .hero-space { flex-basis: 17svh; }
  .screen--form .hero-space--short { flex-basis: 6svh; }
  .title { font-size: 31px; margin-bottom: 12px; }
  .field--area { min-height: 92px; }
  .portrait-pick__ring { width: min(48vw, 190px); }
  .screen--capsule .who__photo { width: 88px; height: 88px; }
  .who__photo { width: 88px; height: 88px; }
  .screen--capsule .title--name { font-size: 44px; margin-top: 2px; }
  .words { font-size: 18px; -webkit-line-clamp: 2; }
  .sharebox { padding: 16px; gap: 10px; }
  .btn { min-height: 56px; }
  .btn--ghost { min-height: 48px; }
  .lead { font-size: 21px; }
}
@media (min-width: 900px) {
  .screen { max-width: 560px; }
}
@media (prefers-reduced-motion: reduce) {
  .grain, .btn--glow::after, .who__photo { animation: none; }
  .reveal, .screen.is-on .reveal { animation: none; opacity: 1; filter: none; transform: none; }
  .display .word, .screen.is-on .display .word { animation: none; -webkit-mask-image: none; mask-image: none; }
}
#vaultBtn { border-color: rgba(255, 190, 122, .6); color: #ffe3c2; box-shadow: 0 0 26px -8px rgba(255, 160, 90, .7); }
#vaultBtn .ic { color: var(--amber); }

/* ---------- spacing pass ---------- */
.lead span { display: block; text-wrap: balance; }
.lead span + span { margin-top: 2px; }
@media (max-width: 420px) { .lead { font-size: 21px; } }
.kicker { margin-bottom: 0; }

/* back button sits on the left; the wordmark makes room for it */
#backBtn { position: absolute; left: var(--pad); top: max(14px, env(safe-area-inset-top)); }
.dots { top: calc(max(14px, env(safe-area-inset-top)) + 18.5px); }
.mark { transition: opacity .3s; }
body:has(#backBtn:not([hidden])) .mark { opacity: 0; pointer-events: none; }

/* form screens: the lantern space grows, fields sit close to the button */
.screen--form .hero-space { flex: 1 1 24svh; min-height: 15svh; max-height: 36svh; }
.screen--form .actions { padding-top: 18px; }

/* add a memory: the writing box fills the free height */
.screen[data-screen="add"] .form { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.screen[data-screen="add"] .title { margin-bottom: 4px; }
.screen[data-screen="add"] #mText { flex: 1 1 auto; min-height: 110px; max-height: 360px; height: auto; }
.screen[data-screen="add"] .actions { margin-top: 0; }
.addrow { justify-content: space-between; }

/* share: group centred, even rhythm */
.screen--share { gap: 16px; }
.screen--share .who { margin-top: auto; padding: 0 4px; }
.screen--share .actions { margin-top: auto; }
.who--small .kicker { margin-bottom: 2px; }
.who--small .title--name { font-size: clamp(38px, 10.5vw, 48px); line-height: 1.05; padding: 0; text-align: left; }

/* capsule: breathing room between blocks */
.screen--capsule .who { gap: 4px; }
.screen--capsule .years-show { margin-top: -2px; }
.screen--capsule .words { margin-top: 6px; }
.cap-mid { gap: 6px; padding-bottom: 2px; }
.screen--capsule .actions { gap: 10px; }

/* vault */
.screen--vault { gap: 12px; }
.vault-head .kicker { margin-bottom: -2px; }
.chap b { margin-top: 2px; }
.prow { padding: 12px 14px 12px 16px; }
@media (max-width: 520px) { .lead span + span { max-width: 13.5em; margin-inline: auto; } }

.screen--capsule .title--name { line-height: 1.02; }
.cap-mid { justify-items: center; }
.cap-mid > * { max-width: 100%; }
@media (max-height: 700px) {
  .words { font-size: 17px; -webkit-line-clamp: 3; }
  .screen--capsule .who__photo { width: 80px; height: 80px; }
}
@media (max-height: 700px) {
  .screen { padding-top: calc(max(14px, env(safe-area-inset-top)) + 54px); }
}
.vault-head .title--script, .who--small .title--name { font-family: 'Pinyon Script', var(--serif); }
.vault-head .title--script { font-size: clamp(40px, 11.5vw, 54px); line-height: 1.12; margin-top: 2px; }
.chap, .prow { background: rgba(14, 12, 32, .8); }
@media (max-height: 700px) {
  .chap { min-height: 84px; padding: 10px 12px 12px; gap: 2px; }
  .chap b { font-size: 18.5px; }
}
.sbtn { font-size: 12px; padding: 12px 0 10px; letter-spacing: -.01em; }
.sharebtns { gap: 7px; }
.card__in { scrollbar-width: none; }
.card__in::-webkit-scrollbar { display: none; }
.card__photo { max-height: 30svh; }
@media (max-height: 700px) {
  .card__photo { max-height: 24svh; margin-bottom: 14px; }
  .card__text { font-size: 21px; }
  .card__in { padding: 20px 20px 18px; }
  .card__mark { margin-bottom: 10px; }
}
@media (min-width: 700px) { .lead { font-size: 26px; max-width: none; } }
