:root {
  --ink: #2c3440;
  --ink-soft: #5d6673;
  --paper: #fbf8f3;
  --card: rgba(255, 255, 255, 0.86);
  --line: #e6dfd4;
  --sage: #6f8a78;
  --sage-deep: #4f6b5a;
  --sage-wash: #e8efe9;
  --dusk: #8d7aa3;
  --gold: #b9965b;
  --rose: #c98f86;
  --radius: 18px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", Helvetica, sans-serif;
}

body {
  background: linear-gradient(180deg, #f6f1ea 0%, var(--paper) 40%, #f3f5f1 100%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  min-height: 100vh;
}

/* Soft drifting light, like late afternoon through a window. */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop span {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.45;
  animation: drift 26s ease-in-out infinite alternate;
}
.backdrop span:nth-child(1) { width: 480px; height: 480px; background: #f1dcc4; top: -120px; left: -100px; }
.backdrop span:nth-child(2) { width: 420px; height: 420px; background: #dbe6dc; top: 30%; right: -140px; animation-delay: -8s; }
.backdrop span:nth-child(3) { width: 360px; height: 360px; background: #e4dcec; bottom: -140px; left: 30%; animation-delay: -16s; }
@keyframes drift { to { transform: translate(40px, 30px) scale(1.08); } }

h1, h2, h3, .brand, .title-input { font-family: var(--serif); }
h1 { font-size: clamp(2.2rem, 5vw, 3.3rem); font-weight: 500; letter-spacing: 0.01em; }
h2 { font-size: 2rem; font-weight: 600; }
h3 { font-size: 1.45rem; font-weight: 600; }

.site-header { padding: 1.1rem 0; }
.brand { font-size: 1.5rem; font-weight: 600; color: var(--sage-deep); }
.brand em { color: var(--ink); font-weight: 500; }
.brand-divider { color: var(--line); margin: 0 0.3rem; }
.prototype-pill {
  font-size: 0.8rem; color: var(--ink-soft); border: 1px solid var(--line);
  padding: 0.25rem 0.75rem; border-radius: 999px; background: var(--card);
}

.intro { max-width: 680px; margin: 1.5rem auto 2rem; }
.intro .lead { color: var(--ink-soft); font-size: 1.15rem; }

.stepper {
  display: flex; gap: 0.25rem; list-style: none; padding: 0; margin: 0 auto 1.75rem;
  max-width: 860px; counter-reset: step;
}
.stepper li {
  flex: 1; text-align: center; font-size: 0.85rem; color: var(--ink-soft);
  position: relative; counter-increment: step;
}
.stepper li button {
  display: block; width: 100%; margin: 0; padding: 2.1rem 0.15rem 0;
  border: 0; background: transparent; color: inherit; font: inherit; line-height: 1.2;
  position: relative; z-index: 0;
}
.stepper li button:disabled { cursor: default; opacity: 1; }
.stepper li.reachable button { cursor: pointer; }
.stepper li.reachable button:hover,
.stepper li button:focus-visible { color: var(--ink); }
.stepper li button:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; border-radius: 8px; }
.clear-session {
  font-size: 0.8rem; color: var(--ink-soft); border: 1px solid var(--line);
  padding: 0.25rem 0.75rem; border-radius: 999px; background: var(--card);
}
.clear-session:hover, .clear-session:focus-visible { color: var(--ink); border-color: var(--sage); }
.stepper li::before {
  content: counter(step); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 1.75rem; height: 1.75rem; border-radius: 50%; line-height: 1.75rem;
  background: #fff; border: 1px solid var(--line); font-weight: 600;
  transition: all 0.35s ease; z-index: 1; pointer-events: none;
}
.stepper li.done::before { background: var(--sage-wash); border-color: var(--sage); color: var(--sage-deep); content: "\2713"; }
.stepper li.current { color: var(--ink); font-weight: 600; }
.stepper li.current::before { background: var(--sage); border-color: var(--sage); color: #fff; box-shadow: 0 0 0 6px rgba(111, 138, 120, 0.18); }

.story-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 0.35rem;
}
.story-head h2 { margin: 0; }
.story-sample { display: flex; flex-direction: column; align-items: flex-end; flex: 0 0 auto; }
.story-sample .form-text { margin: 0.2rem 0 0; text-align: right; }
.panel {
  background: var(--card); backdrop-filter: blur(6px); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(1.25rem, 3vw, 2.25rem);
  max-width: 920px; margin: 0 auto; box-shadow: 0 20px 50px -30px rgba(44, 52, 64, 0.35);
  animation: rise 0.55s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { animation: rise 0.7s ease both; }
.stepper.reveal { animation-delay: 0.12s; }

.hint { color: var(--ink-soft); }
.optional { color: var(--ink-soft); font-weight: 400; font-size: 0.85em; margin-left: 0.25rem; }
.form-label { font-weight: 600; font-size: 0.95rem; }
.form-control {
  border-radius: 12px; border-color: var(--line); background: #fffdfa; color: var(--ink);
}
.form-control:focus { border-color: var(--sage); box-shadow: 0 0 0 0.2rem rgba(111, 138, 120, 0.2); }
.story { font-size: 1rem; line-height: 1.6; }
.lyrics { font-family: var(--serif); font-size: 1.25rem; line-height: 1.55; background: #fffdf8; }
.title-input { font-size: 1.5rem; font-weight: 600; }

.btn { border-radius: 999px; padding: 0.6rem 1.4rem; font-weight: 600; }
.btn-calm { background: var(--sage); color: #fff; border: none; }
.btn-calm:hover, .btn-calm:focus { background: var(--sage-deep); color: #fff; }
.btn-calm:disabled { background: #a9b8ad; color: #fff; }
.btn-outline-calm { border: 1px solid var(--sage); color: var(--sage-deep); background: transparent; }
.btn-outline-calm:hover { background: var(--sage-wash); color: var(--sage-deep); }
.btn-quiet { background: transparent; color: var(--ink-soft); border: none; }
.btn-quiet:hover { color: var(--ink); }
.btn-link { color: var(--sage-deep); }

.actions { display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; }

.segmented { display: inline-flex; background: #f1ece4; border-radius: 999px; padding: 4px; }
.segmented button { border: none; background: transparent; padding: 0.35rem 1rem; border-radius: 999px; color: var(--ink-soft); font-weight: 600; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06); }

.choice-group { margin-bottom: 1.25rem; }
.choice-group .label { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.5rem; display: block; }
.chip {
  display: inline-block; margin: 0 0.4rem 0.5rem 0; padding: 0.45rem 1rem; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
  transition: all 0.2s ease; font-size: 0.95rem;
}
.chip:hover { border-color: var(--sage); }
.chip.selected { background: var(--sage-wash); border-color: var(--sage); color: var(--sage-deep); font-weight: 600; }

.provider-card {
  border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.1rem; height: 100%;
  background: #fff; cursor: pointer; transition: all 0.2s ease; position: relative;
}
.provider-card:hover { border-color: var(--sage); }
.provider-card.selected { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(111, 138, 120, 0.18); }
.provider-card.disabled { opacity: 0.55; cursor: not-allowed; }
.provider-card .name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
.provider-card .meta { font-size: 0.85rem; color: var(--ink-soft); }
.provider-card .price { font-weight: 600; color: var(--ink); }
.provider-card input { position: absolute; top: 1rem; right: 1rem; accent-color: var(--sage); width: 1.1rem; height: 1.1rem; }

.tag {
  display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em;
  text-transform: uppercase; padding: 0.2rem 0.6rem; border-radius: 999px;
  background: #f1ece4; color: var(--ink-soft);
}
.tag-ai { background: var(--sage-wash); color: var(--sage-deep); }
.tag-human { background: #efe7f4; color: #6a5683; }

.warnings { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.warnings li { color: #8a5a3a; font-size: 0.92rem; padding-left: 1.25rem; position: relative; }
.warnings li::before { content: "\2022"; position: absolute; left: 0.3rem; color: var(--gold); }

.regen { display: flex; gap: 0.75rem; }
.regen .form-control { flex: 1; }

.result-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; height: 100%; display: flex; flex-direction: column;
}
.result-card h3 { margin: 0.4rem 0 0.2rem; }
.result-card audio { width: 100%; margin: 1rem 0 0.5rem; }
.result-card .grow { flex: 1; }
.status-line { color: var(--ink-soft); font-size: 0.95rem; }
.timeline { list-style: none; padding: 0; margin: 1rem 0 0; }
.timeline li { position: relative; padding: 0 0 0.75rem 1.6rem; font-size: 0.93rem; color: var(--ink-soft); }
.timeline li::before {
  content: ""; position: absolute; left: 0.3rem; top: 0.35rem; width: 0.7rem; height: 0.7rem;
  border-radius: 50%; background: var(--line);
}
.timeline li::after { content: ""; position: absolute; left: 0.62rem; top: 1.1rem; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.reached { color: var(--ink); }
.timeline li.reached::before { background: var(--sage); }
.timeline li.active::before { background: var(--gold); box-shadow: 0 0 0 5px rgba(185, 150, 91, 0.2); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(185, 150, 91, 0.05); } }

.breathing {
  display: flex; align-items: center; gap: 0.75rem; color: var(--ink-soft); margin: 1rem 0;
}
.breathing i { width: 14px; height: 14px; border-radius: 50%; background: var(--sage); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(0.7); opacity: 0.5; } 50% { transform: scale(1.15); opacity: 1; } }

.delivered-lyrics, .sung-lyrics {
  font-family: var(--serif); white-space: pre-line; font-size: 1.15rem; line-height: 1.55;
  background: #faf7f2; border-radius: 12px; padding: 0.75rem 1rem; margin-top: 0.75rem;
}
.sung-lyrics { white-space: normal; max-height: 16rem; overflow: auto; }
.lyric-section {
  display: block; margin-top: 0.7rem; font-size: 0.78rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-soft);
}
.lyric-section:first-child { margin-top: 0; }
.lyric-line { display: block; }
.lyric-word { border-radius: 0.2em; }
.lyric-word.active { background: #f3e2c2; box-shadow: 0 0 0 0.12em #f3e2c2; }
.saved-banner { color: var(--sage-deep); font-weight: 600; }
.take-list-heading { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; }
.take-list { list-style: none; padding: 0; margin: 0; }
.take-list li {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; margin-bottom: 0.5rem; cursor: pointer;
}
.take-list li:hover, .take-list li:focus { border-color: var(--sage); outline: none; }
.take-list li.take-group {
  display: block; padding: 0; border: 0; background: transparent; cursor: default;
  margin: 0 0 1rem;
}
.take-list li.take-group:hover, .take-list li.take-group:focus { border-color: transparent; }
.take-group-title {
  font-family: var(--serif); font-size: 1.25rem; font-weight: 600;
  margin: 0.35rem 0 0.45rem;
}
.take-group-songs { list-style: none; padding: 0; margin: 0; }
.take-row.is-open { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(111, 138, 120, 0.16); }
.take-list .take-meta { flex: 1; min-width: 10rem; }
.take-list .take-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; line-height: 1.2; }
.take-list audio { width: 160px; height: 32px; }
.take-lyrics { margin-top: 0.5rem; }
.take-lyrics summary { cursor: pointer; color: var(--ink-soft); font-size: 0.9rem; }

.summary { background: #faf7f2; border-radius: 14px; padding: 1.1rem 1.25rem; }
.summary .title { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; }
.add-on { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
.add-on label { display: flex; gap: 0.6rem; align-items: center; cursor: pointer; }
.add-on input { accent-color: var(--sage); }
.total { display: flex; justify-content: space-between; font-size: 1.2rem; border-top: 1px solid var(--line); padding-top: 0.75rem; }
.confirmation { margin-top: 1.5rem; text-align: center; padding: 1.5rem; border-radius: var(--radius); background: var(--sage-wash); }
.confirmation h3 { color: var(--sage-deep); }

.alert-soft { max-width: 920px; margin: 0 auto 1rem; background: #fbefe8; border: 1px solid #efd3c4; color: #7a4a33; border-radius: 14px; }
.footer-note { color: var(--ink-soft); padding: 1rem 0 2rem; }
.about-link {
  border: 0; background: transparent; color: var(--sage-deep); font: inherit;
  text-decoration: underline; cursor: pointer; padding: 0;
}
.about-link:hover, .about-link:focus-visible { color: var(--ink); }
.about-dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.6rem;
  max-width: 36rem; background: var(--paper); color: var(--ink);
}
.about-dialog::backdrop { background: rgba(44, 52, 64, 0.35); }
.about-dialog h2 { margin-bottom: 0.75rem; }
.about-dialog p { margin-bottom: 0.85rem; }

@media (max-width: 640px) {
  .stepper li { font-size: 0; }
  .stepper li::before { font-size: 0.85rem; }
  .brand { font-size: 1.2rem; }
  .brand em { display: none; }
  .brand-divider { display: none; }
  .regen { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
