/* Lumi styles: the spec's palette and type (section 2), mobile first, a
   narrow centred column on desktop, 44 pt tap targets, and a dark theme.
   The theme follows the system unless the device chose one (ADR-019): the
   server then puts data-theme="light" or "dark" on <html>. Every colour
   that differs between the themes is a token here; the dark tokens are
   written twice, for a chosen dark theme and for a dark system without a
   chosen light one, and render_test.go checks the two stay the same. */

:root {
  color-scheme: light dark;
  --bg: #fbf6ef;
  --surface: rgb(255 255 255 / 80%);
  --surface-strong: #fff;
  --primary: #4a2f45;
  --on-primary: #fbf6ef;
  /* The focus ring: plum on cream, apricot on plum-black, at least 3:1
     against the page in both themes. */
  --focus: var(--primary);
  --focus-halo: rgb(74 47 69 / 14%);
  --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fbf6ef' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --apricot: #f2b48c;
  --sage: #a9bfa3;
  --lavender: #cfc6e8;
  --text: #2b2228;
  --muted: #6e5f69;
  --line: rgb(74 47 69 / 14%);
  --danger: #a3363c;
  --ok-bg: rgb(169 191 163 / 35%);
  --error-bg: rgb(242 180 140 / 35%);
  --shadow: 0 1px 2px rgb(74 47 69 / 6%), 0 8px 24px rgb(74 47 69 / 8%);
  --font-heading: "Fixel Display", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Fixel Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* The type scale: every size on a page is one of these steps (rem, so
     Dynamic Type moves them all). */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.15rem;
  --text-xl: 1.3rem;
  --text-2xl: 1.7rem;
  --text-3xl: 2.1rem;
  --radius: 20px;
  --tap: 44px;
  --column: 30rem;
  /* Component tones: one value per theme, so the dark theme is only
     these tokens (below). */
  --choice-on: linear-gradient(135deg, rgb(242 180 140 / 28%), rgb(207 198 232 / 32%));
  --sign-card: linear-gradient(135deg, rgb(207 198 232 / 45%), rgb(242 180 140 / 30%));
  --part-morning: linear-gradient(135deg, rgb(242 180 140 / 30%), var(--surface));
  --part-evening: linear-gradient(135deg, rgb(207 198 232 / 40%), var(--surface));
  --why: #8a5a3c;
  --soft-sage: rgb(169 191 163 / 40%);
  --sheet-backdrop: #e6dcd2;
  --icon-ink: #3b2f38;
  --tint-wellness: rgb(169 191 163 / 45%);
  --tint-beauty: rgb(240 186 196 / 50%);
  --tint-move: rgb(242 180 140 / 45%);
  --tint-mind: rgb(207 198 232 / 60%);
  --tint-focus: rgb(168 196 222 / 50%);
  --tint-home: rgb(226 205 168 / 55%);
  --tint-social: rgb(244 196 168 / 55%);
  --tint-sleep: rgb(176 166 214 / 55%);
  --flame-ink: #b5561f;
  --evening-ink: #6c5fa8;
  --due-bg: rgb(169 191 163 / 38%);
  --due-ink: #2b2228;
  --offer-bg: linear-gradient(135deg, rgb(207 198 232 / 38%), rgb(169 191 163 / 25%));
  --all-done-bg: linear-gradient(135deg, rgb(242 180 140 / 30%), rgb(169 191 163 / 30%));
  --rest-bg: rgb(207 198 232 / 30%);
  --half-morning: linear-gradient(160deg, rgb(242 180 140 / 30%), var(--surface) 70%);
  --half-evening: linear-gradient(160deg, rgb(207 198 232 / 45%), var(--surface) 70%);
  --polaroid-bg: #fffdf9;
  --polaroid-shadow: 0 2px 4px rgb(74 47 69 / 10%), 0 12px 30px rgb(74 47 69 / 14%);
  --closing-bg: linear-gradient(150deg, rgb(242 180 140 / 40%), rgb(207 198 232 / 45%) 60%, rgb(169 191 163 / 35%));
  --closing-evening-bg: linear-gradient(150deg, rgb(207 198 232 / 55%), rgb(169 191 163 / 30%));
  --affirmation-bg: linear-gradient(150deg, rgb(207 198 232 / 40%), rgb(242 180 140 / 25%));
  --bar: var(--sage);
  --picker-filter: none;
  --cover-ink: #3b2f38;
  --tone-plum: #b98aa9;
  --mini-avatar-bg: var(--lavender);
  --milestone-bg: linear-gradient(120deg, rgb(242 180 140 / 28%), rgb(207 198 232 / 28%));
  --cell-done: var(--sage);
  --cell-skipped: var(--lavender);
  --wrap-fill: #f6dcc9;
  --wrap-stroke: #e8b796;
  --daisy-stroke: #e7dccb;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1e1a1f;
  --surface: #2a2430;
  --surface-strong: #322b39;
  --primary: #f2b48c;
  --on-primary: #2b2228;
  --focus-halo: rgb(242 180 140 / 22%);
  --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b2228' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --text: #f4eef2;
  --muted: #b8a9b4;
  --line: rgb(244 238 242 / 12%);
  --danger: #f08a86;
  --ok-bg: rgb(169 191 163 / 22%);
  --error-bg: rgb(242 180 140 / 20%);
  --shadow: none;
  --choice-on: linear-gradient(135deg, rgb(242 180 140 / 18%), rgb(207 198 232 / 14%));
  --sign-card: linear-gradient(135deg, rgb(207 198 232 / 18%), rgb(242 180 140 / 12%));
  --part-morning: linear-gradient(135deg, rgb(242 180 140 / 14%), var(--surface));
  --part-evening: linear-gradient(135deg, rgb(207 198 232 / 16%), var(--surface));
  --why: var(--apricot);
  --soft-sage: rgb(169 191 163 / 25%);
  --sheet-backdrop: #141115;
  --icon-ink: #f4eef2;
  --tint-wellness: rgb(169 191 163 / 28%);
  --tint-beauty: rgb(240 186 196 / 26%);
  --tint-move: rgb(242 180 140 / 26%);
  --tint-mind: rgb(207 198 232 / 26%);
  --tint-focus: rgb(168 196 222 / 26%);
  --tint-home: rgb(226 205 168 / 24%);
  --tint-social: rgb(244 196 168 / 24%);
  --tint-sleep: rgb(176 166 214 / 28%);
  --flame-ink: var(--apricot);
  --evening-ink: var(--lavender);
  --due-bg: rgb(169 191 163 / 26%);
  --due-ink: var(--text);
  --offer-bg: linear-gradient(135deg, rgb(207 198 232 / 14%), rgb(169 191 163 / 12%));
  --all-done-bg: linear-gradient(135deg, rgb(207 198 232 / 14%), rgb(169 191 163 / 12%));
  --rest-bg: linear-gradient(135deg, rgb(207 198 232 / 14%), rgb(169 191 163 / 12%));
  --half-morning: linear-gradient(160deg, rgb(242 180 140 / 16%), var(--surface) 70%);
  --half-evening: linear-gradient(160deg, rgb(207 198 232 / 18%), var(--surface) 70%);
  --polaroid-bg: #f6efe6;
  --polaroid-shadow: 0 12px 30px rgb(0 0 0 / 40%);
  --closing-bg: linear-gradient(150deg, rgb(242 180 140 / 16%), rgb(207 198 232 / 18%) 60%, rgb(169 191 163 / 14%));
  --closing-evening-bg: linear-gradient(150deg, rgb(242 180 140 / 16%), rgb(207 198 232 / 18%) 60%, rgb(169 191 163 / 14%));
  --affirmation-bg: linear-gradient(150deg, rgb(242 180 140 / 16%), rgb(207 198 232 / 18%) 60%, rgb(169 191 163 / 14%));
  --bar: rgb(169 191 163 / 80%);
  --picker-filter: invert(1);
  --cover-ink: #2b2228;
  --tone-plum: #8e6a83;
  --mini-avatar-bg: rgb(207 198 232 / 75%);
  --milestone-bg: linear-gradient(120deg, rgb(242 180 140 / 18%), rgb(207 198 232 / 16%));
  --cell-done: rgb(169 191 163 / 80%);
  --cell-skipped: rgb(207 198 232 / 70%);
  --wrap-fill: #4a3a44;
  --wrap-stroke: #8e6a83;
  --daisy-stroke: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1e1a1f;
    --surface: #2a2430;
    --surface-strong: #322b39;
    --primary: #f2b48c;
    --on-primary: #2b2228;
    --focus-halo: rgb(242 180 140 / 22%);
    --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b2228' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
    --text: #f4eef2;
    --muted: #b8a9b4;
    --line: rgb(244 238 242 / 12%);
    --danger: #f08a86;
    --ok-bg: rgb(169 191 163 / 22%);
    --error-bg: rgb(242 180 140 / 20%);
    --shadow: none;
    --choice-on: linear-gradient(135deg, rgb(242 180 140 / 18%), rgb(207 198 232 / 14%));
    --sign-card: linear-gradient(135deg, rgb(207 198 232 / 18%), rgb(242 180 140 / 12%));
    --part-morning: linear-gradient(135deg, rgb(242 180 140 / 14%), var(--surface));
    --part-evening: linear-gradient(135deg, rgb(207 198 232 / 16%), var(--surface));
    --why: var(--apricot);
    --soft-sage: rgb(169 191 163 / 25%);
    --sheet-backdrop: #141115;
    --icon-ink: #f4eef2;
    --tint-wellness: rgb(169 191 163 / 28%);
    --tint-beauty: rgb(240 186 196 / 26%);
    --tint-move: rgb(242 180 140 / 26%);
    --tint-mind: rgb(207 198 232 / 26%);
    --tint-focus: rgb(168 196 222 / 26%);
    --tint-home: rgb(226 205 168 / 24%);
    --tint-social: rgb(244 196 168 / 24%);
    --tint-sleep: rgb(176 166 214 / 28%);
    --flame-ink: var(--apricot);
    --evening-ink: var(--lavender);
    --due-bg: rgb(169 191 163 / 26%);
    --due-ink: var(--text);
    --offer-bg: linear-gradient(135deg, rgb(207 198 232 / 14%), rgb(169 191 163 / 12%));
    --all-done-bg: linear-gradient(135deg, rgb(207 198 232 / 14%), rgb(169 191 163 / 12%));
    --rest-bg: linear-gradient(135deg, rgb(207 198 232 / 14%), rgb(169 191 163 / 12%));
    --half-morning: linear-gradient(160deg, rgb(242 180 140 / 16%), var(--surface) 70%);
    --half-evening: linear-gradient(160deg, rgb(207 198 232 / 18%), var(--surface) 70%);
    --polaroid-bg: #f6efe6;
    --polaroid-shadow: 0 12px 30px rgb(0 0 0 / 40%);
    --closing-bg: linear-gradient(150deg, rgb(242 180 140 / 16%), rgb(207 198 232 / 18%) 60%, rgb(169 191 163 / 14%));
    --closing-evening-bg: linear-gradient(150deg, rgb(242 180 140 / 16%), rgb(207 198 232 / 18%) 60%, rgb(169 191 163 / 14%));
    --affirmation-bg: linear-gradient(150deg, rgb(242 180 140 / 16%), rgb(207 198 232 / 18%) 60%, rgb(169 191 163 / 14%));
    --bar: rgb(169 191 163 / 80%);
    --picker-filter: invert(1);
    --cover-ink: #2b2228;
    --tone-plum: #8e6a83;
    --mini-avatar-bg: rgb(207 198 232 / 75%);
    --milestone-bg: linear-gradient(120deg, rgb(242 180 140 / 18%), rgb(207 198 232 / 16%));
    --cell-done: rgb(169 191 163 / 80%);
    --cell-skipped: rgb(207 198 232 / 70%);
    --wrap-fill: #4a3a44;
    --wrap-stroke: #8e6a83;
    --daisy-stroke: none;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Dynamic Type (spec 15): on an iPhone or iPad the root size is the
   system's body size (17 pt at the default, more with Settings →
   Accessibility → Larger Text), and every rem follows it. Only iOS:
   -webkit-touch-callout exists nowhere else, and on a Mac the system body
   size is 13 pt. */
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html {
    font: -apple-system-body;
  }
}

/* Nothing may scroll the page sideways; overflow-x: clip keeps sticky
   bars working where hidden would not. */
body {
  margin: 0;
  overflow-x: clip;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Headings are the serif at its lighter weights, set a little tight; the
   body and the controls stay at 400 and 500, so nothing on a page shouts. */
h1,
h2,
h3 {
  text-wrap: balance;
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.012em;
  margin: 0 0 0.5rem;
  overflow-wrap: break-word;
}

h1 {
  font-size: var(--text-2xl);
  font-weight: 400;
}

h2 {
  font-size: var(--text-lg);
}

/* Paragraphs avoid a lone last word where the browser can. */
p {
  margin: 0 0 0.75rem;
  text-wrap: pretty;
}

a {
  color: var(--primary);
}

/* Emphasis is the medium weight, as everywhere else: Fixel's 600 would
   stand out against the light headings. */
strong,
b {
  font-weight: 500;
}

img {
  display: block;
}

/* ── Cards, forms, buttons ─────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin: 0 0 1rem;
}

.card > h1 {
  margin-bottom: 1rem;
}

.card > .stack + .hint {
  margin: 1rem 0 0;
}

.stack {
  display: grid;
  gap: 0.9rem;
}

/* A label stacks its text over its field; the one column never grows past
   the label, so a wide control (an iOS date) cannot push the page wider. */
label {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
  font-weight: 500;
  font-size: var(--text-base);
}

/* Fields keep a 16 px font so iOS does not zoom into them. */
input,
select {
  font: inherit;
  font-size: max(var(--text-base), 16px);
  font-weight: 400;
  color: var(--text);
  background-color: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: var(--tap);
  padding: 0.6rem 0.85rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* A select draws its own chevron, so iOS keeps the 44 pt height. */
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a7f87' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1.1rem;
}

/* iOS draws date and time fields as wide native buttons that ignore their
   width: drop the native look, fill the column, and lay the value out
   like other fields. */
input[type="date"],
input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  line-height: 1.5;
  text-align: left;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
  min-height: 1.5em;
  margin: 0;
  text-align: inherit;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0.6;
  filter: var(--picker-filter);
}

/* An empty date or time in the quiz shows a hint where the value goes:
   iOS leaves the field blank, desktop browsers show a mask. The field is
   required, so it is :invalid while empty. */
.picker-field {
  position: relative;
}

.picker-hint {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  color: var(--muted);
  font-size: var(--text-lg);
  font-weight: 400;
  pointer-events: none;
}

.picker-field input:invalid:not(:focus) + .picker-hint {
  display: flex;
}

.picker-field input:invalid:not(:focus)::-webkit-datetime-edit {
  color: transparent;
}

:focus-visible,
.btn:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* A field in focus turns its own edge the focus colour with a soft halo
   around it, slimmer than the ring of a button, so typing does not frame
   the field twice. The outline sits on the edge, for forced colours. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: -1px;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-halo);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn.small {
  width: auto;
  padding-inline: 1rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

button.link {
  font: inherit;
  color: var(--primary);
  background: none;
  border: 0;
  padding: 0;
  min-height: var(--tap);
  text-decoration: underline;
  cursor: pointer;
}

.hint,
.muted {
  color: var(--muted);
  font-size: var(--text-sm);
}

.eyebrow {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: var(--text-sm);
  margin: 1rem 0 0.25rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

.flash {
  border-radius: 14px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}

.flash.ok {
  background: var(--ok-bg);
}

.flash.error {
  background: var(--error-bg);
}

.passkey-box {
  display: grid;
  gap: 0.5rem;
}

.passkey-box[hidden],
[hidden] {
  display: none;
}

details.password-way summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  list-style: none;
}

details.password-way summary::-webkit-details-marker {
  display: none;
}

details.password-way[open] summary {
  margin-bottom: 0.75rem;
}

.rows {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.rows li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.pill {
  display: inline-block;
  font-size: var(--text-xs);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
  background: var(--lavender);
  color: #2b2228;
}

.actions {
  display: grid;
  gap: 0.75rem;
}

.card.danger h2 {
  color: var(--danger);
}

/* ── Pages before sign-in ──────────────────────────────────────────────── */

.bare-main {
  max-width: var(--column);
  margin: 0 auto;
  padding: max(2rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.logo {
  display: block;
  width: 96px;
  margin: 1rem auto 1.5rem;
}

.logo img {
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.welcome {
  text-align: center;
}

.welcome h1 {
  font-size: var(--text-3xl);
}

.tagline {
  color: var(--muted);
}

.welcome .btn {
  margin: 0.5rem 0 1rem;
}

/* ── The app: top bar, content, tab bar ────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(var(--tap), 1fr) auto minmax(var(--tap), 1fr);
  align-items: center;
  gap: 0.5rem;
  max-width: var(--column);
  margin: 0 auto;
  padding: max(0.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.5rem
    max(1rem, env(safe-area-inset-left));
  background: var(--bg);
}

.topbar-end {
  display: flex;
  justify-self: end;
}

.avatar {
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lavender);
  color: #2b2228;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: var(--text-lg);
  text-decoration: none;
}

.avatar.active {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.brand {
  justify-self: center;
  display: flex;
  align-items: center;
  min-height: var(--tap);
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: var(--text-lg);
  color: var(--text);
  text-decoration: none;
}

.brand img {
  border-radius: 8px;
}

.app-main section[id] {
  scroll-margin-top: 4.5rem;
}

.app-main {
  max-width: var(--column);
  margin: 0 auto;
  padding: 0.5rem max(1rem, env(safe-area-inset-right)) calc(6rem + env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.page-title {
  margin: 0.5rem 0 1rem;
}

.today .date {
  color: var(--muted);
  margin: 0.75rem 0 0.25rem;
}

.today .date::first-letter {
  text-transform: uppercase;
}

.hello {
  font-size: var(--text-3xl);
  margin-bottom: 1.25rem;
}

.soon {
  background: linear-gradient(135deg, rgb(242 180 140 / 30%), rgb(207 198 232 / 35%));
}

.signout {
  margin: 1.5rem 0;
}

.tabbar {
  position: fixed;
  inset: auto 0 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: center;
  gap: 0.25rem;
  max-width: var(--column);
  margin: 0 auto;
  padding: 0.4rem max(0.75rem, env(safe-area-inset-right)) max(0.4rem, env(safe-area-inset-bottom))
    max(0.75rem, env(safe-area-inset-left));
  background: var(--surface-strong);
  border-top: 1px solid var(--line);
}

.tab {
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  min-width: 0;
  min-height: var(--tap);
  padding: 0.25rem 0;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}

.tab > span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab svg {
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab.active {
  color: var(--primary);
}

.tab[aria-disabled="true"] {
  opacity: 0.45;
}

.tab.add {
  justify-self: end;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  place-items: center;
  background: var(--primary);
  color: var(--on-primary);
  padding: 0;
}

@media (min-width: 40rem) {
  .btn {
    width: auto;
  }

  .welcome .btn,
  .stack .btn,
  .passkey-box .btn {
    width: 100%;
  }

  .tabbar {
    border-inline: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

/* ── Content admin (ADR-005): a wider column, Ukrainian and English side by
   side on a desktop, stacked on a phone ─────────────────────────────── */

.admin {
  --column-wide: 72rem;
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--column-wide);
  margin: 0 auto;
  padding: max(0.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.25rem
    max(1rem, env(safe-area-inset-left));
}

.admin-back {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  font-weight: 500;
}

.admin-nav {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  max-width: var(--column-wide);
  margin: 0 auto;
  padding: 0.25rem 1rem 0.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.admin-nav a {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 0.85rem;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-base);
}

.admin-nav a[aria-current="page"] {
  background: var(--primary);
  color: var(--on-primary);
}

.admin-main {
  max-width: var(--column-wide);
  margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) calc(3rem + env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.crumbs {
  margin: 0;
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  align-items: end;
  gap: 0.75rem;
}

.filters .btn {
  width: auto;
}

.field {
  margin: 0 0 0.9rem;
}

.filters .field {
  margin: 0;
}

textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.6rem 0.85rem;
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
}

input[readonly] {
  color: var(--muted);
}

input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: none;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

legend {
  font-weight: 500;
  font-size: var(--text-base);
  padding: 0;
  margin-bottom: 0.35rem;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

label.check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: var(--tap);
  font-weight: 400;
  padding-right: 0.5rem;
}

/* Checkboxes and radio buttons draw themselves, the same in both themes:
   a muted edge, filled with the primary colour and a mark when on. */
label.check input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--muted);
  border-radius: 6px;
  background: var(--surface-strong);
  cursor: pointer;
}

label.check input:checked {
  border-color: var(--primary);
  background: var(--primary) var(--check-mark) center / 0.9rem no-repeat;
}

label.check input[type="radio"] {
  border-radius: 50%;
}

label.check input[type="radio"]:checked {
  background: radial-gradient(circle, var(--primary) 0 38%, var(--surface-strong) 44%);
}

.has-problem input,
.has-problem textarea,
.has-problem select {
  border-color: var(--danger);
}

.field-problem {
  color: var(--danger);
  font-size: var(--text-sm);
  margin: 0.25rem 0 0;
}

.flash ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.admin-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0 1rem;
}

.admin-fields .field:has(fieldset) {
  grid-column: 1 / -1;
}

.lang-columns {
  display: grid;
  gap: 0 1rem;
}

.lang-column h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.form-actions {
  position: sticky;
  bottom: 0;
  padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%);
}

.archive-form {
  display: grid;
  gap: 0.5rem;
  justify-items: start;
}

.admin-rows {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.admin-rows > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.admin-rows > li > a {
  display: block;
  min-height: var(--tap);
  padding: 0.25rem 0;
  color: var(--text);
  text-decoration: none;
  flex: 1 1 20rem;
}

.admin-rows > li > a:hover strong {
  text-decoration: underline;
}

.slug {
  color: var(--muted);
  font-size: var(--text-sm);
  word-break: break-all;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.pill.warn {
  background: var(--apricot);
  text-decoration: none;
}

.pill.ok {
  background: var(--sage);
}

.pill.quiet {
  background: var(--line);
  color: var(--text);
}

/* A wide table scrolls inside its card on a phone, never the page. */
.table-scroll {
  position: relative;
  overflow-x: auto;
  margin-inline: -0.25rem;
  padding-inline: 0.25rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table td,
.admin-table th[scope="row"] {
  white-space: nowrap;
}

.admin-table a,
.link-list a,
.changes li a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.admin-table thead th {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* On a phone a table of many columns becomes one block a row: its first
   cell as the title, each other cell with its column's name before it. */
@media (max-width: 40rem) {
  .admin-table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .admin-table.stack,
  .admin-table.stack tbody {
    display: block;
  }

  .admin-table.stack tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.1rem 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-table.stack tr:last-child {
    border-bottom: 0;
  }

  .admin-table.stack th,
  .admin-table.stack td {
    display: block;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .admin-table.stack th[scope="row"] {
    flex: 1 0 100%;
    font-weight: 500;
  }

  .admin-table.stack td[data-label]::before {
    content: attr(data-label);
    margin-right: 0.35rem;
    color: var(--muted);
    font-size: var(--text-sm);
  }

  .admin-table.stack .row-action {
    flex: 1 0 100%;
    margin-top: 0.25rem;
  }
}

.link-list {
  margin: 0;
  padding-left: 1.25rem;
}

.link-list li {
  margin: 0.4rem 0;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
}

.inline-form label {
  flex: 1 1 12rem;
}

.copy-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 1 1 22rem;
}

.copy-box input {
  flex: 1 1 14rem;
}

.invite:target,
.changes > li:target {
  background: var(--ok-bg);
}

.changes details summary {
  cursor: pointer;
  color: var(--primary);
  min-height: var(--tap);
  display: flex;
  align-items: center;
}

.diff {
  display: grid;
  grid-template-columns: minmax(6rem, auto) minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  margin: 0.25rem 0 0;
  font-size: var(--text-sm);
}

.diff dt {
  color: var(--muted);
}

.diff dd {
  margin: 0;
}

.diff del {
  color: var(--danger);
}

.diff ins {
  text-decoration: none;
  background: var(--ok-bg);
}

@media (min-width: 48rem) {
  .lang-columns {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* ── The first run (spec 7): a flow frame with a back link, the quiz
   progress, and Continue pinned to the bottom ───────────────────────── */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.flow-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(var(--tap), 1fr) auto minmax(var(--tap), 1fr);
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: max(0.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.5rem
    max(1rem, env(safe-area-inset-left));
  background: var(--bg);
}

.flow-end {
  display: flex;
  justify-content: flex-end;
}

/* The language and theme switches (ADR-019): segmented buttons, the
   current one pressed. */
.lang-switch,
.seg-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
}

/* Each segment is as wide as its words, so "As on the system" stays on
   one line beside the shorter ones; they wrap only when text is large. */
.seg-switch {
  display: flex;
  width: 100%;
  margin: 0 0 0.5rem;
}

.seg-switch button {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
}

.large-type .seg-switch button {
  white-space: normal;
}

.lang-switch button,
.seg-switch button {
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0.25rem 0.6rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
}

.lang-switch button {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lang-switch button[aria-pressed="true"],
.seg-switch button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--on-primary);
}

.lang-switch button:focus-visible,
.seg-switch button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.welcome-prefs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0.75rem 0 0;
}

.welcome-prefs .seg-switch {
  width: auto;
  margin: 0;
}

.welcome-prefs .seg-switch span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.seg-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding-inline: 0.5rem;
}

.photo-credits,
.account-foot a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--muted);
  font-size: var(--text-sm);
}

.account-foot {
  text-align: center;
}

.credit-list {
  display: grid;
  gap: 0.9rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.credit-list li {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.9rem;
}

.credit-list img {
  width: 4.5rem;
  height: 6rem;
  border-radius: 12px;
  object-fit: cover;
}

.credit-list p {
  margin: 0 0 0.2rem;
}

.credit-list a {
  display: inline-block;
  padding: 0.6rem 0;
}

.credits h2 {
  margin-top: 1.25rem;
  font-size: var(--text-lg);
}

.bare-top {
  display: flex;
  justify-content: flex-end;
  margin: -1rem 0 0;
}

.flow-back {
  justify-self: start;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  color: var(--text);
}

a.flow-back {
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.flow-back svg,
.points svg,
.part-head svg,
.ritual-check svg,
.tick svg,
.share-icon svg,
.install-art svg,
.line-ic {
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow-logo {
  justify-self: center;
}

.progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  appearance: none;
  overflow: hidden;
}

.progress::-webkit-progress-bar {
  background: var(--line);
  border-radius: 999px;
}

.progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--apricot), var(--lavender));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--apricot), var(--lavender));
  border-radius: 999px;
}

/* The flow fills the screen, so Continue sits at the bottom even when a
   step is short, and stays pinned there when it is long. */
body.flow {
  display: flex;
  flex-direction: column;
}

.flow-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 0.75rem max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
}

.flow-main > form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.flow-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: grid;
  gap: 0.5rem;
  margin: auto -1rem 0;
  padding: 1.5rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 1.25rem);
}

.flow-actions .btn {
  width: 100%;
}

/* Continue before a screen is answered: a quiet grey pill in both themes
   (a faded primary turns muddy on the dark page). */
.flow-actions .btn.primary:disabled {
  opacity: 1;
  background: var(--line);
  border-color: transparent;
  color: var(--muted);
  cursor: not-allowed;
}

.question {
  font-size: var(--text-2xl);
  margin: 0.75rem 0 0.5rem;
}

.question-hint {
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.45;
  margin-bottom: 1.5rem;
}

/* The name: a calm field of normal height, the hint inside it. The time
   keeps its value centred under the picker's hint. */
.field-solo input[type="text"] {
  min-height: 3.25rem;
  padding-inline: 1rem;
  font-size: max(var(--text-lg), 16px);
}

.field-solo input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.picker-field input {
  min-height: 3.25rem;
  font-size: var(--text-lg);
  text-align: center;
}

.field-solo input::-webkit-datetime-edit {
  justify-content: center;
}

/* The birthday: day, month, and year wheels, empty until chosen. */
.date-wheels {
  display: grid;
  grid-template-columns: 5.75rem minmax(0, 1fr) 6.25rem;
  gap: 0.5rem;
}

.date-wheels select {
  min-height: 3.5rem;
  padding-inline: 0.75rem 2rem;
  background-position: right 0.6rem center;
  font-size: var(--text-lg);
}

/* On a narrow phone the year goes under the day and the month. */
@media (max-width: 23rem) {
  .date-wheels {
    grid-template-columns: 5.75rem minmax(0, 1fr);
  }

  .date-wheels .wheel:nth-of-type(3) {
    grid-column: 1 / -1;
  }
}

.choices {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  border: 0;
  margin: 0;
  padding: 0;
}

.choices.multi,
.choices-vibe,
.choices-sign_on {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

label.choice {
  position: relative;
  display: block;
  font-weight: 500;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
}

/* A choice tile: its icon in a tinted circle on the left, the label (and
   a challenge's length) beside it, one left edge on every step. */
.choice > span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  min-height: 3.5rem;
  height: 100%;
  padding: 0.6rem 0.7rem 0.6rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  line-height: 1.3;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.choice-text {
  display: grid;
  gap: 0.15rem;
}

.choice-icon {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--tint-mind);
  color: var(--icon-ink);
  transition: background 0.15s, color 0.15s;
}

.choice-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentcolor;
}

.choice small {
  font-weight: 400;
  font-size: var(--text-sm);
  color: var(--muted);
}

.choice input:checked + span {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 0.5px var(--primary);
  background: var(--choice-on);
}

.choice input:checked + span .choice-icon {
  background: var(--primary);
  color: var(--on-primary);
}

.choice input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* A label that does not fit beside its icon wraps in balanced lines. */
.choice-text {
  text-wrap: balance;
}

/* The mood flower: the petals open with the mood (onboarding.js and
   journal.js set data-mood on .mood; without them the flower stays half
   open). A flower on its own carries its mood itself. */
.mood {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  --open: 0.75;
  --petal: var(--apricot);
}

.flower[data-mood] {
  --open: 0.75;
  --petal: var(--apricot);
}

.mood[data-mood="1"],
.flower[data-mood="1"] {
  --open: 0.35;
  --petal: var(--lavender);
}

.mood[data-mood="2"],
.flower[data-mood="2"] {
  --open: 0.55;
  --petal: #e2cde2;
}

.mood[data-mood="4"],
.flower[data-mood="4"] {
  --open: 0.95;
  --petal: #f4a684;
}

.mood[data-mood="5"],
.flower[data-mood="5"] {
  --open: 1.15;
  --petal: #f08f6e;
}

.flower .petal {
  fill: var(--petal);
  opacity: 0.9;
  transform: scale(var(--open));
  transform-origin: 60px 60px;
  transform-box: view-box;
  transition: transform 0.35s ease, fill 0.35s ease;
}

.flower .heart {
  fill: var(--sage);
}

.mood-word {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
}

.mood-slider {
  width: 100%;
}

.mood-slider input {
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--primary);
}

.mood-scale {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-xs);
  color: var(--muted);
}

.promise {
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--apricot);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
}

.signature canvas {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 3;
  border: 1.5px dashed var(--line);
  border-radius: 18px;
  background: var(--polaroid-bg);
  touch-action: none;
  cursor: crosshair;
}

.signature-tools {
  display: flex;
  justify-content: space-between;
  margin: 0.5rem 0 1rem;
}

.sign-card {
  text-align: center;
  background: var(--sign-card);
}

.sign-name,
.vibe-name {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.vibe-name {
  font-size: var(--text-xl);
}

.points {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.points li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
}

.points svg {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.45rem;
  border-radius: 50%;
  background: var(--soft-sage);
  color: var(--text);
}

.facts {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.facts h2 {
  font-size: var(--text-lg);
}

/* A fact's source stays quiet: a small "Source" that opens the full
   reference. */
.facts .card {
  padding-bottom: 0.5rem;
}

.facts .card > p {
  margin-bottom: 0.25rem;
}

.source {
  font-size: var(--text-xs);
  color: var(--muted);
  margin: 0;
}

.source summary {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-height: var(--tap);
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  list-style: none;
}

.source summary::-webkit-details-marker {
  display: none;
}

.source summary .ic {
  width: 0.9rem;
  height: 0.9rem;
  transition: transform 0.15s;
}

.source[open] summary .ic {
  transform: rotate(180deg);
}

.source p {
  margin: 0 0 0.75rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.quote {
  margin: 1.5rem 0.5rem;
  text-align: center;
}

.quote blockquote {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-size: var(--text-lg);
}

.quote figcaption {
  color: var(--muted);
  font-size: var(--text-sm);
}

.quote figcaption::before {
  content: "— ";
}

/* Welcome slides: a photo each, its copy over a dark gradient that keeps
   white text readable in both themes. The photo's height leaves room for
   the actions on a small phone. */
.welcome-greeting {
  text-align: center;
  margin-top: 0.25rem;
}

.slides {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  outline-offset: 4px;
}

.slides::-webkit-scrollbar {
  display: none;
}

.slide {
  position: relative;
  scroll-snap-align: center;
  height: clamp(20rem, calc(100vh - 20rem), 36rem);
  height: clamp(20rem, calc(100svh - 20rem), 36rem);
  border-radius: 28px;
  overflow: hidden;
  background: var(--surface-strong);
}

.slide-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-copy {
  position: absolute;
  inset: auto 0 0;
  padding: 5rem 1.25rem 1.25rem;
  background: linear-gradient(to top, rgb(24 17 22 / 88%) 0%, rgb(24 17 22 / 70%) 45%, rgb(24 17 22 / 0%) 100%);
  color: #fff;
}

.slide-copy h2 {
  margin: 0 0 0.4rem;
  font-size: var(--text-2xl);
  line-height: 1.15;
}

.slide-copy p {
  margin: 0;
  color: rgb(255 255 255 / 92%);
  line-height: 1.4;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}

.dot.on {
  background: var(--primary);
  width: 22px;
  border-radius: 999px;
}

/* Creating your plan: the list ticks itself off. The done page is
   .done-page: Today's .done marks a day or a check-in. */
.creating,
.done-page {
  text-align: center;
  padding-top: 1rem;
}

.creating-art img {
  margin: 0 auto 1rem;
  border-radius: 20px;
  animation: glow 1.6s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 0 0 rgb(242 180 140 / 0%);
  }

  to {
    box-shadow: 0 0 0 14px rgb(242 180 140 / 25%);
  }
}

.ticks {
  display: grid;
  gap: 0.75rem;
  max-width: 18rem;
  margin: 1.5rem auto;
  padding: 0;
  list-style: none;
  text-align: left;
}

.ticks li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0.35;
  animation: tick 0.4s ease forwards;
}

.ticks li:nth-child(1) { animation-delay: 0.3s; }
.ticks li:nth-child(2) { animation-delay: 0.9s; }
.ticks li:nth-child(3) { animation-delay: 1.5s; }
.ticks li:nth-child(4) { animation-delay: 2.1s; }
.ticks li:nth-child(5) { animation-delay: 2.7s; }

.tick {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--sage);
  color: #2b2228;
}

@keyframes tick {
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticks li {
    animation: none;
    opacity: 1;
  }

  .creating-art img {
    animation: none;
  }
}

.starts {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
}

/* Your plan */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0 0 0.75rem;
}

.tile {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.15rem;
  padding: 0.9rem 0.4rem;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  font-size: var(--text-xs);
  line-height: 1.25;
  color: var(--muted);
}

.tile strong {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--text);
}

.tile strong svg {
  width: 1.6rem;
  height: 1.6rem;
  margin: 0.35rem 0 0.15rem;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  font-size: var(--text-sm);
}

.part-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.part-head h2,
.part-head span {
  margin: 0;
}

.part-card.morning {
  background: var(--part-morning);
}

.part-card.evening {
  background: var(--part-evening);
}

.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
  margin: 0.5rem 0;
  padding: 0;
  list-style: none;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--muted);
}

.week-dot {
  display: block;
  width: 1.6rem;
  height: 1.6rem;
  margin: 0 auto 0.25rem;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.week .active {
  color: var(--text);
  font-weight: 500;
}

.week .active .week-dot {
  border-color: var(--apricot);
  background: var(--apricot);
}

.expect {
  margin: 0;
}

.expect dt {
  font-weight: 500;
}

.expect dd {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

/* Shape your day */
.shape-group {
  margin: 0 0 1rem;
}

.shape-group > h2 {
  margin: 1rem 0 0.6rem;
}

label.ritual-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
  margin: 0 0 0.6rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  font-weight: 400;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.ritual-card input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
}

/* A picked card: a 1 px edge in the primary colour and the soft fill of a
   picked quiz choice; its check is a light mark, not a heavy dot. */
.ritual-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--choice-on);
}

.ritual-card:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.ritual-body {
  display: grid;
  gap: 0.2rem;
}

.ritual-title {
  font-weight: 500;
}

.ritual-text {
  font-size: var(--text-sm);
}

.ritual-why {
  font-size: var(--text-sm);
  color: var(--why);
}

.ritual-minutes {
  font-size: var(--text-xs);
  color: var(--muted);
}

.ritual-check {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 1px solid var(--muted);
  color: transparent;
}

.ritual-check svg {
  width: 1.1rem;
  height: 1.1rem;
}

.ritual-card:has(input:checked) .ritual-check {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border-color: var(--primary);
  color: var(--primary);
}

/* Install and notifications */
.install-art {
  display: grid;
  place-items: center;
  margin: 0.5rem 0 0;
}

.install-art img {
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.install-art svg {
  width: 3.5rem;
  height: 3.5rem;
  padding: 0.75rem;
  border-radius: 50%;
  background: rgb(242 180 140 / 35%);
}

/* On a short screen the install steps come first: the icon steps aside so
   the whole card shows above the pinned buttons. */
@media (max-height: 46rem) {
  .install .install-art {
    display: none;
  }

  .install .question-hint {
    margin-bottom: 1rem;
  }
}

.install .question,
.install .question-hint,
.notify .question,
.notify .question-hint {
  text-align: center;
}

.steps {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.5rem;
}

.steps + .hint {
  margin: 0.9rem 0 0;
}

.share-icon {
  display: inline-grid;
  vertical-align: middle;
  color: #2f7cf6;
}

.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}

/* ── Icons (Phosphor regular, assets/icons.svg) ───────────────────────── */

.ic {
  width: 1.2em;
  height: 1.2em;
  fill: currentcolor;
  vertical-align: -0.22em;
  flex: none;
}

.ritual-icon {
  --tint: var(--soft-sage);
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--tint);
  color: var(--icon-ink);
  flex: none;
}

.ritual-icon svg {
  width: 1.45rem;
  height: 1.45rem;
  fill: currentcolor;
}

.tint-wellness,
.tint-day {
  --tint: var(--tint-wellness);
}

.tint-beauty {
  --tint: var(--tint-beauty);
}

.tint-move,
.tint-morning {
  --tint: var(--tint-move);
}

.tint-mind,
.tint-evening {
  --tint: var(--tint-mind);
}

.tint-focus {
  --tint: var(--tint-focus);
}

.tint-home {
  --tint: var(--tint-home);
}

.tint-social {
  --tint: var(--tint-social);
}

.tint-sleep {
  --tint: var(--tint-sleep);
}

/* ── Today (spec 8) ────────────────────────────────────────────────────── */

.flame {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-height: var(--tap);
  padding: 0 0.6rem;
  border-radius: 999px;
  background: rgb(242 180 140 / 28%);
  font-weight: 500;
  color: var(--text);
}

.flame .ic {
  color: var(--flame-ink);
}

a.flame {
  text-decoration: none;
}

/* No streak yet: a quiet outline, the number in the body weight. */
.flame.zero {
  background: none;
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 400;
  color: var(--muted);
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
  margin: 0 0 1rem;
}

.week-day {
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  min-height: 3.6rem;
  padding: 0.35rem 0 0.3rem;
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
}

.week-label {
  font-size: var(--text-xs);
  color: var(--muted);
}

.week-num {
  font-weight: 500;
}

.week-mark {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
}

.week-day.done .week-mark {
  background: var(--sage);
}

/* Today is named in plum; the day on screen is a filled plum pill. */
.week-day.today .week-label,
.week-day.today .week-num {
  color: var(--primary);
  font-weight: 500;
}

.week-day.current {
  background: var(--primary);
  color: var(--on-primary);
}

.week-day.current .week-label,
.week-day.current .week-num {
  color: var(--on-primary);
}

.week-day.current.done .week-mark {
  background: var(--on-primary);
}

.week-day.ahead {
  opacity: 0.45;
}

.viewing {
  color: var(--muted);
  font-size: var(--text-sm);
}

.viewing::first-letter {
  text-transform: uppercase;
}

/* "Back to today" always has a line of its own. */
.viewing a {
  display: block;
  width: fit-content;
  min-height: var(--tap);
  padding-top: 0.35rem;
  white-space: nowrap;
}

.offer {
  background: var(--offer-bg);
}

.offer h2 .ic {
  color: #6c8fb8;
}

.offer .actions {
  display: grid;
  gap: 0.5rem;
}

.rest-note {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: var(--rest-bg);
}

.all-done {
  text-align: center;
  background: var(--all-done-bg);
}

.all-done > .ic {
  width: 2rem;
  height: 2rem;
  color: var(--flame-ink);
}

.empty-plan .btn .ic,
.create-own .ic {
  width: 1.1rem;
  height: 1.1rem;
}

.rituals-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.rituals-head h2 {
  margin: 0;
}

.ring {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.ring svg {
  width: 2.4rem;
  height: 2.4rem;
}

.ring-track,
.ring-fill {
  fill: none;
  stroke-width: 4;
}

.ring-track {
  stroke: var(--line);
}

.ring-fill {
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease;
}

.filters-row,
.chip-scroll {
  display: flex;
  gap: 0.4rem;
  margin: 0.9rem 0 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: none;
  min-height: var(--tap);
  padding: 0.25rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.chip-count {
  color: var(--muted);
  font-weight: 500;
}

.filters-row input:checked + .chip,
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.filters-row input:checked + .chip .chip-count {
  color: inherit;
  opacity: 0.8;
}

.filters-row input:focus-visible + .chip {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.rituals:has(#part-morning:checked) .ritual-row:not([data-part="morning"]),
.rituals:has(#part-day:checked) .ritual-row:not([data-part="day"]),
.rituals:has(#part-evening:checked) .ritual-row:not([data-part="evening"]) {
  display: none;
}

.ritual-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ritual-row {
  display: grid;
  grid-template-columns: var(--tap) minmax(0, 1fr);
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid var(--line);
}

.ritual-row:last-child {
  border-bottom: 0;
}

.mark {
  margin: 0;
}

.mark-btn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: transparent;
  cursor: pointer;
}

.mark-btn .ic {
  box-sizing: content-box;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0.35rem;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--primary) 45%, transparent);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.mark-btn .ic + .ic {
  display: none;
}

.mark-btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -2px;
  border-radius: 50%;
}

.ritual-row[data-state="done"] .mark-btn .ic {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  animation: pop 0.25s ease;
}

.ritual-row[data-state="skipped"] .mark-btn .ic:first-child {
  display: none;
}

.ritual-row[data-state="skipped"] .mark-btn .ic + .ic {
  display: block;
  color: var(--muted);
  border-color: var(--line);
  border-style: dashed;
}

span.mark-btn {
  cursor: default;
}

@keyframes pop {
  50% {
    transform: scale(1.18);
  }
}

.row-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.6rem;
  padding: 0.4rem 0;
  color: var(--text);
  text-decoration: none;
}

.row-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.row-title {
  font-weight: 500;
  line-height: 1.3;
}

.row-meta {
  font-size: var(--text-sm);
  color: var(--muted);
}

.ritual-row[data-state="done"] .row-title {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
  color: var(--muted);
}

.ritual-row[data-state="skipped"] .row-title {
  color: var(--muted);
}

.sync-mark {
  display: none;
  justify-self: start;
  margin-top: 0.15rem;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgb(242 180 140 / 30%);
  font-size: var(--text-xs);
  color: var(--text);
}

.ritual-row.pending .sync-mark {
  display: inline-flex;
}

.list-empty {
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.done-list {
  margin-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.done-list summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .ring-fill,
  .mark-btn .ic {
    transition: none;
    animation: none;
  }
}

/* Reduced motion everywhere (spec 15): no animation or transition plays,
   each element shows its end state at once. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* ── Sheets over Today: a ritual, Add ritual, Ritual setup, own ritual ── */

body.sheet-page {
  background: var(--sheet-backdrop);
}

.sheet {
  max-width: var(--column);
  min-height: calc(100dvh - max(0.75rem, env(safe-area-inset-top)));
  margin: max(0.75rem, env(safe-area-inset-top)) auto 0;
  padding: 0 max(1rem, env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  border-radius: 24px 24px 0 0;
  overflow: clip;
  background: var(--bg);
  box-shadow: 0 -4px 24px rgb(74 47 69 / 12%);
}

.sheet-top {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  padding: 0.6rem 0 0.25rem;
  background: var(--bg);
}

.sheet-top::before {
  content: "";
  position: absolute;
  top: 0.45rem;
  left: 50%;
  width: 2.5rem;
  height: 0.3rem;
  margin-left: -1.25rem;
  border-radius: 999px;
  background: var(--line);
}

.sheet-close {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  color: var(--text);
}

.sheet-title {
  margin: 0 0 1rem;
}

.item-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0 0 1rem;
}

.item-head .ritual-icon {
  width: 3.5rem;
  height: 3.5rem;
}

.item-head .ritual-icon svg {
  width: 2rem;
  height: 2rem;
}

.item-head h1 {
  margin: 0;
}

.item-head p {
  margin: 0;
}

.item-text {
  font-size: var(--text-base);
}

.item-why {
  color: var(--why);
  font-weight: 500;
}

.item-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.4rem 1rem;
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  border-radius: 16px;
  background: var(--surface);
}

.item-facts dt {
  color: var(--muted);
}

.item-facts dd {
  margin: 0;
}

.item-actions {
  display: grid;
  gap: 0.5rem;
}

.own + .card.danger {
  margin-top: 1.5rem;
}

.item-actions form {
  margin: 0;
}

.confirm .actions {
  display: grid;
  gap: 0.5rem;
}

.create-own {
  margin: 0 0 1rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--muted);
}

.search-box input {
  border: 0;
  padding-inline: 0;
  background: transparent;
}

.search-box input:focus-visible {
  outline: none;
}

.search-box:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.list-head {
  margin: 1.25rem 0 0.25rem;
  font-size: var(--text-base);
}

.pick-list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.pick-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.6rem;
  padding: 0.4rem 0.25rem;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.pick-row > .ic {
  color: var(--primary);
}

.pick-row.in-plan {
  opacity: 0.5;
}

/* Ritual setup and own ritual forms */
fieldset .segments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

label.segment,
label.day-pick,
label.icon-pick {
  position: relative;
  display: block;
  font-weight: 500;
  cursor: pointer;
}

.segment input,
.day-pick input,
.icon-pick input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
}

.segment span,
.day-pick span {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  font-size: var(--text-sm);
}

.segment input:checked + span,
.day-pick input:checked + span,
.icon-pick input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.segment input:focus-visible + span,
.day-pick input:focus-visible + span,
.icon-pick input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.repeat-more,
.when-exact {
  display: none;
  margin-top: 0.75rem;
}

.setup:has(input[name="repeat"][value="weekdays"]:checked) .repeat-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.day-pick span {
  justify-content: center;
  min-width: 2.75rem;
  padding: 0.3rem 0.5rem;
}

.setup:has(input[name="repeat"][value="per_week"]:checked) .repeat-per_week,
.setup:has(input[name="repeat"][value="weekly"]:checked) .repeat-weekly,
.setup:has(input[name="when"][value="exact"]:checked) .when-exact {
  display: grid;
}

.preview h2 {
  font-size: var(--text-base);
}

.cal {
  display: grid;
  gap: 0.3rem;
}

.cal-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.3rem;
  text-align: center;
}

[data-cal-days] {
  display: grid;
  gap: 0.3rem;
}

.cal-names span {
  font-size: var(--text-xs);
  color: var(--muted);
}

.cal-day {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  font-size: var(--text-sm);
}

/* A day it is due: a soft tint, not a heavy dot. */
.cal-day.due {
  background: var(--due-bg);
  color: var(--due-ink);
  font-weight: 500;
}

.cal-day.before {
  opacity: 0.35;
  background: none;
  font-weight: 400;
}

.cal-day.today {
  outline: 1.5px solid var(--primary);
  outline-offset: -1.5px;
}

.cal-note {
  display: none;
  margin-top: 0.5rem;
}

.setup:has(input[name="repeat"][value="per_week"]:checked) .cal-note {
  display: block;
}

.setup:has(input[name="repeat"][value="per_week"]:checked) .cal-day.due {
  background: none;
  box-shadow: inset 0 0 0 1px var(--sage);
  font-weight: 400;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tap), 1fr));
  gap: 0.35rem;
  max-height: 13rem;
  overflow-y: auto;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.icon-pick span {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.icon-pick .ic {
  width: 1.4rem;
  height: 1.4rem;
}

.quiet-own {
  display: none;
  margin-top: 0.5rem;
}

.reminders:has(input[name="quiet"][value="own"]:checked) .quiet-own {
  display: grid;
}

/* ── Check-ins, gratitude, affirmations, insights (spec 10, ADR-014) ──── */

/* journal.js hides what waits: a step ahead, the dots and chips until it
   runs. */
.step[hidden],
.step-dots[hidden],
.suggestions[hidden] {
  display: none;
}

.checkins {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.6rem;
  margin: 0 0 1rem;
}

.checkin-half {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-width: 0;
  min-height: 5.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}

.half-morning {
  background: var(--half-morning);
}

.half-evening {
  background: var(--half-evening);
}

.half-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.half-mood {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.35rem;
  min-width: 0;
}

.half-mood .flower {
  width: 2.4rem;
  height: 2.4rem;
  flex: none;
}

/* The mood word and the status share one style, so the two halves read
   alike whether a half is done or not. */
.half-word {
  min-width: 0;
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.half-wish {
  overflow-wrap: break-word;
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.35;
}

.half-status {
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.3;
  color: var(--muted);
  overflow-wrap: break-word;
}

a.checkin-half:not(.done) .half-status {
  color: var(--primary);
}

.step-dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.step-dots li {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--line);
}

.step-dots li.current {
  width: 1.4rem;
  border-radius: 999px;
  background: var(--primary);
}

.step {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.step legend {
  margin: 0 0 0.25rem;
}

.step legend .sheet-title {
  margin: 0;
}

.step-count {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

.prompt-label,
.step-hint {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.3;
}

.polaroid {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  width: min(15rem, 80%);
  margin: 0.25rem auto 0.5rem;
  padding: 1rem 1rem 0.9rem;
  border-radius: 6px;
  background: var(--polaroid-bg);
  box-shadow: var(--polaroid-shadow);
  transform: rotate(-2deg);
  color: #2b2228;
}

.polaroid .flower {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 4px;
  background: linear-gradient(160deg, rgb(169 191 163 / 30%), rgb(207 198 232 / 35%));
}

.polaroid figcaption {
  display: grid;
  justify-items: center;
}

.polaroid .mood-word {
  font-size: var(--text-xl);
}

.polaroid-date {
  font-size: var(--text-xs);
  color: #6e5f69;
}

.closing-card {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 1.75rem 1.25rem;
  border-radius: var(--radius);
  text-align: center;
  background: var(--closing-bg);
}

.checkin-evening .closing-card {
  background: var(--closing-evening-bg);
}

.closing-card > .ic {
  width: 2.2rem;
  height: 2.2rem;
  color: var(--flame-ink);
}

.checkin-evening .closing-card > .ic {
  color: var(--evening-ink);
}

.closing-card h1 {
  font-size: var(--text-lg);
  margin: 0;
  color: var(--muted);
}

.closing-line {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  line-height: 1.45;
}

.summary-mood {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 500;
}

.summary-mood .flower {
  width: 3.5rem;
  height: 3.5rem;
}

/* A small flower of a rough morning stays visible. */
.half-mood .flower[data-mood="1"],
.summary-mood .flower[data-mood="1"],
.mini-flower .flower[data-mood="1"] {
  --open: 0.5;
}

.checkin-summary .prompt-label {
  margin: 0.9rem 0 0.25rem;
  font-size: var(--text-base);
  color: var(--muted);
}

.my-text,
.journal-text,
.journal-note {
  margin: 0;
  white-space: pre-line;
}

.journal-note {
  color: var(--muted);
}

.gratitude-card .journal-note {
  margin-bottom: 0.9rem;
}

.gratitude-card h2 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.thanks {
  display: grid;
  gap: 0.4rem;
  margin: 0.5rem 0 0.9rem;
  padding: 0;
  list-style: none;
  counter-reset: thanks;
}

.thanks li {
  display: flex;
  gap: 0.6rem;
  counter-increment: thanks;
}

.thanks li::before {
  content: counter(thanks);
  display: grid;
  place-items: center;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--soft-sage);
  font-size: var(--text-xs);
  font-weight: 500;
}

.line-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.line-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--soft-sage);
  font-weight: 500;
}

.suggestions {
  flex-wrap: wrap;
  margin: 0;
}

.affirmation {
  background: var(--affirmation-bg);
}

.affirmation .eyebrow {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.affirmation-text,
.saved-affirmation blockquote {
  margin: 0.25rem 0 1rem;
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  line-height: 1.4;
}

.affirmation-actions,
.prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Two buttons side by side share the row; when they wrap, each fills its
   own, so no button stands half wide under a full one. */
.affirmation-actions > *,
.prompt-actions > * {
  flex: 1 1 auto;
}

.affirmation-actions .btn,
.prompt-actions .btn {
  width: 100%;
}

.affirmation-actions form {
  margin: 0;
}

.bookmark.saved {
  background: var(--lavender);
  border-color: var(--lavender);
  color: #2b2228;
}

.prompt-text {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  line-height: 1.4;
}

.week-nav {
  display: grid;
  grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap);
  align-items: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0.5rem;
  text-align: center;
}

.week-nav h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.week-arrow {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  color: var(--text);
}

a.week-arrow {
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.journal-stats {
  text-align: center;
}

.journal-days {
  margin: 0;
  padding: 0;
  list-style: none;
}

.journal-day.today {
  outline: 1px solid var(--line);
}

.journal-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.journal-day-head h3 {
  margin: 0;
  font-size: var(--text-base);
}

.journal-day-head h3::first-letter {
  text-transform: uppercase;
}

.day-flowers {
  display: flex;
  gap: 0.15rem;
}

.mini-flower {
  display: inline-grid;
}

.mini-flower .flower {
  width: 2rem;
  height: 2rem;
}

.journal-label {
  margin: 0.6rem 0 0.15rem;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.journal-day .thanks {
  margin: 0.25rem 0 0.4rem;
}

.mood-week {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  text-align: center;
}

.mood-week th {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--muted);
  padding: 0 0 0.3rem;
}

.mood-week th[scope="row"] {
  width: 1.8rem;
  text-align: left;
}

.mood-week td {
  height: 2.6rem;
  padding: 0;
}

.mood-week .mini-flower .flower {
  width: 2.1rem;
  height: 2.1rem;
}

.no-mood {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--line);
}

.no-mood.future {
  background: none;
  border: 1px dashed var(--line);
}

.bars {
  display: block;
  width: 100%;
  height: auto;
}

.bar-track {
  fill: var(--line);
  opacity: 0.45;
}

/* An empty week keeps its layout, only quieter, and says so kindly. */
.insight.empty .bar-track,
.insight.empty .no-mood {
  opacity: 0.4;
}

.insight.empty .bar-labels,
.insight.empty .mood-week th {
  opacity: 0.7;
}

.bar {
  fill: var(--bar);
}

.bar-labels {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin: 0.3rem 0 0.6rem;
  padding: 0;
  list-style: none;
  font-size: var(--text-xs);
  color: var(--muted);
  text-align: center;
}

.bar-count {
  display: block;
  font-weight: 500;
  color: var(--text);
  min-height: 1.1em;
}

.stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  margin: 0;
}

.stat {
  display: grid;
  gap: 0.1rem;
  padding: 0.75rem;
  border-radius: 16px;
  background: var(--surface-strong);
}

.stat dt {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--text-xs);
  color: var(--muted);
}

.stat dd {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 500;
}

.share {
  margin: 0.5rem 0 1rem;
}

.saved-list {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.saved-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.saved-meta form {
  margin: 0;
}

.checkin-reminder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
}

.checkin-time {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

.checkin-time input {
  flex: none;
  width: 7.5rem;
}

/* ── Challenges (spec 11, ADR-016) ─────────────────────────────────────── */

.section-title {
  margin: 1.5rem 0 0.75rem;
}

.cover {
  --cover: var(--apricot);
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 7;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 80% 20%, rgb(255 255 255 / 45%), transparent 45%),
    linear-gradient(140deg, var(--cover), rgb(207 198 232 / 70%));
  overflow: hidden;
  color: var(--cover-ink);
}

.tone-apricot {
  --cover: #f2b48c;
}

.tone-sage {
  --cover: #a9bfa3;
}

.tone-lavender {
  --cover: #cfc6e8;
}

.tone-plum {
  --cover: var(--tone-plum);
}

.cover-icon {
  width: 3rem;
  height: 3rem;
  opacity: 0.85;
}

.cover-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Text over a cover photo: white on a dark gradient whatever the theme,
   so it reads the same in light and dark (at least 7:1 where the text
   sits). The text grows the cover rather than spill out of it. */
.cover-stack,
.challenge-hero.has-photo {
  display: grid;
}

.cover-stack > *,
.challenge-hero.has-photo > * {
  grid-area: 1 / 1;
}

.cover-stack > .cover,
.challenge-hero.has-photo > .cover {
  align-self: stretch;
}

.cover-stack > .cover::after,
.challenge-hero.has-photo > .cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(28 20 27 / 85%), rgb(28 20 27 / 55%) 45%, rgb(28 20 27 / 0%) 85%);
}

.cover-caption,
.challenge-hero.has-photo .hero-text {
  position: relative;
  align-self: end;
  color: #fff;
  text-shadow: 0 1px 2px rgb(0 0 0 / 40%);
}

.cover-caption {
  padding: 2.5rem 1.1rem 0.7rem;
  font-size: var(--text-sm);
}

.challenge-hero {
  margin-bottom: 0.9rem;
}

.challenge-hero > .cover {
  margin-bottom: 0.9rem;
}

.challenge-hero .hero-text > * {
  margin: 0;
}

.challenge-hero .hero-text .page-title {
  margin-top: 0.15rem;
}

.challenge-hero.has-photo > .cover {
  aspect-ratio: 3 / 2;
  margin-bottom: 0;
}

.challenge-hero.has-photo .hero-text {
  padding: 3rem 1.1rem 1rem;
}

.challenge-hero.has-photo .challenge-meta {
  color: rgb(255 255 255 / 90%);
}

.challenge-list,
.friend-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.challenge-card {
  padding: 0;
  overflow: hidden;
}

.challenge-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.challenge-card .cover {
  border-radius: 0;
}

.challenge-body {
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem 1.1rem 1.1rem;
}

.challenge-meta,
.challenge-counts,
.challenge-friends {
  color: var(--muted);
  font-size: var(--text-sm);
}

.challenge-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 500;
}

.challenge-friends {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chips.small {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.chip-tag {
  font-size: var(--text-xs);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.active-challenge,
.challenge-today {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.active-challenge .cover,
.challenge-today .cover {
  aspect-ratio: 1;
  border-radius: 16px;
}

.active-challenge .challenge-body,
.challenge-today .challenge-body {
  padding: 0;
}

.challenge-today .btn {
  width: auto;
  justify-self: start;
}

/* The suggestion: its eyebrow heads the whole card, the cover sits beside
   the title, and the text column keeps one left edge. */
.recommended > .eyebrow {
  margin: 0 0 0.75rem;
}

.recommended .challenge-today {
  align-items: flex-start;
}

.challenge-pitch {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.recommended .challenge-body .btn {
  margin-top: 0.5rem;
}

progress.bar-line {
  appearance: none;
  width: 100%;
  height: 0.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  color: var(--primary);
}

progress.bar-line::-webkit-progress-bar {
  background: var(--line);
  border-radius: 999px;
}

progress.bar-line::-webkit-progress-value {
  background: var(--primary);
  border-radius: 999px;
}

progress.bar-line::-moz-progress-bar {
  background: var(--primary);
  border-radius: 999px;
}

.level-filter {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.level-filter .chip.current {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

.invite-card .actions,
.friend-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.invite-card .actions .btn,
.friend-card .actions .btn,
.member .btn,
.rows.people .btn {
  width: auto;
}

.confirm-switch > summary {
  list-style: none;
  width: auto;
}

.confirm-switch > summary::-webkit-details-marker {
  display: none;
}

.confirm-switch[open] > summary {
  opacity: 0.6;
}

.confirm-switch > .card,
.confirm-switch > .hint,
.confirm-switch > form {
  margin-top: 0.6rem;
}

.lead {
  font-size: var(--text-lg);
}

.rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.item-list,
.day-items,
.milestone-list,
.member-strip {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item-row {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.item-row:last-child {
  border-bottom: 0;
}

.item-desc {
  display: block;
  color: var(--muted);
  font-size: var(--text-sm);
}

.milestone-list li {
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.milestone-list li:last-child {
  border-bottom: 0;
}

.milestone-day {
  font-weight: 500;
  color: var(--primary);
}

.milestone-body {
  display: grid;
  gap: 0.15rem;
}

.milestone-body span {
  color: var(--muted);
  font-size: var(--text-sm);
}

/* Actions pinned above the tab bar: the page fades out under their top
   edge, and their background reaches down behind the tab bar, so no line
   of text shows between the button and the bar. */
.sticky-actions {
  position: sticky;
  bottom: calc(4.5rem + env(safe-area-inset-bottom));
  z-index: 1;
  margin: 1rem -1rem 0;
  padding: 1.25rem 1rem 0.75rem;
  background: linear-gradient(to bottom, transparent, var(--bg) 1.25rem);
}

.sticky-actions::after {
  content: "";
  position: absolute;
  inset: 100% 0 auto;
  height: 6rem;
  background: var(--bg);
}


.active-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu {
  position: relative;
}

.menu > summary {
  list-style: none;
  display: grid;
  place-items: center;
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu-body {
  position: absolute;
  right: 0;
  z-index: 5;
  width: min(18rem, 80vw);
  display: grid;
  gap: 0.5rem;
  background: var(--surface-strong);
}

.menu-body .btn {
  width: 100%;
  justify-content: flex-start;
}

.day-progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.25rem 0.6rem;
  align-items: baseline;
  margin-bottom: 1rem;
}

.day-progress progress {
  grid-column: 1 / -1;
}

.day-carousel {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 1rem;
  margin: 0 -1rem 1rem;
  padding: 0 1rem 0.25rem;
}

.day-card {
  flex: 0 0 85%;
  scroll-snap-align: start;
  margin: 0;
}

.day-card:not(.today) {
  opacity: 0.85;
}

.day-card.today {
  border: 1px solid var(--primary);
}

.day-card-head {
  margin-bottom: 0.25rem;
}

.day-item {
  display: grid;
  grid-template-columns: var(--tap) 2.6rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}

.day-item:last-child {
  border-bottom: 0;
}

.day-item.milestone,
.milestone-row {
  background: var(--milestone-bg);
  border-radius: 14px;
  border-bottom: 0;
  margin-bottom: 0.35rem;
}

.day-item .mark-btn::before,
.day-mark .mark-btn::before {
  content: "";
}

.day-item .mark-btn {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  margin: auto;
  color: transparent;
}

/* The circle stays small; its tap area is 44 pt. */
.day-item .mark-btn::after {
  content: "";
  position: absolute;
  inset: calc((2rem - var(--tap)) / 2);
}

.day-item.done .mark-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.day-item .mark-btn .ic {
  width: 1rem;
  height: 1rem;
}

.day-item.done .row-title {
  text-decoration: line-through;
  opacity: 0.7;
}

.skip-card form,
.group-card > .btn {
  width: auto;
}

.skip-card .btn,
.group-card > .btn {
  width: auto;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0.5rem;
}

.cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 1.4rem;
  border-radius: 8px;
  background: var(--line);
  font-size: var(--text-xs);
  color: var(--muted);
}

.cell.done {
  background: var(--cell-done);
  color: #2b2228;
}

.cell.skipped {
  background: var(--cell-skipped);
  color: #2b2228;
}

.cell.missed {
  background: transparent;
  border: 1px dashed var(--muted);
}

.cell.is-today {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  color: var(--text);
  font-weight: 500;
}

.cell.has-milestone {
  box-shadow: inset 0 -3px 0 var(--apricot);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  font-size: var(--text-xs);
  color: var(--muted);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend .cell {
  width: 0.9rem;
  min-width: 0;
  height: 0.9rem;
  aspect-ratio: auto;
}

.next-milestone {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.member-strip {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.member {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) auto;
  gap: 0.15rem 0.6rem;
  align-items: center;
}

.member .mini-avatar {
  grid-row: span 2;
}

.member-meta,
.member-done {
  font-size: var(--text-sm);
  color: var(--muted);
}

.member-meta .ic,
.flame-count .ic {
  width: 0.9rem;
  height: 0.9rem;
}

.member.done .member-done {
  color: var(--text);
}

.member > .btn,
.member > form {
  grid-column: 2 / -1;
  justify-self: start;
}

.mini-avatar {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--mini-avatar-bg);
  color: #2b2228;
  font-weight: 500;
}

.rows.people li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.person-name {
  flex: 1;
  font-weight: 500;
}

.card.gentle {
  background: linear-gradient(140deg, rgb(169 191 163 / 30%), var(--surface));
}

.challenge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--primary);
  margin-right: 0.15rem;
}

.challenge-tag svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.milestone-row {
  padding-right: 0.5rem;
}

/* ── Friends and flowers (spec 11.5-11.6, ADR-017) ─────────────────────── */

.defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.requests .actions {
  display: flex;
  gap: 0.4rem;
}

.requests .actions .btn {
  width: auto;
}

.bouquet-card,
.past-bouquet {
  text-align: center;
}

.bouquet-card .btn {
  width: auto;
}

svg.bouquet {
  display: block;
  width: min(15rem, 75%);
  max-height: 16rem;
  margin: 0 auto 0.5rem;
}

.bouquet .stems path {
  fill: none;
  stroke: #7f9b78;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.bouquet .leaf {
  fill: #a9bfa3;
}

.bouquet .bud {
  fill: #cfc6e8;
}

.bouquet .wrap {
  fill: var(--wrap-fill);
  stroke: var(--wrap-stroke);
  stroke-width: 1.5;
}

.bouquet .wrap-fold {
  fill: none;
  stroke: var(--wrap-stroke);
  stroke-width: 1.5;
}

.bouquet .bow {
  fill: #b98aa9;
}

.fl-tulip {
  fill: #ee8f8a;
}

.fl-tulip-in {
  fill: #d8706e;
}

.fl-daisy ellipse {
  fill: #fffdf8;
  stroke: var(--daisy-stroke);
  stroke-width: 0.6;
}

.fl-heart {
  fill: #f2c14e;
}

.fl-peony {
  fill: #f4b3c2;
}

.fl-peony-mid {
  fill: #ef9fb3;
}

.fl-peony-in {
  fill: #e88aa1;
}

.fl-stalk {
  fill: none;
  stroke: #7f9b78;
  stroke-width: 1.6;
}

.fl-lavender ellipse {
  fill: #a991d4;
}

.fl-sunflower ellipse {
  fill: #f2c14e;
}

.fl-seeds {
  fill: #7a5230;
}

.flower-icon {
  width: 1.6rem;
  height: 1.6rem;
  vertical-align: middle;
}

.friend-card {
  display: grid;
  gap: 0.35rem;
}

.friend-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.flame-count {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 500;
}

.friend-line {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.friend-flowers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.flower-options {
  border: 0;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.6rem;
}

.flower-option {
  position: relative;
  display: block;
}

.flower-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
}

.flower-choice {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  gap: 0 0.75rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}

.flower-choice .flower-icon {
  grid-row: span 2;
  width: 2.6rem;
  height: 2.6rem;
}

.flower-name {
  font-weight: 500;
}

.flower-meaning {
  color: var(--muted);
  font-size: var(--text-sm);
}

.flower-option input:checked + .flower-choice {
  border-color: var(--primary);
  background: var(--choice-on);
}

.flower-option input:focus-visible + .flower-choice {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.friend-link {
  text-align: center;
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

.friend-link .mini-avatar {
  width: 3.5rem;
  height: 3.5rem;
  font-size: var(--text-xl);
}

.field-group {
  grid-column: 1 / -1;
}

.field-heading {
  margin: 0.75rem 0 0;
  font-size: var(--text-base);
}

.day-item .row-text,
.item-row .row-text {
  display: grid;
  text-align: left;
  min-width: 0;
}

/* ── The journal's keys (ADR-022) ────────────────────────────────────── */

.keys {
  display: grid;
  gap: 1rem;
}

.keys > div {
  display: grid;
  gap: 0.75rem;
}

/* keys.js shows one step at a time. */
.keys [hidden] {
  display: none;
}

.keys-art {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--rest-bg);
  color: var(--primary);
}

.keys-art .ic {
  width: 2.25rem;
  height: 2.25rem;
}

.keys-points {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.keys-points li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.keys-points .ic {
  width: 1.4rem;
  height: 1.4rem;
  color: var(--primary);
}

/* The recovery code: large, even letters, wrapping between its groups. */
.recovery-code {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  font-size: var(--text-xl);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  line-height: 1.6;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
}

.verify-code {
  margin: 0.25rem 0;
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  text-align: center;
}

.code-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* A step's heading takes the focus for screen readers; it is not a
   control, so it draws no ring. */
.keys h1[tabindex="-1"]:focus,
.keys h2[tabindex="-1"]:focus {
  outline: none;
}

.keys-error {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: var(--error-bg);
}

.keys-device {
  margin: 0.5rem 0;
}

.keys-card .btn + .btn {
  margin-top: 0.5rem;
}

.trusted-list {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.keys-nudge h2 .ic {
  vertical-align: -0.15em;
}

/* ── Large text (Dynamic Type up to 200 % and more, spec 15) ─────────────
   Long words wrap instead of widening the page; rows of two give way to
   one; the top and tab bars, which iOS itself keeps small, grow only a
   little. */

h1,
h2,
h3,
.sheet-title,
.question,
.challenge-title,
.row-title,
.row-meta,
.item-desc,
label.check,
.stat dt,
.stat dd {
  overflow-wrap: break-word;
}

/* Headings hyphenate only when the text itself is large (app.js marks
   the page when Dynamic Type sets the root past 24 px): at the default
   size a Ukrainian heading wraps between words. */
.large-type h1,
.large-type h2,
.large-type .sheet-title,
.large-type .question {
  hyphens: auto;
}

label.check {
  max-width: 100%;
}

.brand {
  font-size: min(var(--text-lg), 23px);
}

.avatar {
  font-size: min(var(--text-lg), 22px);
}

.flame {
  font-size: min(var(--text-base), 20px);
}

.tab {
  font-size: min(var(--text-xs), 12.5px);
}

.mood-scale {
  flex-wrap: wrap;
  column-gap: 0.5rem;
}

.checkin-time {
  flex-wrap: wrap;
}

.checkin-time input {
  max-width: 100%;
}

/* A cover whose text is taller than its picture grows downwards at the
   width it has, instead of keeping its ratio and widening. */
.cover-stack,
.challenge-hero.has-photo {
  grid-template-columns: minmax(0, 1fr);
}

.cover-stack > .cover,
.challenge-hero.has-photo > .cover {
  width: 100%;
  min-width: 0;
}

/* Today's and the tab's challenge card: the body goes under the cover
   when the text no longer fits beside it. */
.active-challenge,
.challenge-today {
  display: flex;
  flex-wrap: wrap;
}

.active-challenge > .cover,
.challenge-today > .cover {
  flex: 0 0 5.5rem;
}

.active-challenge > .challenge-body,
.challenge-today > .challenge-body {
  flex: 1 1 9rem;
  min-width: 0;
}

.stats {
  display: flex;
  flex-wrap: wrap;
}

.stat {
  flex: 1 1 8rem;
  min-width: 0;
}

.milestone-body {
  min-width: 0;
  overflow-wrap: break-word;
}

.milestone-body > * {
  min-width: 0;
}

.rows li {
  flex-wrap: wrap;
}

.rows li > div {
  flex: 1 1 10rem;
  min-width: 0;
  overflow-wrap: break-word;
}

/* The birthday's wheels wrap, each at least as wide as its words. */
.date-wheels {
  display: flex;
  flex-wrap: wrap;
}

.date-wheels .wheel {
  flex: 1 1 5.75rem;
  min-width: 0;
}

.date-wheels .wheel:nth-of-type(2) {
  flex-basis: 8rem;
}

.choice span,
.choice small {
  min-width: 0;
  overflow-wrap: break-word;
}

/* Two choices a row while their words fit, one when the text is large;
   the challenges, each with its length under its name, one a row. */
.choices.multi,
.choices-vibe,
.choices-sign_on {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
}

.choices.choices-challenges {
  grid-template-columns: minmax(0, 1fr);
}

/* The day shown already has a ring of its own; focus draws a wider one. */
.week-strip .week-day:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
