/* =============================================================================
   Streaks — lavender consistency tracker
   Tokens and visual language carried over from the Claude Design canvas.
   ========================================================================== */

:root {
  --bg: #efeaf9;
  --surface: #ffffff;
  --surface-2: #f7f3ff;
  --text: #2c2547;
  --text-2: #6b6289;
  --text-3: #a099bf;
  --line: #ebe4f6;
  --lav-50: #f7f3ff;
  --lav-100: #efe7fd;
  --lav-200: #ded0fa;
  --lav-300: #c3adf3;
  --lav-400: #a68ae8;
  --lav-500: #8b6fd6;
  --lav-600: #6f57b8;
  --lav-700: #524193;
  --peach: #ffcfb8;
  --peach-ink: #7a4a2a;
  --sage: #b8dcc0;
  --sage-ink: #2d6b3a;
  --sun: #ffe08a;
  --rose: #ffb6c8;
  --miss: #e6dff2;
  --danger: #d97a8a;
  --shadow-card: 0 4px 14px rgba(90, 70, 150, .08);
  --shadow-lift: 0 12px 28px rgba(120, 90, 200, .22);
  --shadow-btn: 0 8px 20px rgba(120, 90, 200, .28);
}

[data-theme="dark"] {
  --bg: #1b1530;
  --surface: #2a2245;
  --surface-2: #221a3a;
  --text: #f0ebff;
  --text-2: #b7add6;
  --text-3: #7a719e;
  --line: #3a2f5c;
  --lav-50: #2a2245;
  --lav-100: #322758;
  --lav-200: #3f3170;
  --lav-300: #6a55a8;
  --lav-400: #9781dd;
  --lav-500: #b39aec;
  --lav-600: #c9b6f5;
  --lav-700: #e0d3ff;
  /* peach and sage stay light in dark mode — they are the two "good news"
     accents and the canvas keeps them bright against the twilight ground */
  --peach: #ffcfb8;
  --peach-ink: #7a4a2a;
  --sage: #b8dcc0;
  --sage-ink: #2d6b3a;
  --miss: #392f56;
  --shadow-card: 0 4px 14px rgba(0, 0, 0, .28);
  --shadow-lift: 0 12px 28px rgba(0, 0, 0, .38);
  --shadow-btn: 0 8px 20px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.serif {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  letter-spacing: -.01em;
}

button, input, textarea, select { font-family: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

/* ----------------------------------------------------------------- shell */

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

/* ambient lavender + peach glow, same as the canvas */
#app::before, #app::after {
  content: '';
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  z-index: 0;
}
#app::before {
  top: -80px; right: -60px; width: 240px; height: 240px;
  background: radial-gradient(circle, var(--lav-200), transparent 70%);
  opacity: .7;
}
#app::after {
  bottom: 120px; left: -80px; width: 210px; height: 210px;
  background: radial-gradient(circle, var(--peach), transparent 70%);
  opacity: .35;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 14px) 22px 8px;
}
.kicker {
  font-size: 11px;
  letter-spacing: .18em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-3);
}
.title { font-size: 28px; line-height: 1.1; margin-top: 2px; }

.moon-btn {
  all: unset;
  cursor: pointer;
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 200ms;
}
.moon-btn:active { transform: scale(.92) rotate(-18deg); }
.moon-btn .ico { width: 20px; height: 20px; stroke: var(--lav-500); }

.ico {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 22px 28px;
  outline: none;
  scrollbar-width: none;
}
.view::-webkit-scrollbar { display: none; }

.tabbar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 10px 14px calc(env(safe-area-inset-bottom) + 12px);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tab {
  all: unset;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border-radius: 14px;
  color: var(--text-3);
  transition: background 160ms, color 160ms;
}
.tab span { font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.tab.on { background: var(--lav-100); color: var(--lav-600); }

/* ------------------------------------------------------------- primitives */

.panel {
  background: var(--surface);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow-card);
}
.panel + .panel { margin-top: 16px; }
.panel-title { font-size: 18px; margin-bottom: 14px; }

.bar {
  height: 8px;
  background: var(--lav-100);
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--lav-400), var(--lav-500));
  transition: width 320ms cubic-bezier(.34, 1.2, .64, 1);
}

.pill-btn {
  all: unset;
  cursor: pointer;
  background: var(--lav-500);
  color: #fff;
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
}
.pill-btn.ghost { background: var(--lav-200); color: var(--lav-700); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head .label { font-weight: 800; font-size: 14px; color: var(--text-2); }

.notice {
  padding: 12px 14px;
  background: var(--peach);
  color: var(--peach-ink);
  border-radius: 16px;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--text-2); font-size: 12px; font-weight: 600; }

/* ------------------------------------------------------------------ today */

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--lav-300), var(--lav-500));
  border-radius: 28px;
  padding: 20px 22px;
  color: #fff;
  margin-bottom: 22px;
  box-shadow: var(--shadow-lift);
}
.hero::before, .hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
}
.hero::before { top: -30px; right: -30px; width: 140px; height: 140px; }
.hero::after { bottom: -40px; right: 40px; width: 80px; height: 80px; }
.hero-date { position: relative; font-size: 12px; opacity: .88; font-weight: 700; letter-spacing: .06em; }
.hero-msg { position: relative; font-size: 30px; line-height: 1.15; margin-top: 8px; }
.hero-progress {
  position: relative;
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.hero-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, .25);
  border-radius: 99px;
  overflow: hidden;
}
.hero-fill { height: 100%; background: #fff; border-radius: 99px; transition: width 320ms; }
.hero-count { font-weight: 800; font-size: 14px; }

.row-card {
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 22px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-card);
  transition: background 200ms, border-color 200ms;
}
.row-card.is-done {
  background: linear-gradient(135deg, var(--lav-100), var(--lav-50));
  border-color: var(--lav-300);
}

.check-btn {
  all: unset;
  cursor: pointer;
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--lav-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--lav-500);
  transition: background 160ms, transform 160ms;
}
.check-btn:active { transform: scale(.88); }
.check-btn.on { background: var(--lav-500); color: #fff; }
.check-btn .ico { width: 18px; height: 18px; stroke: #fff; stroke-width: 3.5; }

.row-main {
  all: unset;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.row-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-meta { font-size: 12px; color: var(--text-2); font-weight: 600; }
.row-streak {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 4px;
  min-width: 30px;
}
.streak-emoji { font-size: 18px; line-height: 1; }
.streak-num { font-size: 20px; line-height: 1.2; color: var(--lav-600); }

.rescue {
  all: unset;
  cursor: pointer;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px dashed var(--lav-300);
  font-size: 11px;
  font-weight: 700;
  color: var(--lav-600);
}

.add-dash {
  all: unset;
  cursor: pointer;
  display: block;
  margin-top: 14px;
  width: 100%;
  padding: 14px;
  border-radius: 20px;
  border: 2px dashed var(--lav-300);
  text-align: center;
  font-weight: 800;
  color: var(--lav-600);
  font-size: 14px;
}

.empty {
  background: var(--surface);
  border-radius: 24px;
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.empty-emoji { font-size: 48px; margin-bottom: 8px; }
.empty-title { font-size: 22px; margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }

.big-pill {
  all: unset;
  cursor: pointer;
  display: inline-block;
  background: var(--lav-500);
  color: #fff;
  padding: 12px 22px;
  border-radius: 99px;
  font-weight: 800;
  box-shadow: var(--shadow-btn);
}

/* ------------------------------------------------------------- challenges */

.ch-card {
  all: unset;
  cursor: pointer;
  background: var(--surface);
  border-radius: 22px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
}
.ch-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ch-name {
  font-size: 19px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch-day { font-size: 11px; color: var(--text-3); font-weight: 800; white-space: nowrap; }
.ch-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
}
.ch-meta .pct { color: var(--lav-600); }
.ch-card.paused { opacity: .72; }

.sub-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 28px 0 12px;
}
.sub-head .emoji { font-size: 20px; }
.sub-head .label { font-weight: 800; font-size: 14px; color: var(--text-2); }

.park-row {
  background: var(--surface-2);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.park-row .grow { flex: 1; min-width: 0; }
.park-row .name {
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.park-row .sub { font-size: 11px; color: var(--text-3); font-weight: 600; }

.icon-ghost {
  all: unset;
  cursor: pointer;
  padding: 6px;
  color: var(--text-3);
  display: flex;
  align-items: center;
}
.icon-ghost .ico { width: 16px; height: 16px; }

.archive-row {
  background: var(--surface-2);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.badge {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  background: var(--lav-100);
  color: var(--text-2);
}
.badge.done { background: var(--sage); color: var(--sage-ink); }

/* ------------------------------------------------------------------ stats */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.stat.accent {
  background: linear-gradient(135deg, var(--lav-400), var(--lav-600));
  color: #fff;
}
.stat.peach { background: var(--peach); color: var(--peach-ink); }
.stat-label { font-size: 11px; font-weight: 800; letter-spacing: .05em; opacity: .85; }
.stat .stat-label { color: var(--text-3); }
.stat.accent .stat-label, .stat.peach .stat-label { color: inherit; }
.stat-num { font-size: 36px; line-height: 1; margin-top: 6px; }

.heat {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}
.heat-col { display: flex; flex-direction: column; gap: 4px; }
.heat-cell { height: 16px; border-radius: 5px; background: var(--lav-100); }
.heat-cell.l1 { background: var(--lav-300); }
.heat-cell.l2 { background: var(--lav-400); }
.heat-cell.l3 { background: var(--lav-500); }
.heat-cell.future { background: transparent; border: 1px dashed var(--lav-200); }
.heat-foot {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-3);
  font-weight: 700;
}

.bar-row + .bar-row { margin-top: 14px; }
.bar-row .head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  gap: 8px;
}
.bar-row .head .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .head .pct { color: var(--lav-600); }
.bar-row .bar { height: 6px; }

/* --------------------------------------------------------------- settings */

.set-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 2px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
}
.set-row:last-child { border-bottom: none; }
button.set-row { all: unset; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); width: 100%; }
button.set-row:last-child { border-bottom: none; }
.set-label { font-weight: 700; font-size: 15px; }
.set-label.danger { color: var(--danger); }
.set-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.set-row .ico { color: var(--text-3); flex-shrink: 0; }
.set-row .ico.danger { color: var(--danger); }

.switch {
  position: relative;
  display: inline-block;
  width: 48px; height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--lav-200);
  border-radius: 99px;
  transition: background 160ms;
}
.switch .thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  transition: left 160ms;
  pointer-events: none;
}
.switch input:checked ~ .track { background: var(--lav-500); }
.switch input:checked ~ .thumb { left: 23px; }

.time-input {
  border: none;
  background: var(--lav-100);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
}

.foot {
  text-align: center;
  padding: 14px 0 4px;
  font-size: 12px;
  color: var(--text-3);
}
.foot .moon { font-size: 22px; margin-bottom: 4px; }

/* -------------------------------------------------------------- overlays */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(30, 20, 60, .5);
  display: flex;
  align-items: flex-end;
  animation: fade 200ms ease;
}
.sheet {
  width: 100%;
  max-height: 88%;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  padding: 22px 22px calc(env(safe-area-inset-bottom) + 30px);
  animation: rise 280ms cubic-bezier(.22, 1, .36, 1);
  scrollbar-width: none;
}
.sheet::-webkit-scrollbar { display: none; }
.grab {
  width: 44px; height: 5px;
  background: var(--lav-200);
  border-radius: 99px;
  margin: 0 auto 16px;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.sheet-title { font-size: 26px; }
.close-btn {
  all: unset;
  cursor: pointer;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-2);
}
.close-btn .ico { width: 18px; height: 18px; stroke-width: 2.5; }

.field { margin-bottom: 16px; }
.field > label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-2);
  margin-bottom: 8px;
  letter-spacing: .03em;
}
.input {
  width: 100%;
  background: var(--surface);
  border: 2px solid transparent;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}
.input:focus { outline: none; border-color: var(--lav-300); }
.input::placeholder { color: var(--text-3); font-weight: 500; }
textarea.input { min-height: 72px; resize: vertical; font-weight: 500; font-size: 14px; }

.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.preset {
  all: unset;
  cursor: pointer;
  padding: 12px 6px;
  text-align: center;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  background: var(--surface);
  color: var(--text);
}
.preset.on { background: var(--lav-500); color: #fff; }
.custom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  background: var(--surface);
  padding: 12px 16px;
  border-radius: 16px;
}
.custom-row input {
  width: 84px;
  border: none;
  background: transparent;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}
.custom-row input:focus { outline: none; }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type {
  all: unset;
  cursor: pointer;
  padding: 14px 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 2px solid transparent;
}
.type.on { background: var(--lav-100); border-color: var(--lav-500); }
.type .icon { font-size: 22px; margin-bottom: 4px; }
.type .name { font-weight: 700; font-size: 13px; }
.type .hint { font-size: 11px; opacity: .7; margin-top: 2px; }

.check-line {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.check-line input { width: 18px; height: 18px; accent-color: var(--lav-500); flex-shrink: 0; }

.create-btn {
  all: unset;
  cursor: pointer;
  display: block;
  width: 100%;
  padding: 16px;
  text-align: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--lav-400), var(--lav-600));
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  box-shadow: var(--shadow-btn);
}
.create-btn[disabled] {
  cursor: not-allowed;
  background: var(--lav-200);
  box-shadow: none;
  opacity: .6;
}

/* ---------------------------------------------------------------- detail */

.detail {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  animation: slidein 240ms cubic-bezier(.22, 1, .36, 1);
}
.detail::before {
  content: '';
  position: absolute;
  top: -100px; right: -80px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--lav-200), transparent 70%);
  pointer-events: none;
  opacity: .8;
}
.detail-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 14px) 22px 8px;
}
.round-btn {
  all: unset;
  cursor: pointer;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text);
}
.round-btn .ico { stroke-width: 2.5; }
.detail-day {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-3);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.detail-body {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 8px 22px calc(env(safe-area-inset-bottom) + 40px);
  scrollbar-width: none;
}
.detail-body::-webkit-scrollbar { display: none; }
.detail-title { font-size: 32px; line-height: 1.1; margin-bottom: 6px; }
.detail-desc { font-size: 13px; color: var(--text-2); margin-bottom: 20px; }

.strip {
  background: linear-gradient(135deg, var(--lav-300), var(--lav-500));
  color: #fff;
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-around;
  box-shadow: var(--shadow-lift);
}
.strip .cell { text-align: center; }
.strip .num { font-size: 34px; line-height: 1; }
.strip .cap { font-size: 10px; font-weight: 800; opacity: .85; margin-top: 6px; letter-spacing: .06em; }
.strip .divider { width: 1px; background: rgba(255, 255, 255, .3); }

.big-btn {
  all: unset;
  cursor: pointer;
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  text-align: center;
  background: var(--lav-500);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  box-shadow: var(--shadow-btn);
}
.big-btn.done { background: var(--sage); color: var(--sage-ink); box-shadow: none; }

.counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.counter-btn {
  all: unset;
  cursor: pointer;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--lav-100);
  color: var(--lav-600);
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.counter-btn.plus { background: var(--lav-500); color: #fff; }
.counter-val { text-align: center; flex: 1; min-width: 0; }
.counter-val .num { font-size: 52px; line-height: 1; color: var(--lav-600); }
/* typable for big targets — nobody taps + five hundred times for a word count */
input.num {
  width: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 52px;
  line-height: 1;
  color: var(--lav-600);
  padding: 0;
  -moz-appearance: textfield;
}
input.num::-webkit-outer-spin-button,
input.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.num:focus { outline: none; }
.counter-val .cap { font-size: 11px; color: var(--text-2); font-weight: 700; margin-top: 4px; }

.mood-row { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 14px; }
.mood {
  all: unset;
  cursor: pointer;
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 26px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 2px solid transparent;
  transition: background 160ms, border-color 160ms;
}
.mood.on { background: var(--lav-200); border-color: var(--lav-500); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}
.cal-cell {
  all: unset;
  cursor: pointer;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  background: var(--lav-50);
  color: var(--text-3);
  border: 2px solid transparent;
}
.cal-cell.done { background: var(--lav-500); color: #fff; }
.cal-cell.missed { background: var(--miss); color: var(--text-3); }
.cal-cell.today { border-color: var(--lav-500); color: var(--lav-600); }
.cal-cell.today.done { color: #fff; }
.cal-cell.future { cursor: default; }
.cal-cell .dot {
  position: absolute;
  margin: 20px 0 0 18px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--text-2);
  font-weight: 700;
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i {
  width: 12px; height: 12px;
  border-radius: 4px;
  display: inline-block;
}
.legend i.done { background: var(--lav-500); }
.legend i.missed { background: var(--miss); }
.legend i.today { background: transparent; border: 2px solid var(--lav-500); }
.legend i.future { background: var(--lav-100); }

.menu {
  background: var(--surface);
  border-radius: 20px;
  padding: 4px 0;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(90, 70, 150, .18);
  overflow: hidden;
}
.menu button {
  all: unset;
  cursor: pointer;
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.menu button:last-child { border-bottom: none; }
.menu button.danger { color: var(--danger); }

.milestones { display: flex; flex-wrap: wrap; gap: 8px; }
.mile {
  padding: 8px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
  background: var(--lav-100);
  color: var(--text-3);
}
.mile.hit { background: var(--sun); color: #6b4c00; }

.journal-entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.journal-entry:last-child { border-bottom: none; }
.journal-entry .when { font-size: 11px; font-weight: 800; color: var(--text-3); letter-spacing: .04em; }
.journal-entry .what { font-size: 13px; color: var(--text-2); margin-top: 4px; white-space: pre-wrap; }

/* ------------------------------------------------------------------ toast */

#toast {
  position: fixed;
  left: 22px; right: 22px;
  bottom: calc(env(safe-area-inset-bottom) + 92px);
  z-index: 60;
  background: var(--text);
  color: var(--bg);
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 10px 24px rgba(40, 25, 80, .28);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 220ms, transform 220ms;
}
#toast.on { opacity: 1; transform: translateY(0); }

/* ------------------------------------------------------------- animations */

@keyframes bloom {
  0% { transform: scale(.6); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(28px); } to { transform: translateY(0); } }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.28) rotate(-6deg); }
  100% { transform: scale(1); }
}

.bloom { animation: bloom 380ms cubic-bezier(.34, 1.56, .64, 1); }
.float { animation: float 3.6s ease-in-out infinite; }
.pop { animation: pop 420ms cubic-bezier(.34, 1.56, .64, 1); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* wider screens: keep the phone-sized column the design was drawn for */
@media (min-width: 620px) {
  #app {
    max-width: 460px;
    margin: 0 auto;
    inset: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
  .sheet-backdrop { max-width: 460px; margin: 0 auto; }
  #toast { max-width: 416px; margin: 0 auto; }
}
