/* Atode hi-fi components
   Uses only the role tokens from tokens.css. Look and feel from Figma
   section 156:1955 (3 Nov 2026), applied to every screen. */

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

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

body {
  margin: 0;
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: var(--leading-body);
}

h1, h2, p, ol, fieldset, legend { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
h1:focus { outline: none; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Frame */

.phone {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  background: var(--color-page);
}

@media (min-width: 480px) and (max-width: 767px) {
  body { padding: var(--space-6) 0; }
  .phone {
    width: 390px;
    min-height: 844px;
    margin: 0 auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
  }
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: inherit;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Header: "This can't wait" sits top right on every screen but Help.
   Figma 156:1955 has no help route; it stays for safety. */

.app-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--gutter) 0;
  margin-bottom: var(--space-4);
}
.app-header:not(:has(.help-pill)) { padding-bottom: var(--space-4); margin-bottom: 0; }
/* Header wordmark: tablet and desktop only (phones keep it beside the title). */
.app-header .wordmark-top { display: none; }

/* "I need help now" (Figma 169:867 / 160:1956): red, white cross icon. */
.help-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 13px 14px;
  background: var(--color-help);
  border: 1px solid var(--color-help);
  border-radius: 22px;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.3;
  color: var(--color-text-on-help);
  text-decoration: none;
  white-space: nowrap;
}
.help-pill img { flex-shrink: 0; }
.help-pill:active { background: var(--red-700); }

/* Phones, screens outside onboarding: the pill sits in the title row,
   top right, and there's no wordmark (Figma 169:867). From 768px the
   header row from the tablet layout takes over again. */
@media (max-width: 767px) {
  .screen:not(.onb) { position: relative; }
  .screen:not(.onb) .app-header {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    padding-bottom: 0;
  }
  .screen:not(.onb) .content { padding-top: calc(var(--space-3) + env(safe-area-inset-top)); }
  .screen:not(.onb) .page-head .wordmark { display: none; }
  .screen:not(.onb) .page-head h1 { padding-right: 178px; }
  #act-form .btn-inline { width: 100%; }
  /* Set by fitPill() in app.js when the title can't fit beside the pill:
     the pill takes its own row above the title (WCAG 1.4.10, 1.4.12). */
  .screen.pill-row:not(.onb) .app-header { position: static; padding-top: calc(var(--space-3) + env(safe-area-inset-top)); margin-bottom: var(--space-4); }
  .screen.pill-row:not(.onb) .content { padding-top: 0; }
  .screen.pill-row:not(.onb) .page-head h1 { padding-right: 0; }
}

/* Very long words break rather than spill out of their box. */
h1, .hero-title, .note-title, .question, .ticket-when, .sheet-title { overflow-wrap: break-word; }

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: 0 var(--gutter) var(--space-8);
}

.form-fill { flex: 1; display: flex; flex-direction: column; gap: var(--space-5); }

.push {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.push.center { align-items: center; }

/* Page title row: big black title, wordmark on the right (Figma "Frame 566") */

.page-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
  width: 100%;
}
.page-head h1 { flex: 1; min-width: 0; }
.wordmark { display: block; flex-shrink: 0; margin-top: 7px; }

.title-group { display: flex; flex-direction: column; gap: var(--space-5); width: 100%; }

/* Type */

h1 {
  font-size: var(--text-display);
  font-weight: var(--weight-black);
  line-height: var(--leading-tight);
  color: var(--color-text-heading);
}
.h1-display { font-size: var(--text-display); }

.h2 {
  font-size: var(--text-h2);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  color: var(--color-text-heading);
}

.step-label {
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--color-text);
}
.step-label-center { text-align: center; }

.body { font-size: var(--text-lg); line-height: var(--leading-body); color: var(--color-text-body); }
.hint { font-size: var(--text-md); line-height: var(--leading-body); color: var(--color-text-body); }
.small { font-size: var(--text-sm); line-height: var(--leading-body); color: var(--color-text-muted); }

.intro { font-size: var(--text-sm); line-height: var(--leading-body); color: var(--color-text-body); }
.intro p + p { margin-top: 22px; }
.intro-strong { font-weight: var(--weight-bold); color: var(--color-text); }

.lead { font-size: var(--text-lg); line-height: 1.5; color: var(--color-text-body); }
.lead p + p { margin-top: var(--space-4); }

.eyebrow {
  font-size: var(--text-sm);   /* Figma 13 */
  font-weight: var(--weight-medium);
  line-height: 1.2;
  letter-spacing: 0.2px;
  color: var(--color-text-muted);
}

.question {
  font-family: var(--font);
  font-size: var(--text-h1);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  color: var(--color-text-heading);
}
.question-lg { font-family: var(--font); font-size: var(--text-h1); line-height: 1.2; }

.section-heading {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: 1.3;
  color: var(--color-text-heading);
}

.stack-sm > * + * { margin-top: 10px; }
.stack-xs > * + * { margin-top: var(--space-2); }
.stack-md > * + * { margin-top: var(--space-4); }

.link {
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  line-height: var(--leading-body);
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.link-sm { font-size: var(--text-sm); }

.error {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--color-error);
  border-left: 4px solid var(--color-error);
  padding-left: 10px;
}

/* Buttons: yellow with a black outline (Figma "Button / Primary") */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--button-height);
  padding: 15px var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary {
  border-radius: 16px;
  background: var(--color-primary);
  border-color: var(--color-primary-border);
  color: var(--color-text-on-primary);
}
.btn-primary:active { background: var(--color-primary-pressed); }
.btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
  font-weight: var(--weight-medium);
}
.btn-secondary:active { background: var(--color-surface-warm); }
.btn-danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--color-text-on-danger);
}
.btn-inline { width: min(302px, 100%); align-self: flex-start; }

/* Back: Figma's is 22px tall; padding makes the tap area 44px without moving it. */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  min-height: 44px;
  margin: -11px 0;
  padding: 0 var(--space-2) 0 0;
  background: none;
  border: 0;
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 22px;
  letter-spacing: 0.2px;
  color: var(--color-text-heading);
  text-decoration: none;
  cursor: pointer;
}

/* Surfaces */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}

/* Tinted cards on Home (Figma "Frame 570" and "Frame 571") */
.tint-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5);
  border-radius: var(--radius-xl);
}
.tint-cool { background: var(--color-surface-cool); }
.tint-warm { background: var(--color-surface-warm); }
/* Wraps so the picture drops below "Thought Note" when there isn't room
   beside it (320px / 400% zoom), instead of covering the title. */
.tint-card-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-2); }
.tint-card-text { display: flex; flex-direction: column; gap: var(--space-2); flex: 1 1 0; min-width: min-content; max-width: 100%; }
.tint-card-top .illus-thumb { margin-left: auto; }
.hero-title {
  font-size: var(--text-hero);
  font-weight: var(--weight-black);
  line-height: 1.1;
  color: var(--color-text-heading);
}
.card-title { font-size: var(--text-lg); font-weight: var(--weight-bold); line-height: 1.4; color: var(--color-text-heading); }

/* Illustration slot. The picture comes from assets/illustrations/; if it's
   missing, the simple icon underneath shows instead. */
.illus {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--color-surface-cool);
  border-radius: var(--radius-xl);
  color: var(--color-text);
}
.illus img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.illus-hero {
  height: 220px;
  background: var(--color-hero);
  border: 1px solid var(--color-border-hero);
}
.illus-hero:has(img) { background: none; border: 0; }
.illus-clock { height: 160px; }
.illus-thought { height: 100px; }
.illus-hand { height: 150px; }
/* Figma "Illustration · A thought safely held", exported at 88px. */
.illus-thumb { width: 88px; height: 88px; border-radius: var(--radius-sm); background: transparent; }

/* Safety note */

.safety {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-surface-warm);
  border-radius: var(--radius-xl);
}
.safety-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  line-height: 1.6;
  color: var(--color-text-heading);
}
.icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: 50%;
}

/* Steps: one sticky-note colour each */

.steps { list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }
.step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 0;
}
.step:nth-child(1) { background: var(--note-yellow); }
.step:nth-child(2) { background: var(--note-pink); }
.step:nth-child(3) { background: var(--note-blue); }
.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--color-selected);
  border-radius: 50%;
  font-size: var(--text-lg);
  font-weight: var(--weight-black);
  line-height: 1;
  color: var(--color-text-on-selected);
}
.step-title { font-size: var(--text-h2); font-weight: var(--weight-black); line-height: 1.3; color: var(--color-text-heading); }
.step-text { margin-top: 2px; font-size: var(--text-md); line-height: var(--leading-body); color: var(--color-text); }

/* Radio options (collection time) */

.fieldset { display: flex; flex-direction: column; gap: var(--space-4); }
.fieldset > legend { margin-bottom: var(--space-4); }

.options { display: flex; flex-direction: column; gap: var(--space-3); }

.option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 54px;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--text-lg);
  line-height: 22px;
  color: var(--color-text);
  cursor: pointer;
}
.option input {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 2px solid var(--color-border-strong);
  border-radius: 50%;
  background: var(--color-surface);
}
.option input:checked { border: 5px solid var(--color-surface); background: var(--color-selected); box-shadow: 0 0 0 1px var(--color-surface); }
.option input:focus-visible { outline: none; }
.option:has(input:checked) {
  background: var(--color-selected);
  border-color: var(--color-selected-border);
  font-weight: var(--weight-semibold);
  color: var(--color-text-on-selected);
}
.option:has(input:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.other-time { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-1); }
.other-time input {
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: var(--text-lg);
}

/* Reminder row and switch */

.reminder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 14px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.reminder-label { display: block; font-size: var(--text-lg); line-height: var(--leading-body); color: var(--color-text-heading); cursor: pointer; }
.reminder-note { margin-top: 2px; font-size: var(--text-sm); line-height: var(--leading-body); color: var(--color-text-body); }

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 32px;
  margin: 0;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-border-strong);
}
.switch:checked { background: var(--color-primary); }
.switch:checked::after { left: 22px; background: var(--color-selected); }
@media (prefers-reduced-motion: no-preference) {
  .switch::after { transition: left 0.15s ease; }
}

/* Choice tiles (topics) and pills (refocus). Selected = black, like the
   Figma choice pills, plus a tick so it doesn't rely on colour alone. */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 60px;
  padding: 12px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--text-lg);
  line-height: 1.3;
  text-align: center;
  color: var(--color-text);
  cursor: pointer;
}
.tile-wide { grid-column: 1 / -1; }
.tile-pill { min-height: var(--tap-min); padding: 12px; border-radius: var(--radius-pill); font-family: var(--font-ui); font-size: var(--text-md); }
.tile input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.tile:has(input:checked) {
  background: var(--color-selected);
  border-color: var(--color-selected-border);
  font-weight: var(--weight-semibold);
  color: var(--color-text-on-selected);
}
.tile:has(input:checked)::before { content: "✓"; font-weight: var(--weight-bold); }
.tile:has(input:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 2px; }

/* Text input */

.words { display: flex; flex-direction: column; gap: var(--space-2); }
.words label { font-size: var(--text-sm); line-height: 1.3; color: var(--color-text-body); }
.words textarea {
  width: 100%;
  min-height: 76px;
  padding: var(--space-3);
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  box-shadow: var(--shadow-field);
  font-size: var(--text-lg);
  line-height: 1.3;
  color: var(--color-text-heading);
  resize: vertical;
}
.words textarea::placeholder { color: var(--color-text-muted); opacity: 1; }
.words-label-lg.words-label-lg { font-size: var(--text-lg); line-height: 1.45; color: var(--color-text); }

.skip { align-self: center; font-size: var(--text-sm); }

/* Ticket: a yellow sticky note with a dashed edge */

.ticket {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--space-5);
  background: var(--note-yellow);
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-note);
  box-shadow: var(--shadow-note);
  rotate: -1deg;
}
.ticket-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-sm);
  line-height: 20px;
  color: var(--color-text);
}
.ticket-no { font-weight: var(--weight-semibold); letter-spacing: 1px; text-transform: uppercase; }
.ticket-when { font-size: var(--text-h1); font-weight: var(--weight-black); line-height: var(--leading-tight); color: var(--color-text-heading); }
.ticket-note { font-size: var(--text-md); line-height: var(--leading-body); color: var(--color-text); }
.ticket-actions { display: flex; justify-content: space-between; padding-top: var(--space-2); }

.footnote { font-size: var(--text-sm); line-height: var(--leading-body); color: var(--color-text-body); text-align: center; }

/* Help */

.contact { display: flex; flex-direction: column; gap: 6px; }
.contact-label { font-size: var(--text-sm); font-weight: var(--weight-bold); line-height: 20px; color: var(--color-text-heading); }

/* Home: worry time */

.schedule { display: flex; flex-direction: column; gap: 6px; }
.schedule-time {
  font-size: var(--text-time);
  font-weight: var(--weight-black);
  line-height: 1.05;
  color: var(--color-text-heading);
  font-variant-numeric: tabular-nums;
}
.schedule-status { font-size: var(--text-sm); line-height: 1.3; color: var(--color-text); }  /* Figma 13 */
/* "Get a notification too": 44px tap area without moving the card's layout. */
.schedule-ask { align-self: flex-start; min-height: 44px; margin: -10px 0 -6px; text-align: left; }

/* Worry time reminder on Home: a stack of sticky notes in the Review Notes
   style. The front note is yellow; one paper layer shows behind it for each
   extra waiting note (data-layers 1 to 3, capped), peeking out underneath.
   The layers are decoration only: the count is said in the text. */
.nudge {
  position: relative;
  isolation: isolate;
}
.nudge[data-layers="2"] { padding-bottom: 14px; }
.nudge[data-layers="3"] { padding-bottom: 28px; }
.nudge::before,
.nudge::after {
  content: "";
  position: absolute;
  inset: 0 0 0 0;
  z-index: -1;
  border-radius: var(--radius-note);
  box-shadow: var(--shadow-note);
  display: none;
}
.nudge[data-layers="2"]::before,
.nudge[data-layers="3"]::before {
  display: block;
  inset: 12px 6px 0 6px;
  background: var(--note-pink);
  rotate: 1.5deg;
}
.nudge[data-layers="3"]::before { inset: 12px 6px 12px 6px; }
.nudge[data-layers="3"]::after {
  display: block;
  z-index: -2;
  inset: 24px 12px 0 12px;
  background: var(--note-blue);
  rotate: -1.5deg;
}
/* Wide cards: the same tilt would swing the corners too far. */
@media (min-width: 768px) {
  .nudge[data-layers="2"]::before, .nudge[data-layers="3"]::before { rotate: 0.6deg; }
  .nudge[data-layers="3"]::after { rotate: -0.6deg; }
}
.nudge-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--note-yellow);
  border-radius: var(--radius-note);
  box-shadow: var(--shadow-note);
  color: var(--color-text);
}
.nudge-count { font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.2; }
.nudge-title { font-size: var(--text-h2); font-weight: var(--weight-black); line-height: 1.3; color: var(--color-text-heading); }
.nudge-body { font-size: var(--text-md); line-height: var(--leading-body); color: var(--color-text); }
.nudge-actions { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding-top: var(--space-2); }
/* Yellow button on a yellow note: an ink edge keeps it a clear button. */
.nudge .btn-primary { border: 2px solid var(--color-border-strong); }
.nudge-actions .link { min-height: 44px; padding: 0 var(--space-3); color: var(--color-text); }
/* High contrast mode: paper colours drop out, so give the front note an edge. */
@media (forced-colors: active) {
  .nudge-card, .nudge::before, .nudge::after { border: 2px solid CanvasText; }
}

.early-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 44px;
  margin: -12px 0;
  font-size: var(--text-sm);
  line-height: 1.2;
  color: var(--color-text);
}
.early-link span { text-decoration: underline; text-underline-offset: 3px; }
.early-link[data-later] { justify-content: flex-start; margin: 0; }

/* Review Notes: sticky-note stack (Figma 150:1923). Each note overlaps the
   one above by 18px and tilts a little; colours go yellow, pink, blue, lilac. */

.divider { width: 100%; height: 1px; margin: 0; border: 0; background: var(--color-border); }

/* Tabs (Figma 169:1017): yellow dot and underline on the open tab. */
.tabs { display: flex; align-items: center; gap: var(--space-3); }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0;
  background: none;
  border: 0;
  font-family: var(--font);
  font-size: var(--text-sm);
  line-height: 1.3;
  color: var(--ink-800);
  cursor: pointer;
}
.tab[aria-pressed="true"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tab[aria-pressed="true"] { font-weight: var(--weight-semibold); text-decoration: underline; text-underline-offset: 4px; }
.tab[aria-pressed="true"]::before { background: var(--color-primary); }

.note-stack { list-style: none; margin: 0; padding: var(--space-1) 0 var(--space-2); display: flex; flex-direction: column; }
.note-stack > li + li { margin-top: -18px; }

.note {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  min-height: 160px;
  padding: var(--space-5) var(--space-5) 38px;
  border: 0;
  border-radius: var(--radius-note);
  box-shadow: var(--shadow-note);
  font: inherit;
  text-align: left;
  color: var(--color-text);
}
button.note { cursor: pointer; }
.note:focus-visible { z-index: 2; outline-offset: 3px; }
.note-0 { background: var(--note-yellow); }
.note-1 { background: var(--note-pink); rotate: -2deg; }
.note-2 { background: var(--note-blue); rotate: 2deg; }
.note-3 { background: var(--note-lilac); rotate: -2deg; }
.note-meta { font-size: var(--text-sm); line-height: 1.2; }  /* Figma 13 */
.note-head { display: flex; align-items: center; gap: var(--space-2); }
.note-head img { flex-shrink: 0; }
.note-title {
  flex: 1;
  min-width: 0;
  font-size: var(--text-h1);
  font-weight: var(--weight-black);
  line-height: var(--leading-tight);
}
.note-words { font-size: var(--text-sm); line-height: 1.3; }
.note-extra { font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.3; }

/* Review Note: topic chip, choice pills (Figma 150:1653 to 150:1859) */

/* Figma 12px, raised to 14. */
.topic-chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: var(--space-1) var(--space-5);
  background: var(--color-chip);
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: 22px;
  letter-spacing: 0.2px;
  color: var(--color-text-heading);
}

.choice-row { display: flex; gap: var(--space-6); }
.choice-row .choice { flex: 1; min-width: 0; padding-left: var(--space-2); padding-right: var(--space-2); }
.choices { display: flex; flex-direction: column; gap: var(--space-6); }

.choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap-min);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 22px;
  letter-spacing: 0.2px;
  text-align: center;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
}
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-strong, .choice:has(input:checked), .choice:active {
  background: var(--color-selected);
  border-color: var(--color-selected-border);
  font-weight: var(--weight-semibold);
  color: var(--color-text-on-selected);
}
.choice:has(input:checked)::before { content: "✓"; font-weight: var(--weight-bold); }
.choice:has(input:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.fieldset-tight { gap: var(--space-3); }
.fieldset-tight > legend { margin-bottom: var(--space-3); }

.act-more { display: flex; flex-direction: column; gap: var(--space-6); }
.act-more .words { gap: var(--space-4); }

/* Past note (opened from Past Notes) */
.note-dates { font-size: var(--text-sm); line-height: 1.4; color: var(--color-text-muted); }
.past-block { display: flex; flex-direction: column; gap: var(--space-2); }
.past-answer {
  align-self: flex-start;
  padding: var(--space-2) var(--space-4);
  background: var(--color-selected);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  line-height: 22px;
  color: var(--color-text-on-selected);
}
.past-note-text {
  padding: var(--space-4);
  background: var(--note-yellow);
  border-radius: var(--radius-sm);
  font-size: var(--text-lg);
  line-height: 1.5;
  color: var(--color-text);
  white-space: pre-wrap;
}
.past-note-text.is-empty { background: var(--color-surface-warm); color: var(--color-text-body); }
.note-extra { margin-top: auto; }

/* Outline button (Figma 172:1227 "Download or email report", 172:1282) */
.btn-outline {
  gap: var(--space-2);
  border-radius: 16px;
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn-outline:active { background: var(--color-surface-warm); }
.btn-outline img { flex-shrink: 0; }
.btn-outline[disabled], .btn-primary[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Download Report sheet (Figma 172:1270): a white card over a dimmed page.
   Uses <dialog>, so focus stays inside and Esc closes it. */
.sheet {
  width: min(347px, calc(100% - 2 * var(--space-5)));
  max-height: calc(100dvh - 2 * var(--space-5));
  margin: auto;
  padding: var(--space-4);
  border: 0;
  border-radius: var(--radius-note);
  background: var(--color-surface);
  color: var(--color-text);
  overflow-y: auto;
}
.sheet[open] { display: flex; flex-direction: column; gap: var(--space-4); }
.sheet::backdrop { background: rgba(26, 26, 46, 0.55); }
.sheet-head { display: flex; align-items: flex-start; gap: var(--space-4); }
.sheet-title {
  flex: 1;
  font-size: var(--text-display);
  font-weight: var(--weight-black);
  line-height: 1.2;
  color: var(--color-text-heading);
}
.sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -10px -10px 0 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.sheet-text { font-size: var(--text-sm); line-height: 1.45; color: var(--ink-800); }
.sheet-status { font-size: var(--text-sm); line-height: 1.45; color: var(--color-text-body); }
.sheet-status:empty { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: sheet-in var(--motion-page) var(--ease-out) both; }
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@media (min-width: 768px) {
  .sheet { width: min(440px, calc(100% - 2 * var(--space-12))); padding: var(--space-6); }
  #review .btn-outline[data-report-open] { width: auto; align-self: flex-start; min-width: 260px; }
}

/* Column wrappers: no effect on phones, two columns on tablets (below). */
.split, .split > .col, .narrow { display: contents; }

/* Tablet and desktop (3 Nov review). Phones are untouched: everything
   below only applies from 768px.
   - The wordmark moves to the header, so titles get the full width
     instead of wrapping one word per line beside it.
   - Type steps up so text isn't phone-sized on a big screen.
   - Portrait tablets (768-1023) get one centred column, not two cramped
     ones. Two columns start at 1024 (Figma 130:1445, 1024x768).
   - Content is held in a centred column of fixed maximum width, and on
     landscape screens it is centred vertically, so it doesn't sit in the
     top half with an empty page below. */
@media (min-width: 768px) {
  :root {
    --wrap: 600px;
    --text-display: 40px;
    --text-h1: 30px;
    --text-question: 30px;
    --text-h2: 20px;
    --text-lg: 18px;
    --text-md: 17px;
    --text-sm: 15px;
  }

  .phone { width: 100%; }

  .app-header,
  .content {
    width: 100%;
    max-width: calc(var(--wrap) + 2 * var(--space-12));
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-12);
    padding-right: var(--space-12);
  }
  .app-header {
    justify-content: space-between;
    min-height: calc(44px + var(--space-6) + env(safe-area-inset-top));
    padding-top: calc(var(--space-6) + env(safe-area-inset-top));
    margin-bottom: 0;
  }
  .app-header:not(:has(.help-pill)) { padding-bottom: 0; }
  .app-header .wordmark-top { display: block; width: 89px; height: auto; margin: 0; }
  .page-head .wordmark { display: none; }

  .content { gap: var(--space-6); padding-top: var(--space-10); padding-bottom: var(--space-12); }
  .lead, .intro { max-width: 60ch; }

  .tint-card, .step { padding: var(--space-6); }

  .illus-hero, .illus-clock, .illus-hand { height: auto; max-height: 260px; }
  .illus-hero { aspect-ratio: 342 / 220; }
  .illus-clock { aspect-ratio: 342 / 160; }
  .illus-hand { aspect-ratio: 342 / 150; }

  .push { margin-top: var(--space-2); }
  .push .btn { width: auto; min-width: 260px; align-self: flex-start; }
  .push.center { align-items: flex-start; }
  .step-label-center { text-align: left; }
  .skip { align-self: flex-start; }

  .narrow { display: flex; flex-direction: column; gap: var(--space-6); width: 100%; }
}

/* Landscape tablet and desktop: two columns, vertically centred. */
@media (min-width: 1024px) {
  :root { --wrap: 928px; }

  .content { justify-content: center; padding-top: var(--space-8); }
  .form-fill, .split-hero { flex: none; }

  .split { display: grid; gap: var(--space-12); align-items: start; }
  .split > .col { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
  .split-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
  .split-form { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .split-list { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); }
  .split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-8); }
  #home .split-even, #add .split-even { align-items: stretch; }
  form.split { flex: none; }

  .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
  .step { flex-direction: column; }

  .narrow { max-width: 640px; margin: 0 auto; }
}

@media (min-width: 1280px) {
  :root { --wrap: 1040px; --text-display: 44px; }
}

/* Onboarding (Figma 160:1956, 3 Nov 2026)
   The six onboarding screens (.onb) use the newer look: white page,
   wordmark in a header row on phones too, lilac surfaces, a violet
   accent, yellow selection, ExtraBold titles. The rest of the app keeps
   the 156:1955 style above. Layout from 768px is unchanged.
   Deviations from Figma, for accessibility: control edges are
   --onb-line-control (3:1) not #e6e0ef; 13px labels are 14px. */

.screen.onb { background: var(--color-surface); color: var(--onb-ink); }

/* Header row: wordmark left, pill right, on phones as well. */
.onb .app-header { justify-content: space-between; margin-bottom: var(--space-5); }
.onb .app-header .wordmark-top { display: block; }
.onb .app-header:not(:has(.help-pill)) { padding-bottom: 0; margin-bottom: var(--space-5); }
.onb .page-head .wordmark { display: none; }

.onb h1 {
  font-size: var(--text-onb-title);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--onb-ink);
}
#welcome h1, #how h1 { font-size: var(--text-onb-hero); }

.onb .title-group { gap: 6px; }
.onb .title-group:has(.back) { gap: var(--space-2); }
.onb .back { font-family: var(--font); color: var(--onb-ink); }
.onb .step-label { font-family: var(--font); font-size: var(--text-sm); line-height: 20px; letter-spacing: 0.2px; color: var(--onb-muted); }

.onb .content { gap: var(--space-5); }
#time .content, #time .form-fill { gap: 14px; }
#worry .content, #worry .form-fill, #help .content { gap: var(--space-3); }
#ticket .content { gap: 18px; }

.onb .body, .onb .hint { color: var(--onb-ink); }
.onb .body { font-size: var(--text-lg); line-height: 1.5; }
.onb .hint { line-height: 1.5; }
.onb .small { line-height: 1.5; color: var(--onb-muted); }
.onb .link { font-weight: var(--weight-regular); line-height: 1.45; color: var(--onb-ink); }

/* Buttons: yellow, no outline, 16px corners */
.onb .btn { border-radius: 16px; }
.onb .btn-primary { background: var(--onb-yellow); border-color: var(--onb-yellow); color: var(--onb-ink); }
.onb .btn-primary:active { background: var(--color-primary-pressed); }
.onb .btn-secondary {
  background: var(--onb-lilac-50);
  border-color: var(--onb-line);
  font-weight: var(--weight-regular);
  color: var(--onb-ink);
}
.onb .btn-secondary:active { background: var(--onb-lilac-200); }
.onb .btn-danger { background: var(--onb-ink); border-color: var(--onb-ink); }

/* Illustrations: lilac cloud characters in an edged box */
.onb .illus { background: var(--onb-lilac-50); border: 1px solid var(--onb-line); border-radius: var(--radius-lg); }
.onb .illus-hero { border-radius: var(--radius-xl); }
.onb .illus:has(img) { background: var(--onb-lilac-50); border: 1px solid var(--onb-line); }

/* Safety note */
.onb .safety {
  gap: var(--space-2);
  padding: 14px;
  background: var(--onb-lilac-50);
  border: 1px solid var(--onb-line);
  border-radius: 16px;
}
.onb .safety-title { gap: var(--space-2); font-weight: var(--weight-semibold); line-height: 1.3; }
.onb .icon-badge { border-color: var(--onb-line); border-radius: 12px; }

/* Steps: yellow, violet, lilac */
.onb .step {
  align-items: center;
  padding: var(--space-4);
  border: 1px solid var(--onb-line);
  border-radius: 16px;
}
.onb .step:nth-child(1) { background: var(--onb-yellow); }
.onb .step:nth-child(2) { background: var(--onb-violet); color: var(--color-surface); }
.onb .step:nth-child(3) { background: var(--onb-lilac-50); }
.onb .step-num { background: var(--onb-ink); font-weight: var(--weight-bold); }
.onb .step:nth-child(2) .step-num { background: var(--color-surface); color: var(--onb-ink); }
.onb .step:nth-child(3) .step-num { background: var(--onb-lilac-200); color: var(--onb-ink); }
.onb .step-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: 1.4; color: inherit; }
.onb .step-text { margin-top: var(--space-1); line-height: 1.5; color: inherit; }

/* Collection time options: selected is yellow with a filled dot */
.onb .options { gap: 10px; }
.onb .option { border-color: var(--onb-line-control); color: var(--onb-ink); }
.onb .option input { width: 14px; height: 14px; border: 1px solid var(--onb-line-control); }
.onb .option input:checked { border: 0; background: var(--onb-ink); box-shadow: none; }
.onb .option:has(input:checked) {
  background: var(--onb-yellow);
  border: 2px solid var(--onb-ink);
  padding: 15px;
  color: var(--onb-ink);
}

/* Reminder switch: violet when on */
.onb .reminder { border-color: var(--onb-line); }
.onb .reminder-label { font-size: var(--text-md); line-height: 1.5; color: var(--onb-ink); }
.onb .reminder-note { line-height: 1.5; color: var(--onb-muted); }
.onb .switch { border: 0; background: var(--onb-line-control); }
.onb .switch::after { top: 4px; left: 4px; background: var(--color-surface); }
.onb .switch:checked { background: var(--onb-violet); }
.onb .switch:checked::after { left: 24px; background: var(--color-surface); }

/* Topic tiles and refocus pills: white, thin edge; selected is yellow + tick */
.onb .tiles { gap: 10px; }
.onb .tile { min-height: 65px; border-color: var(--onb-line-control); color: var(--onb-ink); }
.onb .tile:has(input:checked) {
  background: var(--onb-yellow);
  border: 2px solid var(--onb-ink);
  color: var(--onb-ink);
}
.onb .tiles:has(.tile-pill) { display: flex; flex-wrap: wrap; }
.onb .tile-pill {
  min-height: var(--tap-min);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--text-lg);
}

.onb .words label { color: var(--onb-muted); }
.onb .words textarea {
  min-height: 72px;
  padding: var(--space-4) 14px;
  border-color: var(--onb-line-control);
  box-shadow: none;
  font-size: var(--text-md);
  color: var(--onb-ink);
}
.onb .words textarea::placeholder { color: var(--onb-muted); }
.onb .skip { font-weight: var(--weight-regular); }

/* Ticket: lilac, dashed edge, flat */
.onb .ticket {
  padding: var(--space-5);
  background: var(--onb-lilac-200);
  border: 2px dashed var(--onb-line-control);
  border-radius: 16px;
  box-shadow: none;
  rotate: none;
}
.onb .ticket-top { line-height: 1.5; color: var(--onb-muted-strong); }
.onb .ticket-no { letter-spacing: 1px; }
.onb .ticket-when { font-size: var(--text-onb-title); font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; color: var(--onb-ink); }
.onb .ticket-note { line-height: 1.5; color: var(--onb-ink); }
.onb .ticket-actions { padding-top: 0; }
.onb .ticket-actions .link { color: var(--onb-ink); }
.onb .h2 { font-weight: var(--weight-semibold); line-height: 1.3; color: var(--onb-ink); }
.onb .footnote { line-height: 1.5; color: var(--onb-muted); }

/* Help */
.onb .contact-label { font-weight: var(--weight-semibold); line-height: 1.4; color: var(--onb-ink); }

@media (min-width: 768px) {
  :root { --text-onb-hero: 40px; --text-onb-title: 32px; }
  .onb .app-header { margin-bottom: 0; }
  .onb .step { padding: var(--space-6); }
  .onb .content { gap: var(--space-6); }
  .onb .illus-thought { height: auto; max-height: 200px; aspect-ratio: 342 / 100; }
}
@media (min-width: 1024px) {
  .onb .step { align-items: flex-start; }
}
@media (min-width: 1280px) {
  :root { --text-onb-hero: 44px; }
}

/* Loading screen */

.splash {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-page);
}
.splash-mark { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.splash-mark img { display: block; }
.splash-bar {
  display: block;
  width: 48px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
}
.splash-out { opacity: 0; pointer-events: none; }

/* Screen changes fade for everyone (fading isn't movement); the slide
   is added below only when motion is welcome. */
.screen.enter, .screen.enter-back { animation: screen-fade var(--motion-page) var(--ease-soft) both; }
.screen.leave { opacity: 0; transition: opacity var(--motion-leave) ease; }

/* Motion: only when the person hasn't asked to reduce motion */

@media (prefers-reduced-motion: no-preference) {
  /* Logo rises in, the amber bar fills, then the whole screen fades away. */
  .splash-mark img { animation: splash-logo 600ms var(--ease-out) both; }
  .splash-bar { transform-origin: left; animation: splash-bar 700ms var(--ease-out) 350ms both; }
  .splash-out { transition: opacity 400ms ease; }
  .splash-out .splash-mark { transform: scale(1.04); transition: transform 400ms var(--ease-out); }

  .screen.enter { animation-name: screen-in; }
  .screen.enter-back { animation-name: screen-in-back; }

  /* The ticket lands a beat after the screen. */
  #ticket.enter .ticket { animation: ticket-in var(--motion-slow) var(--ease-spring) 80ms both; }

  .btn, .tile, .option, .choice, .note, .help-pill {
    transition:
      background-color var(--motion-fast) ease,
      border-color var(--motion-fast) ease,
      transform var(--motion-fast) var(--ease-out);
  }
  .btn:active, .tile:active, .option:active, .choice:active, button.note:active, .help-pill:active {
    transform: scale(0.98);
  }

  .tile:has(input:checked)::before,
  .choice:has(input:checked)::before { animation: tick-in var(--motion-fast) var(--ease-spring) both; }

  .error:not([hidden]) { animation: nudge 300ms var(--ease-out); }
}

@keyframes splash-logo {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes splash-bar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes screen-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes screen-in {
  from { opacity: 0; transform: translateX(var(--motion-distance)); }
  to { opacity: 1; transform: none; }
}
@keyframes screen-in-back {
  from { opacity: 0; transform: translateX(calc(var(--motion-distance) * -1)); }
  to { opacity: 1; transform: none; }
}
@keyframes ticket-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes tick-in {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: none; }
}
@keyframes nudge {
  0%, 100% { transform: none; }
  30% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
}

.noscript { padding: var(--space-6); }
