:root {
  --ink: #172033;
  --muted: #657086;
  --line: #dce2ec;
  --paper: #f5f7fb;
  --surface: #ffffff;
  --navy: #11182a;
  --navy-2: #202a42;
  --gold: #ffd56a;
  --gold-strong: #f4bd3e;
  --mint: #8ee4c5;
  --coral: #ff8b7a;
  --blue: #6ea8ff;
  --shadow: 0 18px 60px rgba(24, 34, 55, .09);
  --radius-xl: 28px;
  --radius-lg: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 92% 2%, rgba(110,168,255,.16), transparent 27rem), var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
:focus-visible { outline: 3px solid rgba(38,100,255,.45); outline-offset: 3px; }

.app-shell { max-width: 1360px; min-height: 100vh; margin: 0 auto; padding: 0 44px 108px; }
.topbar { height: 84px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(23,32,51,.08); }
.brand { display: inline-flex; align-items: center; gap: 11px; background: none; border: 0; padding: 0; font-weight: 800; font-size: 1.12rem; cursor: pointer; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 12px; background: var(--navy); color: var(--gold); font-size: .95rem; box-shadow: 0 8px 22px rgba(17,24,42,.2); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.local-pill { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; color: var(--muted); background: rgba(255,255,255,.72); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; }
.privacy-dot { width: 8px; height: 8px; border-radius: 50%; background: #28ad75; box-shadow: 0 0 0 4px rgba(40,173,117,.12); }
.help-button { border: 0; border-bottom: 1px solid rgba(186,44,52,.35); padding: 7px 2px; color: #aa2731; background: transparent; cursor: pointer; font-size: .88rem; }

.view { animation: viewIn .3s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 32px; padding: 44px 0 30px; }
.eyebrow, .card-kicker, .dialog-kicker { margin: 0 0 8px; text-transform: uppercase; letter-spacing: .14em; color: #61708d; font-size: .76rem; font-weight: 800; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 4.2vw, 3.7rem); letter-spacing: -.055em; line-height: 1.04; }
h2 { letter-spacing: -.025em; }
.intro-note { max-width: 410px; margin: 0 0 5px; color: var(--muted); font-size: .95rem; line-height: 1.7; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .72fr); gap: 24px; align-items: start; }
.entry-card, .insight-card, .quick-card, .boundary-card, .trend-card, .records-card, .settings-card, .support-strip { background: rgba(255,255,255,.94); border: 1px solid rgba(23,32,51,.08); box-shadow: var(--shadow); }
.entry-card { border-radius: var(--radius-xl); overflow: hidden; }
.step-block { padding: 28px 32px; border-bottom: 1px solid var(--line); }
.step-heading { display: flex; gap: 16px; margin-bottom: 27px; align-items: flex-start; }
.step-heading.compact { margin-bottom: 18px; }
.step-heading h2 { margin: 0 0 5px; font-size: 1.1rem; }
.step-heading p { margin: 0; color: var(--muted); font-size: .86rem; }
.step-number { flex: 0 0 auto; color: #8792a8; font-weight: 800; font-size: .76rem; padding-top: 4px; }
.mood-block { background: linear-gradient(135deg, #fff 48%, #f7f9ff); }
.mood-orb-wrap { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 4px 0 30px; }
.mood-orb { width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 28%, #fff6cd, var(--gold) 44%, #ff9b6b 100%); box-shadow: 0 18px 44px rgba(244,189,62,.3), inset -10px -12px 26px rgba(255,116,88,.18); transition: .35s ease; }
.mood-orb span { color: rgba(17,24,42,.72); font-size: 1.7rem; transform: translateY(-1px); }
.mood-orb-wrap strong { display: block; font-size: 1.35rem; letter-spacing: -.03em; }
.mood-orb-wrap div:last-child span { display: block; margin-top: 6px; color: var(--muted); font-size: .86rem; }
.slider-group { margin: 20px 0 4px; }
.slider-group label { display: block; margin-bottom: 11px; font-size: .92rem; font-weight: 700; }
input[type="range"] { width: 100%; height: 7px; accent-color: var(--navy); cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: #8490a5; font-size: .73rem; margin-top: 4px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 9px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 14px; cursor: pointer; transition: .18s ease; font-size: .91rem; }
.chip:hover { border-color: #aab5c8; transform: translateY(-1px); }
.chip.selected { background: var(--navy); color: #fff; border-color: var(--navy); box-shadow: 0 7px 16px rgba(17,24,42,.16); }
.chip.small { padding: 8px 12px; font-size: .83rem; }

.optional-panel { border-bottom: 1px solid var(--line); }
.optional-panel summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px 32px; cursor: pointer; font-size: .95rem; }
.optional-panel summary::-webkit-details-marker { display: none; }
.optional-panel summary b { margin-right: 18px; color: #8792a8; font-size: .76rem; }
.summary-hint { color: var(--muted); font-size: .8rem; }
.optional-content { padding: 0 32px 28px; }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { margin-bottom: 10px; font-size: .85rem; font-weight: 750; }
.context-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px 0 20px; }
.context-grid label, .note-field { color: var(--muted); font-size: .78rem; font-weight: 700; }
select, textarea { width: 100%; margin-top: 7px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
select { min-height: 43px; padding: 0 11px; }
textarea { resize: vertical; min-height: 92px; padding: 12px 13px; line-height: 1.5; }
.note-field { position: relative; display: block; }
.note-field > span { position: absolute; right: 11px; bottom: 10px; color: #9aa4b5; font-size: .7rem; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 22px 32px 26px; }
.form-footer > span { color: var(--muted); font-size: .78rem; }
.primary-button, .secondary-button, .danger-button { min-height: 46px; border-radius: 14px; border: 0; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; font-weight: 800; text-decoration: none; cursor: pointer; transition: .2s ease; }
.primary-button { background: var(--navy); color: #fff; box-shadow: 0 12px 24px rgba(17,24,42,.18); }
.primary-button:hover { background: var(--navy-2); transform: translateY(-1px); }
.secondary-button { background: #eef2f8; color: var(--ink); }
.danger-button { background: #fff0f0; color: #ab2631; }

.side-column { display: grid; gap: 16px; }
.insight-card, .quick-card, .boundary-card { border-radius: var(--radius-lg); padding: 22px; }
.insight-card { min-height: 210px; background: var(--navy); color: #fff; box-shadow: 0 20px 56px rgba(17,24,42,.2); }
.insight-card .card-kicker { color: #9eabc4; }
.today-count { display: flex; align-items: baseline; gap: 8px; }
.today-count strong { font-size: 3rem; color: var(--gold); line-height: 1; }
.today-count span { color: #c2cad9; }
.insight-card p { color: #b5c0d4; line-height: 1.6; font-size: .86rem; margin: 14px 0; }
.mini-timeline { display: flex; gap: 7px; align-items: end; min-height: 36px; }
.mini-dot { width: 12px; border-radius: 6px; min-height: 10px; background: var(--gold); }
.quick-card { display: grid; grid-template-columns: 42px 1fr; gap: 10px 12px; }
.quick-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #e8f8f1; color: #12865e; font-size: 1.35rem; }
.quick-card h2 { margin: 1px 0 4px; font-size: 1rem; }
.quick-card p, .boundary-card p { color: var(--muted); font-size: .82rem; line-height: 1.55; margin-bottom: 0; }
.quick-card .text-button { grid-column: 2; justify-self: start; }
.text-button { color: #315c9c; border: 0; background: transparent; padding: 0; font-weight: 750; font-size: .82rem; cursor: pointer; }
.boundary-card { box-shadow: none; background: transparent; border-style: dashed; }
.boundary-card > span { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #7c879b; }

.history-layout { display: grid; gap: 20px; }
.trend-card, .records-card { border-radius: var(--radius-xl); padding: 28px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-title-row h2 { margin: 0; font-size: 1.1rem; }
.section-title-row > span { color: var(--muted); font-size: .85rem; }
.trend-chart { min-height: 176px; display: flex; align-items: center; gap: 12px; padding: 30px 8px 14px; overflow-x: auto; }
.trend-column { min-width: 44px; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: end; height: 126px; gap: 8px; }
.trend-bar { width: min(32px, 75%); min-height: 8px; border-radius: 12px 12px 5px 5px; background: var(--blue); }
.trend-bar.good { background: var(--mint); }
.trend-bar.low { background: var(--coral); }
.trend-column span { color: var(--muted); font-size: .7rem; white-space: nowrap; }
.trend-legend { display: flex; gap: 18px; justify-content: center; color: var(--muted); font-size: .76rem; }
.trend-legend span { display: flex; align-items: center; gap: 6px; }
.trend-legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.trend-legend .legend-good { background: var(--mint); }.trend-legend .legend-low { background: var(--coral); }
.history-list { display: grid; gap: 10px; margin-top: 20px; }
.history-item { display: grid; grid-template-columns: 58px 1fr auto; gap: 14px; align-items: center; padding: 16px; border-radius: 16px; background: #f7f9fc; border: 1px solid #edf0f5; }
.history-mood { width: 52px; height: 52px; border-radius: 17px; display: grid; place-items: center; background: #edf2fa; font-weight: 900; }
.history-item h3 { margin: 0 0 4px; font-size: .95rem; }
.history-item p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.history-time { color: #8b95a7; font-size: .76rem; }
.empty-state { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); margin-bottom: 6px; }

.practice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.practice-card { display: flex; flex-direction: column; min-height: 238px; padding: 23px; border: 1px solid rgba(23,32,51,.09); background: #fff; border-radius: 22px; text-align: left; cursor: pointer; box-shadow: 0 12px 38px rgba(24,34,55,.06); transition: .2s ease; }
.practice-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.practice-card .practice-symbol { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: #edf2ff; color: #3a5da0; font-weight: 900; }
.practice-card h2 { margin: 24px 0 8px; font-size: 1.06rem; }
.practice-card p { color: var(--muted); line-height: 1.6; font-size: .84rem; }
.practice-meta { margin-top: auto; display: flex; justify-content: space-between; color: #71809b; font-size: .76rem; }
.support-strip { margin-top: 22px; border-radius: var(--radius-xl); padding: 28px; display: flex; align-items: center; justify-content: space-between; gap: 28px; background: linear-gradient(120deg, #fff 50%, #fff8e5); }
.support-strip h2 { margin-bottom: 7px; }.support-strip p { margin-bottom: 0; color: var(--muted); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-card { border-radius: var(--radius-xl); padding: 28px; }
.settings-card h2 { font-size: 1.08rem; margin-bottom: 20px; }
.settings-card > p { color: var(--muted); line-height: 1.7; }
.full-span { grid-column: 1 / -1; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.setting-row strong, .setting-row span { display: block; }.setting-row div > span { color: var(--muted); font-size: .78rem; margin-top: 5px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch > span { width: 48px; height: 28px; border-radius: 20px; background: #cdd5e2; position: relative; cursor: pointer; transition: .2s; }
.switch > span::after { content: ""; width: 22px; height: 22px; border-radius: 50%; background: #fff; position: absolute; left: 3px; top: 3px; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .2s; }
.switch input:checked + span { background: var(--navy); }.switch input:checked + span::after { transform: translateX(20px); }
.status-badge { color: #17855e; background: #e9f8f2; border-radius: 999px; padding: 7px 10px; font-size: .76rem; font-weight: 800; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.bottom-nav { position: fixed; z-index: 20; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(560px, calc(100% - 28px)); display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 7px; background: rgba(17,24,42,.94); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.11); border-radius: 22px; box-shadow: 0 18px 60px rgba(17,24,42,.32); }
.nav-item { border: 0; background: transparent; color: #9faac0; min-height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-size: .82rem; font-weight: 750; }
.nav-item span { font-size: 1rem; }.nav-item.active { background: #fff; color: var(--ink); }

.app-dialog { border: 0; padding: 0; background: transparent; width: min(620px, calc(100% - 28px)); max-height: calc(100vh - 32px); color: var(--ink); }
.app-dialog::backdrop { background: rgba(9,14,25,.65); backdrop-filter: blur(7px); }
.dialog-shell { position: relative; background: #fff; padding: 34px; border-radius: 28px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 28px 100px rgba(0,0,0,.28); }
.dialog-close { position: absolute; right: 18px; top: 16px; border: 0; background: #f1f3f7; border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 1.4rem; line-height: 1; }
.dialog-shell h2 { font-size: 1.65rem; margin: 0 38px 10px 0; }.dialog-shell > p { color: var(--muted); line-height: 1.65; }
.action-hero { margin: -34px -34px 28px; padding: 40px 34px 30px; border-radius: 28px 28px 0 0; background: var(--navy); color: #fff; }
.action-hero .dialog-kicker { color: var(--gold); }.action-hero h2 { font-size: 1.9rem; }.action-hero p { color: #b8c2d6; line-height: 1.6; margin-bottom: 0; }
.action-meta { display: flex; gap: 8px; margin-top: 18px; }.action-meta span { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 7px 10px; font-size: .76rem; }
.action-steps { display: grid; gap: 12px; margin: 20px 0; padding: 0; list-style: none; }
.action-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; line-height: 1.55; font-size: .9rem; }
.action-steps li span { width: 27px; height: 27px; border-radius: 9px; display: grid; place-items: center; background: #edf2fa; color: #52627f; font-weight: 850; font-size: .74rem; }
.timer-panel { text-align: center; padding: 18px; border-radius: 18px; background: #f5f7fb; margin: 18px 0; }
.timer-panel strong { display: block; font-variant-numeric: tabular-nums; font-size: 2.2rem; letter-spacing: -.04em; }
.timer-panel span { color: var(--muted); font-size: .8rem; }
.timer-actions, .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.feedback-panel { border-top: 1px solid var(--line); margin-top: 26px; padding-top: 24px; }
.feedback-panel h3 { margin: 0 0 15px; font-size: 1rem; }.feedback-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.feedback-choice { border: 1px solid var(--line); background: #fff; padding: 9px 13px; border-radius: 11px; cursor: pointer; }.feedback-choice.selected { background: var(--navy); color: #fff; }
.feedback-save { margin-top: 16px; width: 100%; }
.crisis-dialog .dialog-shell { border-top: 8px solid var(--coral); }
.crisis-actions { display: grid; gap: 12px; margin: 24px 0; }.crisis-actions .primary-button { width: 100%; }
.emergency-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.emergency-pair a { text-align: center; padding: 13px; border-radius: 13px; background: #fff2f0; color: #a52831; text-decoration: none; font-weight: 800; }
.crisis-steps { background: #fff8e8; border-radius: 16px; padding: 18px; line-height: 1.7; font-size: .88rem; }.crisis-steps ol { margin-bottom: 0; padding-left: 20px; }
.dialog-note { font-size: .78rem; }.small-dialog { max-width: 460px; }.danger-text { color: #ab2631; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 92px; transform: translate(-50%, 16px); background: var(--navy); color: #fff; padding: 12px 17px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .25s ease; box-shadow: 0 15px 35px rgba(17,24,42,.25); font-size: .86rem; }.toast.show { opacity: 1; transform: translate(-50%, 0); }
.privacy-cover { position: fixed; z-index: 90; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; background: var(--paper); }.privacy-cover .brand-mark { margin-bottom: 18px; }.privacy-cover strong { font-size: 1.3rem; }.privacy-cover p { color: var(--muted); }
.privacy-cover[hidden] { display: none !important; }

@media (max-width: 900px) {
  .app-shell { padding: 0 22px 102px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: 1fr 1fr; }
  .insight-card { grid-column: 1 / -1; }
  .practice-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .app-shell { padding: 0 14px 98px; }
  .topbar { height: 70px; }
  .local-pill { display: none; }
  .help-button { font-size: .8rem; }
  .page-intro { display: block; padding: 32px 4px 22px; }
  .intro-note { margin-top: 14px; }
  h1 { font-size: 2.2rem; }
  .step-block { padding: 23px 20px; }
  .mood-orb { width: 88px; height: 88px; }
  .optional-panel summary, .optional-content, .form-footer { padding-left: 20px; padding-right: 20px; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-footer .primary-button { width: 100%; }
  .context-grid, .settings-grid, .practice-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: 1fr; }
  .insight-card { grid-column: auto; }
  .support-strip { align-items: stretch; flex-direction: column; }
  .history-item { grid-template-columns: 48px 1fr; }.history-mood { width: 44px; height: 44px; }.history-time { grid-column: 2; }
  .top-actions { gap: 7px; }
  .bottom-nav { bottom: 9px; }
  .nav-item { flex-direction: column; gap: 2px; font-size: .68rem; }
  .dialog-shell { padding: 27px 22px; }.action-hero { margin: -27px -22px 24px; padding: 36px 22px 26px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
