:root {
  color-scheme: light;
  --bg: #ecebe6;
  --surface: #ffffff;
  --surface-strong: #f7f3ea;
  --ink: #111111;
  --muted: #797973;
  --line: #111111;
  --hairline: #e8e5dd;
  --primary: #111111;
  --primary-dark: #111111;
  --primary-soft: #f1eee6;
  --accent: #f2b84b;
  --accent-soft: #fff3cd;
  --danger: #b94343;
  --danger-soft: #ffe1df;
  --yellow: #f2c94c;
  --red: #ec6a5e;
  --mint: #bfe6d4;
  --blue: #c7daf7;
  --lavender: #ded6fb;
  --shadow: 0 24px 70px rgba(15, 15, 15, 0.16);
  --radius: 22px;
  --tap: 48px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
  line-height: 1.6;
}

button:focus-visible,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(30, 127, 114, 0.24);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 44px;
  line-height: 0.96;
  font-weight: 950;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 30px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 18px calc(98px + env(safe-area-inset-bottom));
  background: #fffdf8;
  box-shadow: var(--shadow);
  position: relative;
}

.app-header {
  display: grid;
  gap: 14px;
  padding: 10px 0 8px;
}

.ios-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
  padding: 0 4px;
}

.ios-status-bar span {
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0;
}

.top-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-pill {
  min-height: 44px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 950;
}

.toolbar-pill.single {
  width: 44px;
  padding: 0;
  justify-content: center;
}

.title-block {
  display: grid;
  gap: 4px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.day-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  padding: 4px 0 2px;
}

.day-strip button {
  min-height: 58px;
  border-radius: 999px;
  background: #f2f0ea;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 7px 0;
}

.day-strip span {
  font-size: 11px;
  font-weight: 850;
}

.day-strip strong {
  font-size: 16px;
  line-height: 1;
}

.day-strip button.is-today {
  background: var(--ink);
  color: #fff;
}

.page {
  display: none;
  animation: pageIn 180ms ease-out;
}

.page.is-active {
  display: block;
}

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

.section-heading {
  margin: 18px 0 16px;
}

.section-heading p,
.muted,
.analysis-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.daily-summary {
  display: grid;
  gap: 12px;
}

.summary-hero {
  border: 2px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  background: var(--accent-soft);
}

.summary-hero.good {
  background: var(--mint);
}

.summary-hero.warn {
  background: var(--accent-soft);
}

.summary-hero.risk {
  background: var(--danger-soft);
}

.summary-hero span,
.summary-dimension span,
.summary-disclaimer {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 750;
}

.summary-hero strong {
  display: block;
  margin: 4px 0;
  font-size: 40px;
  line-height: 1;
  font-weight: 950;
}

.summary-hero p,
.summary-dimension p,
.summary-section p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.summary-grid {
  display: grid;
  gap: 10px;
}

.summary-dimension {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px 10px;
  align-items: start;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: #fff;
}

.summary-dimension.good {
  background: #f0fbf5;
}

.summary-dimension.warn {
  background: #fff8df;
}

.summary-dimension.risk {
  background: #fff0ef;
}

.summary-dimension strong {
  display: block;
  margin-bottom: 2px;
  font-size: 15px;
}

.summary-dimension b {
  width: 44px;
  min-height: 36px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.summary-dimension p {
  grid-column: 1 / -1;
  color: var(--muted);
}

.summary-section {
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: var(--primary-soft);
}

.summary-section.tcm {
  background: #f2f7e8;
}

.summary-section.action {
  background: #edf6ff;
}

.summary-section h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.summary-disclaimer {
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stats-grid.four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card,
.panel {
  border: 2px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: none;
}

.metric-card {
  min-height: 116px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-card:nth-child(1) {
  background: var(--accent-soft);
}

.metric-card:nth-child(2) {
  background: var(--mint);
}

.metric-card:nth-child(3) {
  background: var(--blue);
}

.metric-card:nth-child(4) {
  background: var(--lavender);
}

.tip-panel {
  background: #edf6ff;
}

.tip-panel h3::before {
  content: "✦";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  vertical-align: middle;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 800;
}

.metric-card strong {
  font-size: 34px;
  line-height: 1.1;
  font-weight: 950;
  letter-spacing: 0;
}

.panel {
  padding: 18px;
  margin: 14px 0;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-title-row h3 {
  margin: 0;
}

.soft-pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.soft-pill {
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.status-chip {
  min-width: 56px;
  background: #f2f0ea;
  color: var(--muted);
}

.status-chip.is-done {
  background: var(--mint);
  color: var(--ink);
}

.status-chip.is-now {
  background: var(--accent-soft);
  color: var(--ink);
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 16px 0;
}

.urge-hero-button,
.focus-hero-button {
  min-height: 92px;
  border: 2px solid var(--line);
  border-radius: 26px;
  color: var(--ink);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
}

.urge-hero-button {
  background: var(--accent-soft);
}

.focus-hero-button {
  background: var(--blue);
}

.urge-hero-button span,
.focus-hero-button span {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.urge-hero-button small,
.focus-hero-button small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 386px);
  padding: 8px;
  background: #111;
  border: 2px solid #111;
  border-radius: 999px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.bottom-nav button {
  min-height: 50px;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.bottom-nav span {
  font-size: 18px;
  line-height: 1;
}

.bottom-nav small {
  font-size: 10px;
}

.bottom-nav button.is-active {
  background: #fff;
  color: #111;
  font-weight: 900;
}

.primary-action,
.secondary-action,
.ghost-action,
.danger-action,
.text-button,
.file-restore span,
.icon-button {
  min-height: var(--tap);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  padding: 0 16px;
}

.primary-action {
  width: 100%;
  background: var(--ink);
  color: #fff;
}

.secondary-action,
.file-restore span {
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-action {
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-action {
  background: var(--danger-soft);
  color: var(--danger);
}

.text-button {
  min-height: 36px;
  padding: 0 10px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.icon-button {
  width: var(--tap);
  padding: 0;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 24px;
}

.full-width {
  width: 100%;
}

.split-actions,
.timer-actions,
.data-actions {
  display: grid;
  gap: 8px;
}

.split-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.timer-actions {
  grid-template-columns: 1.2fr 1fr 1fr;
}

.data-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented-control,
.tabs {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.segmented-control.wide {
  width: 100%;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 12px;
}

.segmented-control.wide.three {
  grid-template-columns: repeat(3, 1fr);
}

.segmented-control button,
.tabs button {
  min-height: 36px;
  border-radius: 999px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.segmented-control button.is-active,
.tabs button.is-active {
  background: var(--ink);
  color: #fff;
  box-shadow: none;
}

.template-grid,
.dimension-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.template-card,
.dimension-card,
.light-card,
.task-card {
  border: 2px solid var(--line);
  border-radius: 24px;
  background: #fff;
}

.template-card {
  min-height: 148px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-card.is-active {
  background: var(--accent-soft);
}

.template-card strong {
  line-height: 1.35;
}

.template-card span,
.template-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-card {
  padding: 12px;
  display: grid;
  gap: 12px;
}

.task-card-main {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.task-card-main::before {
  content: "✓";
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 950;
}

.task-card.core {
  background: #fdfaf1;
}

.task-card.flex {
  background: #f8fbf7;
}

.task-card-main strong {
  display: block;
  line-height: 1.35;
}

.task-card-main span,
.task-card-main p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.task-card-main p {
  margin: 6px 0 0;
}

.score-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.score-buttons button {
  min-height: 40px;
  border-radius: 999px;
  background: #f2f0ea;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.score-buttons button.is-selected {
  background: var(--ink);
  color: #fff;
}

.task-mini-list,
.reminder-list,
.log-list,
.editable-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-mini-list li,
.reminder-list li,
.log-list li,
.editable-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.task-mini-list li:first-child,
.reminder-list li:first-child,
.log-list li:first-child,
.editable-list li:first-child {
  border-top: 0;
}

.item-main {
  min-width: 0;
}

.item-main strong {
  display: block;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.item-main span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.light-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.light-card {
  min-height: 116px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.light-card strong,
.dimension-card span {
  display: block;
}

.light-card span,
.dimension-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.stepper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.stepper button {
  min-height: 40px;
  border-radius: 999px;
  background: #f2f0ea;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #f2f0ea;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
}

.backfill-grid,
.task-form,
.reminder-form,
.inline-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.backfill-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.task-form {
  grid-template-columns: minmax(0, 1fr) 92px 80px auto;
}

.reminder-form {
  grid-template-columns: 120px minmax(0, 1fr);
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.reminder-form button {
  grid-column: 1 / -1;
}

.task-form button,
.reminder-form button,
.inline-form button {
  min-height: var(--tap);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  padding: 0 14px;
  white-space: nowrap;
}

.backfill-grid label,
.reminder-form label,
.time-pair label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.setting-row,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
}

.setting-row span,
.toggle-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.number-field {
  flex: 0 0 128px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.number-field.full-field,
.text-field.full-field {
  width: 100%;
  margin: 12px 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.text-field.full-field {
  grid-template-columns: 1fr;
  gap: 6px;
}

.number-field input {
  text-align: center;
}

.number-field span,
.text-field span,
.textarea-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.textarea-field {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.time-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.timer-display {
  margin: 12px 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 54px;
  font-weight: 900;
  letter-spacing: 0;
  color: var(--ink);
}

.timer-display.compact {
  font-size: 44px;
}

.strength-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.strength-button {
  aspect-ratio: 1;
  min-height: var(--tap);
  border-radius: 999px;
  background: #f2f0ea;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.strength-button.is-active,
.strength-button.is-selected {
  background: var(--ink);
  color: #fff;
}

.chart-panel {
  overflow: hidden;
}

.chart-panel canvas {
  width: 100% !important;
  max-height: 260px;
}

.week-grid {
  display: grid;
  grid-template-columns: 54px repeat(4, 1fr);
  gap: 6px;
  align-items: center;
}

.week-grid strong {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.heat {
  width: 100%;
  aspect-ratio: 1;
  min-height: 34px;
  border-radius: 10px;
  background: #f2f0ea;
}

.month-heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.heat-cell {
  aspect-ratio: 1;
  min-height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: rgba(25, 33, 31, 0.74);
}

.heat.good,
.heat-cell.good {
  background: var(--mint);
  color: var(--ink);
}

.heat.warn,
.heat-cell.warn {
  background: var(--yellow);
  color: #33260c;
}

.heat.bad,
.heat-cell.bad {
  background: var(--red);
  color: #fff;
}

.heat.empty,
.heat-cell.empty {
  background: #edf1ee;
  color: var(--muted);
}

.dimension-card {
  min-height: 112px;
  padding: 12px;
}

.dimension-card strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.focus-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.focus-analysis-card {
  min-height: 104px;
  border: 2px solid var(--line);
  border-radius: 20px;
  padding: 12px;
  background: var(--blue);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.focus-analysis-card:nth-child(2) {
  background: var(--mint);
}

.focus-analysis-card:nth-child(3) {
  background: var(--lavender);
}

.focus-analysis-card:nth-child(4) {
  background: var(--accent-soft);
}

.focus-analysis-card span,
.focus-analysis-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 800;
}

.focus-analysis-card strong {
  font-size: 27px;
  line-height: 1.05;
  font-weight: 950;
}

.journal-editor {
  background: #f8fbf7;
}

.journal-preview-panel {
  background: #fffaf0;
}

.journal-paper {
  min-height: 360px;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 22px 18px 24px;
  background:
    linear-gradient(90deg, rgba(236, 106, 94, 0.24) 0 2px, transparent 2px 100%) 28px 0 / 100% 100% no-repeat,
    repeating-linear-gradient(#fffdf7 0 31px, #d9e5ef 32px 33px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.paper-meta {
  margin: 0 0 10px 24px;
  color: #8d7e62;
  font-size: 13px;
  font-weight: 800;
}

.journal-paper h3,
.journal-paper p {
  margin-left: 24px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "FangSong", "Comic Sans MS", cursive;
  letter-spacing: 0;
}

.journal-paper h3 {
  margin-bottom: 14px;
  font-size: 25px;
  line-height: 1.35;
  transform: rotate(-0.2deg);
}

.journal-paper p {
  white-space: pre-wrap;
  color: #27353a;
  font-size: 21px;
  line-height: 33px;
  transform: rotate(0.15deg);
}

.toggle-row {
  border-top: 1px solid var(--hairline);
}

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

.toggle-row input {
  width: 54px;
  height: 32px;
  min-height: 32px;
  appearance: none;
  padding: 0;
  border-radius: 999px;
  background: #d7ded9;
  border: 0;
  position: relative;
  flex: 0 0 auto;
}

.toggle-row input::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease;
}

.toggle-row input:checked {
  background: var(--ink);
}

.toggle-row input:checked::after {
  transform: translateX(22px);
}

.install-guide {
  margin-top: 12px;
  border-radius: 18px;
  background: var(--surface-strong);
  padding: 12px;
}

.install-guide p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.file-restore {
  display: block;
}

.file-restore input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-restore span {
  width: 100%;
}

.editable-list .row-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.mini-button {
  min-height: 36px;
  border-radius: 999px;
  padding: 0 10px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.mini-button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 18, 16, 0.68);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.modal-backdrop[hidden],
[hidden] {
  display: none !important;
}

.modal-card {
  width: min(100%, 560px);
  align-self: center;
  border: 2px solid var(--line);
  border-radius: 28px;
  background: #fff;
  padding: 22px;
  box-shadow: var(--shadow);
}

.full-modal {
  min-height: min(540px, 88vh);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.modal-kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.modal-card h2 {
  margin-top: 8px;
  font-size: 32px;
}

.modal-card p {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.55;
  font-weight: 900;
}

.modal-card .calm-copy {
  margin: 12px 0 0;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--accent-soft);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 850;
}

.modal-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  width: min(calc(100% - 28px), 520px);
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 22px;
  background: rgba(25, 33, 31, 0.94);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 60;
  line-height: 1.45;
}

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

.empty-state {
  padding: 18px 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
}

.encouragement {
  margin: 18px 4px 0;
  color: var(--primary-dark);
  font-weight: 800;
  line-height: 1.55;
}

@media (min-width: 760px) {
  body {
    display: grid;
    place-items: start center;
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100vh - 48px);
    border-radius: 42px;
    overflow: hidden;
  }

  .page.is-active {
    display: block;
  }

  .section-heading,
  .stats-grid,
  .quick-actions,
  .segmented-control.wide,
  .full-width,
  .encouragement {
    grid-column: 1 / -1;
  }

  .panel {
    margin: 14px 0;
  }

  .bottom-nav {
    width: 386px;
  }
}

@media (max-width: 700px) {
  .stats-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .template-grid,
  .dimension-grid {
    grid-template-columns: 1fr;
  }

  .task-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .quick-actions {
    grid-template-columns: 1fr;
  }

  .backfill-grid {
    grid-template-columns: 1fr;
  }
}

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

  .metric-card {
    min-height: 96px;
    padding: 10px 8px;
  }

  .metric-card strong {
    font-size: 23px;
  }

  .light-grid,
  .data-actions,
  .timer-actions,
  .split-actions,
  .focus-analysis-grid {
    grid-template-columns: 1fr;
  }

  .reminder-form {
    grid-template-columns: 1fr;
  }

  .timer-display {
    font-size: 44px;
  }

  .bottom-nav {
    width: min(calc(100% - 16px), 386px);
    padding: 6px;
    gap: 2px;
  }

  .bottom-nav button {
    min-height: 48px;
  }

  .bottom-nav span {
    font-size: 16px;
  }

  .bottom-nav small {
    font-size: 9px;
  }

  .journal-paper {
    padding-left: 12px;
    padding-right: 12px;
  }

  .journal-paper p {
    font-size: 19px;
  }
}
