:root {
  color-scheme: light;
  --ink: #263329;
  --ink-soft: #536157;
  --muted: #748078;
  --paper: #fffdf5;
  --paper-soft: #f8f4e8;
  --canvas: #eeece2;
  --line: #ded8c7;
  --line-strong: #c9c0aa;
  --green: #39764c;
  --green-2: #5f9169;
  --green-soft: #dcead8;
  --yellow: #f2ce55;
  --yellow-soft: #fff2b9;
  --orange: #d9753e;
  --orange-soft: #fff0e3;
  --danger: #a94f43;
  --danger-soft: #f7e6e1;
  --shadow: 0 18px 55px rgba(49, 60, 45, .1);
  --hero-pos-desktop: 50% 50%;
  --hero-pos-mobile: 50% 50%;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9eadf;
  --ink-soft: #c0c7ba;
  --muted: #98a294;
  --paper: #202820;
  --paper-soft: #273127;
  --canvas: #182018;
  --line: #3b493b;
  --line-strong: #526153;
  --green: #86bd8b;
  --green-2: #6ca477;
  --green-soft: #304832;
  --yellow: #efd46e;
  --yellow-soft: #594f28;
  --orange: #ef9a69;
  --orange-soft: #493429;
  --danger: #ef9a8b;
  --danger-soft: #4e302c;
  --shadow: 0 20px 60px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  padding-bottom: 84px;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--green) 11%, transparent) 1px, transparent 1.5px) 0 0 / 22px 22px,
    var(--canvas);
}

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

button, [role="button"] { touch-action: manipulation; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
}
.skip-link:focus { top: 12px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 58px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  width: calc(100% - 24px);
  height: 100%;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  min-height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
  letter-spacing: -.02em;
  cursor: pointer;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px 12px 8px 12px;
  color: white;
  background: #39764c;
  box-shadow: inset -6px -6px 0 rgba(0, 0, 0, .06);
}

.desktop-nav { display: none; }

.settings-button,
.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--paper);
  cursor: pointer;
}

.settings-button { font-weight: 900; letter-spacing: 2px; }

.brand { min-width: 0; flex: 0 1 auto; }
.brand > span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.settings-button { flex: 0 0 44px; }
.cloud-status {
  flex: 0 0 auto;
  min-height: 44px;
  max-width: 110px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}
.cloud-status[data-sync-status="synced"] { border-color: var(--green-2); color: var(--green); background: var(--green-soft); }
.cloud-status[data-sync-status="offline"], .cloud-status[data-sync-status="error"] { border-color: var(--orange); color: var(--orange); background: var(--orange-soft); }

.app-shell {
  width: calc(100% - 24px);
  max-width: 1340px;
  margin: 12px auto 28px;
}

.view-header {
  margin: 8px 2px 18px;
}

.view-header h1,
.page-title,
.panel-title,
.hero-title {
  font-family: Georgia, "Songti SC", "STSong", serif;
  text-wrap: balance;
}

.view-header h1 { margin: 2px 0 4px; font-size: 32px; line-height: 1.2; }
.view-header p { margin: 0; color: var(--muted); }
.section-kicker { margin: 0; color: var(--orange); font-size: 13px; font-weight: 800; letter-spacing: .07em; }

.hero {
  position: relative;
  min-height: 250px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(35, 48, 35, .2);
  border-radius: 23px;
  background: var(--paper-soft);
  box-shadow: var(--shadow);
}

.hero-photo {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--hero-pos-mobile);
  transition: opacity .25s ease, transform .55s ease;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(0deg, rgba(11, 25, 19, .72), rgba(13, 27, 21, .09) 78%),
              linear-gradient(90deg, rgba(11, 26, 20, .58), transparent 85%);
  transition: opacity .25s ease;
}

.hero.no-photo .hero-photo,
.hero.no-photo::before { opacity: 0; }

.hero-content {
  min-height: 250px;
  padding: 16px 18px 70px;
  display: grid;
  align-content: start;
  gap: 8px;
  color: white;
}

.hero.no-photo .hero-content { color: var(--ink); }
.hero-copy { min-width: 0; }
.hero-eyebrow { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; }
.hero-eyebrow::before { content: ""; width: 32px; height: 3px; border-radius: 99px; background: var(--yellow); }
.hero-title { max-width: 680px; margin: 0; font-size: 34px; line-height: 1.08; letter-spacing: -.04em; text-shadow: 0 2px 22px rgba(0, 0, 0, .25); }
.hero.no-photo .hero-title { text-shadow: none; }
.hero-note { margin: 5px 0 0; color: rgba(255, 255, 255, .9); }
.hero-note-context { display: none; }
.hero.no-photo .hero-note { color: var(--muted); }

.countdown {
  justify-self: start;
  padding: 7px 11px;
  display: flex;
  align-items: baseline;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: 18px;
  background: rgba(15, 32, 25, .34);
  backdrop-filter: blur(9px);
}
.countdown small { color: rgba(255, 255, 255, .84); }
.countdown strong { font-family: Georgia, serif; font-size: 27px; line-height: 1; }
.hero.no-photo .countdown { border-color: var(--line); color: var(--ink); background: color-mix(in srgb, var(--paper) 80%, transparent); }
.hero.no-photo .countdown small { color: var(--muted); }

.hero-tools {
  position: absolute;
  right: 12px;
  bottom: 8px;
  left: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.scene-strip,
.hero-actions {
  min-width: 0;
  padding: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  background: rgba(12, 29, 21, .55);
  backdrop-filter: blur(12px);
}

.scene-strip {
  max-width: calc(100% - 145px);
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.scene-strip::-webkit-scrollbar { display: none; }
.hero-actions { flex: 0 0 auto; }

.scene-button,
.hero-action {
  min-width: 42px;
  min-height: 36px;
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: transparent;
  cursor: pointer;
}
.scene-button[aria-pressed="true"] { color: #253126; font-weight: 900; background: #fff8df; }
.hero-action[aria-pressed="true"] { color: var(--yellow); }
.action-label, .scene-label { display: none; }
.hero.no-photo .scene-strip, .hero.no-photo .hero-actions { border-color: var(--line); background: color-mix(in srgb, var(--paper) 82%, transparent); }
.hero.no-photo .scene-button, .hero.no-photo .hero-action { color: var(--ink); }
.hero.no-photo .scene-button[aria-pressed="true"] { background: var(--green-soft); }

.hero-gap { height: 16px; }

.mode-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--paper) 97%, transparent);
  box-shadow: 0 12px 34px rgba(53, 62, 48, .07);
}

.mode-panel { padding: 8px 14px; }
.mode-heading h2 { display: none; margin: 3px 0 5px; font-size: 25px; line-height: 1.35; }
.mode-heading p:last-child { margin: 0; color: var(--muted); }

.mode-options { margin-top: 7px; display: flex; gap: 9px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.mode-card {
  min-width: min(78vw, 290px);
  min-height: 50px;
  padding: 8px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: left;
  background: var(--paper-soft);
  cursor: pointer;
}
.mode-card > span:first-child { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; }
.mode-card strong { display: inline; font-size: 16px; }
.mode-card span { color: var(--muted); }
.mode-card.is-active { border-color: var(--green-2); background: var(--green-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 18%, transparent); }
.mode-card.is-active { order: -1; }
.mode-check { color: var(--green); font-size: 20px; opacity: 0; }
.mode-card.is-active .mode-check { opacity: 1; }

.gentle-note {
  margin-top: 13px;
  padding: 14px 15px;
  border-left: 4px solid var(--orange);
  border-radius: 0 14px 14px 0;
  color: #76543e;
  background: var(--orange-soft);
}
[data-theme="dark"] .gentle-note { color: #f2c5a8; }
.gentle-note p { margin: 0 0 10px; }
.gentle-note-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.content-grid { margin-top: 10px; display: grid; gap: 16px; }
.panel { padding: 14px 15px; }
.content-grid.today > .panel { padding-top: 12px; }
.panel-header { margin-bottom: 8px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-title { margin: 2px 0 0; font-size: 23px; line-height: 1.3; }
.panel-subtitle { margin: 5px 0 0; color: var(--muted); }

.button,
.button-secondary,
.button-quiet,
.button-danger {
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 750;
  cursor: pointer;
}
.button { color: white; background: var(--green); }
.button-secondary { border-color: var(--line-strong); color: var(--ink); background: var(--paper); }
.button-quiet { color: var(--green); background: var(--green-soft); }
.button-danger { color: var(--danger); background: var(--danger-soft); }
.button.small, .button-secondary.small, .button-quiet.small, .button-danger.small { min-height: 38px; padding: 7px 12px; font-size: 14px; }
button:disabled { cursor: not-allowed; opacity: .55; }

.task-list { display: grid; gap: 10px; }
.task-card {
  position: relative;
  padding: 12px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}
.task-card.is-complete { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); background: color-mix(in srgb, var(--green-soft) 54%, var(--paper)); }
.task-check {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: transparent;
  background: var(--paper-soft);
  font-weight: 900;
  cursor: pointer;
}
.task-card.is-complete .task-check { border-color: var(--green); color: white; background: var(--green); }
.task-main { min-width: 0; }
.task-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-name { margin: 0; font-size: 17px; line-height: 1.45; }
.task-card.is-complete .task-name { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--ink-soft); }
.task-meta { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.task-note { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; }
.task-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 7px; }
.module-pill, .status-pill, .tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 13px;
  white-space: nowrap;
}
.status-pill.orange { color: var(--orange); background: var(--orange-soft); }
.status-pill.yellow { color: #6d5a13; background: var(--yellow-soft); }

.empty-state {
  padding: 28px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  background: var(--paper-soft);
}
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 18px; }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-item { padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper-soft); }
.stat-item span { display: block; color: var(--muted); font-size: 13px; }
.stat-item strong { display: block; margin-top: 3px; font-family: Georgia, serif; font-size: 27px; line-height: 1.1; }
.stat-item small { color: var(--muted); }

.progress-track { height: 9px; overflow: hidden; border-radius: 99px; background: color-mix(in srgb, var(--line) 70%, transparent); }
.progress-fill { height: 100%; border-radius: inherit; background: var(--green); transition: width .3s ease; }
.progress-fill.orange { background: var(--orange); }
.progress-row { margin-top: 12px; }
.progress-label { margin-bottom: 6px; display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 14px; }

.trail { display: grid; grid-template-columns: repeat(7, minmax(28px, 1fr)); gap: 7px; }
.trail-day { min-width: 0; text-align: center; }
.trail-day span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.trail-dot { aspect-ratio: 1; max-width: 44px; margin: auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--paper-soft); font-size: 12px; }
.trail-dot.done { border-color: var(--green); color: white; background: var(--green); }
.trail-dot.partial { border-color: var(--orange); color: var(--orange); background: var(--orange-soft); }
.trail-dot.today { box-shadow: 0 0 0 3px var(--yellow-soft); }

.week-switcher, .date-strip, .filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.week-chip, .date-chip, .filter-chip { min-height: 42px; flex: 0 0 auto; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: var(--paper); cursor: pointer; }
.week-chip.is-active, .date-chip.is-active, .filter-chip.is-active { border-color: var(--green); color: var(--green); background: var(--green-soft); font-weight: 800; }

.goal-grid { display: grid; gap: 11px; }
.goal-card { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.goal-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.goal-card h3 { margin: 0; font-size: 17px; }
.goal-card p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.week-task-group { margin-top: 16px; }
.week-task-group h3 { margin: 0 0 8px; font-size: 18px; }
.week-task-row { padding: 12px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; border-top: 1px dashed var(--line); }
.week-task-row:first-of-type { border-top: 0; }
.week-task-row strong { display: block; }
.week-task-row small { color: var(--muted); }
.row-actions { display: flex; align-items: center; gap: 6px; }

.record-layout { display: grid; gap: 16px; }
.record-summary { padding: 15px; border-radius: 15px; background: var(--green-soft); }
.record-summary strong { font-family: Georgia, serif; font-size: 25px; }
.record-summary p { margin: 3px 0 0; color: var(--ink-soft); }

.detail-sections { display: grid; gap: 13px; }
.detail-card { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.detail-card h3 { margin: 0 0 10px; font-size: 17px; }
.form-grid { display: grid; gap: 11px; }
.field { display: grid; gap: 5px; }
.field label { color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  background: var(--paper);
}
.field textarea { min-height: 92px; resize: vertical; }
.field small { color: var(--muted); }

.library-toolbar { display: grid; gap: 10px; }
.search-input { position: relative; }
.search-input input { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); background: var(--paper); }
.library-list { margin-top: 14px; display: grid; gap: 10px; }
.library-card { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.library-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.library-content { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; font-weight: 700; }
.library-note { margin: 8px 0 0; color: var(--ink-soft); white-space: pre-wrap; }
.tag-row { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.library-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 7px; }

.rate-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.rate-card { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper-soft); }
.rate-card span { color: var(--muted); font-size: 13px; }
.rate-card strong { display: block; margin: 2px 0 8px; font-family: Georgia, serif; font-size: 24px; }
.review-form { margin-top: 16px; display: grid; gap: 13px; }
.improvement-field { padding: 15px; border: 1px solid color-mix(in srgb, var(--orange) 45%, var(--line)); border-radius: 16px; background: var(--orange-soft); }
.backup-reminder { margin-top: 16px; padding: 15px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px; border: 1px solid color-mix(in srgb, var(--green) 34%, var(--line)); border-radius: 16px; background: color-mix(in srgb, var(--green-soft) 64%, var(--paper)); }
.backup-reminder p { margin: 3px 0 0; color: var(--ink-soft); }
.backup-reminder .button-secondary { flex: 0 0 auto; }
.backup-status { color: var(--green); font-weight: 700; }

.app-dialog {
  width: min(620px, calc(100% - 24px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(18, 25, 18, .25);
}
.app-dialog::backdrop { background: rgba(18, 27, 20, .48); backdrop-filter: blur(3px); }
.dialog-frame { margin: 0; }
.dialog-header { padding: 18px 18px 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 2px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 25px; }
.dialog-body { max-height: 62dvh; padding: 17px 18px; overflow-y: auto; }
.dialog-actions { padding: 13px 18px 18px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }

.settings-list { display: grid; gap: 15px; }
.settings-block { padding-bottom: 15px; border-bottom: 1px dashed var(--line); }
.settings-block:last-child { padding-bottom: 0; border-bottom: 0; }
.settings-block h3 { margin: 0 0 7px; font-size: 17px; }
.settings-block p { margin: 0 0 10px; color: var(--muted); }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.toast-region { position: fixed; right: 12px; bottom: 92px; z-index: 90; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: min(360px, calc(100vw - 24px)); padding: 11px 15px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); animation: toast-in .22s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.bottom-nav {
  position: fixed;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 10px;
  z-index: 50;
  min-height: 61px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  box-shadow: 0 10px 30px rgba(34, 45, 33, .16);
  backdrop-filter: blur(14px);
}
.bottom-nav-button { min-height: 48px; border: 0; border-radius: 13px; color: var(--muted); background: transparent; cursor: pointer; font-size: 13px; }
.bottom-nav-button.is-active { color: var(--green); background: var(--green-soft); font-weight: 800; }

@media (min-width: 641px) {
  body { padding-bottom: 28px; }
  .topbar { height: 68px; }
  .topbar-inner, .app-shell { width: min(100% - 30px, 1340px); }
  .app-shell { margin-top: 26px; }
  .bottom-nav { display: none; }
  .desktop-nav { display: flex; align-items: center; gap: 5px; margin-left: auto; }
  .nav-button { min-height: 42px; padding: 9px 13px; border: 0; border-radius: 999px; color: var(--ink-soft); background: transparent; cursor: pointer; }
  .nav-button.is-active { color: var(--green); background: var(--green-soft); font-weight: 800; }
  .hero { min-height: 315px; border-radius: 28px; }
  .hero-photo { object-position: var(--hero-pos-desktop); }
  .hero::before { background: linear-gradient(90deg, rgba(12, 29, 22, .74), rgba(15, 33, 25, .36) 55%, rgba(15, 29, 24, .08) 82%), linear-gradient(0deg, rgba(10, 23, 17, .5), transparent 50%); }
  .hero-content { min-height: 315px; padding: 38px 30px 80px; grid-template-columns: minmax(0, 1fr) auto; gap: 34px; }
  .hero-title { font-size: clamp(46px, 5vw, 66px); }
  .hero-eyebrow { margin-bottom: 11px; }
  .hero-note { margin-top: 11px; }
  .hero-note-context { display: inline; }
  .countdown { min-width: 172px; padding: 16px 18px; display: block; text-align: right; }
  .countdown strong { font-size: 38px; }
  .hero-tools { right: 20px; bottom: 18px; left: 20px; }
  .scene-strip { max-width: none; }
  .action-label { display: inline; }
  .mode-panel { padding: 25px 24px; }
  .mode-options { grid-template-columns: repeat(3, 1fr); }
  .mode-options { display: grid; overflow: visible; padding-bottom: 0; }
  .mode-card { min-width: 0; }
  .mode-card.is-active { order: initial; }
  .mode-heading h2 { display: block; font-size: 28px; }
  .mode-card { min-height: 78px; padding: 15px 16px; }
  .mode-card > span:first-child { display: block; }
  .mode-card strong { display: block; font-size: 17px; }
  .content-grid { margin-top: 16px; }
  .panel { padding: 19px 17px; }
  .content-grid.today > .panel { padding-top: 19px; }
  .panel-header { margin-bottom: 14px; }
  .panel-title { margin-top: 3px; font-size: 25px; }
  .task-card { padding: 15px; grid-template-columns: 44px minmax(0, 1fr) auto; }
  .task-actions { grid-column: 3; align-self: center; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .goal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-layout { grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); }
  .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-toolbar { grid-template-columns: minmax(220px, 1fr) auto; align-items: start; }
  .rate-grid { grid-template-columns: repeat(3, 1fr); }
  .backup-reminder { flex-direction: row; align-items: center; }
  .toast-region { bottom: 18px; }
}

@media (max-width: 390px) {
  .topbar-inner { gap: 6px; }
  .brand { gap: 6px; font-size: 13px; }
  .brand-mark { flex: 0 0 34px; width: 34px; height: 34px; }
  .cloud-status { padding-inline: 8px; }
}

@media (min-width: 901px) {
  .hero-content { padding-right: 42px; padding-left: 42px; }
  .mode-panel { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(520px, 2.6fr); gap: 20px; align-items: center; }
  .mode-options { margin-top: 0; }
  .content-grid.today { grid-template-columns: minmax(0, 1.55fr) minmax(280px, .55fr); align-items: start; }
  .today-sidebar { display: grid; gap: 16px; }
  .today-sidebar .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .goal-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .detail-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scene-label { display: inline; }
}

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

/* New study tools use the existing warm-paper palette and component shapes. */
.timer-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; width: 100%; }
.task-actions > .timer-controls { width: auto; }
.task-more summary { cursor: pointer; min-height: 38px; padding: 7px 10px; font-size: 14px; border-radius: 999px; border: 1px solid var(--line); }
.task-more[open] { width: 100%; }
.task-more > div { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
.content-grid.today > .panel > .panel-header { position: relative; padding-top: 0; }
.content-grid.today > .panel > .panel-header > .inline-actions { position: absolute; right: 0; top: -6px; }
.content-grid.today > .panel > .panel-header .panel-title { margin-top: 10px; }
.timer-digits { font-variant-numeric: tabular-nums; color: var(--green); font-weight: 700; font-size: 15px; }
.task-actions { min-width: 0; }
.task-name, .week-task-row strong { overflow-wrap: anywhere; }
.task-meta { font-variant-numeric: tabular-nums; }
.focus-strip { margin: 0 0 4px; display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--ink-soft); font-size: 13px; }
.content-grid.today > .panel > .panel-header { margin-bottom: 4px; }
.mode-options { margin-top: 5px; }
.focus-strip > span:last-child { display: none; }
.focus-strip > div { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--green-soft); }
.focus-strip .timer-controls { margin: 6px 0; }
.focus-strip small { display: block; }
.day-load { margin: 0 0 10px; }
.load-badge { display: inline-block; border-radius: 8px; padding: 3px 7px; background: var(--green-soft); color: var(--ink); font-size: 13px; }
.load-badge.yellow { background: var(--yellow-soft); }
.load-badge.red, .load-badge.blocked { background: var(--danger-soft); color: var(--danger); }
.form-error { color: var(--danger); }
.week-loads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.week-loads > div { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.week-loads strong { display: block; margin-bottom: 4px; }
.week-task-row { flex-wrap: wrap; }
.week-task-row > div { min-width: 0; }
.row-actions { flex-wrap: wrap; }
.view-header .inline-actions { margin-top: 12px; }
.panel-header { flex-wrap: wrap; }
.field label { display: grid; gap: 5px; }
.field input, .field select, .field textarea { max-width: 100%; min-width: 0; }
.check-label { display: flex; gap: 9px; align-items: center; margin: 12px 0; }
.check-label input { width: 22px; height: 22px; }
.allocation-days { display: grid; gap: 8px; }
.allocation-day { display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.allocation-day span { overflow-wrap: anywhere; }
.time-statistics { margin-bottom: 16px; }
.time-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.time-totals > div { padding: 12px 8px; border-radius: 12px; background: var(--paper-soft); font-size: 14px; }
.time-totals strong { display: block; font-size: 17px; color: var(--green); }
.chart-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 20px 0 10px; }
.chart-heading select { max-width: 100%; background: var(--paper); color: var(--ink); padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.chart-heading > span { font-size: 13px; color: var(--muted); }
.time-chart { display: flex; width: 100%; max-width: 100%; overflow-x: auto; gap: 5px; padding: 5px 2px 12px; }
.chart-day { flex: 1 0 38px; min-width: 38px; padding: 0; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 12px; }
.bar-track { height: 100px; display: flex; align-items: flex-end; justify-content: center; margin: 4px 0; border-bottom: 1px solid var(--line); }
.bar-fill { width: 70%; max-width: 40px; background: var(--green-2); border-radius: 5px 5px 0 0; }
.chart-value { font-variant-numeric: tabular-nums; }
.time-shares { display: grid; gap: 10px; }
.time-shares > div { display: grid; grid-template-columns: 1fr auto; gap: 5px; font-size: 14px; }
.time-shares .progress-track { grid-column: 1 / -1; }
.actual-task { border: 1px solid var(--line); border-radius: 12px; padding: 12px; overflow-wrap: anywhere; }
.actual-task p { margin: 4px 0; }
.actual-task small { color: var(--muted); }
.deferred-tasks { margin-top: 14px; }
.deferred-tasks summary { cursor: pointer; padding: 10px 0; }
.study-suggestions { margin-top: 0; margin-bottom: 16px; }
.study-suggestions p { margin-top: 8px; }
.hero-photo-outgoing { z-index: -2; transition: opacity 900ms ease; }
.hero::before { z-index: -1; }
.hero-photo-outgoing.fade-away { opacity: 0; }
@media (min-width: 641px) {
  .week-loads { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .content-grid.today > .panel > .panel-header { margin-bottom: 14px; }
  .mode-options { margin-top: 14px; }
  .time-shares { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
  .task-actions { max-width: 215px; }
  .row-actions { max-width: 350px; }
  .allocation-days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 901px) {
  .week-loads { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .mode-options { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-photo-outgoing { transition: none; }
}
