/* Willi web — visual language mirrored from the iOS app's Theme.swift.
   background 250/245/235, card 255/252/247, accent 217/148/77 (amber),
   sage 130/153/125, textPrimary 51/46/38, textSecondary 115/107/97. */

:root {
  --bg: rgb(250, 245, 235);
  --card: rgb(255, 252, 247);
  --accent: rgb(217, 148, 77);
  --accent-dark: rgb(190, 122, 55);
  --sage: rgb(130, 153, 125);
  --sage-dark: rgb(104, 126, 99);
  --line: rgba(60, 45, 25, 0.10);
  --text: rgb(51, 46, 38);
  --text-soft: rgb(115, 107, 97);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius: 20px;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 50% -140px, rgba(217, 148, 77, 0.16), transparent 60%),
    radial-gradient(900px 500px at 110% 20%, rgba(130, 153, 125, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg), rgb(245, 238, 225));
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(250, 245, 235, 0.85);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
}
.brand-text {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
}
/* Minimal top bar: a single "More" button opens the full section menu,
   so the front door stays calm instead of showing an 8-item nav. */
.nav-more { position: relative; }
.more-btn {
  border: 1px solid var(--line);
  background: rgba(255, 252, 248, 0.7);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 9px 16px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-soft);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.more-btn:hover { color: var(--text); border-color: rgba(60, 45, 25, 0.2); }
.more-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(60, 45, 25, 0.14);
  z-index: 30;
}
.more-menu[hidden] { display: none; }
.more-menu a {
  text-decoration: none;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 10px;
  transition: background 0.15s, color 0.15s;
}
.more-menu a:hover { background: rgba(217, 148, 77, 0.1); color: var(--text); }
.more-menu a.active { color: var(--accent-dark); background: rgba(217, 148, 77, 0.12); }

/* ---------- Layout ---------- */
.app {
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 24px) 60px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 26px);
}

/* ---------- Home ---------- */
.hero {
  text-align: center;
  padding: clamp(20px, 6vw, 50px) 0 30px;
}
.hero-mark {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.15;
}
.hero .subtitle {
  font-family: var(--serif);
  font-style: italic;
  color: var(--accent-dark);
  font-size: clamp(17px, 3vw, 22px);
  margin: 0 0 6px;
}
.hero .byline {
  color: var(--text-soft);
  font-size: 16px;
  margin: 0 0 28px;
}
.hero p.lede {
  max-width: 560px;
  margin: 0 auto 30px;
  font-size: 18px;
  color: var(--text);
}
.cta-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.home-blurbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 44px;
}
.home-blurbs .card h3 {
  font-family: var(--serif);
  margin: 0 0 8px;
  font-size: 20px;
}
.home-blurbs .card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 16px;
  padding: 13px 24px;
  border-radius: 16px;
  text-decoration: none;
  transition: transform 0.12s ease, opacity 0.12s, background 0.12s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: transparent;
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.btn-secondary:hover { background: rgba(217, 148, 77, 0.1); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Book list ---------- */
.page-head { margin-bottom: 24px; }
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(26px, 5vw, 36px);
  margin: 0 0 4px;
}
.page-head .subtitle {
  font-family: var(--serif);
  font-style: italic;
  color: var(--accent-dark);
  font-size: 18px;
  margin: 0 0 6px;
}
.page-head p { color: var(--text-soft); margin: 0; }

.chapter-list { display: flex; flex-direction: column; gap: 12px; }
.chapter-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s ease, box-shadow 0.12s;
}
.chapter-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.09);
}
.chapter-num {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
}
.chapter-meta { flex: 1; min-width: 0; }
.chapter-meta .title {
  font-weight: 700;
  font-size: 17px;
  display: block;
}
.chapter-meta .theme {
  color: var(--text-soft);
  font-size: 14px;
}
.chapter-row .chevron { color: var(--text-soft); font-size: 20px; }

/* ---------- Reader ---------- */
.reader-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.reader-head .num {
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
}
.reader-head .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
}
.reader-head h1 {
  font-family: var(--serif);
  font-size: clamp(24px, 4.5vw, 32px);
  margin: 2px 0 0;
  line-height: 1.2;
}

.reader-body { font-family: var(--serif); font-size: 19px; }
.reader-body p { margin: 0 0 20px; }
.reader-body .epigraph {
  background: var(--card);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 0 0 26px;
  box-shadow: var(--shadow);
}
.reader-body .epigraph .quote { font-style: italic; margin: 0; }
.reader-body .epigraph .attr {
  color: var(--sage);
  font-family: var(--sans);
  font-size: 15px;
  margin-top: 8px;
}
.reader-body h2 {
  font-family: var(--serif);
  font-size: 24px;
  margin: 34px 0 14px;
}
.reader-body h3 {
  font-family: var(--sans);
  color: var(--accent-dark);
  font-size: 18px;
  margin: 26px 0 10px;
}
.reader-body ul { margin: 0 0 20px; padding-left: 4px; list-style: none; }
.reader-body li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
}
.reader-body li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 11px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.reader-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
}

/* narration bar */
.narration-bar {
  position: sticky;
  bottom: 16px;
  margin-top: 30px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  padding: 12px 16px;
}
.narration-bar .play {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.narration-bar .play:hover { background: var(--accent-dark); }
.narration-bar .seek {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.narration-bar .seek:hover { background: rgba(0, 0, 0, 0.06); }
.narration-bar .label { flex: 1; min-width: 0; }
.narration-bar .label .state { font-weight: 700; font-size: 15px; }
.narration-bar .label .count { color: var(--text-soft); font-size: 13px; }
.narration-bar .stop {
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 22px;
  cursor: pointer;
  padding: 8px;
}
.pdf-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: var(--card);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}
.pdf-download:hover { background: var(--accent); color: #fff; }
.pdf-download .icon { flex: none; }

/* ---------- Willi chat ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 220px); min-height: 420px; }
.chat-intro { margin-bottom: 16px; }
.chat-intro h1 { font-family: var(--serif); margin: 0 0 4px; font-size: clamp(24px,4vw,32px); }
.chat-intro p { color: var(--text-soft); margin: 0; }
.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 6px 2px;
}
.bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble.willi {
  align-self: flex-start;
  background: var(--card);
  box-shadow: var(--shadow);
  font-family: var(--serif);
}
.bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}
.bubble.typing { color: var(--text-soft); font-style: italic; }
.bubble.willi { position: relative; }
.speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-top: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  vertical-align: middle;
}
.speak-btn:hover { background: rgba(217, 148, 77, 0.16); color: var(--accent-dark); }
.speak-btn.playing { background: var(--accent); color: #fff; }
.speak-btn.failed { background: rgb(178, 76, 60); color: #fff; }
.speak-btn .speak-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: speak-spin 0.7s linear infinite;
}
@keyframes speak-spin { to { transform: rotate(360deg); } }
.chat-input-row {
  display: flex;
  gap: 10px;
  padding-top: 14px;
}
.chat-input-row textarea {
  flex: 1;
  resize: none;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 16px;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 16px;
  background: var(--card);
  color: var(--text);
  max-height: 120px;
}
.chat-input-row textarea:focus { outline: 2px solid var(--accent); }
.chat-disclaimer {
  text-align: center;
  color: var(--text-soft);
  font-size: 12px;
  margin-top: 10px;
}

/* "Willi is listening" indicator — shown on the input bar while the mic is
   capturing voice, so it's always clear when you're being heard. */
.listening-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 10px;
  border-radius: 100px;
  background: rgba(178, 76, 60, 0.10);
  border: 1px solid rgba(178, 76, 60, 0.32);
}
.listening-bar.on { display: flex; }
.listening-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgb(178, 76, 60);
  flex-shrink: 0;
  animation: listening-pulse 1.4s ease-in-out infinite;
}
@keyframes listening-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(1.3); }
}
.listening-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgb(178, 76, 60);
  flex-shrink: 0;
}
.listening-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  height: 26px;
  min-width: 60px;
}
.listening-wave span {
  flex: 1;
  height: 100%;
  border-radius: 2px;
  transform: scaleY(0.25);
  transform-origin: center;
  background: linear-gradient(var(--accent), rgb(178, 76, 60));
  animation: listening-wave 0.9s ease-in-out infinite;
}
@keyframes listening-wave {
  0%, 100% { transform: scaleY(0.25); }
  50%      { transform: scaleY(1); }
}
.listening-time {
  font-size: 13px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
@media (prefers-reduced-motion: reduce) {
  .listening-dot, .listening-wave span { animation: none; }
  .listening-wave span { transform: scaleY(0.6); }
}
.chat-error {
  background: rgba(217, 148, 77, 0.12);
  color: var(--accent-dark);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 10px;
}

/* ---------- Crisis card ----------
   Shown when the backend safety screen trips. Calm, warm, and clearly
   distinct from an ordinary reply, with one-tap ways to reach a human. */
.crisis-card {
  background: rgba(130, 153, 125, 0.10);
  border: 1px solid rgba(130, 153, 125, 0.45);
  border-left: 5px solid var(--sage);
  border-radius: 16px;
  padding: 18px 20px;
  margin: 6px 0 14px;
  max-width: 100%;
}
.crisis-badge {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgb(74, 96, 70);
  margin-bottom: 8px;
}
.crisis-card p {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 16px;
}
.crisis-card p:last-of-type { margin-bottom: 14px; }
.crisis-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.btn-crisis {
  background: var(--sage);
  color: #fff;
  text-decoration: none;
}
.btn-crisis:hover { background: rgb(108, 130, 103); }
.btn-crisis-outline {
  background: transparent;
  color: rgb(74, 96, 70);
  box-shadow: inset 0 0 0 2px var(--sage);
  text-decoration: none;
}
.btn-crisis-outline:hover { background: rgba(130, 153, 125, 0.12); }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 30px 20px 40px;
  color: var(--text-soft);
  font-size: 13px;
  border-top: 1px solid rgba(0,0,0,0.05);
}
.site-footer p { margin: 4px 0; }
.footer-soft { opacity: 0.8; max-width: 520px; margin: 8px auto 0; }

/* ---------- Shared bits for the app views ---------- */
.icon { display: inline-flex; vertical-align: middle; }
.icon.big { color: var(--accent); opacity: 0.8; }
.icon.big.rose { color: rgb(204, 115, 115); }
.serif { font-family: var(--serif); }

.page-head.with-action {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.section-title {
  font-weight: 700;
  color: var(--text-soft);
  margin: 26px 0 12px;
}

.card-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}
.thought-card .thought-text {
  font-family: var(--serif);
  font-size: 19px;
  margin: 0;
}

/* link rows (Today quick links, exercises) */
.link-list, .entry-list, .practice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 12px;
  transition: transform 0.12s ease, box-shadow 0.12s;
}
.link-list .link-card, .entry-list .link-card { margin-bottom: 0; }
.link-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,0.09); }
.link-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
}
.c-accent { background: var(--accent); }
.c-sage { background: var(--sage); }
.c-rose { background: rgb(204, 115, 115); }
.c-plum { background: rgb(140, 128, 179); }
.tile-icon.c-accent, .tile-icon.c-sage { background: none; color: var(--accent); }
.tile-icon.c-sage { color: var(--sage); }
.link-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.link-title { font-weight: 700; font-size: 16px; }
.link-sub { color: var(--text-soft); font-size: 14px; }
.link-card .chevron { color: var(--text-soft); font-size: 20px; }
.ring { flex: none; display: grid; place-items: center; }

/* practice steps */
.practice-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--sans);
  color: var(--text);
}
.practice-step .step-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(130, 153, 125, 0.15);
  color: var(--sage);
}
.practice-step.done { opacity: 0.7; }
.practice-step.done .step-icon { background: var(--sage); color: #fff; }
.step-prompt { font-family: var(--serif); color: var(--text-soft); font-size: 15px; }
.streak-capsule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(217, 148, 77, 0.12);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  border-radius: 999px;
  padding: 9px 16px;
  margin-bottom: 16px;
}
.streak-capsule .icon { color: var(--accent); }
.blessing {
  text-align: center;
  background: rgba(217, 148, 77, 0.10);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-top: 18px;
}
.blessing .icon { color: var(--accent); }
.blessing-title { font-family: var(--serif); font-size: 19px; margin: 10px 0 6px; }
.blessing-sub { color: var(--text-soft); font-size: 15px; margin: 0; }
.trophy-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(217, 148, 77, 0.12);
  white-space: nowrap;
}

/* stat tiles + badges */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.stat-tile { display: flex; flex-direction: column; gap: 2px; padding: 16px; }
.tile-value { font-size: 32px; font-weight: 700; }
.tile-unit, .tile-label { color: var(--text-soft); font-size: 13px; }
.badge-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 22px 0 10px;
}
.badge-cat { font-weight: 700; }
.badge-count { color: var(--text-soft); font-weight: 700; font-size: 13px; }
.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 16px 12px;
  opacity: 0.85;
}
.badge-card.earned { opacity: 1; }
.badge-card .badge-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(115, 107, 97, 0.12);
  color: rgba(115, 107, 97, 0.6);
}
.badge-card.earned .badge-icon { background: var(--accent); color: #fff; }
.badge-title { font-weight: 700; font-size: 14px; }
.badge-blurb { color: var(--text-soft); font-size: 12px; }
.badge-earned {
  color: var(--accent-dark);
  background: rgba(217, 148, 77, 0.12);
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
}
.badge-progress-label { color: var(--text-soft); font-size: 11px; }
.badge-progress {
  width: 80%;
  height: 4px;
  border-radius: 2px;
  background: rgba(0,0,0,0.08);
  overflow: hidden;
}
.badge-progress-fill { display: block; height: 100%; background: var(--sage); }

/* forms */
.big-input {
  width: 100%;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  font-size: 17px;
  padding: 14px 16px;
  resize: vertical;
  box-shadow: var(--shadow);
}
.big-input:focus { outline: 2px solid var(--accent); }
.line-input { resize: none; }
.form-row { margin-top: 14px; display: flex; gap: 10px; }
.form-error { color: rgb(178, 76, 60); font-size: 14px; margin-top: 8px; min-height: 1em; }
.btn-full { width: 100%; justify-content: center; margin-top: 14px; }
/* Google renders its own button into this box and owns how it looks —
   their branding rules don't allow restyling it, so this only positions
   it. min-height reserves the space so the card doesn't jump when the
   button finally arrives from Google's async script. */
.invite-google {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  min-height: 44px;
}
/* display:flex above outranks the browser's own [hidden] rule, so without
   this the button stays on screen after someone has already asked. */
.invite-google[hidden] { display: none; }
/* Sits under "Open in the Willi app". Quiet, because it is a caveat and
   not an instruction — most people should read it and do nothing. */
.invite-app-note {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 0 0;
  text-align: center;
}
.btn-small { padding: 9px 16px; font-size: 14px; }
.btn .icon, .btn svg { flex: none; }
.gratitude-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.gi-heart { color: rgb(204, 115, 115); display: inline-flex; flex: none; }

/* entry cards (journal, gratitude, reframes, reflections) */
.entry-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
}
a.entry-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,0.09); }

/* A small "read the whole thing" toggle under a clamped past reframe. */
.entry-expand {
  align-self: flex-start;
  margin-top: 2px;
  padding: 0;
  border: none;
  background: none;
  color: var(--sage, #82997d);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.entry-expand:hover { text-decoration: underline; }

/* "The storm blows away" when a past reframe is let go: the card washes to a
   calm sage-blue, lifts and tilts, then drifts up-and-away while the list
   closes the gap behind it. */
.entry-card { max-height: 800px; }
.entry-card.removing {
  pointer-events: none;
  overflow: hidden;
  transform-origin: 60% 60%;
  animation: storm-blow-away 0.72s cubic-bezier(0.4, 0, 0.5, 1) forwards;
}
@keyframes storm-blow-away {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
    background: linear-gradient(rgba(130, 153, 125, 0), rgba(130, 153, 125, 0)), #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
  }
  22% {
    opacity: 1;
    transform: translate(0, -6px) rotate(-1.5deg) scale(1.02);
    /* soft sage-blue wash */
    background: linear-gradient(rgba(122, 160, 168, 0.4), rgba(130, 153, 125, 0.4)), #fff;
    box-shadow: 0 16px 34px rgba(122, 160, 168, 0.28);
  }
  55% {
    opacity: 0.85;
    transform: translate(14px, -34px) rotate(5deg) scale(0.98);
    max-height: 800px;
    background: linear-gradient(rgba(122, 160, 168, 0.35), rgba(130, 153, 125, 0.35)), #fff;
  }
  100% {
    opacity: 0;
    transform: translate(46px, -96px) rotate(11deg) scale(0.88);
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    background: linear-gradient(rgba(122, 160, 168, 0.2), rgba(130, 153, 125, 0.2)), #fff;
  }
}
@media (prefers-reduced-motion: reduce) {
  .entry-card.removing { animation-duration: 0.3s; }
}

/* "Warm lift-away" when a gratitude list is released: the card washes to a
   soft rose-gold, swells, then floats gently up-and-away as the list closes. */
.entry-card.lifting-away {
  pointer-events: none;
  overflow: hidden;
  transform-origin: 50% 70%;
  animation: gratitude-lift-away 0.72s cubic-bezier(0.34, 0, 0.4, 1) forwards;
}
@keyframes gratitude-lift-away {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    background: linear-gradient(rgba(217, 148, 77, 0), rgba(204, 102, 102, 0)), #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
  }
  25% {
    opacity: 1;
    transform: translateY(-4px) scale(1.03);
    background: linear-gradient(rgba(217, 148, 77, 0.32), rgba(204, 102, 102, 0.28)), #fff;
    box-shadow: 0 18px 38px rgba(204, 102, 102, 0.26);
  }
  60% {
    opacity: 0.85;
    transform: translateY(-40px) scale(0.99);
    max-height: 800px;
    background: linear-gradient(rgba(217, 148, 77, 0.28), rgba(204, 102, 102, 0.24)), #fff;
  }
  100% {
    opacity: 0;
    transform: translateY(-108px) scale(0.9);
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    background: linear-gradient(rgba(217, 148, 77, 0.15), rgba(204, 102, 102, 0.12)), #fff;
  }
}
@media (prefers-reduced-motion: reduce) {
  .entry-card.lifting-away { animation-duration: 0.3s; }
}
.entry-date { color: var(--text-soft); font-size: 13px; }
.entry-text { font-family: var(--serif); white-space: pre-wrap; }
.entry-text.soft { color: var(--text-soft); }
.clamp, .clamp2, .clamp3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp { -webkit-line-clamp: 4; }
.clamp2 { -webkit-line-clamp: 2; }
.clamp3 { -webkit-line-clamp: 3; }
.entry-flag, .entry-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--accent-dark);
  font-size: 13px;
}
.entry-note { color: var(--text-soft); border-top: 1px solid rgba(0,0,0,0.06); padding-top: 8px; }
.entry-note .icon, .entry-flag .icon { color: var(--accent); }
.gratitude-item { display: flex; align-items: flex-start; gap: 8px; font-family: var(--serif); }
.gratitude-item .gi-heart { margin-top: 4px; }
.divider { border-top: 1px solid rgba(0,0,0,0.06); }

.willi-note {
  background: rgba(217, 148, 77, 0.08);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 14px;
}
.willi-note-head {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}
.willi-note p { margin: 0; }
.reflect-wrap { margin-top: 4px; }

/* icon buttons */
.icon-btn {
  border: none;
  background: rgba(0,0,0,0.05);
  color: var(--text-soft);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: rgba(0,0,0,0.09); }
.icon-btn.on { background: var(--accent); color: #fff; }
.icon-btn.danger { color: rgb(178, 76, 60); }
.icon-btn.corner { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; }
.icon-btn.mic { width: 44px; height: 44px; background: rgba(217,148,77,0.12); color: var(--accent-dark); }
.icon-btn.mic.recording { background: rgb(178, 76, 60); color: #fff; }

/* reframe result */
.reframe-result {
  background: rgba(130, 153, 125, 0.12);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.reframe-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sage);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}
.reframe-block p { margin: 0; }
.reframe-closing { font-style: italic; color: var(--text-soft); margin: 0; }
/* saving the past list to a file — deliberately quiet, below the list */
.reframe-export { margin-top: 20px; }
.reframe-export-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.reframe-export-note {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 0 0;
}
/* while choosing which reframes to send, each card is a checkbox */
.entry-card.picking { cursor: pointer; padding-right: 48px; }
.entry-card.picked { box-shadow: 0 0 0 2px var(--sage) inset; }
.reframe-pick {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--sage);
  cursor: pointer;
}

/* exercises */
.reader-head .num.icon-num { font-size: inherit; }
.exercise-prompt p { margin: 0 0 14px; font-size: 17px; }
.exercise-prompt p:last-child { margin-bottom: 0; }
.exercise-prompt .bullet-line { padding-left: 10px; }

/* chat additions */
.chat-head { margin-bottom: 10px; }
.chat-tools { display: flex; gap: 8px; }
.typing-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(217, 148, 77, 0.6);
  animation: dotpulse 1s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes dotpulse {
  0%, 100% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1.25); opacity: 1; }
}
.chat-input-row { align-items: flex-end; }

/* empty states */
.empty-state {
  text-align: center;
  padding: 40px 24px;
}
.empty-state h2 { font-family: var(--serif); font-size: 22px; margin: 14px 0 8px; }
.empty-state p { color: var(--text-soft); max-width: 440px; margin: 0 auto 18px; }

/* ---------------------------------------------------------------------
   Song of the Week — a reflection from Hal on the Today page, plus a
   full-reflection detail view. Design mirrors the approved front-door
   mockup.
   --------------------------------------------------------------------- */
.song-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(60, 45, 25, 0.07);
  text-align: left;
}
.song-top { display: flex; gap: 14px; align-items: center; }
.song-cover {
  width: 66px; height: 66px; border-radius: 16px; flex: none;
  position: relative; overflow: hidden;
  background: linear-gradient(145deg, var(--sage), var(--sage-dark));
  box-shadow: 0 6px 16px rgba(104, 126, 99, 0.4);
  display: grid; place-items: center;
}
.song-cover::before {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.18);
}
.song-cover::after {
  content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--sage-dark);
}
.song-meta { flex: 1; min-width: 0; }
.song-eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px;
  font-weight: 800; color: var(--sage-dark); margin-bottom: 3px;
}
.song-title { font-family: var(--serif); font-weight: 600; font-size: 19px; line-height: 1.2; }
.song-artist { color: var(--text-soft); font-size: 14px; margin-top: 2px; }
.song-reflect {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: flex-start;
  text-decoration: none; color: var(--text);
}
.song-reflect p { color: var(--text); }
.song-reflect .mark {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; flex: none; font-family: var(--serif);
}
.song-reflect p { margin: 0; font-family: var(--serif); font-size: 15.5px; line-height: 1.55; }
.song-foot { margin-top: 12px; font-size: 12.5px; color: var(--text-soft); font-weight: 600; }
.song-actions { display: flex; gap: 9px; margin-top: 14px; flex-wrap: wrap; }
.btn-listen {
  flex: 1; min-width: 150px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark)); color: #fff;
  border: none; border-radius: 13px; padding: 11px; font-weight: 700; font-size: 14.5px;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 6px 14px rgba(217, 148, 77, 0.35);
}
.btn-reflect {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; color: var(--sage-dark); border: 1.5px solid var(--sage);
  border-radius: 13px; padding: 11px 16px; font-weight: 700; font-size: 14.5px;
  cursor: pointer; text-decoration: none;
}

/* Full reflection detail view (#/song) */
.song-detail .song-detail-head {
  display: flex; gap: 16px; align-items: center; margin-bottom: 8px;
}
.song-detail .song-cover { width: 84px; height: 84px; border-radius: 18px; }
.song-detail-body {
  font-family: var(--serif); font-size: 17px; line-height: 1.7; color: var(--text);
  white-space: pre-wrap;
}
.song-detail-body p { margin: 0 0 1em; }
.song-signoff { color: var(--text-soft); font-style: italic; margin-top: 6px; }

/* ---------------------------------------------------------------------
   Front door (Today) — a calm, conversation-first landing that matches
   the approved redesign mockup: greeting, a word from Willi, a primary
   "say anything" input, then a quote, the song of the week, and tiles
   to the rest of the app.
   --------------------------------------------------------------------- */
.frontdoor { max-width: 520px; margin: 0 auto; }

.greeting {
  font-family: var(--serif);
  font-size: clamp(26px, 6vw, 30px);
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin: 6px 2px 8px;
}
.greeting .warm { color: var(--accent-dark); font-style: italic; }
.frontdoor .sub {
  color: var(--text-soft);
  margin: 0 2px 18px;
  font-size: 16px;
  line-height: 1.55;
}

.willi-line { display: flex; gap: 11px; align-items: flex-start; margin: 4px 0 14px; }
.willi-line .mark {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; font-family: var(--serif);
  box-shadow: 0 4px 10px rgba(217, 148, 77, 0.3);
}
.willi-bubble {
  background: var(--card); border-radius: 20px; border-top-left-radius: 6px;
  padding: 15px 17px; font-family: var(--serif); font-size: 17px; line-height: 1.55;
  box-shadow: 0 6px 20px rgba(60, 45, 25, 0.06); border: 1px solid rgba(255, 255, 255, 0.6);
}

.input-shell {
  position: relative; margin: 4px 0 6px; border-radius: 24px; padding: 2px;
  background: linear-gradient(135deg, rgba(217, 148, 77, 0.55), rgba(130, 153, 125, 0.45));
  box-shadow: 0 10px 28px rgba(60, 45, 25, 0.1);
}
.input-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 22px; padding: 8px 8px 8px 18px;
}
.input-row input {
  flex: 1; border: none; background: transparent; outline: none;
  font-family: var(--serif); font-size: 16px; color: var(--text);
}
.input-row input::placeholder { color: var(--text-soft); opacity: 0.85; }
.input-row .mic {
  width: 42px; height: 42px; border-radius: 50%; border: none; flex: none;
  background: rgba(217, 148, 77, 0.14); color: var(--accent-dark);
  font-size: 18px; cursor: pointer; display: grid; place-items: center;
}
.input-row .mic.recording { background: rgba(217, 148, 77, 0.32); }
.input-row .send {
  width: 42px; height: 42px; border-radius: 50%; border: none; flex: none;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark)); color: #fff;
  font-size: 19px; cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(217, 148, 77, 0.4);
}

.section-label {
  display: flex; align-items: center; gap: 12px; margin: 26px 2px 14px;
  font-size: 12.5px; text-transform: uppercase; letter-spacing: 1.2px;
  font-weight: 800; color: var(--sage-dark);
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.quote-card {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 252, 248, 0.95), rgba(245, 238, 225, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 22px;
  padding: 22px 22px 20px; box-shadow: 0 8px 24px rgba(60, 45, 25, 0.07);
}
.quote-card .qmark {
  position: absolute; top: -14px; left: 14px; font-family: var(--serif); font-weight: 600;
  font-size: 96px; color: rgba(217, 148, 77, 0.16); line-height: 1;
}
.quote-eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px;
  font-weight: 800; color: var(--accent-dark); margin-bottom: 8px;
}
.quote-text {
  font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.5;
  position: relative; z-index: 1; margin: 0;
}
.quote-foot {
  margin-top: 12px; font-size: 13px; color: var(--text-soft);
  display: flex; align-items: center; gap: 6px;
}
.quote-foot .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--sage); }

/* The way into the rest of the app: tiles, not a nav bar. Same shape as
   the blessing card above them, so the front door reads as one column. */
.tile-list { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 4px; }
/* Reframe stands on its own under the blessing card, so it carries the
   spacing the list would otherwise have given it. */
.frontdoor > .nav-tile { margin: 12px 0 4px; }
.nav-tile {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--text);
  transition: transform 0.12s ease, box-shadow 0.12s;
}
.nav-tile:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.09); }
.nav-tile-orb {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--sage));
}
.nav-tile-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nav-tile-label { font-family: var(--serif); font-size: 18px; }
.nav-tile-sub { color: var(--text-soft); font-size: 13px; }
.nav-tile-chev { margin-left: auto; color: var(--text-soft); font-size: 22px; flex: none; }

.crisis-strip {
  display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  margin: 22px 0 4px; padding: 12px; font-size: 13.5px; color: var(--sage-dark);
  background: rgba(130, 153, 125, 0.12); border-radius: 14px; border: 1px solid rgba(130, 153, 125, 0.2);
}
.crisis-strip a { color: var(--accent-dark); font-weight: 800; text-decoration: none; }

@media (max-width: 540px) {
  .brand-text { display: none; }
  .bubble { max-width: 90%; }
}

/* ---------- Celebration ---------- */
.celebrate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(40, 30, 18, 0);
  transition: background 0.26s ease;
  overflow: hidden;
}
.celebrate.in { background: rgba(40, 30, 18, 0.42); }
.celebrate.leaving { background: rgba(40, 30, 18, 0); }

.celebrate-card {
  position: relative;
  z-index: 2;
  width: min(360px, 100%);
  text-align: center;
  background: var(--card);
  border-radius: 26px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  padding: 30px 26px 24px;
  transform: translateY(16px) scale(0.94);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.26s ease;
}
.celebrate.in .celebrate-card { transform: translateY(0) scale(1); opacity: 1; }
.celebrate.leaving .celebrate-card { transform: translateY(10px) scale(0.96); opacity: 0; }

.medallion {
  width: 84px;
  height: 84px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: radial-gradient(circle at 32% 28%, #f0b968, var(--accent) 62%, var(--accent-dark));
  box-shadow: 0 10px 26px rgba(217, 148, 77, 0.45), inset 0 2px 6px rgba(255, 255, 255, 0.35);
  animation: medallion-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.3) 0.05s both;
}
.medallion.sun {
  background: radial-gradient(circle at 32% 28%, #ffd98a, #f0b043 60%, var(--accent-dark));
}
@keyframes medallion-pop {
  0%   { transform: scale(0.2) rotate(-24deg); opacity: 0; }
  70%  { transform: scale(1.12) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

.celebrate-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent-dark);
  margin-bottom: 6px;
}
.celebrate-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.celebrate-sub { margin-top: 8px; font-size: 14.5px; color: var(--text-soft); }
.celebrate-more { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--sage-dark); }

.celebrate-streak {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(217, 148, 77, 0.14);
}
.celebrate-streak .flame { display: inline-flex; }

.celebrate-done { margin-top: 22px; width: 100%; }

.confetti { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.confetti span {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation-name: confetti-fall;
  animation-timing-function: cubic-bezier(0.3, 0.2, 0.6, 1);
  animation-iteration-count: 1;
}
@keyframes confetti-fall {
  0%   { transform: translateY(-12px) rotate(0); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .celebrate, .celebrate-card { transition: opacity 0.2s ease; transform: none; }
  .celebrate.in .celebrate-card { transform: none; }
  .medallion { animation: none; }
  .confetti { display: none; }
}

/* Access-code gate — the private "enter your code" overlay. */
.gate {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(40, 30, 18, 0);
  transition: background 0.22s ease;
}
.gate.in { background: rgba(40, 30, 18, 0.5); }
.gate.leaving { background: rgba(40, 30, 18, 0); }

.gate-card {
  width: min(360px, 100%);
  text-align: center;
  background: var(--card);
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  padding: 28px 24px 22px;
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  transition: transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.15), opacity 0.22s ease;
}
.gate.in .gate-card { transform: translateY(0) scale(1); opacity: 1; }
.gate.leaving .gate-card { transform: translateY(10px) scale(0.97); opacity: 0; }

.gate-title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  color: var(--text);
}
.gate-sub { margin-top: 8px; font-size: 14.5px; color: var(--text-soft); line-height: 1.45; }

.gate-input {
  width: 100%;
  margin-top: 18px;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.gate-input:focus { outline: none; border-color: var(--accent); }
.gate-err { min-height: 18px; margin-top: 8px; font-size: 13px; color: var(--sage-dark); }
.gate .btn-full + .btn-full { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  .gate, .gate-card { transition: opacity 0.2s ease; transform: none; }
  .gate.in .gate-card { transform: none; }
}

/* ── Home streak card ───────────────────────────────────────────────
   The web parallel of the iOS home-screen widget. A grown streak grows
   the flame; a lapsed one reads "Begin again," never failure. */
.streak-card {
  display: block;
  margin: 18px 0 4px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(60, 45, 25, 0.04);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.streak-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(60, 45, 25, 0.08); }
.streak-card.lit { border-color: rgba(217, 148, 77, 0.35); }

.streak-main { display: flex; align-items: center; gap: 14px; }
.streak-flamewrap { display: flex; align-items: baseline; gap: 6px; min-width: 54px; }

.streak-flame { color: rgba(115, 107, 97, 0.5); line-height: 0; }
.streak-flame.lit { color: var(--accent); }
.streak-flame.tier-1 { font-size: 30px; }
.streak-flame.tier-2 { font-size: 34px; }
.streak-flame.tier-3 { font-size: 38px; }
.streak-flame.tier-4 { font-size: 42px; }
.streak-flame.lit svg { filter: drop-shadow(0 1px 1px rgba(190, 122, 55, 0.35)); }
.streak-flame.milestone svg { filter: drop-shadow(0 0 8px rgba(217, 148, 77, 0.55)); }

.streak-count {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--text);
}
.streak-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.streak-headline-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.streak-headline { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--text); }
.streak-sub { font-size: 13px; color: var(--text-soft); }

/* The named flame tier — Ember → Flame → Hearth → Beacon. A small pill that
   deepens in color as the flame climbs, so growth feels earned. */
.streak-tier {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 999px;
  color: #fff;
  background: rgba(115, 107, 97, 0.5);
  line-height: 1.5;
}
.streak-tier.tier-1 { background: #d9944d; }
.streak-tier.tier-2 { background: #cf7f32; }
.streak-tier.tier-3 { background: #b8632a; }
.streak-tier.tier-4 {
  background: linear-gradient(135deg, #b8632a, #d9944d);
  box-shadow: 0 0 10px rgba(217, 148, 77, 0.5);
}

/* The next-milestone goal + personal best — a gentle target, never a threat. */
.streak-goal { margin-top: 14px; }
.streak-goal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}
.streak-goal-label { font-size: 13px; font-weight: 600; color: var(--text); }
.streak-best { font-size: 12px; color: var(--text-soft); white-space: nowrap; }
.streak-best.best-now {
  color: var(--accent-dark);
  font-weight: 700;
}
.streak-goal-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(115, 107, 97, 0.16);
  overflow: hidden;
}
.streak-goal-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}
@media (prefers-reduced-motion: reduce) {
  .streak-goal-fill { transition: none; }
}

/* Rest days — the compassionate freeze. A soft, low-key line: banked rests
   in muted ink, or a warm accent note the morning after one is spent. */
.streak-rest {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-soft);
}
.streak-rest-icon { display: flex; color: var(--sage); line-height: 0; }
.streak-rest.kept { color: var(--accent-dark); font-weight: 600; }
.streak-rest.kept .streak-rest-icon { color: var(--accent); }

.streak-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.streak-dots { display: flex; gap: 7px; }
.streak-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(115, 107, 97, 0.4);
  background: transparent;
}
.streak-dot.done { background: var(--accent); border-color: var(--accent); }
.streak-dot.today { border-width: 1.6px; border-color: var(--accent); }

.streak-cta {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  padding: 8px 14px;
  border-radius: 999px;
}
.streak-card:hover .streak-cta { background: var(--accent-dark); }

@media (prefers-reduced-motion: reduce) {
  .streak-card, .streak-card:hover { transform: none; transition: none; }
}

/* The Practice Path invitation card, sat right under the Willi box on   */
/* the front door — the primary way in. Warmer than the streak card so   */
/* it reads as the main call, with a slim progress track along the base. */
.path-card {
  display: block;
  margin: 18px 0 4px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(217, 148, 77, 0.12), rgba(217, 148, 77, 0.04));
  border: 1px solid rgba(217, 148, 77, 0.32);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(60, 45, 25, 0.04);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.path-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(190, 122, 55, 0.14); }

.path-card-main { display: flex; align-items: center; gap: 14px; }
.path-card-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  min-width: 46px;
  border-radius: 50%;
  background: rgba(217, 148, 77, 0.16);
  color: var(--accent);
  line-height: 0;
}
.path-card-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.path-card-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.path-card-headline { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--text); }
.path-card-sub { font-size: 13px; color: var(--text-soft); line-height: 1.4; }

.path-card-track {
  margin-top: 14px;
  height: 6px;
  border-radius: 999px;
  background: rgba(217, 148, 77, 0.18);
  overflow: hidden;
}
.path-card-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .path-card, .path-card:hover { transform: none; transition: none; }
  .path-card-fill { transition: none; }
}

/* ------------------------------------------------------------------ */
/* Practice Path — the guided chapter journey (path map, player,      */
/* next-day check-in). Mirrors PathMapView / ChapterPlayerView.       */
/* ------------------------------------------------------------------ */
.path-points {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.path-points-icon { color: var(--accent); display: flex; }
.path-points-text { display: flex; flex-direction: column; gap: 2px; }
.path-points-num {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}
.path-points-sub { font-size: 13px; color: var(--text-soft); }

/* Check-in banner (path map) + the check-in page. */
.checkin-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  margin-bottom: 12px;
}
.checkin-icon { color: var(--accent); display: flex; }
.checkin-text { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.checkin-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.checkin-eyebrow.big {
  display: block;
  letter-spacing: 0.1em;
  color: var(--sage-dark);
  margin-bottom: 10px;
}
.checkin-line {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--text);
}
.checkin-chev { color: var(--text-soft); display: flex; }
.checkin-promise {
  font-size: 20px;
  color: var(--text);
  margin-bottom: 16px;
}
.checkin-ask { color: var(--text-soft); margin: 0 0 16px; }
.checkin-skip {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border: none;
  border-radius: 14px;
  background: rgba(130, 153, 125, 0.14);
  color: var(--sage-dark);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.checkin-skip:hover { background: rgba(130, 153, 125, 0.22); }

/* The vertical path map of chapter nodes. */
.path-map { display: flex; flex-direction: column; }
.path-node {
  display: flex;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}
.path-node.locked { opacity: 0.55; }
.path-rail { display: flex; flex-direction: column; align-items: center; }
.path-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--accent);
}
.path-dot.completed { background: var(--accent); color: #fff; }
.path-dot.current { background: rgba(217, 148, 77, 0.25); color: var(--accent-dark); }
.path-dot.future { background: var(--card); box-shadow: inset 0 0 0 1.5px var(--accent); }
.path-dot.locked { background: var(--card); box-shadow: inset 0 0 0 1.5px rgba(130,153,125,0.5); color: var(--sage-dark); }
.path-connector {
  width: 2px;
  flex: 1;
  min-height: 28px;
  background: rgba(217, 148, 77, 0.25);
  margin: 2px 0;
}
.path-node-body { display: flex; flex-direction: column; gap: 4px; padding-bottom: 18px; flex: 1; }
.path-ch-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage);
}
.path-ch-title { font-family: var(--serif); font-size: 19px; color: var(--text); }
.path-ch-theme { font-family: var(--serif); font-size: 14px; color: var(--text-soft); }
.path-caption { font-size: 12px; font-weight: 600; color: var(--text-soft); margin-top: 2px; }
.path-caption.done { color: var(--accent-dark); }

/* Segmented step progress (used on the map and in the player header). */
.path-progress-wrap { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.path-progress { display: flex; gap: 4px; flex: 1; }
.path-seg {
  height: 5px;
  flex: 1;
  border-radius: 3px;
  background: rgba(130, 153, 125, 0.22);
}
.path-seg.done { background: var(--accent); }
.path-seg.current { background: rgba(217, 148, 77, 0.5); }
.path-progress-count { font-size: 12px; color: var(--text-soft); font-weight: 600; }

/* The chapter player. */
.path-player { max-width: 640px; margin: 0 auto; }
.player-head { margin-bottom: 20px; }
.player-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-dark);
  text-decoration: none;
  margin-bottom: 10px;
}
.player-title { font-family: var(--serif); font-size: 24px; margin: 0 0 10px; color: var(--text); }
.player-steptype {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage-dark);
}
.player-read {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  box-shadow: 0 1px 3px rgba(60, 45, 25, 0.06);
}
.player-read p { font-size: 18px; line-height: 1.65; color: var(--text); margin: 0 0 16px; }
.player-read p:last-child { margin-bottom: 0; }
.player-prompt {
  background: rgba(217, 148, 77, 0.08);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}
.player-prompt-eyebrow {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 8px;
}
.player-prompt p { font-size: 18px; line-height: 1.55; color: var(--text); margin: 0; }
.player-commit-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--sage-dark);
  margin: 4px 0 8px;
}
.player-continue { width: 100%; margin-top: 20px; }
.player-continue.dim { opacity: 0.5; }

/* Completion screen. */
.player-done { text-align: center; padding: 24px 8px; }
.player-done-bloom { color: var(--accent); margin-bottom: 12px; animation: bloom 0.8s ease-out; }
@keyframes bloom {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.player-done h1 { font-family: var(--serif); font-size: 26px; color: var(--text); margin: 0 0 14px; }
.player-done-commit { font-size: 17px; color: var(--text-soft); margin: 0 auto 18px; max-width: 460px; }
.player-done-points {
  display: inline-block;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(217, 148, 77, 0.14);
  padding: 8px 20px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.player-tomorrow {
  display: flex;
  gap: 12px;
  text-align: left;
  max-width: 480px;
  margin: 0 auto 20px;
  align-items: flex-start;
}
.player-tomorrow-icon { color: var(--sage); display: flex; padding-top: 2px; }
.player-tomorrow p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-soft); }
.player-done .btn-primary { display: inline-block; min-width: 160px; }
.player-done-link {
  display: block;
  margin-top: 14px;
  background: none;
  border: none;
  color: var(--sage-dark);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.player-done-link:hover { color: var(--accent-dark); }

@media (prefers-reduced-motion: reduce) {
  .player-done-bloom { animation: none; }
}

/* ------------------------------------------------------------------ */
/* Backup — "Your journey, saved": local export/import on the         */
/* Progress page. Nothing leaves the browser except the saved file.   */
/* ------------------------------------------------------------------ */
.backup-section {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid rgba(115, 107, 97, 0.18);
}
.backup-title {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--text);
  margin: 0 0 8px;
}
.backup-note {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 16px;
}
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.backup-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.backup-status {
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 600;
  min-height: 1.2em;
}
.backup-status.ok { color: var(--sage-dark); }
.backup-status.err { color: rgb(178, 76, 60); }

/* ------------------------------------------------------------------ */
/* The reader list — a quiet invitation to hear when the book is out.  */
/* Styled like the sage cards, not like a marketing banner: it should  */
/* read as an offer, not a demand, and it disappears once accepted.    */
/* ------------------------------------------------------------------ */
.signup-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 22px 0 4px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(130, 153, 125, 0.12), rgba(130, 153, 125, 0.04));
  border: 1px solid rgba(130, 153, 125, 0.30);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(60, 45, 25, 0.04);
}
.signup-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: rgba(130, 153, 125, 0.18);
  color: var(--sage-dark);
}
.signup-copy { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.signup-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sage-dark);
}
.signup-headline { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--text); }
.signup-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-soft); line-height: 1.5; }

.signup-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.signup-row input {
  flex: 1;
  min-width: 180px;
  padding: 11px 14px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.signup-row input:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(130, 153, 125, 0.18);
}
.signup-btn {
  padding: 11px 18px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: rgb(255, 252, 247);
  background: var(--sage-dark);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
.signup-btn:hover { background: var(--sage); }
.signup-btn:disabled { opacity: 0.6; cursor: default; }

.signup-note { margin: 8px 0 0; font-size: 12px; color: var(--text-soft); line-height: 1.45; }
.signup-note.warn { color: rgb(178, 76, 60); font-weight: 600; }

.signup-card.done { align-items: center; }

/* ---------------------------------------------------------------------
   Send a blessing — the one door in Willi that opens outward.
   --------------------------------------------------------------------- */

/* The front-door invitation. */
.blessing-card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
}
a.blessing-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,0.09); }
.bless-orb {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--sage));
}
.bless-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bless-title { font-family: var(--serif); font-size: 18px; }
.bless-sub { color: var(--text-soft); font-size: 13px; }
.bless-chev { margin-left: auto; color: var(--text-soft); font-size: 22px; flex: none; }

/* The occasion chips — pick the moment, get a starting place. */
.occasion-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
  margin-bottom: 18px;
}
.occasion {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(60, 45, 25, 0.10);
  background: rgba(255, 252, 247, 0.7);
  color: var(--text-soft);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.occasion svg { flex: none; color: var(--sage); }
.occasion:hover { background: rgba(130, 153, 125, 0.10); }
.occasion:active { transform: scale(0.98); }
.occasion.on { background: var(--sage); border-color: transparent; color: #fff; }
.occasion.on svg { color: #fff; }

/* Willi's pen — an intention, and two ways to hand him the writing. */
.willis-pen {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: inset 0 0 0 1px rgba(130, 153, 125, 0.32);
  margin-bottom: 18px;
}
.willis-pen .section-title { margin-top: 0; }
.willis-pen .line-input {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(60, 45, 25, 0.10);
  background: var(--card);
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
}
.willis-pen .line-input {
  background: rgba(250, 245, 235, 0.7);
}
.willis-pen .line-input:focus { outline: 2px solid var(--sage); }

/* Both pen buttons share the row evenly and stay on one line — at 16px the
   labels wrap on a narrow phone, which reads as an accident. */
.pen-btn {
  flex: 1;
  justify-content: center;
  font-size: 14px;
  padding: 12px 10px;
  white-space: nowrap;
}
.form-error.crisis { color: var(--text); white-space: pre-line; line-height: 1.6; }

/* A quiet note under a field. */
.field-note { color: var(--text-soft); font-size: 13px; margin: 8px 0 0; }

/* What you see after it's gone. */
.blessing-sent { padding-top: 12px; }
.sent-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--sage));
}
.blessing-sent h2 { font-family: var(--serif); font-size: 26px; margin: 16px 0 8px; }
.blessing-sent p { color: var(--text-soft); margin: 0 0 20px; }
