:root {
  color-scheme: dark;
  --bg: #0b0d0e;
  --bg-elevated: #111416;
  --surface: #15191b;
  --surface-strong: #1b2023;
  --surface-soft: #242a2d;
  --ink: #f2f5f3;
  --muted: #8c9792;
  --line: #293033;
  --line-strong: #414b4e;
  --gold: #c9ff63;
  --gold-soft: #27351b;
  --emerald: #42d6a4;
  --emerald-soft: #143a2f;
  --red: #ff6b63;
  --red-soft: #472321;
  --blue: #59b7ff;
  --violet: #a88cff;
  --orange: #ff9a5c;
  --shadow: 0 18px 50px rgba(0, 0, 0, .18);
  --nav-height: 76px;
}

html[data-mode="light"] {
  color-scheme: light;
  --bg: #f2f5f3;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-strong: #edf1ef;
  --surface-soft: #e1e7e4;
  --ink: #141817;
  --muted: #68716e;
  --line: #d7dfdb;
  --line-strong: #9da8a3;
  --gold-soft: #e2f4c5;
  --emerald-soft: #dcefe8;
  --red-soft: #f7dedd;
  --shadow: 0 14px 34px rgba(47, 43, 33, .09);
}

html[data-theme="moss"] { --gold: #98f58a; --emerald: #4bd5a0; --blue: #6bbbc4; }
html[data-theme="voyage"] { --gold: #6fe7ff; --emerald: #4bd7c6; --blue: #61a9ff; --violet: #a695ff; }
html[data-theme="crimson"] { --gold: #ffad5c; --emerald: #55d39e; --red: #ff6b63; --orange: #ff8a58; }
html[data-theme="aurora"] { --gold: #ddff6b; --emerald: #4ce6be; --blue: #70c8ff; --violet: #c59bff; }

* { box-sizing: border-box; }
html { min-height: 100%; max-width: 100%; overflow-x: hidden; background: var(--bg); }
html, body { -webkit-text-size-adjust: 100%; }
body {
  max-width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  transition: background-color .2s ease, color .2s ease;
}
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
svg { display: block; }
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.small { width: 16px; height: 16px; }

#app-shell { min-height: 100vh; padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
.topbar {
  height: calc(60px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 13, 14, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
html[data-mode="light"] .topbar { background: rgba(242, 245, 243, .92); }
.brand {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  padding: 4px 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.brand-glyph {
  width: 30px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font: 750 9px/1 ui-monospace, monospace;
}
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand strong { font-size: 12px; color: var(--gold); }
.brand small { max-width: 160px; margin-top: 3px; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
}
.icon-button:hover { background: var(--surface); color: var(--ink); }
.back-button[hidden] { display: block; visibility: hidden; pointer-events: none; }

.view { width: min(760px, 100%); min-height: calc(100vh - 60px); margin: 0 auto; padding: 22px 16px 36px; }
.route-map .view { width: min(900px, 100%); background-image: url("assets/map-contours.svg"); background-position: center top; background-size: 640px auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 2px 0 24px; }
.page-head h1 { margin: 0; font-size: 28px; line-height: 1.12; font-weight: 760; }
.page-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.section { margin: 30px 0; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 730; }
.section-head .meta { color: var(--muted); font-size: 12px; }
.eyebrow { margin: 0 0 5px; color: var(--gold); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.muted { color: var(--muted); }
.danger-text { color: var(--red); }
.success-text { color: var(--emerald); }
.empty { padding: 36px 12px; color: var(--muted); text-align: center; font-size: 13px; }
.empty .icon { width: 28px; height: 28px; margin: 0 auto 10px; color: var(--line-strong); }

.primary-button, .secondary-button, .danger-button, .text-button {
  min-height: 40px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 720;
}
.primary-button { border: 1px solid var(--gold); background: var(--gold); color: #17140d; }
.primary-button:hover { filter: brightness(1.06); }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.secondary-button:hover { border-color: var(--line-strong); background: var(--surface-strong); }
.danger-button { border: 1px solid var(--red); background: transparent; color: var(--red); }
.text-button { min-height: 32px; padding: 5px 2px; border: 0; background: transparent; color: var(--gold); }
.small-button { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.button-row > * { flex: 1; }
.button-row > .data-refresh-button { flex-basis: 100%; }
.readable-export-row { margin-top: 9px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.role-banner {
  position: relative;
  min-height: 166px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 20, 22, .94);
  box-shadow: none;
  overflow: hidden;
}
html[data-mode="light"] .role-banner { background: rgba(255, 255, 255, .94); }
.role-banner::after {
  content: "";
  position: absolute;
  width: 96px;
  height: 1px;
  right: 18px;
  top: 17px;
  border: 0;
  background: var(--line);
  pointer-events: none;
}
.role-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.role-line h1 { margin: 2px 0 0; font-size: 26px; }
.title-chip { color: var(--gold); font-size: 12px; font-weight: 720; }
.level-seal {
  width: 70px;
  height: 42px;
  border: 0;
  border-radius: 5px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--gold);
  color: #10150c;
}
.level-seal span { font: 780 14px/1 ui-monospace, monospace; }
.xp-track { height: 8px; margin-top: 22px; background: var(--surface-soft); overflow: hidden; }
.xp-track > i { display: block; width: 0; height: 100%; background: var(--gold); transition: width .5s ease; }
.xp-meta { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.hero-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 14px; background: var(--line); border: 1px solid var(--line); }
.hero-metrics > div { min-width: 0; padding: 12px; background: var(--bg-elevated); }
.hero-metrics strong { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.hero-metrics span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }

.map-intro { margin-bottom: 22px; }
.map-intro h2 { margin: 0; font-size: 17px; }
.map-intro p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.map-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; position: relative; }
.map-node {
  --system: var(--gold);
  min-height: 144px;
  padding: 17px;
  border: 1px solid color-mix(in srgb, var(--system) 46%, var(--line));
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background: rgba(17, 20, 22, .94);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}
html[data-mode="light"] .map-node { background: rgba(255, 255, 255, .93); }
.map-node::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--system); }
.map-node:hover { border-color: var(--system); transform: translateY(-2px); }
.map-node:active { transform: translateY(0); }
.map-node .node-top { display: flex; justify-content: space-between; align-items: flex-start; }
.map-node .node-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 6px; background: color-mix(in srgb, var(--system) 14%, transparent); color: var(--system); }
.map-node .node-index { color: var(--muted); font: 11px ui-monospace, monospace; }
.map-node h3 { margin: 20px 0 3px; font-size: 17px; }
.map-node p { max-width: 100%; margin: 0; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-node[data-system="goal"] { --system: var(--blue); }
.map-node[data-system="time"] { --system: var(--emerald); }
.map-node[data-system="notes"] { --system: var(--orange); }
.map-node[data-system="action"] { --system: var(--violet); }
.map-node[data-system="habits"] { --system: #45d4c5; }
.map-node[data-system="energy"] { --system: var(--red); }
.map-node[data-system="journal"] { --system: #6c96d1; }
.map-node[data-system="assets"] { --system: var(--gold); }

.list { display: grid; gap: 9px; }
.item-row {
  min-height: 62px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface);
}
.item-row.clickable { width: 100%; color: var(--ink); text-align: left; }
.item-row.clickable:hover { border-color: var(--line-strong); }
.item-main { min-width: 0; flex: 1; }
.item-main strong { display: block; overflow-wrap: anywhere; }
.item-main small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.item-actions { display: flex; align-items: center; gap: 3px; }
.item-actions .icon-button { width: 34px; height: 34px; }
.status-mark {
  width: 25px;
  height: 25px;
  flex: none;
  border: 1px solid currentColor;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--red);
}
.todo-row { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.todo-row .item-main strong { color: var(--red); }
.todo-row.done { border-color: color-mix(in srgb, var(--emerald) 45%, var(--line)); opacity: .83; }
.todo-row.done .status-mark { background: var(--emerald); border-color: var(--emerald); color: #081d17; }
.todo-row.done .item-main strong { color: var(--emerald); text-decoration: line-through; }
.todo-row.overdue { border-left: 3px solid var(--red); }
.todo-row.archived { opacity: .55; }
.todo-row .danger-icon { color: var(--red); }
.habit-row { border-left: 3px solid color-mix(in srgb, var(--red) 65%, var(--line)); }
.habit-row .item-main strong { color: var(--red); }
.habit-row.done { border-left-color: var(--emerald); background: var(--emerald-soft); }
.habit-row.done .status-mark { background: var(--emerald); border-color: var(--emerald); color: #081d17; }
.habit-row.done .item-main strong { color: var(--emerald); }
.habit-row.done .habit-streak { color: var(--emerald); }
.habit-row:not(.done) .habit-streak { color: var(--red); }
.todo-row .item-actions .icon-button.todo-delete-button { width: auto; min-width: 52px; padding: 0 8px; gap: 4px; border-color: color-mix(in srgb, var(--red) 24%, var(--line)); background: color-mix(in srgb, var(--red) 8%, var(--surface)); font-size: 11px; }
.todo-delete-button .icon { width: 16px; height: 16px; }
.source-badge, .tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}
.tag.active { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }

.goal-item { padding: 16px; border: 1px solid var(--line); border-left: 3px solid var(--blue); background: var(--surface); }
.goal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.goal-top h3 { margin: 0; font-size: 16px; }
.goal-top p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.progress-track { height: 6px; margin-top: 13px; background: var(--surface-soft); overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--blue); }
.stage-list { display: grid; gap: 11px; }
.stage-card { overflow: hidden; border-left: 2px solid var(--blue); background: var(--surface); }
.stage-row { min-height: 76px; padding: 12px 13px; display: flex; align-items: center; gap: 10px; }
.stage-main { min-width: 0; padding: 0; flex: 1; border: 0; background: transparent; color: var(--ink); text-align: left; }
.stage-main strong, .stage-main small { display: block; }
.stage-main strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.stage-main small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.stage-chevron { transition: transform .2s ease; }
.stage-card.expanded .stage-chevron { transform: rotate(90deg); }
.stage-progress { height: 3px; margin: 0 14px; overflow: hidden; background: var(--surface-soft); }
.stage-progress i { display: block; height: 100%; background: var(--emerald); }
.stage-expanded { padding: 14px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.stage-criterion { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.stage-criterion span, .stage-criterion strong { display: block; }
.stage-criterion span { color: var(--muted); font-size: 10px; }
.stage-criterion strong { margin-top: 2px; font-size: 13px; }
.stage-records { display: flex; flex-wrap: wrap; gap: 6px; margin: -3px 0 12px; }
.stage-records span { padding: 5px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 9px; }
.stage-todo-list { display: grid; gap: 7px; }
.stage-todo-row { min-height: 62px; padding: 9px 10px; display: flex; align-items: center; gap: 9px; border-radius: 14px; background: var(--surface); }
.stage-todo-row.done { opacity: .7; }
.stage-todo-row.done .item-main strong { color: var(--emerald); text-decoration: line-through; }
.stage-todo-row .item-actions { gap: 2px; }
.stage-todo-row .icon-button { width: 30px; height: 30px; }
.stage-add-action { width: 100%; margin-top: 10px; }
.stage-standard-fields[hidden] { display: none; }

.calendar-shell { border: 1px solid var(--line); background: var(--surface); }
.calendar-toolbar { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; padding: 9px; border-bottom: 1px solid var(--line); }
.calendar-toolbar strong { text-align: center; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays span { padding: 8px 0; color: var(--muted); font-size: 10px; text-align: center; }
.calendar-day {
  min-width: 0;
  aspect-ratio: 1 / 1;
  border: 0;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { color: var(--line-strong); }
.calendar-day.selected { background: var(--gold-soft); color: var(--gold); font-weight: 750; }
.calendar-day.today span:first-child { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 50%; }
.day-dots { height: 5px; display: flex; gap: 2px; }
.day-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--emerald); }
.day-dots i.mood { background: var(--violet); }
.timeline { display: grid; gap: 0; }
.timeline-item { min-height: 70px; display: grid; grid-template-columns: 62px 1fr 34px; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-time { color: var(--gold); font-size: 11px; font-variant-numeric: tabular-nums; }

.habit-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 11px; }
.habit-day { min-height: 30px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); font-size: 10px; }
.habit-day.on { border-color: var(--emerald); background: var(--emerald-soft); color: var(--emerald); }
.habit-streak { color: var(--gold); font-size: 12px; font-variant-numeric: tabular-nums; }

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.metric {
  min-height: 94px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
button.metric { color: var(--ink); text-align: left; }
.metric .icon { color: var(--gold); }
.metric strong { display: block; margin-top: 11px; font-size: 21px; font-variant-numeric: tabular-nums; }
.metric span { display: block; margin-top: 1px; color: var(--muted); font-size: 10px; }
.energy-bars { height: 120px; display: flex; align-items: end; gap: 7px; border-bottom: 1px solid var(--line); }
.energy-bar { min-width: 0; flex: 1; height: calc(var(--score, 0) * 1%); min-height: 2px; position: relative; background: var(--emerald); }
.energy-chart { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: stretch; }
.energy-y-axis { height: 120px; padding: 0 0 21px; display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: 9px; line-height: 1; text-align: right; }
.energy-plot { min-width: 0; position: relative; }
.energy-grid-lines { position: absolute; inset: 0 0 21px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.energy-grid-lines i { height: 1px; background: var(--line); }
.energy-value { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 9px; font-weight: 500; line-height: 1; }
.energy-chart-unit { grid-column: 2; margin: 7px 0 0; color: var(--muted); font-size: 10px; text-align: right; }
.energy-bar small { position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 9px; }
.energy-bar small:empty { display: none; }
.energy-trend-summary { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.energy-range-control { max-width: 210px; margin: 0 0 10px auto; }
.energy-bars.range-month { gap: 3px; padding-right: 12px; padding-left: 12px; }
.energy-bars.range-month .energy-bar small { font-size: 8px; }
.energy-bars.range-month .energy-value { display: none; }
.timer-display { padding: 22px 0; color: var(--gold); font: 600 46px/1 ui-monospace, monospace; text-align: center; font-variant-numeric: tabular-nums; }
.timer-picker { display: grid; gap: 14px; margin-top: 14px; }
.timer-range { display: grid; grid-template-columns: 52px minmax(0, 1fr) 38px; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.timer-range input[type="range"] { width: 100%; min-height: 28px; padding: 0; border: 0; background: transparent; box-shadow: none; accent-color: var(--gold); }
.timer-range output { color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; }
.timer-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.exercise-start-button { width: 100%; }
.exercise-record-list { margin-top: 10px; }
.exercise-timer-card { padding: 18px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.exercise-timer-head { display: flex; align-items: center; gap: 11px; }
.exercise-timer-head > span { width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); }
.exercise-timer-head strong, .exercise-timer-head small { display: block; }
.exercise-timer-head small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.exercise-timer-value { display: block; margin-top: 24px; font: 650 46px/1 ui-monospace, monospace; font-variant-numeric: tabular-nums; text-align: center; }
.exercise-timer-label { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; text-align: center; }
.exercise-timer-actions { margin-top: 22px; }
.exercise-mode-grid { margin-top: 2px; }

.segmented { display: flex; gap: 3px; padding: 3px; background: var(--surface-strong); }
.segmented button { min-height: 35px; flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.segmented button.active { background: var(--surface); color: var(--gold); box-shadow: 0 2px 7px rgba(0, 0, 0, .12); }
.search-box { position: relative; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 40px; }
.note-item { padding: 15px; border-left: 2px solid var(--orange); background: var(--surface); }
.note-item p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; align-items: center; justify-content: space-between; gap: 9px; color: var(--muted); font-size: 11px; }
.journal-preview { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mood-row { display: flex; flex-wrap: wrap; gap: 7px; }
.mood-slider { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; touch-action: pan-x; }
.mood-slider::-webkit-scrollbar { display: none; }
.mood-slider .mood { flex: 0 0 auto; }
.mood { border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; background: transparent; color: var(--muted); font-size: 12px; }
.mood.selected { border-color: var(--violet); color: var(--ink); background: color-mix(in srgb, var(--violet) 20%, transparent); }

.asset-section { border-top: 1px solid var(--line); padding-top: 18px; }
.asset-section:first-of-type { border-top: 0; padding-top: 0; }
.anniversary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.anniversary-card { min-height: 132px; padding: 15px; border: 1px solid var(--gold-soft); background: var(--surface); position: relative; }
.anniversary-card strong { display: block; padding-right: 70px; overflow-wrap: anywhere; }
.anniversary-card .days { margin: 17px 0 2px; color: var(--gold); font-size: 27px; font-weight: 780; font-variant-numeric: tabular-nums; }
.anniversary-card small { color: var(--muted); font-size: 10px; }
.anniversary-card > .item-actions { position: absolute; top: 7px; right: 7px; }
.anniversary-card .icon-button { width: 32px; height: 32px; }

.achievement-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.achievement { min-height: 105px; padding: 12px 8px; border: 1px solid var(--line); text-align: center; background: var(--surface); }
.achievement .badge-icon { width: 36px; height: 36px; margin: 0 auto 9px; display: grid; place-items: center; border: 1px solid var(--line-strong); transform: rotate(45deg); color: var(--muted); }
.achievement .badge-icon .icon { transform: rotate(-45deg); }
.achievement strong { display: block; font-size: 11px; }
.achievement small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.achievement.unlocked { border-color: var(--gold-soft); }
.achievement.unlocked .badge-icon { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.theme-choice { min-height: 70px; padding: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; }
.theme-choice.active { border-color: var(--gold); }
.theme-choice[disabled] { cursor: not-allowed; opacity: .48; }
.swatches { display: flex; gap: 4px; margin-top: 9px; }
.swatches i { width: 18px; height: 6px; background: var(--swatch); }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span, .field-label { color: var(--muted); font-size: 11px; font-weight: 650; }
input, textarea, select {
  width: 100%;
  min-height: 43px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
}
textarea { min-height: 112px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 18px; min-height: 18px; accent-color: var(--gold); }
input[type="range"] { padding: 0; accent-color: var(--gold); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.check-option { min-height: 40px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 11px; }
.check-option:has(input:checked) { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.form-actions { display: flex; gap: 8px; padding-top: 4px; }
.form-actions > * { flex: 1; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; background: rgba(4, 6, 7, .68); }
.sheet {
  width: min(720px, 100%);
  max-height: min(90vh, 860px);
  margin: 0 auto;
  padding: 17px 17px calc(24px + env(safe-area-inset-bottom));
  overflow: auto;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}
.sheet-handle { width: 42px; height: 4px; margin: 0 auto 16px; border-radius: 99px; background: var(--line-strong); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-head .icon-button { background: var(--surface); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + 18px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.level-up {
  position: fixed;
  left: 50%;
  top: 22%;
  z-index: 90;
  width: min(330px, calc(100vw - 36px));
  padding: 24px;
  border: 1px solid var(--gold);
  background: var(--bg-elevated);
  color: var(--ink);
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px) scale(.96);
  transition: opacity .25s ease, transform .25s ease;
}
.level-up.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.level-up strong { display: block; color: var(--gold); font-size: 24px; }
.level-up span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.tabbar {
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding: 7px 16px env(safe-area-inset-bottom);
  position: fixed;
  inset: auto 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(11, 13, 14, .95);
  backdrop-filter: blur(18px);
}
html[data-mode="light"] .tabbar { background: rgba(250, 248, 242, .95); }
.tab { min-width: 0; border: 0; border-radius: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: transparent; color: var(--muted); }
.tab small { font-size: 10px; }
.tab.active { color: var(--gold); background: transparent; }
.tab.active::before { content: ""; position: absolute; top: 0; left: 34%; right: 34%; height: 2px; background: var(--gold); }

@media (min-width: 860px) {
  #app-shell { padding-bottom: 0; padding-left: 92px; }
  .topbar { grid-template-columns: 40px 1fr 40px; padding-left: max(20px, calc((100vw - 980px) / 2)); padding-right: max(20px, calc((100vw - 980px) / 2)); }
  .tabbar { width: 92px; height: 100vh; padding: calc(76px + env(safe-area-inset-top)) 10px 20px; inset: 0 auto 0 0; grid-template-columns: 1fr; grid-template-rows: repeat(4, 68px); align-content: start; border-top: 0; border-right: 1px solid var(--line); }
  .toast { bottom: 26px; }
  .view { padding-top: 34px; }
  .map-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .map-node { min-height: 185px; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .anniversary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .achievement-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 390px) {
  .view { padding-left: 13px; padding-right: 13px; }
  .map-grid { gap: 9px; }
  .map-node { min-height: 138px; padding: 14px; }
  .map-node h3 { margin-top: 18px; font-size: 16px; }
  .hero-metrics > div { padding: 10px 7px; }
  .hero-metrics strong { font-size: 17px; }
  .form-grid { grid-template-columns: 1fr; }
  .anniversary-grid { grid-template-columns: 1fr; }
  .achievement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-day { font-size: 11px; }
}

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

/* iOS-style modern surface language */
html[data-mode="light"] {
  --bg: #f2f2f2;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-strong: #f3f3f3;
  --surface-soft: #e9e9e9;
  --ink: #111111;
  --muted: #8a8a8a;
  --line: #e7e7e7;
  --line-strong: #cecece;
  --gold: #1bb98a;
  --gold-soft: #e6f8f2;
  --emerald: #1bb98a;
  --emerald-soft: #e6f8f2;
  --red: #f15353;
  --red-soft: #fff0f0;
  --blue: #448cff;
  --violet: #8c6be8;
  --orange: #f08a45;
  --shadow: 0 13px 34px rgba(20, 20, 20, .065);
}
html[data-mode="light"][data-theme="moss"] { --gold: #49a860; --gold-soft: #e9f6ec; }
html[data-mode="light"][data-theme="voyage"] { --gold: #268db5; --gold-soft: #e4f4fa; }
html[data-mode="light"][data-theme="crimson"] { --gold: #e57943; --gold-soft: #fff0e8; }
html[data-mode="light"][data-theme="aurora"] { --gold: #7559cf; --gold-soft: #f0ebff; }

body { background: var(--bg); }
.route-map .topbar { display: none; }
.route-map .view { width: min(780px, 100%); padding-top: max(24px, env(safe-area-inset-top)); background-image: none; }
.home-toolbar { height: 58px; display: flex; align-items: center; justify-content: space-between; }
.floating-control {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.floating-control .icon { width: 22px; height: 22px; }
.home-heading { margin: 29px 2px 31px; }
.home-heading p { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.home-heading h1 { margin: 0; font-size: 42px; line-height: 1.08; font-weight: 800; }
.home-heading > span { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }

.topbar {
  height: calc(86px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 18px 0;
  grid-template-columns: 52px 1fr 52px;
  border-bottom: 0;
  background: rgba(242, 242, 242, .88);
}
html[data-mode="dark"] .topbar { background: rgba(16, 18, 19, .9); }
.topbar .icon-button { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.brand { padding: 4px; }
.brand-glyph, .brand strong { display: none; }
.brand small { max-width: 230px; margin: 0; color: var(--ink); font-size: 18px; font-weight: 760; }
.view { width: min(760px, 100%); padding: 28px 18px 120px; }
.page-head { margin: 6px 2px 30px; align-items: center; }
.page-head h1 { font-size: 36px; font-weight: 800; }
.page-head p { margin-top: 6px; font-size: 12px; }
.eyebrow { color: var(--muted); font-size: 10px; }
.section { margin: 32px 0; }
.section-head { margin: 0 3px 13px; }
.section-head h2 { font-size: 19px; font-weight: 780; }
.section-head .meta { font-size: 12px; }

.primary-button, .secondary-button, .danger-button, .text-button { border-radius: 14px; }
.primary-button { min-height: 46px; border: 0; background: var(--ink); color: var(--surface); box-shadow: 0 8px 20px rgba(0, 0, 0, .1); }
html[data-mode="dark"] .primary-button { color: var(--bg); }
.secondary-button { min-height: 46px; border: 0; background: var(--surface); box-shadow: var(--shadow); }
.danger-button { min-height: 44px; border-color: transparent; background: var(--red-soft); }
.text-button { color: var(--ink); }

.role-banner {
  min-height: 0;
  padding: 24px 22px 20px;
  border: 0;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
html[data-mode="light"] .role-banner { background: var(--surface); }
.role-banner::after { display: none; }
.role-line { align-items: flex-start; }
.role-line .card-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.role-line h1 { margin: 0; font-size: 38px; line-height: 1; }
.role-line h1 small { margin-left: 9px; color: var(--muted); font-size: 13px; font-weight: 560; }
.trend-chip { padding: 7px 11px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: 12px; font-weight: 750; }
.title-chip { display: inline-block; padding: 6px 10px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); }
.level-seal { width: auto; min-width: 126px; height: 42px; padding: 0 14px; border-radius: 14px; background: var(--gold-soft); color: var(--gold); white-space: nowrap; }
.xp-track { height: 7px; margin-top: 24px; border-radius: 99px; background: var(--surface-soft); }
.xp-track > i { border-radius: inherit; background: var(--gold); }
.xp-meta { margin-top: 8px; }
.hero-metrics { gap: 0; margin-top: 19px; border: 0; border-top: 1px solid var(--line); background: transparent; }
.hero-metrics > div { padding: 17px 11px 5px; background: transparent; }
.hero-metrics > div + div { border-left: 1px solid var(--line); }
.hero-metrics strong { font-size: 21px; }

.map-grid { gap: 12px; }
.map-node {
  min-height: 154px;
  padding: 17px;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
html[data-mode="light"] .map-node { background: var(--surface); }
.map-node::before { display: none; }
.map-node:hover { transform: translateY(-1px); box-shadow: 0 16px 36px rgba(20, 20, 20, .09); }
.map-node .node-icon { width: 43px; height: 43px; border-radius: 13px; background: color-mix(in srgb, var(--system) 12%, var(--surface)); }
.map-node .node-index { color: #b5b5b5; }
.map-node h3 { margin: 22px 0 3px; color: var(--ink); font-size: 20px; }
.map-node p { padding-right: 22px; }
.map-node .node-arrow { position: absolute; right: 15px; bottom: 15px; color: #b2b2b2; }

.item-row, .goal-item, .note-item {
  min-height: 74px;
  padding: 14px 15px;
  border: 0;
  border-radius: 19px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.item-row.clickable:hover { border-color: transparent; background: var(--surface); }
.item-main strong { font-size: 15px; }
.status-mark { background: var(--red-soft); }
.todo-row, .todo-row.done, .todo-row.overdue { border: 0; }
.todo-row.overdue { box-shadow: inset 3px 0 var(--red), var(--shadow); }
.todo-row.done .status-mark { background: var(--emerald); }
.tag, .source-badge { min-height: 24px; border: 0; background: var(--surface-strong); }
.tag.active { border: 0; background: var(--gold-soft); }
.goal-item { border-left: 0; }
.stage-card { border-left: 0; border-radius: 19px; box-shadow: var(--shadow); }
.progress-track { border-radius: 99px; }
.progress-track i { border-radius: 99px; }

.calendar-shell { overflow: hidden; border: 0; border-radius: 25px; background: var(--surface); box-shadow: var(--shadow); }
.calendar-toolbar { min-height: 66px; padding: 8px 13px; border-bottom: 0; }
.calendar-toolbar .icon-button { border-radius: 50%; background: var(--surface-strong); }
.calendar-weekdays { padding: 0 10px; }
.calendar-grid { padding: 0 10px 13px; }
.calendar-day { border: 0; border-radius: 13px; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.selected { background: var(--surface-strong); color: var(--ink); }
.calendar-day.today span:first-child { border-color: var(--gold); }
.timeline-item { min-height: 78px; padding: 14px 5px; }

.metric-grid { gap: 11px; }
.metric { min-height: 106px; padding: 17px; border: 0; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.metric .icon { color: var(--ink); }
.energy-bars { height: 220px; padding: 24px 20px 29px; border: 0; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.energy-y-axis { height: 220px; padding: 24px 0 29px; }
.energy-plot { border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.energy-grid-lines { inset: 24px 20px 29px; }
.energy-chart-unit { margin-top: 7px; }
.energy-bar { border-radius: 99px; background: var(--ink); }
.timer-display { margin: 12px 0; padding: 27px 0; border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented { padding: 4px; border-radius: 16px; background: var(--surface-soft); }
.segmented button { border-radius: 13px; }
.segmented button.active { border-radius: 13px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.search-box input { min-height: 52px; border: 0; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.note-item p { line-height: 1.65; }

.anniversary-grid { gap: 11px; }
.anniversary-card { min-height: 146px; padding: 17px; border: 0; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.anniversary-card .days { color: var(--ink); }
.achievement-grid { gap: 10px; }
.achievement { min-height: 112px; border: 0; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.achievement .badge-icon { border: 0; border-radius: 13px; background: var(--surface-strong); transform: none; }
.achievement .badge-icon .icon { transform: none; }
.achievement.unlocked { border: 0; }
.achievement.unlocked .badge-icon { border: 0; background: var(--gold-soft); color: var(--gold); }
.theme-choice { min-height: 78px; border: 0; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.theme-choice.active { box-shadow: inset 0 0 0 2px var(--gold), var(--shadow); }

input, textarea, select { min-height: 48px; border: 0; border-radius: 14px; background: var(--surface-strong); }
.check-option { min-height: 44px; border: 0; border-radius: 13px; background: var(--surface-strong); }
.check-option:has(input:checked) { border: 0; background: var(--gold-soft); }
.mood { border: 0; background: var(--surface-strong); }
.sheet-backdrop { background: rgba(0, 0, 0, .28); backdrop-filter: blur(4px); }
.sheet { border: 0; border-radius: 28px 28px 0 0; background: var(--bg-elevated); }
.sheet-head .icon-button { border-radius: 50%; }
.toast { border: 0; border-radius: 14px; background: #171717; color: #fff; }

.tabbar {
  height: calc(82px + env(safe-area-inset-bottom));
  padding: 9px 20px env(safe-area-inset-bottom);
  border-top: 0;
  background: rgba(255, 255, 255, .93);
  box-shadow: 0 -8px 30px rgba(20, 20, 20, .07);
}
html[data-mode="dark"] .tabbar { background: rgba(21, 25, 27, .94); }
.tab { border-radius: 16px; }
.tab.active { color: var(--ink); }
.tab.active::before { display: none; }
.tab.active .icon { padding: 4px; border-radius: 8px; background: var(--gold-soft); color: var(--gold); }

@media (min-width: 860px) {
  #app-shell { padding-left: 0; padding-bottom: 108px; }
  .topbar { padding-left: max(24px, calc((100vw - 920px) / 2)); padding-right: max(24px, calc((100vw - 920px) / 2)); }
  .tabbar { width: 500px; height: 72px; padding: 8px 18px; inset: auto auto 22px 50%; transform: translateX(-50%); grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr; border: 0; border-radius: 24px; box-shadow: 0 14px 45px rgba(20, 20, 20, .16); }
  .view { width: min(900px, 100%); }
  .route-map .view { width: min(900px, 100%); }
  .map-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .map-node { min-height: 170px; }
  .toast { bottom: 112px; }
}

@media (max-width: 390px) {
  .home-heading h1 { font-size: 38px; }
  .role-banner { padding-left: 18px; padding-right: 18px; }
  .role-line h1 { font-size: 34px; }
  .map-node { min-height: 145px; padding: 15px; }
  .map-node h3 { margin-top: 18px; font-size: 18px; }
}

@media (max-width: 560px) {
  .anniversary-grid { grid-template-columns: 1fr; }
}

[hidden] { display: none !important; }
.home-heading h1 small { color: var(--muted); font-size: 19px; font-weight: 650; }
.chip-button { border: 0; }
.chip-button .icon { display: inline-block; width: 14px; height: 14px; margin-left: 3px; vertical-align: -2px; }
.level-seal { border: 0; }
.hero-metrics > button {
  min-width: 0;
  padding: 17px 11px 5px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.hero-metrics > button + button,
.hero-metrics > div + button,
.hero-metrics > button + div { border-left: 1px solid var(--line); }
.hero-metrics > button strong { display: block; font-size: 21px; font-variant-numeric: tabular-nums; }
.hero-metrics > button span { display: flex; align-items: center; gap: 4px; margin-top: 2px; color: var(--muted); font-size: 10px; }
.hero-metrics > button .icon { width: 12px; height: 12px; }
.metric.energy-summary {
  grid-column: 1 / -1;
  min-height: 118px;
  position: relative;
  color: var(--ink);
  text-align: left;
}
.energy-summary strong { font-size: 34px; }
.energy-summary strong small, .energy-guide-head strong small { margin-left: 2px; color: var(--muted); font-size: 14px; }
.energy-score-track { display: block; height: 7px; margin-top: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-soft); }
.energy-score-track b { display: block; height: 100%; border-radius: inherit; background: var(--gold); }
.section-note { margin: 0 2px 14px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.guide-intro { padding: 18px; border-radius: 18px; background: var(--surface-strong); }
.guide-intro > strong { display: block; font-size: 19px; }
.guide-intro p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.guide-list, .score-list { display: grid; gap: 8px; margin-top: 16px; }
.guide-row, .score-row {
  min-height: 58px;
  padding: 12px 14px;
  border-radius: 15px;
  display: grid;
  grid-template-columns: 78px 1fr auto;
  align-items: center;
  gap: 10px;
  background: var(--surface-strong);
}
.guide-row > span { color: var(--muted); font-size: 12px; }
.guide-row > small { color: var(--muted); font-size: 11px; }
.guide-row.reached { background: var(--gold-soft); }
.guide-row.reached > span, .guide-row.reached > small { color: var(--gold); }
.energy-guide-head { display: flex; align-items: end; justify-content: space-between; padding: 2px 2px 13px; border-bottom: 1px solid var(--line); }
.energy-guide-head strong { font-size: 42px; line-height: 1; }
.energy-guide-head span { color: var(--gold); font-size: 13px; font-weight: 750; }
.score-row { grid-template-columns: 1fr auto; }
.score-row div strong, .score-row div small { display: block; }
.score-row div small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.score-row > span { font-weight: 760; font-variant-numeric: tabular-nums; }

.finite-time-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; }
.finite-time-picker select { min-width: 0; padding-left: 10px; padding-right: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.finite-time-picker b { color: var(--muted); font-size: 18px; }
.all-day-window { padding: 15px; border-radius: 14px; background: var(--gold-soft); color: var(--muted); text-align: center; }
.all-day-window strong { color: var(--gold); font-variant-numeric: tabular-nums; }

.timing-mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.action-kind-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.timing-choice { min-width: 0; }
.timing-choice input { position: absolute; opacity: 0; pointer-events: none; }
.timing-choice > span {
  min-height: 78px;
  padding: 10px 5px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.timing-choice.selected > span { background: var(--gold-soft); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.timing-choice .icon { width: 20px; height: 20px; }
.timer-button.active { background: var(--red-soft); color: var(--red); }

@media (min-width: 700px) {
  .metric.energy-summary { grid-column: span 2; }
}

@media (max-width: 430px) {
  .guide-row { grid-template-columns: 68px 1fr; }
  .guide-row > small { grid-column: 2; }
  .todo-row .item-actions .icon-button { width: 31px; height: 31px; }
}

.memo-add-button { width: 48px; min-width: 48px; padding: 0; border-radius: 50%; }
.memo-tools { margin-top: 0; }
.memo-filters { margin-top: 11px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.memo-filters::-webkit-scrollbar { display: none; }
.memo-section { margin-top: 24px; }
.memo-list-head { display: flex; align-items: center; justify-content: space-between; margin: 0 3px 12px; }
.memo-list-head h2 { margin: 0; font-size: 19px; }
.memo-list-head span { color: var(--muted); font-size: 12px; }
.memo-groups { display: grid; gap: 24px; }
.memo-year-head { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 9px; }
.memo-year-head h3 { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 15px; }
.memo-year-head h3 .icon { color: #e7a500; }
.memo-year-head span { color: var(--muted); font-size: 11px; }
.memo-list { width: 100%; max-width: 100%; overflow: hidden; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.memo-row { min-height: 96px; position: relative; display: flex; align-items: stretch; overflow: hidden; background: var(--red); }
.memo-row + .memo-row::before { content: ""; height: 1px; position: absolute; top: 0; left: 17px; right: 17px; background: var(--line); }
.memo-open { width: 100%; min-width: 0; flex: 1; padding: 15px 17px; border: 0; position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; overflow: hidden; background: var(--surface); color: var(--ink); text-align: left; touch-action: pan-y; transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.memo-row.swiped-left .memo-open { transform: translateX(-86px); }
.memo-row.swiped-right .memo-open { transform: translateX(86px); }
.memo-row.dragging .memo-open { transition: none; }
.memo-copy { width: 100%; min-width: 0; flex: 1; overflow: hidden; }
.memo-copy h3 { width: 100%; max-width: 100%; margin: 0; overflow: hidden; color: var(--ink); font-size: 16px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.memo-copy p { display: -webkit-box; margin: 5px 0 6px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.memo-copy small { color: var(--muted); font-size: 11px; }
.memo-delete-action { width: 86px; height: 100%; padding: 0; border: 0; position: absolute; right: 0; top: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; background: #ff3b30; color: #fff; font-size: 11px; }
.memo-delete-action .icon { width: 18px; height: 18px; }
.memo-pin-action { width: 86px; height: 100%; padding: 0; border: 0; position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; background: #ffcc00; color: #2b2100; font-size: 11px; }
.memo-pin-action .icon { width: 18px; height: 18px; }
.memo-editor-sheet { height: min(92dvh, 820px); }
.memo-editor { height: calc(100% - 54px); display: flex; flex-direction: column; }
.memo-body { min-height: 0; flex: 1; }
.memo-body textarea { height: 100%; min-height: 300px; padding: 17px; resize: none; background: transparent; font-size: 16px; line-height: 1.75; }
.memo-editor .form-actions { margin-top: auto; }
.visually-hidden { width: 1px; height: 1px; padding: 0; position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.memo-page-editor { min-height: calc(100vh - 150px); display: flex; flex-direction: column; }
.memo-page-head { flex: none; }
.memo-page-form { min-height: 0; display: block; }
.memo-editor-meta { flex: none; }
.memo-page-body { margin-top: 14px; }
.memo-page-body textarea { width: 100%; height: auto; min-height: 430px; overflow: hidden; padding: 21px; border-radius: 22px; resize: none; background: var(--surface); box-shadow: var(--shadow); font-size: 16px; line-height: 1.8; }
.memo-editing .tabbar { display: none; }
.journal-editing .tabbar { display: none; }
.memo-editing #app-shell { padding-bottom: env(safe-area-inset-bottom); }
.journal-editing #app-shell { padding-bottom: env(safe-area-inset-bottom); }
.memo-editing .view { padding-bottom: 24px; }
.journal-editing .view { padding-bottom: 24px; }
.journal-date-field { max-width: 280px; }
.journal-page-editor .mood-row { margin-top: 10px; }
.journal-saved-preview { max-height: 210px; padding: 18px; margin-bottom: 20px; overflow: auto; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.journal-saved-preview small { color: var(--muted); }
.journal-saved-preview p { margin: 9px 0 0; white-space: pre-wrap; line-height: 1.7; }

@media (max-width: 560px) {
  input, textarea, select { font-size: 16px; }
  .memo-editor-sheet { height: calc(100dvh - max(18px, env(safe-area-inset-top))); border-radius: 28px 28px 0 0; }
  .memo-page-editor { min-height: calc(100dvh - 146px - env(safe-area-inset-top)); }
  .memo-page-body textarea { min-height: calc(100dvh - 360px - env(safe-area-inset-top)); }
}

/* Daily stability release */
[data-section] { scroll-margin-top: 108px; }
.update-banner {
  width: min(560px, calc(100vw - 28px));
  min-height: 66px;
  padding: 10px 11px 10px 16px;
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + 12px + env(safe-area-inset-bottom));
  z-index: 72;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg-elevated);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .2);
  transform: translateX(-50%);
}
.update-banner > div { min-width: 0; }
.update-banner strong, .update-banner span { display: block; }
.update-banner strong { font-size: 14px; }
.update-banner span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.update-banner .primary-button { min-height: 40px; flex: none; }
body:has(.sheet-backdrop) .toast { top: calc(82px + env(safe-area-inset-top)); bottom: auto; }

.today-overview { margin-bottom: 28px; }
.today-overview .section-head { align-items: end; margin-bottom: 14px; }
.today-overview .section-head h2 { margin: 0; font-size: 22px; }
.today-overview .section-head .eyebrow { margin-bottom: 3px; }
.today-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.today-metric {
  min-width: 0;
  min-height: 108px;
  padding: 13px;
  border: 0;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}
.today-metric > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--gold-soft); color: var(--gold); }
.today-metric > span .icon { width: 17px; height: 17px; }
.today-metric strong { width: 100%; margin-top: 10px; overflow-wrap: anywhere; font-size: 16px; line-height: 1.2; }
.today-metric small { width: 100%; margin-top: 4px; overflow-wrap: anywhere; color: var(--muted); font-size: 10px; line-height: 1.35; }
.today-metric.is-warning > span { background: var(--red-soft); color: var(--red); }
.today-metric.is-warning strong { color: var(--red); }
.weekly-review-entry { width: 100%; min-height: 76px; padding: 14px 16px; border: 0; border-radius: 20px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 20px; align-items: center; gap: 12px; background: var(--surface); color: var(--ink); text-align: left; box-shadow: var(--shadow); }
.weekly-review-entry > span { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--emerald-soft); color: var(--emerald); }
.weekly-review-entry strong, .weekly-review-entry small { display: block; }
.weekly-review-entry small { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.weekly-review-entry > .icon { color: var(--muted); }
.weekly-review-head { margin-bottom: 16px; }
.weekly-review-head strong, .weekly-review-head span { display: block; }
.weekly-review-head strong { font-size: 18px; }
.weekly-review-head span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.weekly-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.weekly-review-metric { min-width: 0; min-height: 112px; padding: 14px; border-radius: 16px; background: var(--surface-strong); }
.weekly-review-metric .icon { color: var(--emerald); }
.weekly-review-metric strong, .weekly-review-metric small { display: block; }
.weekly-review-metric strong { margin-top: 13px; overflow-wrap: anywhere; font-size: 18px; }
.weekly-review-metric small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.section-subtitle { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.unscheduled-row { border: 0; box-shadow: var(--shadow); }
.unscheduled-row .status-mark { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, var(--surface)); color: var(--blue); }
.schedule-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.schedule-button { min-height: 32px; padding: 5px 9px; border: 0; border-radius: 11px; background: var(--surface-strong); color: var(--ink); font-size: 11px; }
.action-date-groups { display: grid; gap: 9px; }
.action-date-group { overflow: hidden; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.action-date-group > summary { min-height: 64px; padding: 12px 15px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; }
.action-date-group > summary::-webkit-details-marker { display: none; }
.action-date-group > summary strong, .action-date-group > summary small { display: block; }
.action-date-group > summary small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.action-date-group > summary > .icon { color: var(--muted); transition: transform .2s ease; }
.action-date-group[open] > summary > .icon { transform: rotate(90deg); }
.action-date-group > .list { padding: 0 8px 8px; }
.action-history-controls { min-height: 54px; margin-top: 0; display: flex; align-items: center; justify-content: space-between; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.action-history-controls strong { font-size: 13px; }
.action-history-controls .icon-button:disabled { opacity: .3; }
.history-day-groups { display: grid; gap: 25px; }
.history-day { min-width: 0; }
.history-todo-row { min-height: 64px; }
.history-todo-row.history-completed { background: color-mix(in srgb, var(--emerald) 8%, var(--surface)); box-shadow: inset 3px 0 var(--emerald), var(--shadow); }
.history-todo-row.history-completed .status-mark { border-color: var(--emerald); background: var(--emerald-soft); color: var(--emerald); }
.history-todo-row.history-completed .item-main strong { color: var(--emerald); text-decoration: line-through; }
.history-todo-row.history-completed .item-main small { color: color-mix(in srgb, var(--emerald) 72%, var(--muted)); }
.history-todo-row.history-incomplete { background: color-mix(in srgb, var(--red) 7%, var(--surface)); box-shadow: inset 3px 0 var(--red), var(--shadow); }
.history-todo-row.history-incomplete .status-mark { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.history-todo-row.history-incomplete .item-main strong { color: var(--red); }
.history-todo-row.history-incomplete .item-main small { color: color-mix(in srgb, var(--red) 68%, var(--muted)); }
.exercise-total-metric strong small { color: var(--muted); font-size: 13px; font-weight: 650; }
.exercise-total-metric > span { color: var(--muted); }
.energy-history-groups { display: grid; gap: 9px; }
.energy-history-day { overflow: hidden; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.energy-history-day > summary { min-height: 68px; padding: 12px 15px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; }
.energy-history-day > summary::-webkit-details-marker { display: none; }
.energy-history-day > summary > div { min-width: 0; }
.energy-history-day > summary strong, .energy-history-day > summary small { display: block; }
.energy-history-day > summary small { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.energy-history-day > summary > .icon { flex: none; color: var(--muted); transition: transform .2s ease; }
.energy-history-day[open] > summary > .icon { transform: rotate(90deg); }
.energy-history-day > .list { padding: 0 8px 8px; }
.energy-history-actions { display: grid; gap: 6px; margin-top: 10px; }
.energy-history-more { width: 100%; }
.energy-history-collapse { justify-self: center; }

.stage-standard { overflow: hidden; border-radius: 15px; background: var(--surface-strong); }
.stage-standard summary { min-height: 54px; padding: 12px 14px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; }
.stage-standard summary::-webkit-details-marker { display: none; }
.stage-standard summary span { font-size: 13px; font-weight: 720; }
.stage-standard summary small { color: var(--muted); font-size: 11px; }
.stage-standard-body { padding: 2px 14px 14px; display: grid; gap: 14px; }
.stage-record-list { display: grid; gap: 7px; margin: 0 0 12px; }
.stage-record-row { min-height: 58px; padding: 9px 10px 9px 12px; border-radius: 13px; display: flex; align-items: center; justify-content: space-between; gap: 9px; background: var(--surface); }
.stage-record-row > div:first-child { min-width: 0; }
.stage-record-row strong, .stage-record-row small { display: block; overflow-wrap: anywhere; }
.stage-record-row strong { font-size: 13px; }
.stage-record-row small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.archive-manager-section { padding-top: 0; }
.archive-manager-entry { width: 100%; min-height: 76px; padding: 15px 17px; border: 0; border-radius: 20px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 24px; align-items: center; gap: 12px; background: var(--surface); color: var(--ink); text-align: left; box-shadow: var(--shadow); }
.archive-manager-entry > span { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-strong); color: var(--muted); }
.archive-manager-entry strong, .archive-manager-entry small { display: block; }
.archive-manager-entry small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.archive-manager-entry > .icon { color: var(--muted); }
.archived-goal-main { min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.archived-goal-row .item-actions { flex: none; }
.archive-detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.energy-bar.blank { height: 2px; min-height: 2px; background: var(--line); }
.data-status-list { overflow: hidden; margin-bottom: 12px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.data-status-list > div { min-height: 52px; padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.data-status-list > div + div { border-top: 1px solid var(--line); }
.data-status-list span { color: var(--muted); font-size: 12px; }
.data-status-list strong { text-align: right; font-size: 12px; overflow-wrap: anywhere; }
.backup-reminder { margin: 0 0 12px; padding: 12px 14px; border-radius: 15px; background: var(--gold-soft); color: var(--gold); font-size: 12px; }

@media (min-width: 700px) {
  .today-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (min-width: 860px) {
  .update-banner { bottom: 106px; }
  body:has(.sheet-backdrop) .toast { top: 92px; }
}

@media (max-width: 560px) {
  .today-overview .section-head .meta { display: none; }
  .unscheduled-row { flex-wrap: wrap; }
  .unscheduled-row .item-main { min-width: calc(100% - 42px); }
  .schedule-actions { width: 100%; justify-content: flex-end; padding-left: 36px; }
}

@media (max-width: 370px) {
  .today-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exercise-timer-value { font-size: 40px; }
}
