:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.22, .8, .24, 1);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #F5F1E8;
  --bg-accent: rgba(46, 107, 88, .075);
  --bg-warm: rgba(177, 139, 82, .09);
  --surface: #FFFCF6;
  --surface-2: #F9F5EC;
  --surface-3: #F1EBDD;
  --ink: #1D2823;
  --ink-2: #37453D;
  --muted: #6C776F;
  --faint: #9AA49D;
  --line: rgba(29, 40, 35, .10);
  --line-strong: rgba(29, 40, 35, .18);
  --accent: #2E6B58;
  --accent-strong: #245546;
  --accent-soft: rgba(46, 107, 88, .10);
  --accent-soft-2: rgba(46, 107, 88, .16);
  --accent-contrast: #F8FBF8;
  --gold: #B18B52;
  --gold-soft: rgba(177, 139, 82, .13);
  --shadow: 0 14px 40px rgba(33, 44, 38, .06);
  --shadow-sheet: 0 -20px 60px rgba(22, 30, 26, .18);
  --backdrop: rgba(23, 30, 26, .38);
  --cell: rgba(255, 252, 246, .62);
  --cell-empty: transparent;
  --heat-1: rgba(46, 107, 88, .065);
  --heat-2: rgba(46, 107, 88, .11);
  --heat-3: rgba(46, 107, 88, .17);
  --heat-4: rgba(46, 107, 88, .24);
  --diet-healthy: #2F7A58;
  --diet-normal: #A87625;
  --diet-excess: #B0504B;
  --sleep-enough: #2F7A58;
  --sleep-short: #B0504B;
  --exercise-strength: #3C7A5B;
  --exercise-cardio: #3D7898;
  --exercise-light: #8FB6A1;
  --exercise-none: #8B9490;
  --mood-good: #3C7A5B;
  --mood-normal: #A67A2E;
  --mood-abnormal: #B0504B;
  --block: #3F7D69;
  --block-soft: rgba(63, 125, 105, .18);
  --type-discipline: #2E6B58;
  --type-grit: #5B3FC8;
  --type-achievement: #B8860B;
  --splash-smiley: #A8CDBA;
  --ink-on-fill: #F8FBF8;
  --ink-on-fill-dark: #1D2823;
  --toast-bg: #1E2A24;
  --toast-ink: #F5F8F5;
  --seg-shadow: 0 2px 8px rgba(33, 44, 38, .08);
  --focus-ring: rgba(46, 107, 88, .32);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1512;
  --bg-accent: rgba(130, 185, 163, .065);
  --bg-warm: rgba(199, 170, 116, .045);
  --surface: #17201B;
  --surface-2: #1B251F;
  --surface-3: #202C25;
  --ink: #E6EDE8;
  --ink-2: #C4D0C8;
  --muted: #9AA79F;
  --faint: #6E7B73;
  --line: rgba(230, 237, 232, .09);
  --line-strong: rgba(230, 237, 232, .18);
  --accent: #82B9A3;
  --accent-strong: #A4CFBC;
  --accent-soft: rgba(130, 185, 163, .12);
  --accent-soft-2: rgba(130, 185, 163, .20);
  --accent-contrast: #0F1B16;
  --gold: #C7AA74;
  --gold-soft: rgba(199, 170, 116, .10);
  --shadow: 0 16px 44px rgba(0, 0, 0, .24);
  --shadow-sheet: 0 -24px 70px rgba(0, 0, 0, .46);
  --backdrop: rgba(0, 0, 0, .58);
  --cell: rgba(23, 32, 27, .72);
  --cell-empty: transparent;
  --heat-1: rgba(130, 185, 163, .06);
  --heat-2: rgba(130, 185, 163, .105);
  --heat-3: rgba(130, 185, 163, .16);
  --heat-4: rgba(130, 185, 163, .225);
  --diet-healthy: #78BFA2;
  --diet-normal: #D3A75E;
  --diet-excess: #DC8A84;
  --sleep-enough: #78BFA2;
  --sleep-short: #DC8A84;
  --exercise-strength: #78BFA2;
  --exercise-cardio: #78A9C4;
  --exercise-light: #9BC7B3;
  --exercise-none: #8B9991;
  --mood-good: #78BFA2;
  --mood-normal: #D3A75E;
  --mood-abnormal: #DC8A84;
  --block: #79B29C;
  --block-soft: rgba(121, 178, 156, .18);
  --type-discipline: #82B9A3;
  --type-grit: #A395F0;
  --type-achievement: #E2B54B;
  --splash-smiley: #8FC8B2;
  --ink-on-fill: #12211B;
  --ink-on-fill-dark: #14201A;
  --toast-bg: #DCE9E1;
  --toast-ink: #14201A;
  --seg-shadow: 0 2px 10px rgba(0, 0, 0, .22);
  --focus-ring: rgba(130, 185, 163, .35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body.splash-open {
  overflow: hidden;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(32px, env(safe-area-inset-top, 0px)) 28px max(30px, env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(680px 520px at 50% 18%, var(--bg-accent), transparent 72%),
    radial-gradient(520px 420px at 50% 110%, var(--bg-warm), transparent 66%),
    var(--bg);
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: opacity .48s var(--ease), visibility .48s;
}

.splash.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 340px);
}

.splash-mark {
  width: 66px;
  height: 66px;
  color: var(--splash-smiley);
}

.splash-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.splash-brand {
  margin-top: 21px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .30em;
}

.splash-rule {
  width: 30px;
  height: 1px;
  margin: 21px 0 23px;
  background: var(--gold);
  opacity: .72;
}

.splash-phrase {
  margin: 0;
  max-width: 100%;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(24px, 7vw, 30px);
  font-weight: 600;
  line-height: 1.65;
  letter-spacing: .01em;
  white-space: pre-line;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.splash-hint {
  margin-top: 48px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: .18em;
}

.splash-progress {
  position: fixed;
  left: 50%;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  width: 36px;
  height: 1px;
  transform: translateX(-50%);
  background: var(--line);
  overflow: hidden;
}

.splash-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

.splash.is-showing .splash-inner {
  animation: splashIn .8s var(--ease) both;
}

.splash.is-showing .splash-hint {
  animation: splashHint 2.4s ease-in-out infinite;
}

.splash.is-showing .splash-progress::after {
  animation: splashProgress var(--splash-duration, 2600ms) linear forwards;
}

@keyframes splashIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes splashHint {
  0%, 100% { opacity: .42; }
  50% { opacity: .9; }
}

@keyframes splashProgress {
  to { transform: scaleX(1); }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(620px 380px at 88% -8%, var(--bg-warm), transparent 68%),
    radial-gradient(720px 480px at -12% 12%, var(--bg-accent), transparent 64%);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

::selection {
  background: var(--accent-soft-2);
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  margin: 0 auto;
  min-height: 100vh;
  padding: max(18px, var(--safe-top)) 18px calc(40px + var(--safe-bottom));
}

.boot-screen {
  min-height: 70vh;
  display: grid;
  place-items: center;
}

.brand {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  color: var(--muted);
}

.page {
  animation: pageIn .28s var(--ease) both;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}

.icon-button:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.icon-button:active {
  transform: scale(.96);
}

.home-header .topbar .brand {
  color: var(--muted);
}

.month-nav {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 8px;
  margin: 18px 0 22px;
}

.month-display {
  text-align: center;
  min-width: 0;
}

.month-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(30px, 8.4vw, 38px);
  line-height: 1.15;
  letter-spacing: .02em;
  color: var(--ink);
}

.month-year {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  letter-spacing: .24em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.month-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
  min-height: 30px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
}

.text-button:hover {
  background: var(--accent-soft);
}

.legend-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  min-height: 34px;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}

.legend-link:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.legend-link .icon {
  width: 15px;
  height: 15px;
}

.summary-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
}

.summary-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  top: -82px;
  right: -60px;
  border-radius: 50%;
  border: 1px solid var(--line);
  pointer-events: none;
}

.summary-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
}

.summary-label::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--gold);
}

.summary-number-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 10px;
}

.summary-value {
  font-family: var(--font-display);
  font-size: clamp(46px, 14vw, 58px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.summary-unit {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--muted);
}

.summary-caption {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
}

.summary-split {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 13px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.split-item {
  min-width: 0;
  padding: 13px 10px 12px;
  border-left: 1px solid var(--line);
}

.split-item:first-child {
  border-left: 0;
  padding-left: 0;
}

.split-item:last-child {
  padding-right: 0;
}

.split-name {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
  white-space: nowrap;
}

.type-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
  flex: 0 0 auto;
}

.type-dot.is-discipline { background: var(--type-discipline); }
.type-dot.is-grit { background: var(--type-grit); }
.type-dot.is-achievement { background: var(--type-achievement); }

.split-discipline .split-value { color: var(--type-discipline); }
.split-grit .split-value { color: var(--type-grit); }

.split-value {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: clamp(22px, 6.7vw, 32px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.split-unit {
  margin-left: 3px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.split-meta {
  margin-top: 4px;
  color: var(--faint);
  font-size: 10px;
}

.trophy-value {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--type-achievement);
}

.trophy-value .icon {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.trophy-value > span {
  font-size: clamp(20px, 6vw, 28px);
  font-family: var(--font-display);
  font-weight: 600;
  white-space: nowrap;
}

.summary-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.summary-foot-note {
  color: var(--faint);
  font-size: 12px;
}

.summary-foot-action {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 0;
}

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 13px;
}

.segmented {
  position: relative;
  display: flex;
  flex: 1;
  max-width: 270px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  --idx: 0;
  --count: 2;
}

.seg-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / var(--count));
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--seg-shadow);
  transform: translateX(calc(var(--idx) * 100%));
  transition: transform .22s var(--ease), background .2s var(--ease);
  pointer-events: none;
}

.seg-btn {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: color .2s var(--ease);
}

.seg-btn[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
}

.seg-btn .icon {
  width: 16px;
  height: 16px;
}

.month-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 14px 12px 13px;
  box-shadow: var(--shadow);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 0 4px 9px;
}

.weekday {
  text-align: center;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: .1em;
}

.weekday.is-weekend {
  color: var(--gold);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.day-cell {
  position: relative;
  min-width: 0;
  min-height: 84px;
  border-radius: 12px;
  padding: 7px 6px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  row-gap: 3px;
  text-align: left;
  color: var(--ink);
  border: 1px solid transparent;
  background: var(--cell);
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}

.day-cell.heat-1 { background: var(--heat-1); }
.day-cell.heat-2 { background: var(--heat-2); }
.day-cell.heat-3 { background: var(--heat-3); }
.day-cell.heat-4 { background: var(--heat-4); }

.day-cell:not(.is-empty):hover {
  border-color: var(--line-strong);
}

.day-cell:not(.is-empty):active {
  transform: scale(.975);
}

.day-cell.is-empty {
  pointer-events: none;
  background: transparent;
}

.day-cell.is-today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.day-cell.is-weekend .day-num {
  color: var(--gold);
}

.day-cell.is-today .day-num {
  color: var(--accent);
  font-weight: 600;
}

.day-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0 3px;
}

.day-num {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.day-total {
  font-size: 9px;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.day-top .day-total {
  margin-left: auto;
}

.cell-times {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.cell-time {
  font-size: 9px;
  line-height: 1.2;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-time.is-discipline { color: var(--type-discipline); }
.cell-time.is-grit { color: var(--type-grit); }

.trophy-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--type-achievement);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.trophy-badge .icon {
  width: 12px;
  height: 12px;
  fill: currentColor;
  stroke: none;
}

.cell-trophy {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 9px;
  gap: 1px;
}

.cell-trophy .icon {
  width: 10px;
  height: 10px;
}

.status-strip {
  display: grid;
  grid-template-columns: 12px 9px;
  grid-template-rows: 8px 9px;
  column-gap: 4px;
  row-gap: 4px;
  align-items: center;
  min-height: 21px;
}

.mark {
  display: inline-block;
  flex: 0 0 auto;
}

.diet-mark {
  display: inline-flex;
  align-items: stretch;
  gap: 1px;
  width: 10px;
  height: 7px;
}

.diet-bar {
  display: block;
  width: 2px;
  min-width: 2px;
  border-radius: .5px;
  background: var(--line-strong);
  opacity: .55;
}

.diet-bar.is-healthy { background: var(--diet-healthy); opacity: 1; }
.diet-bar.is-normal { background: var(--diet-normal); opacity: 1; }
.diet-bar.is-excess { background: var(--diet-excess); opacity: 1; }

.sleep-mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  opacity: .5;
}

.sleep-mark.is-enough {
  background: var(--sleep-enough);
  border-color: var(--sleep-enough);
  opacity: 1;
}

.sleep-mark.is-short {
  border-color: var(--sleep-short);
  background: linear-gradient(90deg, var(--sleep-short) 0 50%, transparent 50% 100%);
  opacity: 1;
}

.exercise-mark {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  background: transparent;
  opacity: .5;
}

.exercise-mark.is-combo {
  width: 11px;
  border-color: var(--line-strong);
  background: linear-gradient(90deg,
    var(--exercise-strength) 0 44%,
    transparent 44% 56%,
    var(--exercise-cardio) 56% 100%);
  opacity: 1;
}

.exercise-mark.is-strength {
  background: var(--exercise-strength);
  border-color: var(--exercise-strength);
  opacity: 1;
}

.exercise-mark.is-cardio {
  background: var(--exercise-cardio);
  border-color: var(--exercise-cardio);
  opacity: 1;
}

.exercise-mark.is-light {
  border-color: var(--exercise-light);
  background: transparent;
  opacity: 1;
}

.exercise-mark.is-none {
  border-color: var(--exercise-none);
  background: linear-gradient(135deg, transparent 0 42%, var(--exercise-none) 42% 58%, transparent 58% 100%);
  opacity: 1;
}

.mood-mark {
  width: 8px;
  height: 8px;
  margin: 0 1px;
  border: 1px solid var(--line-strong);
  transform: rotate(45deg);
  border-radius: 1px;
  background: transparent;
  opacity: .5;
}

.mood-mark.is-good {
  background: var(--mood-good);
  border-color: var(--mood-good);
  opacity: 1;
}

.mood-mark.is-normal {
  background: var(--mood-normal);
  border-color: var(--mood-normal);
  opacity: 1;
}

.mood-mark.is-abnormal {
  background: var(--mood-abnormal);
  border-color: var(--mood-abnormal);
  opacity: 1;
}

.calendar-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  margin: 11px 2px 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.45;
}

.calendar-key span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.calendar-key .key-num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.calendar-key .key-num.is-discipline { color: var(--type-discipline); }
.calendar-key .key-num.is-grit { color: var(--type-grit); }

.calendar-key .icon {
  width: 10px;
  height: 10px;
  color: var(--type-achievement);
}

.legend-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 2px 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.45;
}

.legend-hint b {
  font-weight: 500;
  color: var(--muted);
}

.month-empty-note {
  margin: 12px 2px 0;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.stats-empty-option {
  color: var(--faint);
  font-size: 11px;
}

.stats-card {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 17px;
}

.section-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
}

.section-kicker::before {
  content: "";
  display: block;
  width: 14px;
  height: 1px;
  background: var(--gold);
}

.stats-rows {
  margin-top: 11px;
}

.stats-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.stats-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.stats-label {
  flex: 0 0 42px;
  color: var(--ink-2);
  font-weight: 600;
  padding-top: 1px;
}

.stats-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
  min-width: 0;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stat-swatch {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
  flex: 0 0 auto;
}

.stat-swatch.is-healthy { background: var(--diet-healthy); }
.stat-swatch.is-normal { background: var(--diet-normal); }
.stat-swatch.is-excess { background: var(--diet-excess); }
.stat-swatch.is-enough { background: var(--sleep-enough); }
.stat-swatch.is-short { background: var(--sleep-short); }
.stat-swatch.is-strength { background: var(--exercise-strength); }
.stat-swatch.is-cardio { background: var(--exercise-cardio); }
.stat-swatch.is-light { background: var(--exercise-light); }
.stat-swatch.is-none { background: var(--exercise-none); }
.stat-swatch.is-discipline { background: var(--type-discipline); }
.stat-swatch.is-grit { background: var(--type-grit); }
.stat-swatch.is-achievement { background: var(--type-achievement); }
.stat-swatch.is-good { background: var(--mood-good); }
.stat-swatch.is-abnormal { background: var(--mood-abnormal); }
.stat-swatch.is-combo {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  background: linear-gradient(90deg,
    var(--exercise-strength) 0 44%,
    transparent 44% 56%,
    var(--exercise-cardio) 56% 100%);
}

.timeline-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 16px 15px 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.timeline-head-note {
  color: var(--faint);
  font-size: 10px;
}

.timeline-axis {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: end;
  padding: 0 2px 7px;
}

.timeline-axis .axis-label {
  color: var(--faint);
  font-size: 9px;
  letter-spacing: .08em;
}

.axis-track {
  position: relative;
  height: 15px;
  color: var(--faint);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.axis-track span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.axis-track span:first-child { transform: none; }
.axis-track span:last-child { transform: translateX(-100%); }

.axis-trophy {
  text-align: right;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: .04em;
}

.timeline-rows {
  display: flex;
  flex-direction: column;
}

.timeline-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
  min-height: 32px;
  padding: 3px 2px;
  border-radius: 8px;
  color: var(--ink);
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  transition: background .16s var(--ease);
}

.timeline-row:hover {
  background: var(--surface-2);
}

.timeline-row.is-today {
  background: var(--accent-soft);
}

.timeline-row:active {
  background: var(--accent-soft-2);
}

.tl-date {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.tl-day {
  font-size: 12px;
  font-weight: 600;
}

.tl-week {
  color: var(--faint);
  font-size: 9px;
}

.tl-total {
  margin-left: auto;
  color: var(--faint);
  font-size: 9px;
  white-space: nowrap;
}

.tl-track {
  position: relative;
  height: 20px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: hidden;
}

.tl-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%, transparent 25% 100%),
    linear-gradient(90deg, transparent 0 calc(50% - 1px), var(--line) calc(50% - 1px) 50%, transparent 50% 100%),
    linear-gradient(90deg, transparent 0 calc(75% - 1px), var(--line) calc(75% - 1px) 75%, transparent 75% 100%);
  pointer-events: none;
}

.tl-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  min-width: 3px;
  border-radius: 3px;
  background: var(--block);
  opacity: .9;
  pointer-events: auto;
  cursor: pointer;
}

.tl-block.t-discipline { background: var(--type-discipline); }
.tl-block.t-grit { background: var(--type-grit); }
.tl-block.t-achievement { background: var(--type-achievement); }

.tl-block:hover {
  opacity: 1;
}

.tl-trophy {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  color: var(--type-achievement);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.tl-trophy .icon {
  width: 12px;
  height: 12px;
}

.tl-empty-note {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 7px;
  color: var(--faint);
  font-size: 9px;
  pointer-events: none;
}

.timeline-footer {
  margin: 11px 2px 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
}

.empty-screen {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 46px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 13px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.empty-icon .icon {
  width: 22px;
  height: 22px;
}

.empty-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
}

.empty-text {
  margin: 7px auto 0;
  max-width: 250px;
  color: var(--muted);
  font-size: 13px;
}

.empty-action {
  margin-top: 18px;
}

.day-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 -18px;
  padding: max(10px, var(--safe-top)) 18px 10px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
}

.day-topbar.is-scrolled {
  border-bottom-color: var(--line);
}

.day-topbar-title {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .12em;
}

.day-heading {
  padding: 24px 2px 18px;
}

.day-heading-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.day-date {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(32px, 9vw, 42px);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -.01em;
}

.today-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
}

.day-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.day-timeline-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 17px 16px 16px;
  box-shadow: var(--shadow);
}

.day-timeline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.day-timeline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.day-achievement {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--type-achievement) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--type-achievement) 8%, transparent);
}

.day-achievement .icon {
  width: 14px;
  height: 14px;
}

.day-timeline-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
}

.day-timeline-caption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}

.add-button:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.add-button .icon {
  width: 16px;
  height: 16px;
}

.day-axis {
  display: flex;
  justify-content: space-between;
  margin: 20px 1px 7px;
  color: var(--faint);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.day-track {
  position: relative;
  height: 38px;
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}

.day-track .tl-grid {
  background:
    linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%, transparent 25% 100%),
    linear-gradient(90deg, transparent 0 calc(50% - 1px), var(--line) calc(50% - 1px) 50%, transparent 50% 100%),
    linear-gradient(90deg, transparent 0 calc(75% - 1px), var(--line) calc(75% - 1px) 75%, transparent 75% 100%);
}

.day-block {
  position: absolute;
  top: 7px;
  bottom: 7px;
  min-width: 3px;
  border-radius: 4px;
  background: var(--block);
  color: var(--ink-on-fill);
  overflow: hidden;
  padding: 0 5px;
  display: flex;
  align-items: center;
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 600;
}

.day-block.empty {
  display: none;
}

.day-block.t-discipline { background: var(--type-discipline); --bi: var(--ink-on-fill); }
.day-block.t-grit { background: var(--type-grit); --bi: var(--ink-on-fill); }
.day-block.t-achievement { background: var(--type-achievement); --bi: var(--ink-on-fill-dark); }

.day-block.t-discipline,
.day-block.t-grit,
.day-block.t-achievement {
  color: var(--bi, var(--ink-on-fill));
}

.day-track-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 9px;
  color: var(--faint);
  font-size: 10px;
  pointer-events: none;
}

.day-timeline-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  color: var(--faint);
  font-size: 10px;
}

.day-timeline-total {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.section-block {
  margin-top: 25px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 10px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
}

.section-heading span {
  color: var(--faint);
  font-size: 11px;
}

.activity-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.activity-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  padding: 13px 15px;
  border-top: 1px solid var(--line);
  transition: background .16s var(--ease);
}

.activity-row:first-child {
  border-top: 0;
}

.activity-row:hover {
  background: var(--surface-2);
}

.activity-row:active {
  background: var(--accent-soft);
}

.activity-time {
  flex: 0 0 75px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.activity-time strong {
  display: block;
  color: var(--ink-2);
  font-weight: 600;
}

.activity-main {
  min-width: 0;
  flex: 1;
}

.activity-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.type-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
  background: color-mix(in srgb, var(--tag-color) 13%, transparent);
  color: var(--tag-color);
}

.type-tag.t-discipline { --tag-color: var(--type-discipline); }
.type-tag.t-grit { --tag-color: var(--type-grit); }
.type-tag.t-achievement { --tag-color: var(--type-achievement); }

.activity-title,
.activity-duration {
  display: block;
}

.activity-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.activity-duration {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
}

.activity-row .icon {
  width: 17px;
  height: 17px;
  color: var(--faint);
}

.inline-empty {
  padding: 25px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty-action-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.status-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 16px 15px;
  margin-top: 12px;
}

.status-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.status-card-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.status-card-title .shape {
  display: inline-block;
}

.status-hint {
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
}

.status-card-body {
  margin-top: 13px;
}

.meal-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 6px 0;
}

.meal-row + .meal-row {
  border-top: 1px solid var(--line);
}

.meal-name {
  color: var(--muted);
  font-size: 12px;
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.option-btn {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}

.option-btn:hover {
  border-color: var(--line-strong);
}

.option-btn:active {
  transform: scale(.97);
}

.option-btn[aria-pressed="true"] {
  background: var(--tone-soft);
  border-color: var(--tone);
  color: var(--tone-ink);
  font-weight: 600;
}

.option-btn.tone-healthy { --tone: var(--diet-healthy); --tone-soft: color-mix(in srgb, var(--diet-healthy) 14%, transparent); --tone-ink: var(--diet-healthy); }
.option-btn.tone-normal { --tone: var(--diet-normal); --tone-soft: color-mix(in srgb, var(--diet-normal) 14%, transparent); --tone-ink: var(--diet-normal); }
.option-btn.tone-excess { --tone: var(--diet-excess); --tone-soft: color-mix(in srgb, var(--diet-excess) 14%, transparent); --tone-ink: var(--diet-excess); }
.option-btn.tone-enough { --tone: var(--sleep-enough); --tone-soft: color-mix(in srgb, var(--sleep-enough) 14%, transparent); --tone-ink: var(--sleep-enough); }
.option-btn.tone-short { --tone: var(--sleep-short); --tone-soft: color-mix(in srgb, var(--sleep-short) 14%, transparent); --tone-ink: var(--sleep-short); }
.option-btn.tone-strength_cardio { --tone: var(--exercise-cardio); --tone-soft: color-mix(in srgb, var(--exercise-cardio) 14%, transparent); --tone-ink: var(--exercise-cardio); }
.option-btn.tone-strength { --tone: var(--exercise-strength); --tone-soft: color-mix(in srgb, var(--exercise-strength) 14%, transparent); --tone-ink: var(--exercise-strength); }
.option-btn.tone-cardio { --tone: var(--exercise-cardio); --tone-soft: color-mix(in srgb, var(--exercise-cardio) 14%, transparent); --tone-ink: var(--exercise-cardio); }
.option-btn.tone-light { --tone: var(--exercise-light); --tone-soft: color-mix(in srgb, var(--exercise-light) 18%, transparent); --tone-ink: var(--exercise-light); }
.option-btn.tone-none { --tone: var(--exercise-none); --tone-soft: color-mix(in srgb, var(--exercise-none) 14%, transparent); --tone-ink: var(--exercise-none); }
.option-btn.tone-good { --tone: var(--mood-good); --tone-soft: color-mix(in srgb, var(--mood-good) 14%, transparent); --tone-ink: var(--mood-good); }
.option-btn.tone-abnormal { --tone: var(--mood-abnormal); --tone-soft: color-mix(in srgb, var(--mood-abnormal) 14%, transparent); --tone-ink: var(--mood-abnormal); }
.option-btn.tone-discipline { --tone: var(--type-discipline); --tone-soft: color-mix(in srgb, var(--type-discipline) 14%, transparent); --tone-ink: var(--type-discipline); }
.option-btn.tone-grit { --tone: var(--type-grit); --tone-soft: color-mix(in srgb, var(--type-grit) 14%, transparent); --tone-ink: var(--type-grit); }
.option-btn.tone-achievement { --tone: var(--type-achievement); --tone-soft: color-mix(in srgb, var(--type-achievement) 16%, transparent); --tone-ink: var(--type-achievement); }

.type-hint {
  margin-top: 8px;
  color: var(--faint);
  font-size: 11px;
}

.status-card .option-row {
  gap: 7px;
}

.page-footer {
  margin: 28px 2px 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: .04em;
}

.footer-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.footer-action:hover {
  color: var(--ink);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--backdrop);
  animation: fadeIn .18s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet-wrap.is-upper {
  align-items: flex-start;
  padding-top: max(52px, env(safe-area-inset-top, 0px));
}

.sheet.is-upper {
  border-radius: var(--radius-xl);
  border-bottom: 1px solid var(--line);
  max-height: 82vh;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 51;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 max(0px, env(safe-area-inset-left, 0px)) 0 max(0px, env(safe-area-inset-right, 0px));
  pointer-events: none;
}

.sheet {
  pointer-events: auto;
  width: min(100%, 560px);
  max-height: 91vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-sheet);
  padding: 9px 20px calc(22px + var(--safe-bottom));
  animation: sheetUp .26s var(--ease) both;
  -webkit-overflow-scrolling: touch;
}

@keyframes sheetUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.sheet-grabber {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  margin: 0 auto 10px;
  background: var(--line-strong);
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0 2px;
}

.sheet-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
}

.sheet-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.sheet-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.sheet-close:hover {
  color: var(--ink);
}

.sheet-close .icon {
  width: 17px;
  height: 17px;
}

.sheet-body {
  padding: 14px 0 0;
}

.field {
  margin-top: 14px;
}

.field:first-child {
  margin-top: 0;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
}

.text-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--ink);
  padding: 11px 13px;
  font-size: 15px;
  outline: none;
  transition: border-color .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease);
}

.text-input::placeholder { color: var(--faint); }

.text-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}


.splash-textarea {
  min-height: 112px;
  resize: none;
  line-height: 1.65;
}

.splash-count {
  margin-top: 6px;
  text-align: right;
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.menu-row-note.is-phrase {
  max-width: 56%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.time-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--ink);
  padding: 9px 12px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.time-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.duration-preview {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 12px;
}

.duration-preview strong {
  color: var(--ink-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.form-error {
  display: none;
  margin-top: 11px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--diet-excess);
  background: color-mix(in srgb, var(--diet-excess) 10%, transparent);
  font-size: 12px;
  line-height: 1.45;
}

.form-error.is-visible {
  display: block;
}

.sheet-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 20px;
}

.inline-confirm {
  margin-top: 16px;
  padding: 12px 13px;
  border: 1px solid color-mix(in srgb, var(--diet-excess) 28%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--diet-excess) 8%, transparent);
  color: var(--ink-2);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inline-confirm-actions {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}

.inline-confirm-actions .btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

[hidden] {
  display: none !important;
}

.btn {
  min-height: 46px;
  border-radius: 14px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line);
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .16s var(--ease), color .18s var(--ease);
}

.btn:active {
  transform: scale(.98);
}

.btn-primary {
  flex: 1;
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--ink-2);
}

.btn-ghost:hover {
  border-color: var(--line-strong);
}

.btn-danger {
  background: transparent;
  color: var(--diet-excess);
  border-color: color-mix(in srgb, var(--diet-excess) 30%, transparent);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--diet-excess) 8%, transparent);
}

.sheet-footer .btn-danger {
  margin-right: auto;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.legend-sheet .sheet-heading {
  font-size: 25px;
}

.legend-intro {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.legend-group {
  margin-top: 19px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.legend-group:first-of-type {
  margin-top: 13px;
  padding-top: 0;
  border-top: 0;
}

.legend-group-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 9px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}

.legend-rows {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.legend-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.legend-shape-box {
  width: 32px;
  min-height: 22px;
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface-2);
}

.legend-text {
  min-width: 0;
}

.legend-text strong {
  color: var(--ink-2);
  font-weight: 600;
}

.legend-status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 3px;
}

.legend-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 11px;
}

.legend-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--line-strong);
}

.legend-status i.is-healthy,
.legend-status i.is-good,
.legend-status i.is-strength { background: var(--diet-healthy); }
.legend-status i.is-normal { background: var(--diet-normal); }
.legend-status i.is-excess,
.legend-status i.is-abnormal { background: var(--diet-excess); }
.legend-status i.is-enough { background: var(--sleep-enough); }
.legend-status i.is-short { background: var(--sleep-short); }
.legend-status i.is-cardio { background: var(--exercise-cardio); }
.legend-status i.is-light { background: var(--exercise-light); }
.legend-status i.is-none { background: var(--exercise-none); }
.legend-status i.is-discipline { background: var(--type-discipline); }
.legend-status i.is-grit { background: var(--type-grit); }
.legend-status i.is-achievement { background: var(--type-achievement); }

.legend-shape-box .trophy-icon {
  width: 18px;
  height: 18px;
  color: var(--type-achievement);
}
.legend-status i.is-combo {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  background: linear-gradient(90deg,
    var(--exercise-strength) 0 44%,
    transparent 44% 56%,
    var(--exercise-cardio) 56% 100%);
}

.legend-note {
  margin-top: 12px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.6;
}

.heat-scale {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.heat-sample {
  width: 28px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--cell);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.heat-sample.heat-1 { background: var(--heat-1); }
.heat-sample.heat-2 { background: var(--heat-2); }
.heat-sample.heat-3 { background: var(--heat-3); }
.heat-sample.heat-4 { background: var(--heat-4); }

.menu-sheet .sheet-heading {
  font-size: 25px;
}

.menu-group {
  margin-top: 20px;
}

.menu-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
}

.appearance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.appearance-option {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  transition: border-color .16s var(--ease), background .16s var(--ease), color .16s var(--ease);
}

.appearance-option:hover {
  border-color: var(--line-strong);
}

.appearance-option[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.appearance-option .icon {
  width: 20px;
  height: 20px;
}

.menu-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  text-align: left;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}

.menu-row:first-of-type {
  border-top: 0;
}

.menu-row .icon {
  color: var(--muted);
}

.menu-row-text {
  flex: 1;
  font-size: 13px;
}

.menu-row-note {
  color: var(--faint);
  font-size: 10px;
}

.menu-version {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.confirm-sheet {
  max-width: 460px;
  margin: 0 12px 12px;
  border-radius: var(--radius-xl);
  max-height: 70vh;
}

.confirm-message {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  z-index: 80;
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 420px);
  pointer-events: none;
  display: flex;
  justify-content: center;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
  animation: toastIn .2s var(--ease) both;
}

.toast .icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.noscript {
  margin: 40px 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.fatal-screen {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 30px;
}

.fatal-screen h1 {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 15px 0 6px;
}

.fatal-screen p {
  color: var(--muted);
  font-size: 13px;
  max-width: 280px;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 360px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .month-nav {
    margin-top: 12px;
    margin-bottom: 17px;
  }

  .summary-card {
    padding: 18px 17px 15px;
  }

  .split-item {
    padding-left: 7px;
    padding-right: 7px;
  }

  .split-name {
    font-size: 10px;
  }

  .split-value {
    font-size: 22px;
  }

  .trophy-value .icon {
    width: 19px;
    height: 19px;
  }

  .trophy-value > span {
    font-size: 19px;
  }

  .summary-foot {
    margin-top: 14px;
    padding-top: 12px;
  }

  .summary-foot-note {
    display: none;
  }

  .month-card {
    padding: 12px 8px 11px;
  }

  .weekdays {
    gap: 3px;
    padding-left: 3px;
    padding-right: 3px;
  }

  .calendar-grid {
    gap: 4px;
  }

  .day-cell {
    min-height: 78px;
    padding: 6px 4px 5px;
    border-radius: 10px;
  }

  .cell-time {
    font-size: 8.5px;
    line-height: 1.15;
  }

  .cell-trophy {
    font-size: 8px;
    gap: 0;
  }

  .cell-trophy .icon {
    width: 9px;
    height: 9px;
  }

  .cell-time-bar {
    height: 4px;
  }

  .day-top {
    gap: 2px;
  }

  .day-num {
    font-size: 12px;
  }

  .day-total {
    font-size: 8px;
  }

  .status-strip {
    grid-template-columns: 10px 8px;
    grid-template-rows: 7px 8px;
    column-gap: 3px;
    row-gap: 3px;
  }

  .diet-mark {
    width: 10px;
    height: 7px;
  }

  .diet-bar {
    width: 2.5px;
    min-width: 2.5px;
  }

  .sleep-mark,
  .exercise-mark {
    width: 8px;
    height: 8px;
  }

  .exercise-mark.is-combo {
    width: 10px;
  }

  .mood-mark {
    width: 7px;
    height: 7px;
  }

  .legend-hint {
    margin-top: 9px;
    font-size: 9px;
  }

  .stats-card {
    padding: 14px 14px;
  }

  .stats-label {
    flex-basis: 36px;
  }

  .timeline-card {
    padding-left: 11px;
    padding-right: 11px;
  }

  .timeline-axis,
  .timeline-row {
    grid-template-columns: 43px minmax(0, 1fr) 26px;
    gap: 6px;
  }

  .axis-trophy {
    font-size: 8px;
  }

  .tl-trophy {
    font-size: 9px;
  }

  .tl-trophy .icon {
    width: 10px;
    height: 10px;
  }

  .day-topbar {
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .sheet {
    padding-left: 16px;
    padding-right: 16px;
  }

  .meal-row {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 7px;
  }

  .option-btn {
    padding-left: 10px;
    padding-right: 10px;
    font-size: 11.5px;
  }

  .activity-time {
    flex-basis: 68px;
  }

  .day-timeline-card {
    padding-left: 13px;
    padding-right: 13px;
  }

  .day-timeline-head {
    gap: 8px;
  }

  .day-timeline-title {
    font-size: 20px;
  }

  .add-button {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (max-height: 560px) {
  .sheet {
    max-height: 95vh;
    padding-top: 6px;
  }

  .sheet-grabber {
    margin-bottom: 6px;
  }

  .sheet-head {
    padding-top: 4px;
  }

  .sheet-heading {
    font-size: 22px;
  }

  .sheet-subtitle {
    display: none;
  }

  .sheet-body {
    padding-top: 8px;
  }

  .splash-textarea {
    min-height: 70px;
  }

  .sheet-footer {
    padding-top: 12px;
  }

  .sheet-close {
    width: 34px;
    height: 34px;
  }
}

@media (min-width: 600px) {
  .app-shell {
    padding-top: 36px;
  }

  .day-topbar {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    border-radius: 0;
  }
}

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

  .splash-hint {
    opacity: .7;
    animation: none;
  }

  .splash-progress::after {
    transform: scaleX(1);
    animation: none;
  }
}

/* Appended polish for tiny interactive states */
.day-topbar.is-scrolled {
  border-bottom-color: var(--line);
}

.summary-foot-action .icon,
.footer-action .icon,
.empty-action-inline .icon {
  width: 15px;
  height: 15px;
}

.empty-action-inline:hover {
  color: var(--accent-strong);
}

.stats-row .stat-chip b {
  color: var(--ink-2);
  font-weight: 600;
}

.option-btn[aria-pressed="true"] .check-dot {
  display: inline-block;
}

@media (max-width: 360px) {
  .stats-row {
    gap: 8px;
    font-size: 11px;
  }

  .inline-confirm {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-confirm-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

.stats-empty {
  margin: 12px 0 0;
  color: var(--faint);
  font-size: 12px;
}

.month-empty-note {
  padding: 15px 0 5px;
}

/* ---- 同步设置（v1.1.0） ---- */

.sync-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.sync-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.sync-dot.is-ok { background: var(--accent); }

.sync-dot.is-error { background: var(--diet-excess); }

.sync-dot.is-busy {
  background: var(--accent);
  animation: sync-pulse 1s var(--ease) infinite;
}

@keyframes sync-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.72); }
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sync-actions .btn { flex: none; }

.sync-note {
  margin: 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.6;
}

/* ---- 宽屏适配（v1.1.0）----
   手机端规则完全不变，以下全部是 min-width 渐进增强：
   ≥720px  半屏/平板窗口：单列放宽
   ≥1000px 桌面：双栏网格 + 弹层居中对话框 */

@media (min-width: 720px) {
  .app-shell {
    width: min(100%, 680px);
  }
}

@media (min-width: 1000px) {
  .app-shell {
    width: min(100%, 1120px);
    padding-left: 32px;
    padding-right: 32px;
  }

  /* 背景渐变随视口放大，避免大屏下显得局促 */
  body::before {
    background:
      radial-gradient(1100px 640px at 88% -8%, var(--bg-warm), transparent 68%),
      radial-gradient(1250px 780px at -12% 12%, var(--bg-accent), transparent 64%);
  }

  .splash {
    background:
      radial-gradient(1180px 860px at 50% 18%, var(--bg-accent), transparent 72%),
      radial-gradient(950px 720px at 50% 110%, var(--bg-warm), transparent 66%),
      var(--bg);
  }

  /* 首页：品牌与月份导航并排，日历/时间轴左列，摘要与状态右列 */
  .home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
  }

  .home-header .month-nav {
    margin: 0;
  }

  .home-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    column-gap: 28px;
    align-items: start;
  }

  .home-header {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .view-toolbar {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 26px 0 22px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--line);
  }

  .summary-card {
    grid-column: 2;
    grid-row: 3;
    /* 桌面：摘要跟随滚动，右侧不空 */
    position: sticky;
    top: 20px;
  }

  .month-card,
  .timeline-card,
  .empty-screen {
    grid-column: 1;
    grid-row: 3;
  }

  .month-empty-note {
    grid-column: 1;
    grid-row: 4;
  }

  /* 统计卡通栏放在日历下方（与空态提示互斥出现，不冲突） */
  .stats-card {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .page-footer {
    grid-column: 1 / -1;
  }

  /* 当天页：时间轴 + 事项列表左列，状态卡右列（跨两行对齐左列） */
  .day-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    column-gap: 28px;
    align-items: start;
  }

  .day-topbar {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .day-heading {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .day-timeline-card {
    grid-column: 1;
    grid-row: 3;
  }

  #day-activities-section {
    grid-column: 1;
    grid-row: 4;
  }

  .day-page > .section-block:last-of-type {
    grid-column: 2;
    grid-row: 3 / span 2;
    margin-top: 24px;
  }

  .day-page > .page-footer {
    grid-column: 1 / -1;
  }

  /* 月历格随列宽放大，保持接近手机的纵向比例 */
  .calendar-grid {
    gap: 7px;
  }

  .weekdays {
    gap: 7px;
  }

  .day-cell {
    min-height: 100px;
    padding: 9px 9px 8px;
  }

  .day-num {
    font-size: 14px;
  }

  .cell-time {
    font-size: 10px;
  }

  /* 弹层：贴底 sheet → 居中对话框 */
  .sheet-wrap {
    align-items: center;
    padding: 40px 24px;
  }

  .sheet-wrap.is-upper {
    align-items: center;
    padding-top: 40px;
  }

  .sheet {
    width: min(100%, 480px);
    max-height: 86vh;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding-top: 22px;
    animation: dialogIn .22s var(--ease) both;
  }

  .sheet.is-upper {
    max-height: 86vh;
    padding-top: 22px;
  }

  .sheet-grabber {
    display: none;
  }
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
