:root {
  --bg: #f7f3ee;
  --ink: #2c2622;
  --ink-soft: #6b6058;
  --accent: #8b4a2e;
  --accent-soft: #b9744f;
  --line: #ddd2c5;
  --card: #fffdfa;
  --shadow: 0 1px 2px rgba(60, 40, 25, 0.04), 0 10px 30px rgba(60, 40, 25, 0.06);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.stage {
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(2rem, 6vh, 6rem) 1.5rem;
}

.screen {
  display: none;
  width: 100%;
  max-width: 640px;
  animation: rise 0.5s ease both;
}

.screen.is-active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typography helpers */
.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1.1rem;
}

.display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 3.9rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.display-sm {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.8rem, 4.5vw, 2.4rem);
  line-height: 1.15;
}

.lede {
  font-size: 1.08rem;
  color: var(--ink-soft);
  margin-top: 1.4rem;
}

.fine {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-top: 1rem;
  font-weight: 300;
}

/* Intro */
.intro {
  padding-top: clamp(1rem, 8vh, 5rem);
}

.intro .btn {
  margin-top: 1.6rem;
}

.signup {
  margin-top: 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 420px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
}

.field-input {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.signup-note {
  font-size: 0.86rem;
  color: var(--ink-soft);
  font-weight: 300;
  margin-top: -0.2rem;
}

.signup-error {
  font-size: 0.92rem;
  color: var(--accent);
  font-weight: 500;
}

/* Intro: stack the two flow buttons */
.intro-actions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: flex-start;
  margin-top: 0.4rem;
}

.intro-actions .btn {
  width: auto;
}

/* Debt-flow result header */
.debt-headline {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 2.9rem);
  line-height: 1.18;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.debt-subhead {
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-top: 0.9rem;
}

/* Result actions row (Download PDF + Start again) */
.result-actions {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 2.4rem;
}

.pdf-hint {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 300;
  font-style: italic;
}

/* Daily practices checklist (debt-flow only) */
.practices {
  margin-top: 2.6rem;
  padding: 1.6rem 1.5rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.practices-heading {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.practices-intro {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 1.2rem;
  font-weight: 300;
}

.practices-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.practice-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  font-size: 1rem;
  line-height: 1.5;
}

.practice-box {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 0.25rem;
  border: 1.5px solid var(--accent-soft);
  border-radius: 3px;
  background: transparent;
}

.practice-text {
  color: var(--ink);
}

/* Tighter, print-safer styling applied only while html2pdf snapshots */
.reading.for-pdf {
  padding: 6mm 0;
  background: #fffdfa;
}

.reading.for-pdf .section {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Buttons */
.btn {
  font-family: var(--sans);
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, opacity 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fdfaf6;
}

.btn-primary:hover {
  background: #763e26;
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}

.btn-ghost:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
}

/* Progress */
.progress {
  display: flex;
  gap: 8px;
  margin-bottom: 2.6rem;
}

.progress span {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.3s ease;
}

.progress span.done {
  background: var(--accent-soft);
}

.progress span.current {
  background: var(--accent);
}

/* Question */
.q-count {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.9rem;
}

.q-text {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.7rem, 4.4vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: -0.005em;
}

.q-hint {
  color: var(--ink-soft);
  font-size: 0.98rem;
  font-weight: 300;
  margin-top: 0.8rem;
}

.q-body {
  margin-top: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* Option cards */
.option {
  text-align: left;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.05rem 1.2rem;
  font-family: var(--sans);
  font-size: 1.02rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease,
    box-shadow 0.18s ease;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.option:hover {
  border-color: var(--accent-soft);
}

.option .tick {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.option.selected {
  border-color: var(--accent);
  background: #f3e7dd;
  box-shadow: var(--shadow);
}

.option.selected .tick {
  border-color: var(--accent);
  background: var(--accent);
}

.option.selected .tick::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fdfaf6;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Text answer */
.q-textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink);
}

.q-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.q-textarea::placeholder {
  color: #b4a799;
}

/* Nav row */
.q-nav {
  margin-top: 2.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.q-nav--center {
  justify-content: center;
  margin-top: 2.4rem;
}

/* Loading */
.loading {
  text-align: center;
  padding-top: clamp(2rem, 14vh, 8rem);
}

.orbit {
  width: 54px;
  height: 54px;
  margin: 0 auto 2rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--ink);
}

/* Result */
.reading {
  padding-bottom: 2rem;
}

.reading-head {
  text-align: center;
  padding-bottom: 2.4rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2.6rem;
}

.archetype {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
  font-size: clamp(2.4rem, 6.5vw, 3.5rem);
  line-height: 1.1;
  margin-top: 0.6rem;
}

.secondary-line {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin-top: 0.9rem;
}

.secondary-line span {
  font-style: italic;
  color: var(--accent-soft);
}

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ink);
  margin-top: 1.4rem;
  max-width: 30rem;
  margin-left: auto;
  margin-right: auto;
}

.section {
  margin-bottom: 2.6rem;
}

.section h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 0.9rem;
  letter-spacing: 0.01em;
}

.section p {
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.section p:last-child {
  margin-bottom: 0;
}

.btn-restart {
  display: block;
  margin: 1.5rem auto 0;
}

/* Error */
.errorbox {
  text-align: center;
  padding-top: clamp(2rem, 12vh, 7rem);
}

.errorbox .lede {
  margin-bottom: 0.5rem;
}

@media (max-width: 520px) {
  .q-nav {
    flex-direction: row;
  }
  .btn {
    padding: 0.8rem 1.5rem;
  }
}
