  /* iOS grouped-list palette. Secondary text and accent are darkened from the
     system values so small text clears 4.5:1. */
  :root {
    --bg: #f2f2f7; --card: #ffffff; --fill: #e9e9ee;
    --label: #000000; --label-2: #6c6c70; --sep: rgba(60, 60, 67, 0.18);
    --accent: #0071e3; --on-accent: #ffffff; --done: #248a3d; --error: #d70015;
    --bar: rgba(242, 242, 247, 0.86); --hover: rgba(0, 0, 0, 0.04);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #000000; --card: #1c1c1e; --fill: #2c2c2e;
      --label: #ffffff; --label-2: #aeaeb2; --sep: rgba(84, 84, 88, 0.6);
      --accent: #0a84ff; --on-accent: #ffffff; --done: #30d158; --error: #ff6961;
      --bar: rgba(0, 0, 0, 0.82); --hover: rgba(255, 255, 255, 0.06);
    }
  }
  * { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0; background: var(--bg); color: var(--label);
    font: 17px/22px -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  button { font: inherit; color: inherit; }
  a { color: var(--accent); }

  /* Top bar */
  .topbar {
    position: sticky; top: 0; z-index: 2;
    padding: calc(env(safe-area-inset-top) + 8px) 16px 12px;
    background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .topbar-row { display: flex; align-items: center; justify-content: space-between; height: 44px; max-width: 568px; margin: 0 auto; }
  .back {
    display: inline-flex; align-items: center; gap: 4px; min-width: 44px; height: 44px;
    margin-left: -8px; padding: 0 8px; border: 0; background: none; color: var(--accent); cursor: pointer;
  }
  .step-count { font-size: 15px; line-height: 20px; color: var(--label-2); font-variant-numeric: tabular-nums; }
  .bars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; max-width: 568px; margin: 4px auto 0; }
  .bars span { height: 4px; border-radius: 2px; background: var(--fill); transition: background-color 300ms var(--ease); }
  .bars span.on { background: var(--accent); }

  main { max-width: 600px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 168px); }
  .view { animation: enter 360ms var(--ease) both; }
  @keyframes enter { from { opacity: 0; transform: translateY(8px); } }
  @media (prefers-reduced-motion: reduce) { .view { animation: none; } }

  h1 { font-size: 34px; line-height: 41px; font-weight: 700; margin: 8px 0 8px; letter-spacing: 0.01em; }
  .lede { font-size: 17px; line-height: 22px; color: var(--label-2); margin: 0 0 24px; }
  .group-title { font-size: 13px; line-height: 18px; color: var(--label-2); margin: 24px 16px 8px; }
  .footnote { font-size: 13px; line-height: 18px; color: var(--label-2); margin: 8px 16px 0; }

  /* Inset grouped list */
  .list { background: var(--card); border-radius: 12px; overflow: hidden; margin: 0; padding: 0; list-style: none; }
  .row { display: flex; align-items: center; min-height: 44px; position: relative; }
  .row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 56px; height: 1px; background: var(--sep); transform: scaleY(0.5); transform-origin: top; }
  .list.plain .row + .row::before { left: 16px; }
  .check {
    flex: none; display: grid; place-items: center; width: 56px; height: 56px; padding: 0;
    border: 0; background: none; cursor: pointer;
  }
  .check i {
    display: grid; place-items: center; width: 24px; height: 24px; border-radius: 12px;
    border: 1.5px solid var(--label-2); transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
  }
  .check svg { opacity: 0; transition: opacity 160ms var(--ease); }
  .row.done .check i { background: var(--done); border-color: var(--done); }
  .row.done .check svg { opacity: 1; }
  .row-link {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
    padding: 12px 16px 12px 0; color: var(--label); text-decoration: none;
  }
  .row-text { flex: 1; min-width: 0; }
  .row-title { display: block; }
  .row.done .row-title { color: var(--label-2); }
  .row-sub { display: block; font-size: 15px; line-height: 20px; color: var(--label-2); margin-top: 2px; }
  .row-trail { flex: none; color: var(--label-2); font-size: 15px; }
  .copy-row { width: 100%; border: 0; background: none; padding-left: 16px; text-align: left; font: inherit; cursor: pointer; }
  .copy-row:active { background: var(--fill); }

  /* Form fields */
  .field { display: block; padding: 12px 16px; position: relative; }
  .form > * { position: relative; }
  .form > * + *::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 1px; background: var(--sep); transform: scaleY(0.5); transform-origin: top; }
  .field-pair { display: grid; grid-template-columns: 2fr 3fr; }
  .field-pair .field + .field { box-shadow: inset 0.5px 0 0 var(--sep); }
  .field span { display: block; font-size: 13px; line-height: 18px; color: var(--label-2); }
  .field .field-error { display: block; font-style: normal; font-size: 13px; line-height: 18px; color: var(--error); margin-top: 4px; }
  .field .field-error[hidden] { display: none; }
  .field.invalid span { color: var(--error); }
  .field input {
    width: 100%; padding: 2px 0 0; border: 0; outline: 0; background: none;
    font: inherit; color: var(--label);
  }
  .field input::placeholder { color: var(--label-2); opacity: 0.45; }
  .field:focus-within span { color: var(--accent); }

  /* The letter: the one rich moment */
  .letter {
    background: var(--card); border-radius: 12px; padding: 20px 16px 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }
  .letter-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--sep); }
  .stamp {
    flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
    background: var(--fill); color: var(--accent);
  }
  .letter-meta { font-size: 15px; line-height: 20px; color: var(--label-2); }
  .letter-meta strong { display: block; color: var(--label); font-weight: 600; font-size: 17px; line-height: 22px; }
  .letter-body {
    margin: 12px 0 0; font-size: 15px; line-height: 20px; color: var(--label-2);
    white-space: pre-wrap; max-height: 120px; overflow: hidden;
    -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent);
  }
  .letter.open .letter-body { max-height: none; -webkit-mask-image: none; mask-image: none; }
  .text-btn {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none;
    color: var(--accent); font-size: 17px; cursor: pointer;
  }
  .recipients { font-size: 15px; line-height: 20px; color: var(--label-2); margin: 0 16px; padding: 0 0 8px; }

  /* Buttons */
  .actions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
    padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
    background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .actions-inner { max-width: 568px; margin: 0 auto; }
  .btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px;
    padding: 0 20px; border: 0; border-radius: 12px; cursor: pointer; text-decoration: none;
    font-size: 17px; font-weight: 600; background: var(--accent); color: var(--on-accent);
    transition: transform 120ms var(--ease), opacity 120ms var(--ease);
  }
  .btn:active { transform: scale(0.98); opacity: 0.85; }
  .btn.tinted { background: var(--fill); color: var(--accent); }
  .btn + .btn { margin-top: 8px; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* Start and done screens */
  .facts { margin-top: 8px; }
  .fact { display: flex; gap: 16px; padding: 12px 0; }
  .fact svg { flex: none; color: var(--accent); margin-top: 1px; }
  .fact strong { display: block; font-weight: 600; }
  .fact span { display: block; color: var(--label-2); font-size: 15px; line-height: 20px; margin-top: 2px; }
  .brand { display: flex; align-items: center; gap: 8px; font-size: 17px; line-height: 22px; font-weight: 600; color: var(--accent); margin: 8px 0 0; }
  .brand img { border-radius: 7px; }
  .summary { display: flex; align-items: baseline; gap: 8px; margin: 0 0 24px; }
  .summary b { font-size: 34px; line-height: 41px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .summary span { color: var(--label-2); }
  .hidden { display: none; }
  .tabular { font-variant-numeric: tabular-nums; }
  .note { margin-top: 24px; }
  .facts-card { padding: 0 16px; }
  .copy-row .row-title { color: var(--accent); }

  /* Pointer devices: quiet hover feedback in the same surface steps as the rest of the UI. */
  @media (hover: hover) {
    .row:has(a.row-link):hover, .row:has(.copy-row):hover { background: var(--hover); }
    .check:hover i { border-color: var(--accent); }
    .btn:hover { opacity: 0.9; }
    .text-btn:hover, .back:hover, .brand a:hover { opacity: 0.7; }
  }

  /* Wide screens: the actions follow the content instead of sticking to the window bottom,
     and the column starts a little lower so the page does not hug the top edge. */
  @media (min-width: 768px) {
    main { padding: 48px 16px 0; }
    .actions {
      position: static; padding: 32px 16px 80px;
      background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    }
  }
