:root {
  color-scheme: light;
  --bg: #f0efe8;
  --surface: #fafaf6;
  --surface-raised: #fffefa;
  --surface-soft: #e4e9e1;
  --ink: #263128;
  --muted: #626f65;
  --muted-soft: #5e6b62;
  --accent: #7a9179;
  --accent-strong: #3e5b48;
  --accent-soft: #e0e8df;
  --accent-contrast: #fbfcf8;
  --ink-soft: #34463a;
  --line: #d7ded5;
  --line-strong: #c3cdc2;
  --ambient: rgba(119, 146, 122, 0.13);
  --shadow: rgba(52, 70, 58, 0.09);
  --shadow-strong: rgba(43, 61, 49, 0.17);
  --night: #3d4b42;
  --night-raised: #495a4e;
  --night-ink: #f9faf4;
  --night-muted: #cbd3c9;
  --night-line: rgba(249, 250, 244, 0.17);
  --toast-bg: #34463a;
  --toast-ink: #fbfcf8;
  --overlay: rgba(23, 31, 26, 0.46);
  --radius-card: 20px;
  --radius-panel: 17px;
  --radius-row: 14px;
  --radius-pill: 999px;
  --font-sans:
    "Aptos", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei",
    sans-serif;
  --font-display:
    "Arial Rounded MT Bold", "Aptos Display", "PingFang SC",
    "Microsoft YaHei UI", sans-serif;
  --font-serif:
    "Iowan Old Style", Baskerville, Georgia, "Songti SC", "STSong",
    "Noto Serif CJK SC", SimSun, serif;
  font-family: var(--font-sans);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background:
    linear-gradient(rgba(240, 239, 232, 0.3), rgba(240, 239, 232, 0.3)),
    url("./assets/hero-curtain-poster.jpg") center / cover fixed no-repeat,
    var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 4px;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 88% -7%, rgba(188, 214, 220, 0.34), transparent 28rem),
    radial-gradient(circle at -10% 48%, var(--ambient), transparent 26rem),
    linear-gradient(155deg, transparent 54%, rgba(255, 255, 255, 0.22));
}

.page-media {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg) url("./assets/hero-curtain-poster.jpg") center / cover
    no-repeat;
}

.page-backdrop,
.page-backdrop img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.page-backdrop img {
  object-fit: cover;
  object-position: center 48%;
  transform-origin: center;
  will-change: transform;
}

.page-wash {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(241, 240, 233, 0.4) 0%,
      rgba(241, 240, 233, 0.18) 25%,
      rgba(241, 240, 233, 0.34) 62%,
      rgba(241, 240, 233, 0.68) 100%
    ),
    linear-gradient(
      90deg,
      rgba(241, 240, 233, 0.22),
      transparent 42%,
      rgba(241, 240, 233, 0.12)
    );
}

.page-shell {
  position: relative;
  z-index: 3;
  width: min(100%, 800px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(15px, env(safe-area-inset-top))
    17px
    calc(38px + env(safe-area-inset-bottom));
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  margin: 0 -3px;
  padding: 8px 3px;
  background: transparent;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sync-status {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(250, 250, 246, 0.7);
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.sync-status::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--muted-soft);
  content: "";
  vertical-align: 1px;
}

.sync-status[data-state="synced"]::before {
  background: var(--accent);
}

.sync-status[data-state="syncing"]::before {
  background: #b08c52;
}

.sync-status[data-state="error"]::before,
.sync-status[data-state="offline"]::before {
  background: #9a6859;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.06em;
}

.brand-caption {
  color: var(--muted);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: 0.18em;
}

.text-button,
.month-button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: rgba(250, 250, 246, 0.66);
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    transform 150ms ease;
}

.text-button:hover,
.month-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}

.text-button:active,
.month-button:active,
.primary-button:active,
.task:active,
.week-day:active {
  transform: scale(0.975);
}

.hero {
  position: relative;
  margin-top: 12px;
  padding: 22px 20px 17px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius-card);
  background: rgba(250, 250, 246, 0.82);
  box-shadow: 0 25px 65px -48px var(--shadow-strong);
  -webkit-backdrop-filter: blur(22px) saturate(115%);
  backdrop-filter: blur(22px) saturate(115%);
}

.hero-content {
  position: relative;
  z-index: 2;
  padding-top: 42px;
}

.hero-date {
  position: absolute;
  top: 17px;
  left: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius-pill);
  background: rgba(249, 249, 243, 0.8);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.hero-weekday {
  padding-left: 9px;
  border-left: 1px solid rgba(38, 49, 40, 0.2);
}

.hero-day {
  position: absolute;
  top: 17px;
  right: 18px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  background: rgba(247, 248, 241, 0.8);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 17px;
  font-variant-numeric: lining-nums;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.greeting {
  position: relative;
  z-index: 2;
  margin: 0 0 7px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hero h1 {
  position: relative;
  z-index: 2;
  max-width: 570px;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(2rem, 8.2vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.065em;
}

.hero h1 span {
  position: relative;
  display: inline-block;
  z-index: 0;
}

.hero h1 span::after {
  position: absolute;
  right: -3px;
  bottom: 1px;
  left: -2px;
  z-index: -1;
  height: 0.3em;
  border-radius: 2px;
  background: var(--accent-soft);
  content: "";
  transform: rotate(-1deg);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 34ch;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.72;
}

.hero-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.hero-stat {
  display: grid;
  gap: 1px;
}

.stat-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.hero-stat strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  line-height: 1.2;
}

.hero-stat small {
  margin-left: 4px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
}

.hero-note {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.week-panel {
  margin-top: 12px;
  padding: 15px 13px 13px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius-panel);
  background: rgba(250, 250, 246, 0.84);
  -webkit-backdrop-filter: blur(18px) saturate(112%);
  backdrop-filter: blur(18px) saturate(112%);
}

.week-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 3px;
}

.week-panel-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.week-panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.week-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin-top: 11px;
}

.week-day {
  position: relative;
  display: grid;
  justify-items: center;
  min-width: 0;
  min-height: 67px;
  padding: 8px 2px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-row);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    transform 150ms ease,
    background-color 170ms ease,
    border-color 170ms ease;
}

.week-day:hover {
  border-color: var(--line-strong);
}

.week-day-name {
  font-size: 8.5px;
  font-weight: 650;
}

.week-day-number {
  margin-top: 3px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.week-day-mark {
  width: 4px;
  height: 4px;
  margin-top: 5px;
  border-radius: 50%;
  background: transparent;
}

.week-day.is-today {
  background: var(--ink-soft);
  color: var(--night-ink);
}

.week-day.is-today .week-day-number {
  color: var(--night-ink);
}

.week-day.is-today .week-day-mark {
  background: var(--accent);
}

.week-day.is-checked:not(.is-today) {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.week-day.is-checked:not(.is-today) .week-day-number {
  color: var(--accent-strong);
}

.week-day.is-checked:not(.is-today) .week-day-mark {
  background: var(--accent);
}

.week-day.is-future {
  opacity: 0.34;
  pointer-events: none;
}

.progress-panel {
  margin-top: 4px;
  padding: 13px 5px 11px;
  border-bottom: 1px solid var(--line);
}

.progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.progress-heading > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.progress-label,
.progress-status {
  color: var(--muted);
  font-size: 9.5px;
}

.progress-heading strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.progress-status {
  text-align: right;
}

.progress-marks {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  gap: 4px;
  margin-top: 9px;
}

.progress-mark {
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  transition:
    background-color 220ms ease,
    transform 220ms ease;
}

.progress-mark.is-done {
  background: var(--accent);
  transform: scaleY(1.35);
}

.session {
  margin-top: 34px;
}

.session-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: center;
  margin-bottom: 13px;
}

.session-marker {
  display: grid;
  place-items: center;
  min-width: 46px;
  height: 25px;
  padding-inline: 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--accent-strong);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.session-title-wrap {
  min-width: 0;
}

.session h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.2;
}

.session-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.session-count {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ritual-group {
  padding: 13px 15px 2px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius-panel);
  background: rgba(250, 250, 246, 0.9);
}

.ritual-group + .ritual-group {
  margin-top: 10px;
}

.ritual-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 7px;
}

.ritual-group-head h3 {
  flex: 0 0 auto;
  margin: 0;
  color: var(--accent-strong);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.ritual-group-head span {
  width: 100%;
  height: 1px;
  background: var(--line);
}

.task-grid {
  display: block;
}

.task {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  gap: 11px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition:
    background-color 170ms ease,
    color 170ms ease,
    transform 150ms ease;
}

.task:last-child {
  border-bottom: 0;
}

.task:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.task-copy {
  min-width: 0;
}

.task-title {
  display: block;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 720;
  line-height: 1.4;
  letter-spacing: -0.012em;
}

.task-detail {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.task-index {
  padding-top: 2px;
  color: var(--muted-soft);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.task-check {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-raised);
  color: transparent;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms cubic-bezier(0.2, 0.9, 0.25, 1.25);
}

.task.is-done {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.task.is-done .task-check {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: var(--accent-contrast);
  transform: scale(1.04);
}

.task.is-done .task-title {
  color: var(--accent-strong);
}

.task.is-done .task-index {
  color: var(--accent-strong);
}

.session-note {
  margin: 12px 3px 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.6;
}

.session#session-evening {
  margin-top: 42px;
  padding: 24px 16px 18px;
  border-radius: var(--radius-card);
  background:
    radial-gradient(circle at 92% 2%, rgba(255, 255, 255, 0.1), transparent 12rem),
    var(--night);
  color: var(--night-ink);
  box-shadow: 0 25px 60px -47px var(--shadow-strong);
}

.session#session-evening .session-marker {
  border-color: var(--night-line);
  color: var(--night-ink);
}

.session#session-evening h2 {
  color: var(--night-ink);
}

.session#session-evening .session-subtitle,
.session#session-evening .session-count,
.session#session-evening .session-note,
.session#session-evening .task-detail {
  color: var(--night-muted);
}

.session#session-evening .ritual-group {
  border-color: var(--night-line);
  background: var(--night-raised);
}

.session#session-evening .ritual-group-head h3 {
  color: var(--night-ink);
}

.session#session-evening .ritual-group-head span {
  background: var(--night-line);
}

.session#session-evening .task {
  border-color: var(--night-line);
  color: var(--night-ink);
}

.session#session-evening .task:hover {
  background: rgba(255, 255, 255, 0.04);
}

.session#session-evening .task-title {
  color: var(--night-ink);
}

.session#session-evening .task-index {
  color: var(--night-muted);
}

.session#session-evening .task-check {
  border-color: rgba(249, 244, 235, 0.38);
  background: transparent;
}

.session#session-evening .task.is-done .task-title,
.session#session-evening .task.is-done .task-index {
  color: #c7ddc6;
}

.session#session-evening .task.is-done .task-check {
  border-color: #c7ddc6;
  background: #c7ddc6;
  color: #263b2c;
}

.page-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 35px;
  padding: 16px 2px 0;
  border-top: 1px solid var(--line);
  color: var(--muted-soft);
  font-size: 9.5px;
}

.page-footer p {
  margin: 0;
}

.toast {
  position: fixed;
  top: calc(13px + env(safe-area-inset-top));
  left: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(calc(100% - 30px), 420px);
  min-height: 46px;
  padding: 8px 15px 8px 8px;
  border-radius: var(--radius-pill);
  background: var(--toast-bg);
  box-shadow: 0 17px 42px -23px var(--shadow-strong);
  color: var(--toast-ink);
  font-size: 11.5px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -16px);
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--accent-strong);
  color: var(--accent-contrast);
  font-size: 13px;
  font-weight: 850;
}

.dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: overlay-in 180ms ease both;
}

.dialog-layer[hidden] {
  display: none;
}

.dialog-card {
  position: relative;
  width: min(100%, 430px);
  max-height: calc(100dvh - 40px);
  padding: 28px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 23px;
  background: var(--surface-raised);
  box-shadow: 0 35px 90px -30px rgba(36, 26, 18, 0.46);
  animation: card-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dialog-card:focus {
  outline: none;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0 0 2px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.celebration-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 7px 0 24px;
  border: 1px solid var(--accent-soft);
  border-radius: 50%;
  background: var(--accent-soft);
}

.celebration-mark span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-strong);
  color: var(--accent-contrast);
  font-size: 19px;
  font-weight: 850;
  line-height: 1;
}

.dialog-kicker {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.dialog-card h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.18;
}

.dialog-copy {
  margin: 13px 0 23px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.78;
}

.message-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 23px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.message-stats > div {
  display: grid;
  gap: 3px;
}

.message-stats > div + div {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.message-stats strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.message-stats span {
  color: var(--muted);
  font-size: 9.5px;
}

.primary-button {
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent-strong);
  color: var(--accent-contrast);
  font-size: 13px;
  font-weight: 720;
  cursor: pointer;
  transition:
    transform 150ms ease,
    background-color 170ms ease;
}

.primary-button:hover {
  background: var(--ink);
}

.message-card .primary-button {
  width: 100%;
}

.history-card {
  width: min(100%, 520px);
}

.history-card h2 {
  font-size: 28px;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 25px;
}

.calendar-toolbar strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.month-button {
  min-height: 36px;
  padding-inline: 12px;
  font-size: 10px;
}

.month-button:disabled {
  opacity: 0.35;
  cursor: default;
}

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

.weekdays {
  margin-top: 18px;
  color: var(--muted-soft);
  font-size: 9px;
  text-align: center;
}

.calendar-grid {
  margin-top: 7px;
}

.calendar-spacer {
  aspect-ratio: 1;
}

.calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background-color 150ms ease;
}

.calendar-day:hover {
  border-color: var(--line-strong);
}

.calendar-day:active {
  transform: scale(0.93);
}

.calendar-day.is-checked {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.calendar-day.has-note::after {
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.calendar-day.is-full {
  background: var(--accent-strong);
  color: var(--accent-contrast);
}

.calendar-day.is-today {
  border-color: var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: -4px;
}

.calendar-day.is-selected {
  outline: 2px solid var(--ink);
  outline-offset: -4px;
}

.calendar-day.is-future {
  opacity: 0.27;
  pointer-events: none;
}

.record-section {
  margin-top: 19px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.record-heading,
.record-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-heading h3 {
  margin: 0;
  scroll-margin-top: 16px;
  font-size: 18px;
}

.record-heading .month-button {
  flex-shrink: 0;
  min-height: 42px;
  font-size: 12px;
}

.record-detail {
  margin: 3px 0 11px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.record-checklist {
  border-block: 1px solid var(--line);
}

.record-task {
  min-height: 44px;
  padding: 7px 10px;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}

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

.record-task:has(input:checked) {
  background: var(--accent-soft);
}

.record-task input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent-strong);
  cursor: pointer;
}

.record-activities {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.record-activities:empty {
  display: none;
}

.record-note-editor {
  display: grid;
  gap: 9px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.record-note-label {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.record-note-editor textarea {
  width: 100%;
  min-height: 82px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(250, 250, 246, 0.74);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.65;
  resize: vertical;
}

.record-note-editor textarea::placeholder {
  color: var(--muted-soft);
  opacity: 1;
}

.record-note-editor textarea:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.record-note-editor textarea:disabled {
  background: var(--surface-soft);
  cursor: not-allowed;
}

.record-note-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.record-note-actions > span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.note-save-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding-inline: 15px;
  font-size: 11px;
}

.note-save-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.month-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 10px;
}

.month-summary strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
}

.privacy-note {
  margin: 20px 0 0;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted-soft);
  font-size: 9px;
  line-height: 1.65;
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.978);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes backdrop-breathe {
  from {
    transform: scale(1.01) translate3d(0, -0.15%, 0);
  }
  to {
    transform: scale(1.025) translate3d(0, 0.25%, 0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .page-backdrop img {
    animation: backdrop-breathe 14s ease-in-out infinite alternate;
  }

  .hero {
    animation: page-rise 430ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .week-panel {
    animation: page-rise 470ms 45ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .progress-panel {
    animation: page-rise 490ms 70ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .session {
    animation: page-rise 520ms 110ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .session + .session {
    animation-delay: 165ms;
  }

  .toast.is-visible .toast-mark {
    animation: toast-pop 350ms cubic-bezier(0.2, 0.9, 0.25, 1.3);
  }
}

@keyframes toast-pop {
  0% {
    transform: scale(0.7);
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@media (min-width: 640px) {
  .page-shell {
    padding-inline: 25px;
  }

  .hero {
    padding: 25px 27px 20px;
  }

  .hero-content {
    padding-top: 44px;
  }

  .hero-day {
    top: 20px;
    right: 24px;
    width: 53px;
    height: 53px;
    font-size: 19px;
  }

  .greeting {
    margin-top: 0;
  }

  .hero-stats {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
  }

  .hero-note {
    grid-column: auto;
    max-width: 25ch;
    margin: 0 0 3px;
    text-align: right;
  }

  .session#session-evening {
    padding: 28px 24px 21px;
  }
}

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

  .page-backdrop img {
    animation: none !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .dialog-layer {
    background: var(--overlay);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
