:root {
  --ink: #16352f;
  --muted: #71817c;
  --green: #194c43;
  --green-2: #2f6a5e;
  --mint: #dbeae2;
  --paper: #f7f3e9;
  --cream: #efe7d5;
  --saffron: #e7a83d;
  --coral: #c7644d;
  --white: #fffdf7;
  --line: rgba(25, 76, 67, .14);
  --shadow: 0 18px 55px rgba(41, 62, 54, .12);
  font-family: "Avenir Next", "Futura", "PingFang SC", sans-serif;
  color: var(--ink);
  background: #e9eee9;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: #e9eee9; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(231,168,61,.45); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.ambient { position: fixed; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.ambient-a { width: 420px; height: 420px; background: rgba(207,221,202,.55); top: -180px; left: calc(50% - 460px); }
.ambient-b { width: 360px; height: 360px; background: rgba(234,211,158,.33); bottom: -160px; right: calc(50% - 440px); }
.app-shell { position: relative; width: min(100%, 520px); min-height: 100vh; margin: 0 auto; background: var(--paper); box-shadow: 0 0 80px rgba(27,61,52,.13); overflow: hidden; }
.topbar { height: 82px; padding: max(18px, env(safe-area-inset-top)) 22px 12px; display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 8; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: "Songti SC", Georgia, serif; font-size: 18px; font-weight: 700; letter-spacing: .08em; }
.brand small { display: block; margin-top: 2px; font-family: "Avenir Next", sans-serif; font-size: 7px; letter-spacing: .18em; color: var(--muted); }
.brand-mark { width: 31px; height: 31px; border: 1px solid var(--green); border-radius: 50%; display: grid; place-items: center; position: relative; }
.brand-mark i { position: absolute; width: 10px; height: 16px; border: 1.5px solid var(--green); border-radius: 100% 0 100% 0; transform-origin: bottom left; }
.brand-mark i:nth-child(1) { transform: rotate(-52deg) translate(1px,-1px); }
.brand-mark i:nth-child(2) { transform: rotate(-2deg) translate(1px,-1px); }
.brand-mark i:nth-child(3) { transform: rotate(48deg) translate(1px,-1px); }
.profile-button { border: 0; background: transparent; padding: 0; position: relative; cursor: pointer; }
.profile-button span { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.4); background: var(--green); color: #fff; border-radius: 50%; display: grid; place-items: center; font-family: "Songti SC", serif; }
.profile-button i { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--saffron); border: 2px solid var(--paper); right: 0; bottom: 0; }

main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.view { display: none; padding: 10px 22px 40px; min-height: calc(100vh - 82px); }
.view.active { display: block; animation: viewIn .38s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
.eyebrow { margin: 0 0 7px; font-size: 10px; letter-spacing: .19em; font-weight: 700; color: var(--coral); }
.hero { min-height: 306px; background: var(--green); border-radius: 5px 5px 96px 5px; padding: 32px 24px; color: #f9f7ec; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.hero::before { content: ""; position: absolute; width: 230px; height: 230px; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; right: -56px; top: -76px; }
.hero h1, .view-title h1 { font-family: "Songti SC", "STSong", Georgia, serif; font-weight: 600; letter-spacing: .03em; }
.hero h1 { margin: 14px 0; font-size: clamp(34px, 9.3vw, 48px); line-height: 1.23; }
.hero-copy { width: 60%; margin: 20px 0 0; color: rgba(255,255,255,.74); font-size: 13px; line-height: 1.8; }
.hero-orbit { position: absolute; width: 162px; height: 162px; right: -5px; bottom: -8px; display: grid; place-items: center; }
.hero-orbit svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-orbit path:first-child { fill: rgba(230,207,150,.15); stroke: rgba(250,246,228,.42); stroke-width: 1; }
.hero-orbit .leaf { fill: none; stroke: rgba(250,246,228,.7); stroke-width: 1.25; stroke-linecap: round; }
.hero-orbit span { text-align: center; font-size: 11px; color: rgba(255,255,255,.7); }
.hero-orbit b { font-family: Georgia, serif; font-size: 25px; font-weight: 400; color: #fff; }

.today-card { padding: 31px 4px 10px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 15px; }
.section-heading h2 { margin: 0; font: 600 24px/1.2 "Songti SC", serif; }
.text-button { border: 0; background: none; padding: 6px 0; font-size: 12px; color: var(--green-2); cursor: pointer; }
.text-button span { margin-left: 6px; }
.task-preview { display: grid; gap: 8px; }
.preview-item { min-height: 70px; padding: 12px 14px; display: flex; align-items: center; gap: 13px; background: rgba(255,253,247,.88); border: 1px solid var(--line); border-radius: 3px 18px 3px 18px; }
.preview-check { width: 28px; height: 28px; border: 1px solid #a9bcb5; background: transparent; border-radius: 50%; cursor: pointer; flex: 0 0 auto; }
.preview-check.done { background: var(--green); border-color: var(--green); color: #fff; }
.preview-item div { min-width: 0; flex: 1; }
.preview-item b { font-size: 14px; display: block; margin-bottom: 4px; }
.preview-item small { color: var(--muted); font-size: 11px; }
.preview-item > span { font: 17px Georgia, serif; color: var(--coral); }
.empty-inline { padding: 22px; color: var(--muted); text-align: center; border: 1px dashed rgba(25,76,67,.25); border-radius: 4px 18px; font-size: 13px; }
.home-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; margin: 17px 0; }
.action-card, .week-card { border: 0; min-height: 122px; border-radius: 3px 28px 3px 28px; padding: 17px; text-align: left; }
.action-card { background: #dfad56; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; cursor: pointer; }
.action-card .action-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.42); font: 17px "Songti SC", serif; }
.action-card small, .action-card b { display: block; }
.action-card small { font-size: 9px; margin-bottom: 6px; opacity: .68; }
.action-card b { font: 600 14px "Songti SC", serif; }
.action-card i { font-style: normal; }
.week-card { background: var(--mint); position: relative; overflow: hidden; }
.week-card p { font-size: 10px; margin: 0 0 7px; color: var(--muted); }
.week-card strong { font: 32px Georgia, serif; font-weight: 400; }
.week-card span { font-size: 9px; margin-left: 3px; color: var(--muted); }
.mini-bars { height: 25px; display: flex; align-items: end; gap: 4px; margin-top: 6px; }
.mini-bars i { display: block; flex: 1; background: var(--green-2); opacity: .35; height: 30%; }
.mini-bars i:nth-child(2), .mini-bars i:nth-child(5) { height: 70%; }
.mini-bars i:nth-child(3), .mini-bars i:nth-child(7) { height: 95%; opacity: .75; }
.mini-bars i:nth-child(4) { height: 50%; }
.safety-note { display: flex; gap: 12px; padding: 14px 4px; border-top: 1px solid var(--line); }
.safety-note > span { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; background: var(--cream); border-radius: 50%; font: 14px "Songti SC", serif; }
.safety-note p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.safety-note b { color: var(--ink); }

.view-title { margin: 18px 2px 20px; }
.view-title h1 { margin: 0; font-size: 37px; }
.view-title > p:last-child { color: var(--muted); font-size: 13px; line-height: 1.7; }
.chat-view { padding-bottom: 100px; }
.topic-chips { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; margin: 0 -22px 18px; padding: 0 22px; }
.topic-chips::-webkit-scrollbar { display: none; }
.topic-chips button { white-space: nowrap; border: 1px solid var(--line); background: rgba(255,255,255,.6); border-radius: 30px; padding: 9px 13px; font-size: 11px; cursor: pointer; }
.message-list { display: flex; flex-direction: column; gap: 14px; min-height: 300px; padding-bottom: 20px; }
.message { max-width: 86%; animation: bubbleIn .28s ease both; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px); } }
.message p { white-space: pre-wrap; margin: 0; padding: 13px 15px; border-radius: 4px 18px 18px 18px; background: #e1e9e3; font-size: 13px; line-height: 1.72; }
.message small { display: block; margin: 5px 6px 0; font-size: 9px; color: var(--muted); }
.message.user { align-self: flex-end; }
.message.user p { background: var(--green); color: #fff; border-radius: 18px 4px 18px 18px; }
.message.emergency p { background: #f5ded8; color: #722f24; border: 1px solid #e8b6aa; }
.message.typing p { width: 58px; color: transparent; background: #e1e9e3; position: relative; }
.message.typing p::after { content: "•••"; position: absolute; color: var(--muted); left: 18px; letter-spacing: 3px; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.chat-composer { position: fixed; z-index: 9; width: min(calc(100% - 44px), 476px); bottom: calc(73px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: end; gap: 8px; background: rgba(255,253,247,.94); box-shadow: 0 10px 32px rgba(25,76,67,.16); backdrop-filter: blur(16px); border: 1px solid rgba(25,76,67,.12); padding: 8px; border-radius: 20px; }
.chat-composer textarea { resize: none; flex: 1; max-height: 100px; border: 0; outline: 0; background: none; padding: 9px 11px; font-size: 13px; }
.chat-composer button { width: 38px; height: 38px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--saffron); font-size: 20px; cursor: pointer; }

.plan-heading { display: flex; align-items: center; justify-content: space-between; }
.round-action { width: 49px; height: 49px; border-radius: 50%; border: 1px solid var(--line); background: var(--white); font-size: 11px; cursor: pointer; }
.plan-summary { background: var(--green); color: #fff; min-height: 175px; padding: 24px; border-radius: 4px 46px 4px 46px; position: relative; overflow: hidden; }
.plan-summary::after { content: ""; position: absolute; width: 120px; height: 120px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; right: -24px; bottom: -38px; box-shadow: 0 0 0 20px rgba(255,255,255,.03); }
.plan-summary h2 { font: 600 24px "Songti SC", serif; margin: 0 0 12px; }
.plan-summary p { width: 75%; color: rgba(255,255,255,.72); font-size: 12px; line-height: 1.7; }
.plan-meta { display: flex; gap: 18px; margin-top: 20px; font-size: 10px; }
.plan-meta b { display: block; color: #f2c66d; font: 17px Georgia, serif; margin-bottom: 2px; }
.timeline-label { display: flex; align-items: center; gap: 15px; margin: 27px 0 16px; font: 600 16px "Songti SC", serif; }
.timeline-label i { height: 1px; background: var(--line); flex: 1; }
.plan-tasks { position: relative; }
.plan-tasks::before { content: ""; position: absolute; left: 20px; top: 20px; bottom: 20px; width: 1px; background: rgba(25,76,67,.18); }
.plan-task { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; min-height: 94px; position: relative; }
.plan-task .task-node { width: 41px; height: 41px; border-radius: 50%; border: 1px solid #a8bbb4; background: var(--paper); z-index: 1; display: grid; place-items: center; font: 13px Georgia, serif; }
.plan-task.done .task-node { background: var(--green); color: #fff; }
.plan-task h3 { margin: 0 0 5px; font-size: 14px; }
.plan-task p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.plan-task button { border: 0; border-radius: 30px; padding: 8px 11px; background: var(--cream); font-size: 10px; cursor: pointer; }
.plan-task.done button { color: var(--green); background: var(--mint); }
.plan-footnote { margin-top: 22px; padding: 17px; border: 1px solid var(--line); border-radius: 3px 24px; }
.plan-footnote b { font: 600 13px "Songti SC", serif; }
.plan-footnote p { color: var(--muted); font-size: 10px; line-height: 1.7; margin-bottom: 0; }

.record-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.record-stats article { min-height: 130px; padding: 22px; background: var(--mint); border-radius: 3px 32px; }
.record-stats article:last-child { background: var(--cream); }
.record-stats small { display: block; color: var(--muted); font-size: 10px; margin-bottom: 16px; }
.record-stats b { font: 39px Georgia, serif; font-weight: 400; }
.record-stats span { color: var(--muted); font-size: 10px; margin-left: 4px; }
.record-paper { margin-top: 20px; padding: 25px 22px; min-height: 250px; background: #fffaf0; background-image: repeating-linear-gradient(transparent, transparent 31px, rgba(25,76,67,.08) 32px); box-shadow: var(--shadow); transform: rotate(-.5deg); }
.paper-header { display: flex; justify-content: space-between; font: 600 16px "Songti SC", serif; }
.paper-header span { color: var(--muted); font: 10px "Avenir Next", sans-serif; }
.record-paper > p { margin-top: 29px; color: var(--muted); font-size: 12px; line-height: 2.65; }
.record-paper blockquote { margin: 22px 0 0; padding-left: 15px; border-left: 2px solid var(--saffron); font: 14px/2 "Songti SC", serif; color: var(--green-2); }

.bottom-nav { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%,520px); height: calc(70px + env(safe-area-inset-bottom)); padding: 8px 19px env(safe-area-inset-bottom); display: flex; background: rgba(249,246,237,.94); backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.bottom-nav button { border: 0; background: none; flex: 1; padding: 4px; color: #8a9792; cursor: pointer; }
.bottom-nav span, .bottom-nav b { display: block; }
.bottom-nav span { font: 19px Georgia, serif; height: 25px; }
.bottom-nav b { font-size: 9px; letter-spacing: .08em; }
.bottom-nav button.active { color: var(--green); }
.bottom-nav button.active span { transform: translateY(-2px); }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(17,42,36,.58); backdrop-filter: blur(4px); }
.profile-dialog, .checkin-dialog { width: min(calc(100% - 24px), 500px); max-height: calc(100vh - 24px); border: 0; border-radius: 5px 38px 5px 38px; padding: 0; background: var(--paper); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.profile-dialog form, .checkin-dialog form { padding: 30px 24px; position: relative; }
.profile-dialog h2, .checkin-dialog h2 { margin: 0 0 6px; font: 600 30px "Songti SC", serif; }
.form-intro { margin: 0 0 25px; color: var(--muted); font-size: 12px; }
.dialog-close { position: absolute; right: 20px; top: 18px; width: 34px; height: 34px; border: 0; background: var(--cream); border-radius: 50%; font-size: 21px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 12px; }
.full { grid-column: 1 / -1; }
.field > span, fieldset legend { display: block; font-size: 11px; font-weight: 700; margin-bottom: 7px; }
.field em, fieldset em { color: var(--coral); font-style: normal; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 2px 12px; background: rgba(255,255,255,.65); padding: 11px 12px; color: var(--ink); font-size: 12px; }
.field textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; }
.segmented, .check-grid { display: grid; gap: 7px; }
.segmented { grid-template-columns: 1fr 1fr; }
.check-grid { grid-template-columns: repeat(2,1fr); }
.segmented input, .check-grid input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span, .check-grid span { display: block; padding: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.6); border-radius: 2px 12px; text-align: center; font-size: 11px; cursor: pointer; }
.segmented input:checked + span, .check-grid input:checked + span { color: #fff; border-color: var(--green); background: var(--green); }
.consent { display: flex; align-items: flex-start; gap: 9px; margin: 22px 0 13px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.consent input { accent-color: var(--green); margin-top: 2px; }
.primary-button { width: 100%; border: 0; background: var(--saffron); padding: 14px 18px; border-radius: 2px 16px; font-size: 13px; font-weight: 700; cursor: pointer; }
.primary-button span { float: right; }
.form-error { min-height: 16px; color: #a84332; font-size: 11px; }
.checkin-dialog { width: min(calc(100% - 30px),440px); }
.checkin-dialog form { padding: 34px 25px; }
.range-field { display: block; margin: 22px 0; }
.range-field > span { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; }
.range-field output { font: 25px Georgia, serif; color: var(--coral); }
.range-field input { width: 100%; accent-color: var(--green); }
.range-field small { display: block; color: var(--muted); font-size: 9px; }
.checkin-dialog .primary-button { margin-top: 20px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 95px; transform: translate(-50%,20px); opacity: 0; pointer-events: none; background: #173d35; color: #fff; padding: 11px 17px; border-radius: 30px; font-size: 11px; box-shadow: var(--shadow); transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

.reveal { animation: reveal .65s cubic-bezier(.22,.9,.3,1) both; }
.delay-1 { animation-delay: .09s; }.delay-2 { animation-delay: .17s; }.delay-3 { animation-delay: .24s; }
@keyframes reveal { from { opacity: 0; transform: translateY(18px); } }
@media (min-width: 700px) { body { padding: 20px 0; } .app-shell { min-height: calc(100vh - 40px); border-radius: 8px 50px 8px 50px; } .bottom-nav { bottom: 20px; border-radius: 0 0 8px 50px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
