/* Looks: each theme sets the same colour channels ("r g b"), and everything else derives from them.
   --base: page background   --surface: cards   --fg: text   --a1 / --a2: accent pair (gradient)
   --a3: soft tint for the Today card   --tile0: empty calendar tile   --on-accent: text on the accent
   Mono (black, sharp, one lime accent) is the default; Sunrise (warm, rounded) is the alternative. */
:root,
:root[data-theme="mono"] {
  --base: 0 0 0;
  --surface: 20 20 20;
  --fg: 255 255 255;
  --a1: 212 255 64;
  --a2: 212 255 64;
  --a3: 34 34 34;
  --tile0: 30 30 30;
  --shade: 0 0 0;
  --on-accent: #000000;
  --radius: 8px;
  --serif: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

:root[data-theme="sunrise"] {
  --base: 255 243 234;
  --surface: 255 255 255;
  --fg: 64 36 52;
  --a1: 232 90 60;
  --a2: 246 168 40;
  --a3: 255 212 190;
  --tile0: 255 230 216;
  --shade: 190 90 50;
  --on-accent: #FFFFFF;
  --radius: 30px;
  --serif: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --sans: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  color-scheme: light;
}

:root {
  --ink: rgb(var(--base));
  --midnight: rgb(var(--surface));
  --teal: rgb(var(--a3));
  --sage: rgb(var(--a1));
  --lavender: rgb(var(--a2));
  --ivory: rgb(var(--fg));

  --accent: linear-gradient(135deg, var(--sage), var(--lavender));
  --muted: rgb(var(--fg) / .55);
  --faint: rgb(var(--fg) / .35);
  --line: rgb(var(--fg) / .08);
  --card: rgb(var(--surface) / .55);
  --field: rgb(var(--base) / .55);
}

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

html { background: var(--ink); }

html, body {
  margin: 0;
  min-height: 100%;
  /* body stays transparent so the fixed .bg glow shows through */
  color: var(--ivory);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 40% at 100% 0%, rgb(var(--a2) / .16), transparent 70%),
    radial-gradient(70% 50% at 0% 100%, rgb(var(--a3) / .45), transparent 70%),
    linear-gradient(180deg, var(--ink), var(--midnight));
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px calc(env(safe-area-inset-bottom) + 36px);
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 0 -16px 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: rgb(var(--base) / .6);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid transparent;
}
/* The home top bar scrolls away with the page, so the streak badge never floats over the cards. */
.topbar.home { position: relative; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.topbar h2 { margin: 0; font: 600 17px var(--sans); text-align: center; }
.topbar .right { justify-self: end; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgb(var(--fg) / .07);
  color: var(--sage);
  transition: transform .15s ease, background .2s ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 19px; height: 19px; }

.back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px 6px 2px;
  border: 0;
  background: none;
  color: var(--sage);
  font-size: 17px;
}
.back svg { width: 22px; height: 22px; }

/* ---------- Shared pieces ---------- */

.label {
  font: 700 11px/1 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--lavender);
}

.card {
  position: relative;
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius, 24px);
  background: var(--card);
  border: 1px solid rgb(var(--fg) / .08);
  box-shadow: inset 0 1px 0 rgb(var(--fg) / .07), 0 10px 30px rgb(var(--shade) / .25);
  animation: rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
.card > .label { display: block; margin-bottom: 14px; }

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

.ring { display: block; }
.ring .track { fill: none; stroke: rgb(var(--fg) / .08); }
.ring .bar {
  fill: none;
  stroke: url(#g-accent);
  stroke-linecap: round;
  transition: stroke-dashoffset .6s cubic-bezier(.2, .8, .2, 1), opacity .3s;
}
.ring.full .bar { filter: drop-shadow(0 0 6px rgb(var(--a2) / .55)); }
.ring text {
  fill: var(--ivory);
  font-family: var(--sans);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
  dominant-baseline: central;
}

.lt { font-family: var(--sans); font-size: .74em; font-weight: 600; }

/* ---------- Home ---------- */

.hero { padding-top: 2px; animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
.hero h1 {
  margin: 4px 0 0;
  font: 600 50px/1.05 var(--serif);
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgb(var(--a2) / .25));
}
.hero .subtitle { font: italic 400 20px var(--serif); color: rgb(var(--fg) / .7); }
.hero .subtitle .lt { font-style: normal; font-size: .8em; font-weight: 500; }

.challenge { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: calc(var(--radius, 24px) + 4px); }
.challenge .count { display: flex; align-items: baseline; gap: 6px; margin: 6px 0; }
.challenge .big { font: 600 56px/1 var(--serif); font-variant-numeric: tabular-nums; }
.challenge .of { font: 400 20px var(--serif); color: rgb(var(--fg) / .4); }
.challenge .togo { font-size: 15px; font-weight: 600; color: var(--sage); }
.challenge .left { flex: 1; min-width: 0; }

.dots { display: grid; grid-template-columns: repeat(var(--cols, 10), var(--dot, 8px)); gap: var(--gap, 4px); }
.dot { width: var(--dot, 8px); height: var(--dot, 8px); border-radius: 2.5px; background: rgb(var(--fg) / .07); }
/* Challenges longer than 400 days show a bar instead of dots. */
.long-bar { flex: 0 0 38%; height: 10px; border-radius: 999px; background: rgb(var(--fg) / .08); overflow: hidden; }
.long-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.dot.full { background: var(--accent); }
.dot.is-today { box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 2.7px var(--lavender); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { margin-top: 16px; padding: 14px 6px; text-align: center; border-radius: calc(var(--radius, 24px) - 4px); }
.stat svg { width: 15px; height: 15px; }
.stat .value { margin-top: 4px; font: 600 24px var(--serif); font-variant-numeric: tabular-nums; }
.stat .name { margin-top: 2px; font-size: 11px; font-weight: 500; color: rgb(var(--fg) / .5); }

.today {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius, 24px);
  background: linear-gradient(135deg, rgb(var(--a3) / .7), rgb(var(--surface) / .6));
  border: 1px solid rgb(var(--a1) / .25);
  box-shadow: 0 10px 30px rgb(var(--a3) / .35);
  transition: transform .15s ease;
  animation: rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
.today:active { transform: scale(.985); }
.today .text { flex: 1; min-width: 0; }
.today .title { font: 600 24px var(--serif); }
.today .sub { margin-top: 2px; font-size: 15px; color: rgb(var(--fg) / .65); }
.arrow {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}
.arrow svg { width: 18px; height: 18px; }

.month-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.month-head h3 { flex: 1; margin: 0; font: 600 20px var(--serif); }
.month-head .icon-btn { width: 32px; height: 32px; color: var(--ivory); }
.month-head .icon-btn svg { width: 15px; height: 15px; }
.month-head .icon-btn:disabled { opacity: .3; cursor: default; }

.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { padding-bottom: 2px; text-align: center; font-size: 11px; font-weight: 600; color: rgb(var(--fg) / .4); }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 46px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: rgb(var(--fg) / .04);
  color: rgb(var(--fg) / .9);
  transition: transform .15s ease;
}
.tile:active:not(:disabled) { transform: scale(.94); }
.tile .num { font: 500 15px var(--serif); }
.tile .pct { font-size: 9px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: .75; min-height: 11px; }
.tile.full { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 12px rgb(var(--a1) / .4); }
.tile.is-today { box-shadow: inset 0 0 0 1.5px var(--lavender); }
.tile.is-today .num { font-weight: 700; }
.tile.full.is-today { box-shadow: inset 0 0 0 1.5px var(--ink), 0 0 12px rgb(var(--a1) / .4); }
.tile:disabled { background: rgb(var(--fg) / .02); color: rgb(var(--fg) / .25); cursor: default; }

.legend { display: flex; justify-content: flex-end; align-items: center; gap: 5px; margin-top: 12px; font-size: 11px; color: rgb(var(--fg) / .4); }
.legend i { width: 12px; height: 12px; border-radius: 3px; }

/* ---------- Day ---------- */

.day-head { display: flex; align-items: center; gap: 18px; padding: 6px 0 0; animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
.day-head .date { margin-top: 6px; font: 600 21px/1.2 var(--serif); }
.day-head .sub { margin-top: 4px; font-size: 15px; color: rgb(var(--fg) / .65); }

.task + .task, .add { border-top: 1px solid rgb(var(--fg) / .06); margin-top: 12px; padding-top: 12px; }

.task-row { display: flex; align-items: flex-start; gap: 12px; }
.check {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: rgb(var(--fg) / .35);
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
}
.check svg { width: 26px; height: 26px; }
.check .on { display: none; }
.task.done .check { color: var(--sage); }
.task.done .check .on { display: block; }
.task.done .check .off { display: none; }
.check:active { transform: scale(.85); }

.task-text { flex: 1; min-width: 0; padding-top: 3px; cursor: pointer; }
.task-title { font-size: 17px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; transition: color .2s; }
.task.done .task-title { color: rgb(var(--fg) / .55); text-decoration: line-through; text-decoration-color: rgb(var(--fg) / .4); }
.oneoff { margin-top: 2px; font-size: 12px; color: rgb(var(--a2) / .85); }

.mini-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--faint);
}
.mini-btn:hover { background: rgb(var(--fg) / .06); color: var(--ivory); }
.mini-btn svg { width: 16px; height: 16px; }

textarea.note {
  display: block;
  width: calc(100% - 40px);
  margin: 10px 0 0 40px;
  min-height: 44px;
  padding: 10px 12px;
  resize: none;
  overflow: hidden;
  border: 1px solid rgb(var(--fg) / .06);
  border-radius: 14px;
  outline: none;
  background: var(--field);
  /* 16px stops iPhone Safari from zooming in when you tap the field */
  font-size: 16px;
  line-height: 1.4;
  transition: border-color .2s;
}
textarea.note.learn { width: 100%; margin: 0; min-height: 120px; }
textarea.note:focus { border-color: rgb(var(--a2) / .45); }
textarea::placeholder, input::placeholder { color: var(--faint); }

.add-line { display: flex; align-items: center; gap: 12px; }
.plus { flex: none; width: 28px; height: 28px; color: var(--sage); }
.add-input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 17px;
}
.text-btn { border: 0; background: none; color: var(--sage); font-weight: 600; font-size: 15px; padding: 6px 2px; }
.add .text-btn { visibility: hidden; }
.add.has-text .text-btn { visibility: visible; }

.seg {
  display: none;
  margin: 12px 0 0 40px;
  padding: 3px;
  border-radius: 10px;
  background: rgb(var(--fg) / .07);
}
.add:focus-within .seg, .add.has-text .seg { display: flex; }
.seg button {
  flex: 1;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: rgb(var(--fg) / .7);
  font-size: 13px;
  font-weight: 600;
  transition: background .2s, color .2s;
}
.seg button.on { background: rgb(var(--fg) / .14); color: var(--ivory); box-shadow: 0 1px 3px rgb(var(--shade) / .25); }

.hint { font-size: 15px; color: rgb(var(--fg) / .7); line-height: 1.4; }
.hint .text-btn { padding: 0; }

/* ---------- Daily tasks ---------- */

.section-label { margin: 22px 4px 8px; }
.footnote { margin: 8px 4px 0; font-size: 13px; line-height: 1.4; color: rgb(var(--fg) / .45); }
.list { margin-top: 0; padding: 4px 6px 4px 16px; }
.list-row { display: flex; align-items: center; gap: 4px; min-height: 48px; }
.list-row + .list-row { border-top: 1px solid rgb(var(--fg) / .06); }
.list-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 17px;
}
.list-row input[type="date"] { flex: none; text-align: right; color: var(--sage); }
.list-row .row-label { flex: 1; font-size: 17px; }
.mini-btn:disabled { opacity: .25; cursor: default; }
.mini-btn.danger:hover { color: var(--lavender); }
.empty { padding: 14px 0; font-size: 15px; color: var(--muted); }

.buttons { display: flex; gap: 10px; margin-top: 16px; }
.pill {
  flex: 1;
  padding: 12px;
  border: 1px solid rgb(var(--fg) / .1);
  border-radius: 14px;
  background: rgb(var(--surface) / .55);
  color: var(--sage);
  font-weight: 600;
  font-size: 15px;
}
.pill:active { transform: scale(.98); }

/* ---------- Streak badge (home top bar) ---------- */

.streak-chip {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px 7px 9px;
  border-radius: 999px;
  background: rgb(var(--a1) / .12);
  border: 1px solid rgb(var(--a1) / .28);
  font-size: 14px;
  color: rgb(var(--fg) / .85);
  white-space: nowrap;
  animation: rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
.streak-chip svg { width: 16px; height: 16px; }
.streak-chip b { font: 700 16px var(--sans); color: var(--ivory); font-variant-numeric: tabular-nums; }
.streak-chip.cold { background: rgb(var(--fg) / .05); border-color: rgb(var(--fg) / .1); color: var(--muted); }
.streak-chip.cold svg { opacity: .5; }

/* ---------- Day page: navigation, planning, edit mode ---------- */

.topbar .text-btn.right { justify-self: end; font-size: 17px; }
.day-info { flex: 1; min-width: 0; }
.day-nav { display: flex; flex-direction: column; gap: 8px; align-self: center; }
.day-nav .icon-btn { width: 34px; height: 34px; color: var(--ivory); }
.day-nav .icon-btn svg { width: 15px; height: 15px; }

.check:disabled { opacity: .35; cursor: default; }
.check:disabled:active { transform: none; }

.edit-note { margin: -4px 0 12px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.task.editing .task-row { align-items: center; }
.task.editing .oneoff { margin: 4px 0 0; color: var(--faint); }
input.day-rename {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid rgb(var(--a2) / .3);
  border-radius: 12px;
  outline: none;
  background: var(--field);
  font-size: 16px;
}
input.day-rename:focus { border-color: rgb(var(--a2) / .6); }

.tile.future { background: rgb(var(--fg) / .025); color: rgb(var(--fg) / .4); }
.tile.planned { color: rgb(var(--fg) / .75); }
.tile.planned .pct::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lavender);
  vertical-align: middle;
}

/* ---------- Settings rows ---------- */

.list-row input.days-left {
  flex: none;
  width: 72px;
  text-align: right;
  color: var(--sage);
  font-weight: 600;
  -moz-appearance: textfield;
}
.list-row input.days-left::-webkit-inner-spin-button,
.list-row input.days-left::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.row-value { font-size: 15px; color: var(--muted); text-align: right; }

/* ---------- Toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  transform: translate(-50%, 20px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgb(var(--surface) / .95);
  border: 1px solid rgb(var(--fg) / .12);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Mac and other wide screens: calendar beside the countdown on the home screen. */
@media (min-width: 900px) {
  #app.wide { max-width: 1040px; padding-left: 32px; padding-right: 32px; }
  #app.wide .topbar { margin: 0 -32px 8px; padding-left: 32px; padding-right: 32px; }
  .home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    column-gap: 28px;
    align-items: start;
  }
  .home-grid > :not(.month) { grid-column: 1; }
  .home-grid > .month { grid-column: 2; grid-row: 1 / span 4; margin-top: 0; }
  .month .tile { min-height: 56px; }
  .month .tile .num { font-size: 17px; }
  .month .tile .pct { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 360px) {
  .hero h1 { font-size: 42px; }
  .challenge .big { font-size: 46px; }
}

.nowrap { white-space: nowrap; }

/* ---------- Backup reminder and snapshots ---------- */

.backup-nudge {
  display: flex;
  align-items: center;
  gap: 12px;
  border-color: rgb(var(--a2) / .3);
  background: linear-gradient(135deg, rgb(var(--a2) / .14), rgb(var(--surface) / .6));
}
.nudge-text { flex: 1; min-width: 0; }
.nudge-title { font: 600 17px var(--serif); }
.nudge-sub { margin-top: 3px; font-size: 13px; line-height: 1.35; color: rgb(var(--fg) / .65); }
.nudge-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.small-pill {
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}
.text-btn.muted { color: var(--muted); font-weight: 500; font-size: 13px; }
.snapshot-pick {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--ivory);
  font-size: 16px;
}
.muted-text { color: var(--muted); font-size: 15px; }

/* ---------- Custom mission ---------- */

.hero { cursor: pointer; }
.hero h1 { overflow-wrap: anywhere; text-wrap: balance; }
.hero h1.small { font-size: 38px; }
.hero h1.smaller { font-size: 30px; }

.field-row { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.field-row + .field-row { border-top: 1px solid rgb(var(--fg) / .06); }
.field-label { flex: none; width: 92px; font-size: 15px; color: var(--muted); }
.field-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 17px;
  text-align: right;
}
.list-row input.challenge-length {
  flex: none;
  width: 72px;
  text-align: right;
  color: var(--sage);
  font-weight: 600;
  -moz-appearance: textfield;
}
.list-row input.challenge-length::-webkit-inner-spin-button,
.list-row input.challenge-length::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Per-look touches ---------- */

/* Mono: flat black, no glow, sharp corners, monospace numbers and headings. */
:root:not([data-theme="sunrise"]) .bg { background: #000; }
:root:not([data-theme="sunrise"]) .card, :root:not([data-theme="sunrise"]) .today { box-shadow: none; }
:root:not([data-theme="sunrise"]) .hero h1 { filter: none; letter-spacing: -.02em; font-weight: 700; }
:root:not([data-theme="sunrise"]) .tile, :root:not([data-theme="sunrise"]) textarea.note, :root:not([data-theme="sunrise"]) .seg { border-radius: 4px; }
:root:not([data-theme="sunrise"]) .dot { border-radius: 1px; }
:root:not([data-theme="sunrise"]) .label { letter-spacing: .24em; }
:root:not([data-theme="sunrise"]) .today { background: rgb(var(--surface)); border-color: rgb(var(--a1) / .5); }
:root:not([data-theme="sunrise"]) .tile.full, :root:not([data-theme="sunrise"]) .dot.full { box-shadow: none; }

/* Sunrise is light: softer shadows, no glow behind the headline. */
[data-theme="sunrise"] .card,
[data-theme="sunrise"] .today { box-shadow: 0 6px 20px rgb(var(--shade) / .08); }
[data-theme="sunrise"] .hero h1 { filter: none; }
[data-theme="sunrise"] .tile.full { box-shadow: none; }
[data-theme="sunrise"] .topbar:not(.home) { background: rgb(var(--base) / .8); }

/* Sunrise: chunky rounded type and a warm Today card. */
[data-theme="sunrise"] .hero h1 { font-weight: 800; letter-spacing: -.02em; }
[data-theme="sunrise"] .subtitle { font-style: normal; font-weight: 600; }
[data-theme="sunrise"] .today { background: linear-gradient(135deg, rgb(var(--a1) / .18), rgb(var(--a2) / .22)); border-color: rgb(var(--a1) / .25); }
[data-theme="sunrise"] .tile { border-radius: 14px; }
[data-theme="sunrise"] .challenge .big, [data-theme="sunrise"] .stat .value { font-weight: 800; }

/* Look picker in Settings */
.seg.look { display: flex; margin: 0; }
.seg.look button { padding: 10px 8px; font-size: 14px; }
/* Sunrise: amber is too faint for small text on cream, so labels and notes use a deep coral. */
[data-theme="sunrise"] .label, [data-theme="sunrise"] .oneoff { color: rgb(190 70 42); }

/* ---------- Welcome screen (first launch) ---------- */

.welcome-hero h1 { font-size: 44px; }
.welcome-hero .subtitle { margin-top: 6px; font-size: 17px; line-height: 1.4; font-style: normal; font-family: var(--sans); }
textarea.w-tasks {
  display: block;
  width: 100%;
  min-height: 112px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid rgb(var(--fg) / .08);
  border-radius: calc(var(--radius, 24px) / 2);
  outline: none;
  background: var(--field);
  font-size: 16px;
  line-height: 1.5;
}
textarea.w-tasks:focus { border-color: rgb(var(--a1) / .5); }
.field-row input[type="date"], .field-row input[type="number"] { color: var(--sage); font-weight: 600; }
.start-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 16px;
  border: 0;
  border-radius: var(--radius, 24px);
  background: var(--accent);
  color: var(--on-accent);
  font: 700 17px var(--sans);
  transition: transform .15s ease;
}
.start-btn:active { transform: scale(.98); }
.footnote.center { text-align: center; }
.footnote .text-btn { padding: 0; font-size: 13px; }

/* Streak rule picker in Settings */
.list-row select.streak-min {
  flex: none;
  max-width: 60%;
  padding: 10px 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--sage);
  font: 600 16px var(--sans);
  text-align: right;
  text-align-last: right;
}

/* ---------- Install button and guide ---------- */

.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.install-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px 8px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 14px var(--sans);
  white-space: nowrap;
  transition: transform .15s ease;
}
.install-pill:active { transform: scale(.96); }
.install-pill svg { width: 16px; height: 16px; }

#install-sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / .55); opacity: 0; transition: opacity .25s; }
.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(520px, 100%);
  padding: 22px 20px calc(env(safe-area-inset-bottom) + 20px);
  border: 1px solid rgb(var(--fg) / .1);
  border-bottom: 0;
  border-radius: calc(var(--radius) + 14px) calc(var(--radius) + 14px) 0 0;
  background: rgb(var(--surface));
  transform: translate(-50%, 100%);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
#install-sheet.open .sheet-backdrop { opacity: 1; }
#install-sheet.open .sheet { transform: translate(-50%, 0); }
.sheet-head { display: flex; align-items: center; gap: 14px; }
.sheet-head img { flex: none; border-radius: 12px; }
.sheet-head h3 { margin: 0; font: 600 20px var(--serif); }
.sheet-head p { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.steps { margin: 18px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  position: relative;
  counter-increment: step;
  padding: 11px 0 11px 42px;
  border-top: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.4;
  color: rgb(var(--fg) / .8);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 9px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgb(var(--a1) / .15);
  color: var(--sage);
  font: 700 14px var(--sans);
}
.steps b { color: var(--ivory); }
.steps .glyph { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; color: var(--sage); }
.steps .glyph svg { width: 100%; height: 100%; }
.sheet .start-btn { margin-top: 14px; }

/* ---------- About ---------- */

.about p { margin: 12px 0 0; font-size: 15px; line-height: 1.45; color: rgb(var(--fg) / .75); }
.about-head { display: flex; align-items: center; gap: 14px; }
.about-head img { flex: none; border-radius: 11px; }
.about-name { font: 600 19px var(--serif); }
.about-sub { margin-top: 2px; font-size: 14px; color: var(--sage); font-weight: 600; }
a.link { color: var(--sage); font-weight: 600; overflow-wrap: anywhere; }
.credit { margin-top: 26px; color: var(--faint); }
