/* THE UNSENT LETTER · Mila Aurelle
 * Dark cozy-night aesthetic: deep plum night, candlelight amber,
 * paper cream. Mobile-first, 9:16-friendly.
 */
:root {
  --night: #14101d;
  --night-2: #1d1529;
  --plum: #2a1f3d;
  --cream: #f6ead8;
  --paper: #f9f1e3;
  --ink: #2b2135;
  --amber: #f2b25c;
  --ember: #ff7a3d;
  --rose: #e8909e;
  --gold: #e8c476;
  --muted: #b9a8c9;
  --line: rgba(246, 234, 216, 0.16);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--night);
  color: var(--cream);
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #fff8, transparent),
    radial-gradient(1px 1px at 68% 8%, #fff6, transparent),
    radial-gradient(1.5px 1.5px at 84% 34%, #ffe9c4aa, transparent),
    radial-gradient(1px 1px at 32% 64%, #fff5, transparent),
    radial-gradient(1px 1px at 52% 88%, #fff4, transparent),
    radial-gradient(1.5px 1.5px at 8% 78%, #ffe9c4aa, transparent),
    radial-gradient(1px 1px at 92% 66%, #fff5, transparent),
    radial-gradient(1px 1px at 44% 12%, #fff6, transparent);
}

.app {
  position: relative; z-index: 1;
  max-width: 640px; margin: 0 auto; padding: 28px 20px 40px;
}

.screen { display: block; animation: rise .45s ease both; }
.screen[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.kicker {
  text-transform: uppercase; letter-spacing: .22em; font-size: 11px;
  color: var(--amber); margin: 0 0 10px;
}
.title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 9vw, 58px); line-height: 1.05; margin: 0 0 18px;
  color: var(--cream);
}
.h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 6vw, 34px); margin: 0 0 8px; line-height: 1.2;
}
.h3 { font-size: 18px; margin: 26px 0 8px; }
.h3__sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.sub { color: var(--muted); margin: 0 0 18px; }

.mila-card {
  background: linear-gradient(160deg, var(--plum), var(--night-2));
  border: 1px solid var(--line); border-radius: 18px;
  padding: 18px; margin: 0 0 18px;
  display: flex; gap: 14px; align-items: flex-start;
}
.mila-card--small { padding: 14px; }
.mila-card__avatar { font-size: 34px; line-height: 1; flex: 0 0 auto; }
.mila-card__says { margin: 0; font-size: 16.5px; }
.mila-card__says::before { content: "Mila says — "; font-weight: 700; color: var(--rose); }

.privacy-line {
  font-size: 13.5px; color: var(--muted);
  border-left: 3px solid var(--gold); padding-left: 12px; margin: 0 0 20px;
}
.privacy-line--small { font-size: 12.5px; }

.disclosure {
  margin-top: 26px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 14px; text-align: center;
}

/* buttons */
.btn {
  font: inherit; font-weight: 700; border: none; border-radius: 999px;
  padding: 14px 28px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.97); }
.btn--primary {
  background: linear-gradient(135deg, var(--amber), var(--ember));
  color: #241708; box-shadow: 0 6px 24px rgba(242, 178, 92, .35);
}
.btn--primary:hover { box-shadow: 0 8px 30px rgba(242, 178, 92, .5); }
.btn--ghost {
  background: transparent; color: var(--cream);
  border: 1px solid var(--line); font-weight: 600;
}
.btn--sm { padding: 8px 16px; font-size: 13.5px; }
.btn--fire {
  background: linear-gradient(135deg, #ff9a3d, #e23c1e); color: #fff;
  box-shadow: 0 6px 28px rgba(255, 122, 61, .5); font-size: 18px;
}
.btn--danger { border-color: rgba(226, 60, 30, .5); color: #f0a08a; }
.btn-row { display: flex; gap: 14px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.btn-row--center { justify-content: center; }
.linklike {
  background: none; border: none; color: var(--muted); font: inherit;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
  padding: 10px 4px; font-size: 14px; display: inline-block; margin-top: 14px;
}
.linklike:hover { color: var(--cream); }

/* recipient grid */
.recipient-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 440px) { .recipient-grid { grid-template-columns: 1fr; } }
.recipient {
  font: inherit; text-align: left; cursor: pointer;
  background: linear-gradient(160deg, var(--plum), var(--night-2));
  border: 1px solid var(--line); border-radius: 16px; padding: 16px;
  color: var(--cream); transition: transform .15s ease, border-color .15s ease;
}
.recipient:hover { transform: translateY(-2px); border-color: var(--amber); }
.recipient__emoji { font-size: 30px; display: block; margin-bottom: 8px; }
.recipient__name { font-weight: 700; display: block; font-size: 16px; }
.recipient__tag { font-size: 13px; color: var(--muted); display: block; margin-top: 4px; }

/* writing desk */
.desk { display: grid; gap: 16px; }
.desk__paper {
  background:
    repeating-linear-gradient(var(--paper) 0 30px, #efe2cb 30px 31px);
  border-radius: 6px 18px 6px 18px; padding: 20px 18px 12px; color: var(--ink);
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.desk__paper-head { font-family: Georgia, serif; font-size: 18px; margin-bottom: 6px; }
.desk__textarea {
  width: 100%; min-height: 220px; resize: vertical;
  font-family: Georgia, serif; font-size: 17px; line-height: 31px;
  background: transparent; border: none; color: var(--ink); padding: 0;
}
.desk__textarea:focus { outline: 2px dashed var(--amber); outline-offset: 6px; }
.desk__foot {
  display: flex; justify-content: space-between; font-size: 12.5px;
  color: #8a7a5f; border-top: 1px dashed #d8c7a6; padding-top: 8px; margin-top: 6px;
}
.nudges {
  background: rgba(42, 31, 61, .7); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px;
}
.nudges__head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; font-weight: 700; margin-bottom: 10px; flex-wrap: wrap;
}
.nudges__list { margin: 0 0 12px; padding-left: 20px; }
.nudges__list li { margin-bottom: 10px; font-size: 15px; color: var(--cream); }
.nudges__list li.locked { color: var(--muted); filter: blur(3px); user-select: none; }

/* ritual choice */
.ritual-grid { display: grid; gap: 14px; }
@media (min-width: 520px) { .ritual-grid { grid-template-columns: 1fr 1fr; } }
.ritual-card {
  font: inherit; cursor: pointer; text-align: left; color: var(--cream);
  background: linear-gradient(160deg, var(--plum), var(--night-2));
  border: 1px solid var(--line); border-radius: 18px; padding: 20px;
  display: grid; gap: 8px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.ritual-card:hover { transform: translateY(-3px); border-color: var(--amber); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.ritual-card__emoji { font-size: 44px; }
.ritual-card__name { font-size: 20px; font-weight: 800; }
.ritual-card__tag { color: var(--amber); font-size: 14px; font-weight: 600; }
.ritual-card__says { color: var(--muted); font-size: 14.5px; }

/* burn stage */
.burn-stage {
  position: relative; width: 100%; max-width: 420px; margin: 0 auto 18px;
  aspect-ratio: 600 / 760;
}
#burn-canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 14px; }
.burn-letter {
  position: absolute; left: 12%; right: 12%; top: 8%; bottom: 8%;
  background: var(--paper); color: var(--ink); border-radius: 4px;
  padding: 22px 18px; font-family: Georgia, serif; font-size: 14px; line-height: 1.7;
  overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  transform-origin: 50% 100%;
}
.burn-letter.ignited { animation: char 6s ease forwards; }
@keyframes char {
  0% { filter: none; }
  60% { filter: sepia(.8) brightness(.6); transform: rotate(-1.5deg); }
  100% { filter: brightness(.05); transform: rotate(-3deg) scale(.92); opacity: .25; }
}
.burn-hint { text-align: center; color: var(--muted); margin-top: 12px; min-height: 24px; }
#btn-ignite { display: block; margin: 0 auto; }

/* seal stage */
.seal-stage { display: grid; place-items: center; padding: 30px 0; }
.envelope { position: relative; width: min(78vw, 340px); aspect-ratio: 1.6; perspective: 600px; }
.envelope__body {
  position: absolute; inset: 0; border-radius: 10px;
  background: linear-gradient(150deg, #3a2b52, #241a38);
  border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.envelope__flap {
  position: absolute; left: 0; right: 0; top: 0; height: 52%;
  background: linear-gradient(180deg, #4a3866, #33244c);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center; transition: transform 1.2s ease;
  border-radius: 10px 10px 0 0;
}
.envelope.sealed .envelope__flap { transform: rotateX(180deg); }
.envelope__wax {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px;
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a7a, #c22e3d 70%);
  box-shadow: 0 4px 14px rgba(0,0,0,.5), inset 0 2px 6px rgba(255,255,255,.35);
  display: grid; place-items: center;
  transition: transform .5s cubic-bezier(.2, 1.6, .4, 1);
}
.envelope.sealed .envelope__wax { transform: translate(-50%, -50%) scale(1); }
.envelope__wax span {
  font-family: Georgia, serif; font-weight: 700; color: #ffe9e4; font-size: 26px;
}
.envelope__to {
  position: absolute; bottom: 12px; left: 0; right: 0; text-align: center;
  color: var(--muted); font-size: 13px; font-style: italic;
}
#btn-stamp { display: block; margin: 0 auto; }

/* finale */
.finale-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 6px; }
.safety-note {
  background: rgba(232, 196, 118, .1); border: 1px solid rgba(232, 196, 118, .4);
  border-radius: 14px; padding: 14px 16px; font-size: 14.5px; margin: 10px 0 0;
}
.share-block { margin-top: 8px; }
#share-canvas {
  width: 100%; max-width: 340px; height: auto; display: block; margin: 12px auto;
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--night-2);
}
.copy-ok { min-height: 22px; color: var(--gold); font-size: 14px; text-align: center; }

/* vault */
.vault-list { display: grid; gap: 10px; margin-bottom: 18px; }
.vault-item {
  font: inherit; text-align: left; cursor: pointer; color: var(--cream);
  background: linear-gradient(160deg, var(--plum), var(--night-2));
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  display: grid; gap: 4px; width: 100%;
}
.vault-item__title { font-weight: 700; }
.vault-item__meta { font-size: 12.5px; color: var(--muted); }
.vault-empty { color: var(--muted); font-style: italic; }
.vault-reader {
  background: var(--paper); color: var(--ink); border-radius: 12px;
  padding: 20px 18px; margin-bottom: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.vault-reader__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.vault-reader__head span { font-family: Georgia, serif; font-weight: 700; font-size: 18px; }
.vault-reader__head .linklike { color: #8a7a5f; margin: 0; }
.vault-reader__meta { font-size: 12.5px; color: #8a7a5f; margin: 6px 0 12px; }
.vault-reader__body {
  font-family: Georgia, serif; font-size: 16.5px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word; margin: 0 0 16px;
  max-height: 320px; overflow-y: auto;
}

/* footer */
.footer { text-align: center; padding: 30px 20px 46px; color: var(--muted); font-size: 12.5px; }
.footer__small { font-size: 11.5px; opacity: .8; }

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .burn-letter.ignited { animation-duration: .01s; }
}
