:root {
  --ink: #302930;
  --muted: #746b72;
  --soft: #958991;
  --line: #e9dde3;
  --pink: #d85e8b;
  --pink-dark: #b83e6e;
  --pink-soft: #fbe8ef;
  --paper: #fffdfd;
  --bg: #f7f1f4;
}

* { box-sizing: border-box; }
html { color-scheme: light; background: var(--bg); overflow-x: hidden; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 10% 3%, rgba(255,225,237,.72), transparent 25rem), var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, textarea, input { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  background: var(--paper);
  box-shadow: 0 0 70px rgba(66,39,51,.08);
}
.topbar {
  height: 72px;
  padding: 14px 19px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(233,221,227,.8);
  background: rgba(255,253,253,.95);
  backdrop-filter: blur(18px);
}
.brand-mark {
  width: 40px;
  height: 40px;
  padding: 10px 10px 9px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: linear-gradient(145deg, #ec8eaf, #c84c7a);
  box-shadow: 0 8px 18px rgba(200,76,122,.2);
}
.brand-mark i { width: 4px; display: block; border-radius: 9px; background: white; }
.brand-mark i:nth-child(1) { height: 9px; }
.brand-mark i:nth-child(2) { height: 18px; }
.brand-mark i:nth-child(3) { height: 13px; }
.topbar strong, .topbar small { display: block; }
.topbar strong { font-size: 15px; }
.topbar small { margin-top: 1px; color: var(--muted); font-size: 13px; }

.content { min-height: calc(100dvh - 72px); padding-bottom: 92px; }
.screen { padding: 22px 18px 32px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--pink-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1, h2, h3, p { overflow-wrap: anywhere; }
.hero {
  padding: 22px 20px 24px;
  overflow: hidden;
  border: 1px solid #f0dee7;
  border-radius: 28px;
  background: radial-gradient(circle at 100% 0, rgba(244,175,201,.35), transparent 12rem), linear-gradient(145deg, #fff9fb, #fff);
}
.hero h1, .screen-title h1 {
  margin: 0;
  font-size: clamp(29px, 8vw, 38px);
  font-weight: 780;
  line-height: 1.08;
  letter-spacing: -.04em;
}
.hero > p:last-of-type, .screen-title > p:last-child {
  margin: 14px 0 0;
  color: #665e65;
  font-size: 16px;
  line-height: 1.58;
}
.primary, .secondary, .danger {
  min-height: 50px;
  padding: 12px 18px;
  border: 0;
  border-radius: 15px;
  font-weight: 760;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.primary { color: white; background: linear-gradient(145deg, #dd6994, #c54676); box-shadow: 0 9px 22px rgba(197,70,118,.21); }
.secondary { border: 1px solid var(--line); background: white; }
.danger { min-height: 46px; color: #a23b55; border: 1px solid #f0cad5; background: #fff7f9; }
.primary:active, .secondary:active, .choice:active { transform: scale(.985); }
.primary:disabled { opacity: .48; cursor: default; box-shadow: none; }
.hero .primary { width: 100%; min-height: 57px; margin-top: 22px; font-size: 17px; }

.week-card {
  margin-top: 14px;
  padding: 16px 17px;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 15px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: white;
}
.week-card > div:not(.divider) { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: baseline; }
.week-card span { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.week-card strong { font-size: 29px; line-height: 1; }
.week-card small { color: var(--muted); font-size: 13px; }
.divider { background: var(--line); }

.insight-card {
  width: 100%;
  margin-top: 14px;
  padding: 17px 18px;
  display: block;
  text-align: left;
  border: 1px solid #ecd3de;
  border-radius: 21px;
  background: #fff7fa;
  cursor: pointer;
}
.insight-card > span { display: block; color: var(--pink-dark); font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.insight-card strong { display: block; margin-top: 7px; font-size: 15px; line-height: 1.45; }
.insight-card small { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; }

.section-heading { margin: 27px 2px 11px; display: flex; align-items: center; gap: 8px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading span { min-width: 24px; padding: 2px 7px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 700; border-radius: 999px; background: #f2ecef; }
.entry-list { display: grid; gap: 8px; }
.entry-card {
  width: 100%;
  min-height: 84px;
  padding: 14px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  cursor: pointer;
}
.entry-card > div { min-width: 0; }
.entry-card time { display: block; color: var(--soft); font-size: 12px; }
.entry-card strong { display: block; margin-top: 3px; font-size: 15px; }
.entry-card small { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.chevron { flex: 0 0 auto; color: #aa98a1; font-size: 29px; font-weight: 300; }

.bottom-nav {
  width: min(100%, 520px);
  height: calc(74px + env(safe-area-inset-bottom));
  padding: 8px 10px env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  border-top: 1px solid rgba(221,205,213,.9);
  background: rgba(255,253,253,.96);
  backdrop-filter: blur(18px);
}
.bottom-nav button { border: 0; color: #887d84; background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.bottom-nav i { height: 27px; display: block; font-style: normal; font-size: 20px; line-height: 24px; }
.bottom-nav .active { color: var(--pink-dark); }

.screen-title { padding: 8px 4px 19px; }
.screen-title h1 { font-size: 36px; }
.empty { margin-top: 12px; padding: 32px 24px; text-align: center; border: 1px dashed #deccd4; border-radius: 23px; background: #fffafb; }
.empty.compact { margin-top: 0; padding: 24px 20px; }
.empty h3 { margin: 0 0 7px; font-size: 18px; }
.empty p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

.card, .trend-card, .plan-card { margin-top: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 23px; background: white; }
.trend-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.trend-top span { color: var(--muted); font-size: 13px; }
.trend-top strong { display: block; margin-top: 3px; font-size: 34px; line-height: 1; }
.trend-top strong small { color: var(--muted); font-size: 13px; }
.badge { padding: 6px 9px; color: var(--muted); font-size: 12px; font-weight: 750; border-radius: 999px; background: #f2ecef; }
.badge.better { color: #35735c; background: #e8f5ef; }
.badge.worse { color: #a84660; background: #fff0f4; }
.bars { margin-top: 20px; display: grid; gap: 7px; }
.bars span { height: 9px; display: block; border-radius: 99px; background: #decfd6; }
.bars span:last-child { background: linear-gradient(90deg, #db719a, #c94b7c); }
.bar-labels { margin-top: 8px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }

.card { position: relative; }
.card h2 { margin: 0 38px 13px 0; font-size: 20px; letter-spacing: -.02em; }
.card > p { margin: 0 0 15px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.card-number { width: 30px; height: 30px; display: grid; place-items: center; position: absolute; top: 17px; right: 17px; color: var(--pink-dark); font-size: 11px; font-weight: 800; border-radius: 11px; background: var(--pink-soft); }
.pattern-list { display: grid; gap: 9px; }
.pattern-list > div { padding: 13px 14px; border-radius: 15px; background: #faf6f8; }
.pattern-list strong, .pattern-list span { display: block; }
.pattern-list strong { font-size: 14px; line-height: 1.45; }
.pattern-list span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.signal-list { display: grid; gap: 13px; }
.signal-list > div { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; align-items: end; }
.signal-list span { font-size: 14px; }
.signal-list .bar { height: 7px; overflow: hidden; border-radius: 99px; background: #f0e7eb; }
.signal-list .bar i { height: 100%; display: block; border-radius: inherit; background: #d76b93; }
.signal-list b { grid-column: 2; grid-row: 1 / 3; color: var(--pink-dark); font-size: 13px; }
.accent { border-color: #ebc9d8; background: linear-gradient(145deg, #fff8fb, #fff); }
.hypothesis { display: block; margin-bottom: 8px; font-size: 17px; line-height: 1.4; }
.evidence { display: block; margin: -2px 0 12px; color: var(--soft); font-size: 12px; }
.text-button { min-height: 44px; padding: 0; color: var(--pink-dark); border: 0; background: transparent; font-weight: 800; cursor: pointer; }

.plan-card { padding: 22px; background: radial-gradient(circle at 100% 0, rgba(245,181,204,.3), transparent 13rem), white; }
.plan-status { display: inline-block; padding: 5px 9px; color: var(--pink-dark); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; border-radius: 99px; background: var(--pink-soft); }
.plan-card h2 { margin: 13px 0 17px; font-size: 24px; line-height: 1.2; letter-spacing: -.03em; }
.plan-card ol { margin: 0; padding: 0; list-style: none; counter-reset: plan; }
.plan-card li { min-height: 44px; margin-top: 12px; padding-left: 44px; display: flex; align-items: center; position: relative; color: #564e55; font-size: 14px; line-height: 1.45; counter-increment: plan; }
.plan-card li::before { content: counter(plan); width: 32px; height: 32px; display: grid; place-items: center; position: absolute; left: 0; color: var(--pink-dark); font-size: 13px; font-weight: 800; border-radius: 11px; background: var(--pink-soft); }
.plan-card .primary, .plan-card .secondary { width: 100%; margin-top: 21px; }
.plan-meta { margin-top: 20px; padding: 13px 14px; display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; border-radius: 15px; background: #faf5f7; }
.plan-meta span { color: var(--muted); font-size: 13px; }
.plan-meta strong { font-size: 13px; }

.more-list { display: grid; gap: 10px; }
.more-list details, .optional { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: white; }
.more-list summary, .optional summary { min-height: 56px; padding: 15px 45px 15px 16px; display: flex; align-items: center; position: relative; font-weight: 750; cursor: pointer; list-style: none; }
.more-list summary::-webkit-details-marker, .optional summary::-webkit-details-marker { display: none; }
.more-list summary::after, .optional summary::after { content: "+"; position: absolute; right: 17px; color: var(--pink-dark); font-size: 23px; font-weight: 400; }
.more-list details[open] summary::after, .optional[open] summary::after { content: "−"; }
.more-list details > p { margin: -3px 16px 17px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.data-actions { padding: 0 15px 16px; display: grid; gap: 8px; }

.sheet-backdrop { position: fixed; z-index: 100; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: rgba(43,34,39,.38); backdrop-filter: blur(4px); }
.sheet { width: min(100%, 520px); height: min(94dvh, 850px); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; border-radius: 27px 27px 0 0; background: var(--paper); box-shadow: 0 16px 48px rgba(87,51,67,.16); animation: sheet-in .2s ease-out; }
@keyframes sheet-in { from { transform: translateY(18px); opacity: .4; } }
.sheet-header { min-height: 79px; padding: 16px 18px 11px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(233,221,227,.8); }
.sheet-header .eyebrow { margin-bottom: 2px; font-size: 10px; }
.sheet-header h2 { margin: 0; font-size: 23px; line-height: 1.1; }
.close { width: 44px; height: 44px; flex: 0 0 auto; color: #6d6268; border: 0; border-radius: 14px; background: #f7f0f3; font-size: 28px; font-weight: 300; cursor: pointer; }
.progress { height: 5px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.progress span { background: #eee4e8; }
.progress span.on { background: var(--pink); }
.sheet-body { min-height: 0; padding: 21px 18px 30px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.step-intro { margin-bottom: 25px; display: flex; align-items: center; gap: 12px; }
.step-intro > span { width: 37px; height: 37px; display: grid; place-items: center; flex: 0 0 auto; color: white; font-size: 14px; font-weight: 800; border-radius: 13px; background: var(--pink); }
.step-intro h3, .step-intro p { margin: 0; }
.step-intro h3 { font-size: 18px; }
.step-intro p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.question { min-width: 0; margin: 0 0 25px; padding: 0; border: 0; }
.question legend, .note-label { margin-bottom: 10px; padding: 0; font-size: 16px; font-weight: 780; line-height: 1.4; }
.help { margin: -5px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.choices { display: grid; gap: 8px; }
.choice { width: 100%; min-height: 52px; padding: 10px 13px; display: flex; align-items: center; gap: 11px; text-align: left; border: 1px solid #e5dade; border-radius: 15px; background: white; cursor: pointer; }
.choice > span:last-child { font-size: 15px; line-height: 1.35; }
.choice-mark { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 auto; color: white; border: 1.5px solid #c9b8c0; border-radius: 8px; font-size: 12px; font-weight: 800; }
.choice.selected { border-color: #dc789e; background: #fff6f9; }
.choice.selected .choice-mark { border-color: var(--pink); background: var(--pink); }
.optional { margin: 3px 0 24px; background: #fffbfc; }
.optional summary { min-height: 54px; color: #665b62; font-size: 14px; }
.optional-content { padding: 17px 14px 0; border-top: 1px solid var(--line); }
.note { display: grid; }
.note small { color: var(--muted); font-size: 12px; font-weight: 500; }
.note textarea { width: 100%; min-height: 92px; padding: 13px 14px; color: var(--ink); resize: vertical; border: 1px solid #dfd2d8; border-radius: 15px; outline: none; background: white; font-size: 15px; }
.sheet-footer { padding: 9px 14px calc(9px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,253,253,.98); }
.sheet-footer > div { display: grid; grid-template-columns: 1fr 1.45fr; gap: 9px; }
.form-error { margin: 0 2px 8px; color: #a23d57; font-size: 13px; font-weight: 650; }
.detail-sheet { height: min(80dvh, 680px); grid-template-rows: auto minmax(0, 1fr) auto; }
.detail-list { margin: 0; display: grid; gap: 10px; }
.detail-list > div { padding: 14px 15px; border-radius: 16px; background: #faf5f7; }
.detail-list dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.detail-list dd { margin: 4px 0 0; font-size: 15px; line-height: 1.45; }

@media (min-width: 700px) {
  body { padding: 20px 0; }
  .app-shell { min-height: calc(100dvh - 40px); overflow: hidden; border-radius: 28px; }
  .topbar { top: 20px; }
  .bottom-nav { bottom: 20px; border-radius: 0 0 28px 28px; }
  .sheet { margin-bottom: 20px; border-radius: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
