:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --ink: #15201c;
  --muted: #64706b;
  --line: #dbe1dd;
  --primary: #173f37;
  --primary-soft: #e5efeb;
  --danger: #a12b25;
  --danger-soft: #f8e8e6;
  --warning: #7b5a10;
  --shadow: 0 22px 80px rgba(24, 39, 33, 0.12);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: #dfe5e1; color: var(--ink); }
body { display: grid; place-items: center; }
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 4px solid rgba(23, 63, 55, 0.24); outline-offset: 2px; }

#app {
  width: min(100%, 430px);
  min-height: 100dvh;
  background: var(--bg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.app-screen {
  min-height: 100dvh;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 11px; background: var(--primary); color: white; font-size: 18px; font-weight: 900; }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #3a7666; }

.icon-button, .back-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  min-width: 44px;
  min-height: 44px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 750;
}
.back-button { text-align: left; padding: 0; }

.child-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.child-chip { border: 1px solid var(--line); background: var(--surface); padding: 11px 14px; border-radius: 16px; font-weight: 800; color: var(--ink); cursor: pointer; }
.plan-ready { color: var(--primary); background: var(--primary-soft); padding: 8px 11px; border-radius: 999px; font-weight: 800; font-size: 12px; }

.hero { margin-top: 10px; }
.eyebrow { margin: 0 0 10px; font-size: 13px; line-height: 1.2; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 850; }
h1 { margin: 0; font-size: clamp(34px, 10vw, 48px); line-height: 0.99; letter-spacing: -0.055em; }
h2 { margin: 0; font-size: 30px; line-height: 1.08; letter-spacing: -0.04em; }
h3 { margin: 0; font-size: 21px; line-height: 1.15; letter-spacing: -0.025em; }
p { margin: 0; line-height: 1.48; }
.subcopy { margin-top: 12px; color: var(--muted); font-size: 16px; max-width: 34ch; }

.help-button {
  margin-top: 14px;
  min-height: 190px;
  border: 0;
  border-radius: 34px;
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 28px;
  cursor: pointer;
  box-shadow: 0 18px 50px rgba(23, 63, 55, 0.22);
}
.help-button .small { font-weight: 700; opacity: 0.76; font-size: 14px; margin-bottom: 8px; }
.help-button .big { font-size: 44px; line-height: 0.94; letter-spacing: -0.05em; font-weight: 900; }
.help-button:active { transform: scale(0.992); }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-card {
  min-height: 100px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 22px;
  padding: 16px 12px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-weight: 820;
  line-height: 1.1;
}
.quick-card span { color: var(--muted); font-size: 12px; font-weight: 700; }

.footer-note { margin-top: auto; color: var(--muted); font-size: 12px; text-align: center; padding: 5px 10px; }

.progress { display: flex; gap: 6px; height: 5px; }
.progress i { display: block; flex: 1; background: var(--line); border-radius: 999px; }
.progress i.active { background: var(--primary); }

.question-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.question-copy { display: grid; gap: 12px; }
.question-copy .context { color: var(--muted); font-size: 15px; }

.stack { display: grid; gap: 10px; }
.choice-button, .primary-button, .secondary-button, .danger-button {
  width: 100%;
  min-height: 64px;
  border-radius: 20px;
  padding: 15px 18px;
  cursor: pointer;
  font-weight: 850;
  font-size: 17px;
}
.choice-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; }
.choice-button strong { display: block; font-size: 18px; }
.choice-button small { display: block; color: var(--muted); font-weight: 650; margin-top: 4px; line-height: 1.35; }
.choice-button.selected { border: 2px solid var(--primary); background: var(--primary-soft); }
.primary-button { border: 0; background: var(--primary); color: white; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.danger-button { border: 0; background: var(--danger); color: white; }
.text-button { border: 0; background: transparent; color: var(--primary); min-height: 48px; padding: 10px; font-weight: 850; cursor: pointer; }
.text-button.danger-text { color: var(--danger); }

.cue-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cue-button {
  min-height: 104px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 22px;
  color: var(--ink);
  padding: 15px;
  text-align: left;
  cursor: pointer;
  font-weight: 850;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 9px;
}
.cue-icon { width: 28px; height: 28px; border: 2px solid currentColor; border-radius: 10px; opacity: 0.65; }
.cue-button:last-child { grid-column: 1 / -1; min-height: 70px; }

.reset-card { padding: 26px; border-radius: 30px; background: var(--primary); color: white; display: grid; gap: 20px; }
.reset-orb { width: 90px; height: 90px; border-radius: 50%; border: 12px solid rgba(255, 255, 255, 0.19); background: rgba(255, 255, 255, 0.08); }
.reset-card p { font-size: 24px; line-height: 1.24; font-weight: 780; letter-spacing: -0.03em; }
.reset-card .primary-button { background: white; color: var(--primary); }

.possible { color: var(--muted); font-size: 13px; font-weight: 780; }
.action-card { padding: 26px; border: 1px solid var(--line); background: var(--surface); border-radius: 30px; display: grid; gap: 18px; }
.action-number { width: 36px; height: 36px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 900; }
.action-title { font-size: 34px; line-height: 1.02; letter-spacing: -0.045em; font-weight: 900; }
.action-instruction { font-size: 19px; line-height: 1.42; color: #35413d; }
.why { padding: 13px 14px; background: var(--bg); border-radius: 16px; font-size: 13px; color: var(--muted); }
.action-controls { margin-top: auto; display: grid; gap: 10px; }
.emergency-link { color: var(--danger); }

.checkin-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.checkin-buttons button { min-height: 104px; border: 1px solid var(--line); background: white; border-radius: 24px; font-size: 17px; font-weight: 880; cursor: pointer; color: var(--ink); }
.checkin-buttons button:last-child { border-color: #e5b8b4; color: var(--danger); background: var(--danger-soft); }

.success-mark { width: 84px; height: 84px; border-radius: 30px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 42px; font-weight: 900; }
.done-copy { display: grid; gap: 14px; margin-top: 40px; }

.section-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.section-title p { color: var(--muted); font-size: 13px; }
.list { display: grid; gap: 10px; }
.list-card { background: white; border: 1px solid var(--line); border-radius: 22px; padding: 17px; display: grid; gap: 8px; }
.list-card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.list-card .meta { color: var(--muted); font-size: 13px; }
.pill { display: inline-flex; width: fit-content; padding: 6px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 850; }
.pill.warn { background: #f6efd9; color: var(--warning); }

.plan-actions { counter-reset: plan; display: grid; gap: 9px; }
.plan-action { display: flex; align-items: center; gap: 12px; padding: 15px; background: white; border: 1px solid var(--line); border-radius: 18px; }
.plan-action::before { counter-increment: plan; content: counter(plan); width: 30px; height: 30px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 900; flex: 0 0 auto; }
.plan-action strong { flex: 1; }
.mini-button { border: 0; min-width: 36px; min-height: 36px; background: var(--bg); border-radius: 12px; font-weight: 900; cursor: pointer; color: var(--ink); }

.form-section { display: grid; gap: 11px; }
.form-section label { font-weight: 850; }
.form-section input, .form-section textarea { width: 100%; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 16px; padding: 15px; min-height: 52px; }
.form-section textarea { min-height: 92px; resize: vertical; }
.option-list { display: grid; gap: 8px; }
.option-row { display: flex; align-items: center; gap: 11px; padding: 13px 14px; background: white; border: 1px solid var(--line); border-radius: 16px; cursor: pointer; }
.option-row input { width: 22px; height: 22px; accent-color: var(--primary); }
.option-row span { font-weight: 760; }

.share-code { background: var(--primary); color: white; padding: 28px; border-radius: 30px; display: grid; gap: 14px; text-align: center; }
.share-code .code { font-size: clamp(27px, 7vw, 38px); letter-spacing: 0.09em; font-weight: 900; overflow-wrap: anywhere; }
.share-code small { opacity: 0.72; }
.preview-fields { display: flex; flex-wrap: wrap; gap: 7px; }
.preview-fields span { padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--muted); background: white; }

.emergency-panel { background: var(--danger-soft); border: 1px solid #e9bbb6; border-radius: 28px; padding: 23px; display: grid; gap: 16px; }
.emergency-panel h2 { color: var(--danger); }
.emergency-item { padding: 14px; border-radius: 17px; background: white; border: 1px solid #efd3d0; display: grid; gap: 4px; }
.emergency-item small { color: var(--muted); }

.disclaimer { padding: 12px 14px; border-radius: 15px; background: #ecefeb; color: var(--muted); font-size: 12px; line-height: 1.4; }

.toast { position: absolute; left: 20px; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom)); padding: 14px 16px; border-radius: 16px; background: #15201c; color: white; font-size: 14px; font-weight: 700; box-shadow: var(--shadow); }

@media (min-width: 431px) {
  #app { min-height: min(900px, 100dvh); border-radius: 34px; }
  .app-screen { min-height: min(900px, 100dvh); }
}

@media (prefers-reduced-motion: no-preference) {
  .app-screen { animation: enter 160ms ease-out; }
  @keyframes enter { from { opacity: 0.75; transform: translateY(3px); } to { opacity: 1; transform: none; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.call-button { display:grid; place-items:center; text-decoration:none; }
