:root {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-soft: #101a2d;
  --surface: rgba(24, 35, 55, 0.94);
  --surface-raised: #1d2a41;
  --surface-quiet: #142036;
  --text: #f7f9fc;
  --text-soft: #bdc9da;
  --text-muted: #8fa0b8;
  --primary: #f4a6b8;
  --primary-strong: #ffc0ce;
  --primary-ink: #35131d;
  --accent: #9cd8d0;
  --severity-mild: #74d3ae;
  --severity-moderate: #ffc56b;
  --severity-severe: #ff8f8f;
  --estimated: #d4b6ff;
  --location-forehead: #f49bb1;
  --location-crown: #81d9d0;
  --location-back: #b39cf2;
  --location-temple: #f0c36a;
  --danger: #ffb4ab;
  --danger-bg: #4a2022;
  --border: rgba(221, 231, 244, 0.14);
  --focus: #b9e8ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --nav-height: 76px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 12% -5%, rgba(156, 216, 208, 0.12), transparent 34rem),
    radial-gradient(circle at 95% 15%, rgba(244, 166, 184, 0.09), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  overscroll-behavior: contain;
}
button, input, textarea { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.35rem, 5vw, 1.75rem); line-height: 1.2; letter-spacing: -0.02em; }
h2 { margin-bottom: 8px; font-size: clamp(1.45rem, 6vw, 2rem); line-height: 1.25; letter-spacing: -0.025em; }
h3 { margin-bottom: 4px; font-size: 1.08rem; }
.icon { width: 20px; height: 20px; flex: none; }
.sr-only { position: fixed; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 1000; padding: 10px 14px; color: var(--primary-ink); background: var(--primary-strong); border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.app-header { position: sticky; top: 0; z-index: 20; background: rgba(11, 18, 32, 0.86); border-bottom: 1px solid var(--border); backdrop-filter: blur(16px); }
.header-inner { width: min(100%, 760px); margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 18px 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.eyebrow { margin-bottom: 4px; color: var(--accent); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.16em; }
.privacy-pill, .count-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-soft); background: rgba(255,255,255,.035); font-size: .73rem; font-weight: 650; white-space: nowrap; }
.privacy-pill .icon { width: 15px; height: 15px; color: var(--accent); }
.app-main { width: min(100%, 760px); margin: 0 auto; padding: 20px 16px calc(var(--nav-height) + 40px + env(safe-area-inset-bottom)); }
.warning-banner { display: flex; gap: 12px; margin-bottom: 16px; padding: 14px; color: #ffe7a3; background: #3a301b; border: 1px solid rgba(255, 221, 132, .25); border-radius: var(--radius-sm); }
.notice-card, .hero-card, .placeholder-card, .record-card, .preview-card { border: 1px solid var(--border); box-shadow: var(--shadow); }
.notice-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; margin-bottom: 16px; padding: 16px; background: var(--surface-quiet); border-radius: var(--radius-md); }
.notice-card h2 { font-size: 1rem; }
.notice-card p { margin-bottom: 8px; color: var(--text-soft); font-size: .88rem; }
.notice-icon, .confirm-icon { display: grid; place-items: center; width: 42px; height: 42px; color: #ffe7a3; background: rgba(255, 231, 163, .09); border-radius: 12px; }
.text-button { min-height: 44px; padding: 0; color: var(--primary-strong); background: transparent; border: 0; font-weight: 750; cursor: pointer; }
.hero-card { position: relative; overflow: hidden; padding: 24px 20px; background: linear-gradient(145deg, rgba(37, 53, 79, .97), rgba(25, 37, 58, .95)); border-radius: var(--radius-lg); }
.hero-card::after { content: ''; position: absolute; width: 170px; height: 170px; right: -80px; top: -85px; background: var(--primary); border-radius: 50%; opacity: .09; }
.hero-card > * { position: relative; z-index: 1; }
.hero-card > p:not(.eyebrow) { max-width: 34rem; color: var(--text-soft); }
.primary-button, .secondary-button, .danger-button, .danger-solid-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 50px; padding: 11px 18px; border-radius: 14px; font-weight: 780; cursor: pointer; transition: background-color .16s ease, color .16s ease, border-color .16s ease, opacity .16s ease; }
.primary-button { width: 100%; margin-top: 12px; color: var(--primary-ink); background: var(--primary-strong); border: 1px solid transparent; }
.primary-button:active { background: #ffd2dc; }
.secondary-button, .danger-button { min-height: 46px; background: transparent; border: 1px solid var(--border); }
.secondary-button { color: var(--text); }
.danger-button { color: var(--danger); }
.danger-solid-button { color: #31100d; background: var(--danger); border: 1px solid var(--danger); }
.section-block { margin-top: 30px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 1.35rem; }
.record-list { display: grid; gap: 12px; }
.record-card { padding: 17px; background: var(--surface); border-radius: var(--radius-md); }
.record-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.record-time { margin-bottom: 2px; color: var(--text-muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.severity-badge { display: grid; place-items: center; flex: none; min-width: 64px; min-height: 46px; padding: 7px 10px; color: var(--primary-ink); background: var(--primary); border-radius: 15px; font-size: .84rem; font-weight: 850; }
.record-summary { margin: 10px 0 14px; color: var(--text-soft); overflow-wrap: anywhere; }
.record-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.empty-state { display: grid; justify-items: center; padding: 30px 16px; color: var(--text-muted); background: rgba(255,255,255,.025); border: 1px dashed var(--border); border-radius: var(--radius-md); text-align: center; }
.empty-state p { margin: 8px 0 0; }
.empty-mark { font-size: 1.7rem; }
.placeholder-card { margin-top: 20px; padding: 24px; background: var(--surface); border-radius: var(--radius-lg); }
.calendar-intro { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 4px 0 16px; }
.calendar-intro p:not(.eyebrow) { margin-bottom: 0; color: var(--text-soft); }
.compact-button { width: auto; min-width: 156px; flex: none; }
.estimate-note { display: flex; gap: 12px; margin: 0 0 16px; padding: 14px; color: var(--text-soft); background: rgba(156, 216, 208, .07); border: 1px solid rgba(156, 216, 208, .2); border-radius: var(--radius-sm); }
.estimate-note .icon { color: var(--accent); }
.estimate-note p { margin: 0; font-size: .87rem; }
.estimate-note strong { color: var(--text); }
.calendar-card { padding: 14px 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.month-controls { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 10px; padding: 2px 8px; text-align: center; }
.month-controls h3 { margin: 0; font-size: 1.18rem; }
.month-controls .eyebrow { margin: 0; }
.month-today { display: block; min-height: 36px; margin: 0 auto 8px; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 7px 13px; padding: 10px 8px; color: var(--text-soft); border-top: 1px solid var(--border); font-size: .72rem; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 99px; }
.legend-dot.migraine { background: var(--primary); }
.legend-dot.period { background: var(--accent); }
.legend-dot.estimated { background: transparent; border: 2px solid #d4b6ff; }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-row { padding: 4px 0; color: var(--text-muted); text-align: center; font-size: .7rem; font-weight: 750; }
.calendar-day { min-width: 0; min-height: 73px; padding: 5px 3px; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 9px; cursor: pointer; text-align: left; }
.calendar-day:hover, .calendar-day:active { background: rgba(255,255,255,.045); border-color: var(--border); }
.calendar-day.outside { color: #718099; opacity: .62; }
.day-number { display: block; padding: 0 3px; font-size: .74rem; font-variant-numeric: tabular-nums; }
.day-markers { display: grid; gap: 2px; margin-top: 3px; }
.calendar-marker { display: block; overflow: hidden; padding: 2px 3px; border-radius: 4px; font-size: clamp(.48rem, 1.8vw, .62rem); font-weight: 730; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.calendar-marker.migraine { color: var(--primary-ink); background: var(--primary); }
.calendar-marker.period { color: #092b28; background: var(--accent); }
.calendar-marker.estimated { color: #e7d9ff; background: rgba(190, 152, 255, .13); border: 1px solid rgba(212, 182, 255, .45); }
.period-list { display: grid; gap: 12px; }
.period-card { padding: 17px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.estimated-line { margin: 8px 0 14px; color: #d4b6ff; font-size: .88rem; }
.form-disclaimer { color: var(--text-muted); font-size: .82rem; }
.date-details { min-height: 260px; }
.detail-stack { display: grid; gap: 10px; }
.detail-row { display: grid; gap: 3px; padding: 14px; background: var(--surface-quiet); border-left: 4px solid var(--border); border-radius: 10px; }
.detail-row span { color: var(--text-soft); font-size: .88rem; }
.detail-row.migraine { border-left-color: var(--primary); }
.detail-row.period { border-left-color: var(--accent); }
.detail-row.estimated { border-left-color: #d4b6ff; }
.observation-intro { padding: 4px 2px 8px; }
.observation-intro p:last-child { max-width: 38rem; color: var(--text-soft); }
.neutrality-note { display: flex; gap: 12px; padding: 15px; color: var(--text-soft); background: rgba(255, 231, 163, .06); border: 1px solid rgba(255, 231, 163, .18); border-radius: var(--radius-md); }
.neutrality-note .icon { color: #ffe7a3; }
.neutrality-note p { margin: 0; font-size: .88rem; }
.neutrality-note strong { color: var(--text); }
.timeline { position: relative; display: grid; gap: 15px; padding-left: 16px; }
.timeline::before { content: ''; position: absolute; top: 10px; bottom: 10px; left: 5px; width: 2px; background: linear-gradient(var(--primary), rgba(156, 216, 208, .2)); }
.timeline-item { position: relative; }
.timeline-node { position: absolute; z-index: 1; top: 24px; left: -16px; width: 12px; height: 12px; background: var(--primary); border: 3px solid var(--bg); border-radius: 50%; box-shadow: 0 0 0 2px rgba(244, 166, 184, .22); }
.timeline-card { padding: 17px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.distance-list { display: grid; gap: 7px; padding-top: 12px; border-top: 1px solid var(--border); }
.distance-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 54px; padding: 9px 11px; background: var(--surface-quiet); border-left: 3px solid var(--accent); border-radius: 9px; }
.distance-row.estimatedOvulation { border-left-color: #d4b6ff; }
.distance-row span { display: grid; }
.distance-row strong { font-size: .86rem; }
.distance-row small { color: var(--text-muted); font-size: .72rem; }
.distance-row b { flex: none; color: var(--accent); font-size: .82rem; }
.distance-row.estimatedOvulation b { color: #d4b6ff; }
.cycle-empty { margin: 0; padding: 12px; color: var(--text-muted); background: var(--surface-quiet); border-radius: 9px; font-size: .86rem; }
.observation-empty .secondary-button { margin-top: 10px; }
.observation-month-card { margin-top: 16px; padding: 14px 10px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.observation-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 14px; }
.observation-stat { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 3px; min-width: 0; padding: 12px 10px; background: var(--surface-quiet); border: 1px solid var(--border); border-radius: 13px; }
.observation-stat span { color: var(--text-soft); font-size: .76rem; font-weight: 700; }
.observation-stat strong { font-size: 1.55rem; font-variant-numeric: tabular-nums; line-height: 1; }
.observation-stat small { color: var(--text-muted); font-size: .72rem; }
.observation-stat.mild { border-color: color-mix(in srgb, var(--severity-mild) 42%, transparent); }
.observation-stat.moderate { border-color: color-mix(in srgb, var(--severity-moderate) 42%, transparent); }
.observation-stat.severe { border-color: color-mix(in srgb, var(--severity-severe) 42%, transparent); }
.pending-note { margin: -4px 2px 14px; color: var(--text-soft); font-size: .82rem; }
.observation-chart-section, .observation-location-section, .observation-mini-calendar, .observation-details { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.observation-chart-section .section-heading, .observation-location-section .section-heading, .observation-mini-calendar .section-heading { margin-bottom: 8px; }
.observation-chart-section h3, .observation-location-section h3, .observation-mini-calendar h3 { margin: 0; font-size: 1.15rem; }
.observation-legend { display: flex; flex-wrap: wrap; gap: 8px 13px; margin-bottom: 8px; color: var(--text-soft); font-size: .72rem; }
.observation-legend span { display: inline-flex; align-items: center; gap: 6px; }
.severity-marker { display: inline-block; flex: none; width: 10px; height: 10px; }
.marker-circle { background: var(--severity-mild); border-radius: 50%; }
.marker-triangle { width: 0; height: 0; background: transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--severity-moderate); border-left: 6px solid transparent; }
.marker-square { background: var(--severity-severe); border-radius: 1px; }
.marker-pending { display: grid; place-items: center; width: 16px; height: 16px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--text-muted); border-radius: 50%; font-size: .68rem; font-style: normal; }
.period-swatch { width: 18px; height: 10px; background: color-mix(in srgb, var(--primary) 35%, transparent); border: 1px solid var(--primary); border-radius: 3px; }
.ovulation-swatch { width: 14px; height: 14px; border-left: 2px dashed var(--estimated); transform: rotate(45deg); }
.trend-chart-wrap { width: 100%; overflow: hidden; background: rgba(6, 12, 24, .3); border: 1px solid var(--border); border-radius: 12px; }
.trend-chart { display: block; width: 100%; height: auto; min-height: 190px; }
.period-band { fill: var(--primary); opacity: .14; }
.trend-gridline { stroke: rgba(221, 231, 244, .18); stroke-width: 1; }
.trend-axis-label, .trend-tick { fill: var(--text-soft); font-size: 11px; font-weight: 700; }
.trend-line { fill: none; stroke: #dfe8f6; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-marker.mild { fill: var(--severity-mild); stroke: var(--bg); stroke-width: 2; }
.trend-marker.moderate { fill: var(--severity-moderate); stroke: var(--bg); stroke-width: 2; }
.trend-marker.severe { fill: var(--severity-severe); stroke: var(--bg); stroke-width: 2; }
.ovulation-line { stroke: var(--estimated); stroke-width: 1.5; stroke-dasharray: 4 4; }
.ovulation-diamond { fill: var(--estimated); }
.trend-pending { fill: var(--text); font-size: 13px; font-weight: 800; }
.location-basis { margin: 0 0 8px; color: var(--text-soft); font-size: .8rem; }
.location-map-wrap { overflow: hidden; background: rgba(6, 12, 24, .3); border: 1px solid var(--border); border-radius: 12px; }
.location-head-map { display: block; width: 100%; height: auto; margin-inline: auto; }
.head-outline { fill: var(--surface-quiet); stroke: #93abc5; stroke-width: 2.4; stroke-linejoin: round; }
.head-ear { fill: var(--surface-quiet); stroke: #93abc5; stroke-width: 1.8; }
.head-detail { fill: none; stroke: #93abc5; stroke-width: 1.3; stroke-linecap: round; }
.location-zone-forehead { fill: var(--location-forehead); }
.location-zone-crown { fill: var(--location-crown); }
.location-zone-back { fill: var(--location-back); }
.location-zone-temple { fill: var(--location-temple); }
.location-divider { fill: none; stroke: rgba(11, 18, 32, .62); stroke-width: 1.6; }
.location-connectors { fill: none; stroke: #7189a7; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.location-side-heading { fill: var(--text-soft); font-size: 15px; font-weight: 850; }
.location-label { font-variant-numeric: tabular-nums; }
.location-label rect { fill: var(--surface-raised); stroke: currentColor; stroke-opacity: .8; }
.location-label text { fill: var(--text); }
.location-label-name { font-size: 13px; font-weight: 700; }
.location-label-value { font-size: 20px; font-weight: 800; letter-spacing: -.04em; }
.location-label-forehead { color: var(--location-forehead); }
.location-label-crown { color: var(--location-crown); }
.location-label-back { color: var(--location-back); }
.location-label-temple { color: var(--location-temple); }
.location-note { margin: 8px 2px 0; color: var(--text-muted); font-size: .75rem; line-height: 1.5; }
.location-empty { margin: 0; padding: 22px 14px; color: var(--text-muted); background: rgba(6, 12, 24, .3); border: 1px dashed var(--border); border-radius: 12px; text-align: center; }
.observation-weekdays, .observation-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.observation-weekdays { color: var(--text-muted); font-size: .7rem; font-weight: 750; text-align: center; }
.observation-calendar-grid { gap: 3px; margin-top: 4px; }
.observation-calendar-blank { min-height: 48px; }
.observation-calendar-day { position: relative; display: grid; place-items: center; align-content: center; gap: 3px; min-width: 0; min-height: 48px; padding: 4px 1px; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: .78rem; font-variant-numeric: tabular-nums; }
.observation-calendar-day:hover, .observation-calendar-day:active { background: rgba(255,255,255,.05); }
.observation-calendar-day[aria-current="date"] { border-color: var(--focus); background: rgba(185, 232, 255, .08); box-shadow: inset 0 0 0 1px rgba(185, 232, 255, .25); }
.observation-calendar-day.is-period { background: linear-gradient(rgba(244, 166, 184, .17), rgba(244, 166, 184, .17)); }
.observation-calendar-day.is-period[aria-current="date"] { background: linear-gradient(rgba(244, 166, 184, .22), rgba(244, 166, 184, .22)); }
.observation-calendar-day .severity-marker { width: 9px; height: 9px; }
.observation-calendar-day .marker-triangle { width: 0; height: 0; border-right-width: 5px; border-bottom-width: 9px; border-left-width: 5px; }
.mini-ovulation { position: absolute; right: 4px; top: 4px; width: 7px; height: 7px; border: 1.5px solid var(--estimated); transform: rotate(45deg); }
.observation-details { scroll-margin-top: 96px; }
.observation-details h3 { margin-bottom: 10px; }
.observation-detail-record, .detail-cycle, .observation-detail-empty { margin: 8px 0 0; padding: 11px 12px; background: var(--surface-quiet); border-left: 3px solid var(--border); border-radius: 9px; }
.observation-detail-record { min-width: 0; border-left-color: var(--primary-strong); }
.observation-detail-record p { margin-bottom: 0; }
.observation-detail-record .record-time { margin-bottom: 3px; }
.observation-detail-summary { overflow-wrap: anywhere; }
.detail-cycle { color: var(--text-soft); font-size: .86rem; }
.period-detail { border-left-color: var(--primary); }
.estimated-detail { border-left-color: var(--estimated); }
.observation-detail-empty { color: var(--text-muted); font-size: .86rem; }
.bottom-nav { position: fixed; left: 50%; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr); width: min(100%, 760px); min-height: var(--nav-height); padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); background: rgba(16, 26, 45, .96); border: 1px solid var(--border); border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -12px 35px rgba(0,0,0,.25); backdrop-filter: blur(18px); transform: translateX(-50%); }
.nav-item { display: grid; place-items: center; align-content: center; gap: 2px; min-height: 56px; color: var(--text-muted); background: transparent; border: 0; border-radius: 15px; font-size: .72rem; font-weight: 750; cursor: pointer; }
.nav-item[aria-current="page"] { color: var(--primary-strong); background: rgba(244, 166, 184, .09); }
.nav-icon { width: 22px; height: 22px; }
dialog { color: var(--text); }
dialog::backdrop { background: rgba(2, 6, 14, .76); backdrop-filter: blur(4px); }
.sheet-dialog { width: min(100%, 680px); max-width: none; max-height: min(92dvh, 900px); margin: auto auto 0; padding: 0; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 28px 28px 0 0; box-shadow: var(--shadow); }
.sheet { padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 14px; background: var(--text-muted); border-radius: 99px; opacity: .55; }
.sheet-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 8px 0 16px; background: linear-gradient(var(--bg-soft) 80%, transparent); }
.sheet-header h2 { margin: 0; font-size: 1.45rem; }
.icon-button { display: grid; place-items: center; flex: none; width: 48px; height: 48px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 14px; cursor: pointer; }
.form-stack { display: grid; gap: 12px; }
.field-label, legend { color: var(--text); font-weight: 760; }
.field-label span, legend span { color: var(--text-muted); font-size: .8rem; font-weight: 500; }
.text-input { width: 100%; min-height: 50px; padding: 12px 14px; color: var(--text); background: var(--surface-quiet); border: 1px solid var(--border); border-radius: 12px; font-size: 1rem; }
.text-input::placeholder { color: #8191a9; }
textarea.text-input { resize: vertical; }
.choice-group { min-width: 0; margin: 7px 0; padding: 0; border: 0; }
.choice-group legend { margin-bottom: 10px; }
.severity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.daypart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.severity-choice, .daypart-choice, .location-choice, .side-choices button { min-width: 0; min-height: 50px; color: var(--text-soft); background: var(--surface-quiet); border: 1px solid var(--border); border-radius: 12px; font-weight: 760; cursor: pointer; }
[aria-pressed="true"].severity-choice, [aria-pressed="true"].daypart-choice, [aria-pressed="true"].location-choice, .side-choices button[aria-pressed="true"] { color: var(--primary-ink); background: var(--primary-strong); border-color: var(--primary-strong); }
.legacy-note { margin: 0; color: var(--text-soft); font-size: .82rem; }
.location-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.side-groups { display: grid; gap: 9px; margin-top: 12px; }
.side-row { display: grid; gap: 8px; padding: 12px; background: rgba(255,255,255,.025); border-radius: 12px; }
.side-row > span { color: var(--text-soft); font-size: .86rem; font-weight: 700; }
.side-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.field-error { min-height: 1em; margin: -5px 0 0; color: var(--danger); font-size: .82rem; }
.preview-card { padding: 14px; background: rgba(156, 216, 208, .07); border-color: rgba(156, 216, 208, .22); border-radius: var(--radius-sm); }
.preview-card p:last-child { margin: 0; color: var(--text-soft); font-size: .9rem; }
.sticky-save { position: sticky; bottom: 0; box-shadow: 0 -10px 26px var(--bg-soft); }
.confirm-dialog { width: min(calc(100% - 32px), 430px); padding: 0; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.confirm-card { padding: 24px; text-align: center; }
.confirm-card .confirm-icon { margin: 0 auto 14px; color: var(--danger); background: var(--danger-bg); }
.confirm-card p { color: var(--text-soft); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.global-warning:not([hidden]) { max-width: 760px; margin: 12px auto 0; padding: 12px 16px; color: var(--text); background: var(--danger-bg); border: 1px solid var(--danger); border-radius: 12px; }
.backup-summary { max-width: 760px; margin: 12px auto 0; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.backup-status { margin: 0; color: var(--text-soft); font-size: .82rem; }
.backup-open { flex: none; min-height: 44px; padding: 8px 12px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 10px; font-weight: 700; cursor: pointer; }
.backup-dialog { width: min(calc(100% - 24px), 620px); max-height: 90dvh; margin: auto; padding: 0; overflow: auto; color: var(--text); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.backup-sheet { display: grid; gap: 12px; padding: 20px; }
.backup-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.backup-heading h2, .backup-sheet h3 { margin: 0; }
.backup-explain, .backup-hint, .backup-detail { margin: 0; color: var(--text-soft); font-size: .86rem; line-height: 1.5; }
.backup-error:not(:empty) { margin: 0; padding: 10px; color: var(--text); background: var(--danger-bg); border-radius: 8px; }
.backup-error:empty { display: none; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.backup-actions > button, .backup-file-label { min-height: 44px; }
.backup-file-label { display: inline-flex; align-items: center; padding: 10px 14px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.backup-file-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.backup-file-label:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.backup-divider { width: 100%; border: 0; border-top: 1px solid var(--border); }
.backup-safety:not([hidden]) { display: grid; gap: 12px; padding: 14px; background: var(--danger-bg); border: 1px solid var(--danger); border-radius: 12px; }
.backup-safety p { margin: 0; }
[hidden] { display: none !important; }

@media (min-width: 600px) {
  .app-main { padding-inline: 24px; }
  .hero-card { padding: 32px; }
  .primary-button { width: auto; min-width: 220px; }
  .record-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-card { padding: 18px; }
  .calendar-day { min-height: 92px; padding: 7px; }
  .observation-month-card { padding: 20px; }
  .observation-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .observation-calendar-grid { gap: 6px; }
  .observation-calendar-day { min-height: 58px; }
  .sheet { padding-inline: 28px; }
}

@media (max-width: 370px) {
  .privacy-pill { max-width: 120px; white-space: normal; line-height: 1.2; }
  .record-actions, .confirm-actions { grid-template-columns: 1fr; }
  .calendar-intro { align-items: stretch; flex-direction: column; }
  .compact-button { width: 100%; }
  .calendar-day { min-height: 65px; }
}

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