:root {
  color-scheme: light;
  --ink: #18231f;
  --muted: #66716d;
  --paper: #f6f4ef;
  --card: #fffdfa;
  --sage: #d9e5dc;
  --green: #1e6048;
  --green-dark: #124532;
  --coral: #e8755e;
  --line: #e5e3dc;
  --warning: #fff2d5;
  --shadow: 0 24px 70px rgba(27, 48, 40, 0.18);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, #dce9de 0 12%, transparent 35%),
    radial-gradient(circle at 90% 80%, #f1d9cf 0 10%, transparent 34%),
    #eef0eb;
}

button, input { font: inherit; }
button { cursor: pointer; }

.preview-notice {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 12px;
  letter-spacing: .03em;
  background: #202a27;
  color: white;
}

.preview-notice strong { color: #ffd49a; }

.stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(280px, 470px);
  justify-content: center;
  align-items: center;
  gap: clamp(40px, 7vw, 100px);
  padding: 72px 28px 36px;
}

.phone {
  width: 100%;
  height: min(860px, calc(100vh - 108px));
  min-height: 650px;
  overflow: hidden;
  border: 9px solid #26332e;
  border-radius: 48px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

#app { height: 100%; }

.app-page {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 22px 112px;
  scrollbar-width: none;
}

.screen-scroll::-webkit-scrollbar { display: none; }

.topbar {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 12px;
  background: rgba(246, 244, 239, .94);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
  letter-spacing: -.025em;
}

.brand-me {
  display: inline-block;
  width: 2.83em;
  height: 1.88em;
  margin-left: .01em;
  background: var(--green);
  -webkit-mask: url("/assets/brand-me-script.png") center / contain no-repeat;
  mask: url("/assets/brand-me-script.png") center / contain no-repeat;
  transform: translateY(.43em);
  transform-origin: left bottom;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--green);
  color: white;
  font-size: 18px;
}

.icon-button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 16px;
  background: white;
  color: var(--green);
  font-weight: 700;
  box-shadow: 0 5px 18px rgba(25, 51, 41, .08);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .11em;
  font-size: 12px;
  font-weight: 700;
}

h1, h2, h3, p { margin-top: 0; }
h1, .display { font-family: inherit; font-weight: 800; letter-spacing: -.035em; }
h1 { font-size: clamp(38px, 5vw, 62px); line-height: .98; }
h2 { margin-bottom: 8px; font-size: 28px; line-height: 1.1; }
h3 { margin-bottom: 6px; font-size: 17px; }
p { line-height: 1.5; color: var(--muted); }

.hero-art {
  position: relative;
  height: 292px;
  margin: 4px 0 28px;
  border-radius: 36px;
  overflow: hidden;
  background: var(--sage);
  box-shadow: 0 18px 36px rgba(28, 58, 46, .14);
}

.hero-image, .journey-banner, .article-art, .topic-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.primary, .secondary {
  width: 100%;
  min-height: 52px;
  border-radius: 17px;
  font-weight: 700;
}
.primary { border: 0; background: var(--green); color: white; box-shadow: 0 8px 20px rgba(30, 96, 72, .2); }
.primary:hover { background: var(--green-dark); }
.secondary { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.text-button { min-height: 44px; border: 0; background: transparent; color: var(--green); font-weight: 700; }

.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }

.card {
  padding: 18px;
  border: 1px solid rgba(34, 61, 50, .06);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 8px 25px rgba(35, 57, 48, .055);
}

.notice-card { background: var(--warning); border-color: #edd8a8; }
.notice-card p { margin-bottom: 0; color: #75551b; }

.check-line { align-items: flex-start; }
.check-line input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--green); }

.setup-field label { display: block; margin-bottom: 7px; font-weight: 700; font-size: 13px; }
.setup-field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
}

.mini-note { font-size: 12px; }

.onboarding-scroll > .primary { margin-top: 14px; }

.eligibility-card h3 { margin-bottom: 12px; }
.answer-list, .choice-list { display: grid; gap: 7px; }
.answer-list button, .choice-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 600;
}
.answer-list button.selected, .choice-list button.selected { color: var(--green); background: var(--sage); }

.summary-card > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.summary-card > div:last-child { border-bottom: 0; }
.summary-card span { color: var(--muted); }

.today-hero {
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(145deg, var(--green-dark), var(--green));
  color: white;
}
.today-hero p, .today-hero .eyebrow { color: #d9eee5; }
.today-hero h2 { font-family: Georgia, serif; font-size: 36px; }

.today-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.today-heading .app-title { margin: 4px 0; font-size: 46px; }
.today-heading strong { color: var(--green); font-size: 20px; }
.today-date { margin-bottom: 0; font-weight: 700; }
.progress-ring {
  --progress: 0;
  display: grid;
  place-items: center;
  flex: 0 0 78px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--paper) 56%, transparent 58%), conic-gradient(var(--green) calc(var(--progress) * 1turn), var(--line) 0);
  font-weight: 800;
}

.journey-banner {
  height: 238px;
  margin-bottom: 20px;
  border-radius: 30px;
  box-shadow: 0 18px 38px rgba(28, 58, 46, .16);
}
.today-orientation h3 { font-size: 20px; line-height: 1.35; }
.today-orientation p:last-child { margin-bottom: 0; font-size: 13px; }

.progress-track { height: 8px; margin-top: 18px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; }
.progress-fill { width: 38%; height: 100%; border-radius: inherit; background: #ffd7ae; }

.section-title { margin: 28px 2px 12px; }
.section-title p { margin-bottom: 0; font-size: 13px; }

.task { width: 100%; padding: 16px; color: var(--ink); text-align: left; }
.task-check { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border: 2px solid #a8b9b1; border-radius: 50%; color: white; }
.task button {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 2px solid #a8b9b1;
  border-radius: 10px;
  background: white;
  color: white;
}
.task.done .task-check { border-color: var(--green); background: var(--green); }
.task.done h3 { text-decoration: line-through; color: var(--muted); }
.task p { margin-bottom: 0; font-size: 13px; }

.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice-grid button { min-height: 48px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); font-weight: 600; }
.choice-grid button.selected { background: var(--sage); border-color: #91b19e; color: var(--green-dark); }
.saved-note { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; }

.bottom-nav {
  position: absolute;
  z-index: 5;
  inset: auto 14px 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 24px;
  background: rgba(255, 253, 250, .94);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 35px rgba(30, 48, 41, .15);
}
.bottom-nav button { min-height: 54px; border: 0; border-radius: 17px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.bottom-nav button span { display: block; margin-bottom: 3px; font-size: 20px; }
.bottom-nav button.active { color: var(--green); background: var(--sage); }

.app-shell { position: relative; height: 100%; }
.app-title { margin: 8px 0 16px; font-family: inherit; font-size: 36px; letter-spacing: -.035em; }

.topic-art { flex: 0 0 104px; width: 104px; height: 92px; border-radius: 21px; }
.topic-card { padding: 10px; gap: 14px; overflow: hidden; }
.topic-card > div { min-width: 0; }
.topic-card p { margin-bottom: 0; font-size: 13px; }
.article-link { width: 100%; color: var(--ink); text-align: left; }
.article-link .chevron { margin-left: auto; color: var(--muted); font-size: 24px; }
.article-summary { font-size: 18px; }
.article-sections { display: grid; gap: 20px; margin: 24px 0; }
.article-section { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.article-section:last-child { padding-bottom: 0; border-bottom: 0; }
.article-section h3 { margin-bottom: 7px; font-size: 18px; line-height: 1.3; }
.article-section p { margin-bottom: 0; color: var(--ink); font-size: 16px; line-height: 1.58; }
.article-art { height: 300px; margin: 2px 0 14px; border-radius: 30px; box-shadow: 0 18px 38px rgba(28, 58, 46, .16); }
.visual-caption { display: flex; align-items: flex-start; gap: 8px; margin: 0 2px 20px; font-size: 12px; line-height: 1.45; }
.visual-caption span { flex: 0 0 auto; color: var(--green); font-weight: 800; }
.search { width: 100%; min-height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: 16px; background: white; color: var(--ink); }

.emergency-card { background: #fff1ed; border-color: #f2c3b7; }
.emergency-card .primary { background: #a93e2b; }
.draft-chip { display: inline-flex; padding: 6px 9px; border-radius: 9px; background: #fff0c7; color: #7a5515; font-size: 11px; font-weight: 700; }

.setting-row { min-height: 58px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row p { margin-bottom: 0; font-size: 12px; }

.settings-card { padding: 4px 18px; }
.settings-card button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.settings-card button:last-child { border-bottom: 0; }
.settings-card button > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--green); color: white; }
.settings-card button > div { flex: 1; }
.settings-card h3, .reminder-setting h3 { margin-bottom: 2px; }
.settings-card p, .reminder-setting p { margin-bottom: 0; font-size: 12px; }
.settings-card b { color: var(--muted); font-size: 22px; }
.reminder-setting input[type="time"] { width: 100%; min-height: 44px; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); }
.danger-button { width: 100%; min-height: 50px; border: 1px solid #d88d7e; border-radius: 16px; background: transparent; color: #b34531; font-weight: 700; }
.call-link { justify-content: center; text-decoration: none; }
.back-button { font-size: 30px; line-height: 1; }

.dialog-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(5, 12, 9, .48); backdrop-filter: blur(4px); }
.dialog { width: 100%; max-width: 340px; padding: 22px; border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
.dialog .text-button { width: 100%; margin-top: 8px; }

.toast {
  position: absolute;
  z-index: 10;
  left: 22px;
  right: 22px;
  bottom: 92px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #17241f;
  color: white;
  font-size: 13px;
  box-shadow: 0 14px 34px rgba(0,0,0,.22);
  animation: rise .22s ease-out;
}
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

.preview-context { max-width: 430px; }
.preview-context p { font-size: 17px; }
.context-points { display: flex; flex-wrap: wrap; gap: 9px; }
.context-points span { padding: 9px 12px; border-radius: 99px; background: rgba(255,255,255,.7); color: var(--green-dark); font-size: 13px; font-weight: 700; }

.legal-page {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 15% 8%, #dce9de 0 10%, transparent 34%),
    radial-gradient(circle at 90% 72%, #f1d9cf 0 8%, transparent 32%),
    var(--paper);
}

.legal-header,
.legal-footer {
  width: min(960px, calc(100% - 40px));
  margin: 0 auto;
}

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 80px;
  border-bottom: 1px solid var(--line);
}

.legal-brand {
  color: var(--ink);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.025em;
  text-decoration: none;
}

.legal-header nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-header nav a,
.legal-footer a {
  color: var(--green);
  font-weight: 700;
}

.legal-header nav a {
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 13px;
  text-decoration: none;
}

.legal-header nav a[aria-current="page"] {
  background: var(--sage);
  color: var(--green-dark);
}

.legal-shell {
  width: min(780px, calc(100% - 40px));
  margin: 0 auto;
  padding: 80px 0 60px;
}

.legal-hero {
  margin-bottom: 64px;
}

.legal-hero h1 {
  max-width: 720px;
  margin-bottom: 20px;
  font-size: clamp(42px, 7vw, 68px);
  line-height: 1.02;
}

.legal-hero > p:not(.eyebrow, .legal-effective-date) {
  max-width: 660px;
  font-size: 19px;
}

.legal-effective-date {
  margin-top: 24px;
  font-size: 14px;
  font-weight: 700;
}

.legal-primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin-top: 14px;
  padding: 0 20px;
  border-radius: 17px;
  background: var(--green);
  color: white;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(30, 96, 72, .2);
}

.legal-content {
  display: grid;
  gap: 18px;
}

.legal-content > section {
  padding: 26px;
  border: 1px solid rgba(34, 61, 50, .08);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 8px 25px rgba(35, 57, 48, .055);
}

.legal-content h2 {
  margin-bottom: 12px;
  font-size: 24px;
}

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

.legal-content a {
  color: var(--green);
  font-weight: 700;
}

.legal-faq {
  display: grid;
  gap: 22px;
}

.legal-faq > div:not(:last-child) {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.legal-faq p {
  margin-bottom: 0;
}

.legal-safety {
  border-color: #f2c3b7 !important;
  background: #fff1ed !important;
}

.legal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: auto;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 820px) {
  body { background: var(--paper); }
  .preview-notice { position: static; }
  .stage { display: block; min-height: auto; padding: 0; }
  .phone { width: 100%; height: calc(100dvh - 32px); min-height: 600px; border: 0; border-radius: 0; box-shadow: none; }
  .preview-context { display: none; }
  .legal-page { background: var(--paper); }
  .legal-shell { padding: 56px 0 44px; }
  .legal-hero { margin-bottom: 44px; }
}

@media (max-width: 520px) {
  .legal-header,
  .legal-footer,
  .legal-shell {
    width: min(100% - 28px, 780px);
  }

  .legal-header {
    min-height: 68px;
  }

  .legal-header nav a {
    padding-inline: 10px;
  }

  .legal-content > section {
    padding: 20px;
  }

  .legal-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --ink: #eef5f1; --muted: #aab8b2; --paper: #111815; --card: #1b2521; --line: #34433d; --sage: #233a30; --green: #55c5a6; --green-dark: #236b57; }
  body { background: #0e1512; }
  .topbar { background: rgba(17,24,21,.94); }
  .icon-button, .choice-grid button, .setup-field input, .search, .task button { background: #1b2521; }
  .notice-card { background: #40351c; border-color: #66562f; }
  .notice-card p { color: #eed89c; }
  .bottom-nav { background: rgba(27,37,33,.95); border-color: #34433d; }
  .emergency-card { background: #3a211d; border-color: #67352c; }
  .legal-safety { background: #3a211d !important; border-color: #67352c !important; }
  .primary, .brand-mark { color: #07130f; }
  .legal-primary-link { color: #07130f; }
  .preview-notice { background: #050806; }
}
