:root {
  color-scheme: light;
  --bg: #f7f1e8;
  --surface: #fffaf3;
  --surface-soft: #f1e6d8;
  --text: #342f2a;
  --muted: #766d63;
  --line: #dfd1c0;
  --sage: #7f947b;
  --sage-dark: #526850;
  --clay: #b87966;
  --blue: #7893a1;
  --gold: #c5a35d;
  --shadow: 0 18px 50px rgba(61, 48, 36, 0.14);
}

:root.dark {
  color-scheme: dark;
  --bg: #191816;
  --surface: #24211e;
  --surface-soft: #302b27;
  --text: #f2eadf;
  --muted: #c9baaa;
  --line: #4b4038;
  --sage: #9db093;
  --sage-dark: #c2d0b9;
  --clay: #d4947f;
  --blue: #96b2be;
  --gold: #d7bd7a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(127, 148, 123, 0.18), transparent 34rem),
    linear-gradient(160deg, var(--bg), var(--surface-soft));
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
a,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  width: min(100%, 440px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 72px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 14px;
  object-fit: contain;
  object-position: center;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line);
}

.eyebrow,
.step-label {
  margin: 0 0 8px;
  color: var(--sage-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.08;
}

h1 {
  font-size: clamp(1.82rem, 8vw, 2.7rem);
}

h2 {
  font-size: 2rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.screen {
  display: none;
  flex: 1;
  width: 100%;
  background: rgba(255, 250, 243, 0.72);
  border: 1px solid rgba(223, 209, 192, 0.78);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

:root.dark .screen {
  background: rgba(36, 33, 30, 0.84);
  border-color: rgba(75, 64, 56, 0.9);
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.mascot {
  position: absolute;
  z-index: 2;
  top: 198px;
  right: 16px;
  width: 234px;
  height: 348px;
  pointer-events: none;
  opacity: 0.82;
  transform: rotate(2deg);
}

.mascot[data-screen="home"] {
  top: clamp(120px, 18vh, 154px);
  right: auto;
  left: 50%;
  width: min(82vw, 360px);
  height: min(82vw, 360px);
  opacity: 0.9;
  transform: translateX(-50%) rotate(-2deg);
}

.mascot[data-step="2"],
.mascot[data-step="5"] {
  right: -32px;
  width: 204px;
  height: 304px;
}

.mascot[data-step="3"],
.mascot[data-step="4"] {
  top: 150px;
  right: -48px;
}

.mascot[data-step="3"] {
  right: -56px;
}

.mascot[data-step="4"],
.mascot[data-step="6"] {
  right: -60px;
}

.mascot[data-step="6"],
.mascot[data-step="7"] {
  right: -48px;
}

.mascot[data-screen="saved"] {
  top: 372px;
  right: auto;
  left: 50%;
  width: 324px;
  height: 414px;
  opacity: 0.34;
  transform: translateX(-50%);
}

.mascot[data-screen="safety"] {
  top: 292px;
  right: 54px;
  width: 76px;
  height: 102px;
  opacity: 0.28;
}

.mascot svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mascot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 16px;
}

.hidden {
  display: none;
}

.home-copy {
  margin-top: auto;
  padding-top: min(78vw, 340px);
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.5;
}

.small-note,
.prompt-help {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.action-stack {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 34px;
}

.primary-action,
.secondary-action {
  min-height: 54px;
  border: 0;
  border-radius: 18px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  font-weight: 750;
  cursor: pointer;
}

.primary-action {
  background: var(--sage-dark);
  color: var(--surface);
}

.secondary-action {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.link-action {
  color: var(--sage-dark);
}

.compact {
  min-height: 50px;
  flex: 1;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--sage-dark);
  font-weight: 750;
  padding: 10px 0;
  cursor: pointer;
}

.progress {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress span {
  display: block;
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sage), var(--blue));
  transition: width 180ms ease;
}

.prompt-area {
  margin-bottom: 22px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.option.selected {
  background: color-mix(in srgb, var(--sage) 24%, var(--surface));
  border-color: var(--sage);
  transform: translateY(-1px);
}

.journal-field {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-weight: 650;
}

.journal-field.hidden {
  display: none;
}

.journal-field.always {
  margin-top: 22px;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
  outline: none;
}

textarea:focus,
.option:focus-visible,
.primary-action:focus-visible,
.secondary-action:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--gold) 60%, transparent);
  outline-offset: 2px;
}

.bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 28px;
}

.saved-mark {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sage) 24%, var(--surface));
  color: var(--sage-dark);
  font-size: 2.3rem;
  font-weight: 800;
}

.gentle-summary {
  min-height: 48px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

#savedScreen .action-stack {
  padding-top: 280px;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  overflow: auto;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface);
}

.history-card time {
  display: block;
  margin-bottom: 8px;
  color: var(--sage-dark);
  font-weight: 800;
  font-size: 0.85rem;
}

.history-card p {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.4;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 360px) {
  .app-shell {
    padding: 16px 12px;
  }

  .screen {
    border-radius: 22px;
    padding: 20px;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .mascot {
    top: 186px;
    right: 4px;
    width: 186px;
    height: 282px;
    opacity: 0.8;
  }

  .mascot[data-screen="home"] {
    top: 118px;
    right: auto;
    left: 50%;
    width: min(82vw, 286px);
    height: min(82vw, 286px);
    opacity: 0.9;
  }

  .mascot[data-step="2"],
  .mascot[data-step="5"] {
    right: 4px;
    width: 162px;
    height: 246px;
  }

  .mascot[data-step="3"],
  .mascot[data-step="4"] {
    top: 138px;
    right: -32px;
  }

  .mascot[data-step="3"] {
    right: -38px;
  }

  .mascot[data-step="4"],
  .mascot[data-step="6"] {
    right: -40px;
  }

  .mascot[data-step="6"],
  .mascot[data-step="7"] {
    right: -32px;
  }

  .mascot[data-screen="saved"] {
    top: 398px;
    right: auto;
    left: 50%;
    width: 264px;
    height: 348px;
    opacity: 0.3;
    transform: translateX(-50%);
  }

  .mascot[data-screen="safety"] {
    top: 298px;
    right: 34px;
    width: 68px;
    height: 92px;
    opacity: 0.26;
  }

  #savedScreen .action-stack {
    padding-top: 246px;
  }

  .home-copy {
    padding-top: min(78vw, 268px);
  }
}
