/* ============================================================
   Really — design tokens + mobile shell
   ============================================================ */

:root {
  /* -- type ------------------------------------------------- */
  /* Bowlby One is the brand voice. It is deliberately rationed:
     the wordmark, the verdict, the plan names and the home card
     titles. Spread it over ordinary chrome and it stops reading as
     a logo. */
  --font-display: "Bowlby One", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* -- ground & ink ---------------------------------------- */
  --bg:            #f0eee8;
  --surface:       #faf9f6;
  --ink:           #16232e;
  --ink-soft:      rgba(22, 35, 46, .58);
  --ink-faint:     rgba(22, 35, 46, .36);
  --line:          rgba(22, 35, 46, .12);
  --line-strong:   rgba(22, 35, 46, .20);
  --press:         rgba(22, 35, 46, .06);

  /* -- brand accent (interactive only) ---------------------- */
  --accent:        #33679e;
  --accent-on:     #f0eee8;
  --accent-tint:   rgba(51, 103, 158, .10);

  /* -- verdict signal — reserved, never used as chrome ------ */
  --ok:            #2b7a55;
  --ok-tint:       rgba(43, 122, 85, .13);
  --ok-ink:        #1f5b3f;

  --no:            #b4463a;
  --no-tint:       rgba(180, 70, 58, .13);
  --no-ink:        #8e3428;

  --maybe:         #9a7b3c;
  --maybe-tint:    rgba(154, 123, 60, .14);
  --maybe-ink:     #755c2b;
  /* --maybe-ink is tuned for 13px pill text, so it carries 6:1 and pays for
     it in chroma — enlarged it reads brown. The verdict headline is large
     text, where the bar is 3:1, and that budget buys a fully saturated gold
     (3.5:1 on the card, 3.2:1 on the page ground). */
  --maybe-head:    #ad7c00;

  --shadow:        0 1px 2px rgba(22, 35, 46, .04),
                   0 8px 24px -8px rgba(22, 35, 46, .14);

  /* -- metrics ---------------------------------------------- */
  --gutter:        14px;
  --bar-x:         20px;
  --safe-t:        env(safe-area-inset-top, 0px);
  --safe-b:        env(safe-area-inset-bottom, 0px);

  --p: 0;
  color-scheme: light;
}

/* Dark: the same app at night. Ground is the deep teal, the accent
   lightens so it still reads, and every signal colour is re-tuned
   for a dark field rather than simply reused. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
  :root:not([data-theme="light"]) {
    --bg:          #0c262b;
    --surface:     #123339;
    --ink:         #e9efec;
    --ink-soft:    rgba(233, 239, 236, .58);
    --ink-faint:   rgba(233, 239, 236, .34);
    --line:        rgba(233, 239, 236, .14);
    --line-strong: rgba(233, 239, 236, .24);
    --press:       rgba(233, 239, 236, .08);

    --accent:      #65a5c1;
    --accent-on:   #0c262b;
    --accent-tint: rgba(101, 165, 193, .14);

    --ok:          #6fbf92;
    --ok-tint:     rgba(111, 191, 146, .18);
    --ok-ink:      #8fd3ab;

    --no:          #e68b7c;
    --no-tint:     rgba(230, 139, 124, .18);
    --no-ink:      #f0a79a;

    --maybe:       #d6b26a;
    --maybe-tint:  rgba(214, 178, 106, .18);
    --maybe-ink:   #e3c489;
    --maybe-head:  var(--maybe-ink);

    --shadow:      0 1px 2px rgba(0, 0, 0, .28),
                   0 8px 24px -8px rgba(0, 0, 0, .45);
  }
}

/* Manual override wins in both directions. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:          #0c262b;
  --surface:     #123339;
  --ink:         #e9efec;
  --ink-soft:    rgba(233, 239, 236, .58);
  --ink-faint:   rgba(233, 239, 236, .34);
  --line:        rgba(233, 239, 236, .14);
  --line-strong: rgba(233, 239, 236, .24);
  --press:       rgba(233, 239, 236, .08);
  --accent:      #65a5c1;
  --accent-on:   #0c262b;
  --accent-tint: rgba(101, 165, 193, .14);
  --ok:          #6fbf92;
  --ok-tint:     rgba(111, 191, 146, .18);
  --ok-ink:      #8fd3ab;
  --no:          #e68b7c;
  --no-tint:     rgba(230, 139, 124, .18);
  --no-ink:      #f0a79a;
  --maybe:       #d6b26a;
  --maybe-tint:  rgba(214, 178, 106, .18);
  --maybe-ink:   #e3c489;
  --maybe-head:  var(--maybe-ink);
  --shadow:      0 1px 2px rgba(0, 0, 0, .28),
                 0 8px 24px -8px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

/* An author `display` rule beats the UA stylesheet's [hidden] { display: none },
   so elements toggled with el.hidden need this to actually disappear. */
[hidden] { display: none !important; }

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

body {
  /* Pinning the body removes the layout scroll that iOS would otherwise
     perform to lift a focused field clear of the keyboard — the shell
     already handles that itself. */
  position: fixed;
  inset: 0;

  background: var(--bg);
  color: var(--ink);
  font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

.app {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--bg);
  height: var(--vh, 100dvh);

  /* --vv-offset is written by the keyboard handler; the modal state adds its
     own scale on top, so the two must compose rather than overwrite. */
  transform: translateY(var(--vv-offset, 0px));
  transform-origin: 50% 0;
  transition: transform .42s cubic-bezier(.32, .72, 0, 1),
              border-radius .42s cubic-bezier(.32, .72, 0, 1);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

/* ---------------------------------------------------------- modal sheet */

/* Revealed only where the shell scales away from the edges. */
.stage-back {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #000;
}

/* The iOS card effect: the presenting view drops back and rounds off. */
body[data-modal] .app {
  transform: translateY(var(--vv-offset, 0px)) translateY(12px) scale(.926);
  border-radius: 14px;
  overflow: hidden;
}

.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: rgba(0, 0, 0, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .42s cubic-bezier(.32, .72, 0, 1);
}
body[data-modal] .modal-scrim { opacity: 1; pointer-events: auto; }

.sheet-view {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: calc(var(--safe-t) + 34px);
  z-index: 3;

  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 22px 22px 0 0;
  /* The stack starts just under the grab handle, 12px down, where the 22px
     corner has not curved in yet — unclipped, its square corners poke out
     past the rounding. */
  overflow: hidden;
  box-shadow: 0 -1px 0 var(--line), 0 -18px 40px -12px rgba(0, 0, 0, .32);

  transform: translateY(100%);
  visibility: hidden;
  /* The curve iOS uses for sheet presentation. */
  transition: transform .46s cubic-bezier(.32, .72, 0, 1),
              visibility 0s linear .46s;
}
body[data-modal="settings"] .sheet-view {
  transform: translateY(0);
  visibility: visible;
  transition: transform .46s cubic-bezier(.32, .72, 0, 1), visibility 0s;
}

/* While a finger is on it, position is set directly each frame. */
.sheet-view.dragging { transition: none; }

.sheet-grab {
  flex: none;
  width: 36px;
  height: 5px;
  margin: 7px auto 0;
  border-radius: 3px;
  background: var(--line-strong);
}

/* Back and Done share the top row; the title has the row under them to
   itself, flush left with the content, the same size on every page. The
   markup keeps Back and the title in .sheet-head-left, which steps aside
   (display: contents) so all three are placed on this grid. */
.sheet-head {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 4px;
  padding: 12px 20px 6px;
}
.sheet-head .sheet-back  { grid-row: 1; grid-column: 1; justify-self: start; }
.sheet-head .sheet-done  { grid-row: 1; grid-column: 2; }
.sheet-head .sheet-title { grid-row: 2; grid-column: 1 / -1; }

.sheet-title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
}

.sheet-done {
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: 500 16px/1 Manrope, sans-serif;
  cursor: pointer;
}
.sheet-done:active { opacity: .55; }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 10px 16px calc(var(--safe-b) + 28px);
}

/* -- page stack inside the sheet ---------------------------- */

.sheet-stack {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.sheet-page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .36s cubic-bezier(.32, .72, 0, 1),
              visibility 0s linear .36s;
}
.sheet-stack.no-anim .sheet-page { transition: none; }

.sheet-page.is-active {
  transform: none;
  visibility: visible;
  /* Without this the stack paints in DOM order, so pushing to a page that
     sits earlier in the markup (signin, from the Saved or Subscription wall)
     leaves the outgoing page painted on top of the incoming one. */
  z-index: 2;
  transition: transform .36s cubic-bezier(.32, .72, 0, 1), visibility 0s;
}
/* The page underneath slides a little the way iOS parallaxes it. */
.sheet-page.is-behind {
  transform: translateX(-26%);
  visibility: visible;
  z-index: 1;
  transition: transform .36s cubic-bezier(.32, .72, 0, 1), visibility 0s;
}

.sheet-head-left { display: contents; }

.sheet-back {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin-left: -6px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: 500 16px/1 Manrope, sans-serif;
  cursor: pointer;
}
.sheet-back svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.sheet-back:active { opacity: .55; }

.sheet-title--sm { font-size: 19px; }

/* -- grouped list ------------------------------------------- */

.group-label {
  margin: 18px 0 8px 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
/* Opening a page, the label sits under the title like a card would: the
   body's own top padding is the gap, not that plus 18. */
.sheet-body > .group-label:first-child { margin-top: 0; }

.group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 14px 14px 14px 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 500 15.5px/1.2 Manrope, sans-serif;
  text-align: left;
  cursor: pointer;
}
.row:active { background: var(--press); }
.row span { flex: 1; }

/* Inset to start under the label, the way a grouped iOS list does. */
.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 52px;
  right: 0;
  height: 1px;
  background: var(--line);
}

.row-icon,
.row-chev {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.row-icon { width: 21px; height: 21px; stroke-width: 1.6; color: var(--ink-soft); }
.row-chev { width: 15px; height: 15px; stroke-width: 2.1; color: var(--ink-faint); }

/* -- auth form ---------------------------------------------- */

.auth { display: block; }

.auth-intro {
  margin: 2px 4px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
}
.field + .field::before {
  content: "";
  position: absolute;
  top: 0; left: 16px; right: 0;
  height: 1px;
  background: var(--line);
}
.field > span {
  flex: none;
  width: 78px;
  font-size: 15px;
  color: var(--ink-soft);
}
.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  /* 16px keeps iOS from zooming the page on focus. */
  font: 400 16px/1.3 Manrope, -apple-system, sans-serif;
}
.field input::placeholder { color: var(--ink-faint); }

.auth-note {
  margin: 12px 4px 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--no-ink);
}
.auth-note[data-tone="info"] { color: var(--ink-soft); }

.auth-submit {
  width: 100%;
  margin-top: 18px;
  padding: 15px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-on);
  font: 600 16px/1 Manrope, sans-serif;
  cursor: pointer;
}
.auth-submit:disabled { opacity: .5; cursor: default; }
.auth-submit:not(:disabled):active { opacity: .82; }

.auth-toggle {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: 500 14px/1 Manrope, sans-serif;
  cursor: pointer;
}

/* -- usage -------------------------------------------------- */

.usage-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px 16px;
}
.usage-card + .usage-card { margin-top: 12px; }

.usage-plan {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.usage-figure {
  margin: 8px 0 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
}
.usage-figure small {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-faint);
}

.bar {
  height: 10px;
  margin-top: 14px;
  border-radius: 5px;
  background: var(--press);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--accent);
  transition: width .55s cubic-bezier(.32, .72, 0, 1);
}
/* A meter nearing its ceiling is a genuine warning, and no verdict pill is
   ever on this screen, so the signal colours are not competing here. */
.bar[data-level="warn"] i { background: var(--maybe); }
.bar[data-level="full"] i { background: var(--no); }

.usage-meta {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}

/* -- saved list --------------------------------------------- */

.saved-row {
  position: relative;
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.saved-row:active { background: var(--press); }
/* The payload is fetched before the sheet closes, so the row has to show
   that the tap registered. */
.saved-row[aria-busy="true"] { opacity: .5; }
.saved-row + .saved-row::before {
  content: "";
  position: absolute;
  top: 0; left: 16px; right: 0;
  height: 1px;
  background: var(--line);
}

.saved-claim {
  margin: 9px 0 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.saved-meta {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.pill--sm { padding: 3px 10px 3px 8px; font-size: 12px; }
.pill--sm svg { width: 13px; height: 13px; }

/* -- shared page states ------------------------------------- */

.state {
  padding: 34px 18px;
  text-align: center;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-faint);
}
.state strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
}

.state-action {
  margin-top: 14px;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 13.5px/1 Manrope, sans-serif;
  cursor: pointer;
}

/* Small enough to stay a list row, not a heading — the face does the
   distinguishing, not the size. */
/* Scoped through .row-stack b: the generic `.row-stack span` rule above
   turns any span in a row into a faint grey block, which would swallow
   both the size and the colour of a bare .plan-name. */
.row-stack b .plan-name {
  display: inline;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 14px;
  letter-spacing: -.005em;
  color: var(--accent);
}

/* On the dark ground the accent lightens to #65a5c1, which loses contrast
   against #123339 exactly where the heavy face needs it most. Plain ink
   carries better, and the display face alone is enough to set the names
   apart there. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .row-stack b .plan-name { color: var(--ink); }
}
:root[data-theme="dark"] .row-stack b .plan-name { color: var(--ink); }

.plan-tag {
  font-size: 12.5px;
  font-weight: 400;
  font-style: normal;
  color: var(--ink-faint);
}

.plan-price {
  flex: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
}

.state-action:disabled { opacity: .55; cursor: default; }

.resend-note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--no-ink);
}

/* Account row: email on top, action underneath. */
.row-stack { flex: 1; min-width: 0; }
.row-stack b {
  display: block;
  font-size: 15.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-stack span {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink-faint);
}
.row--danger { color: var(--no-ink); }
.row--danger .row-icon { color: currentColor; }

/* ---------------------------------------------------------- top bar */

.topbar {
  position: absolute;
  top: calc(var(--safe-t) + 16px);
  left: var(--bar-x);
  right: var(--bar-x);
  display: flex;
  align-items: center;
  gap: 9px;
  z-index: 8;
  pointer-events: none;
}

.avatar {
  flex: none;
  width:  clamp(26px, 7.4vw, 36px);
  height: clamp(26px, 7.4vw, 36px);
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  padding: 0;
  cursor: pointer;
  opacity: var(--avatar-o, 0);
  transform: scale(var(--avatar-s, .4));
  will-change: opacity, transform;
  position: relative;
}

/* Three stripes cut out of the disc in the ground colour. The bottom one
   runs half width — which also makes it the right length to become half
   of the arrowhead. */
.avatar i {
  position: absolute;
  left: calc(50% - 8px);
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--bg);
  transform-origin: 0 50%;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1),
              width     .3s cubic-bezier(.2, .8, .2, 1);
}
.avatar i:nth-child(1) { top: calc(50% - 6px); }
.avatar i:nth-child(2) { top: calc(50% - 1px); }
.avatar i:nth-child(3) { top: calc(50% + 4px); width: 8px; }

/* Open: the middle stripe stays as the shaft, the outer two swing down and
   up onto its left end to form the arrowhead. */
.app[data-menu="open"] .avatar i:nth-child(1) { width: 8px; transform: translateY(5px) rotate(-45deg); }
.app[data-menu="open"] .avatar i:nth-child(3) { width: 8px; transform: translateY(-5px) rotate(45deg); }

/* ---------------------------------------------------------- menu */

.backdrop {
  position: absolute;
  inset: 0;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
}
.app[data-menu="open"] .backdrop,
.app[data-attach="open"] .backdrop { pointer-events: auto; }

.menu {
  position: absolute;
  top: calc(var(--safe-t) + 56px);
  left: var(--bar-x);
  z-index: 7;
  width: 224px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);

  /* Origin sits on the button itself, so the box grows out of it. */
  transform-origin: 15px -25px;
  transform: scale(.68);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .22s cubic-bezier(.2, .9, .3, 1.05);
}
.app[data-menu="open"] .menu {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 11px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font: 500 14.5px/1 Manrope, sans-serif;
  text-align: left;
  cursor: pointer;
}
.menu-row:active { background: var(--press); }
.menu-row svg {
  flex: none;
  width: 19px; height: 19px;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  color: var(--ink-soft);
}

.menu-sep {
  height: 1px;
  margin: 6px 11px;
  background: var(--line);
}

.menu-theme { padding: 4px 11px 8px; }

.menu-cap {
  display: block;
  margin-bottom: 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 14px;
  background: var(--press);
}

.seg-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px 7px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font: 500 10.5px/1 Manrope, sans-serif;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.seg-btn svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.seg-btn[aria-checked="true"] {
  background: var(--accent-tint);
  color: var(--accent);
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 9.4vw, 46px);
  line-height: 1;
  letter-spacing: -.01em;
  white-space: nowrap;
  transform-origin: 0 0;
}
/* Only while it moves — see moving() in app.js for why not always. */
.brand.is-moving { will-change: transform; }

/* ---------------------------------------------------------- swipe hint */

.hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-b) + 12%);
  z-index: 2;
  translate: -50% 0;
  opacity: var(--hint-o, 1);
  transform: translateY(var(--hint-y, 0px));
  pointer-events: none;
  will-change: opacity, transform;
}

.chevrons { display: block; width: clamp(72px, 21vw, 104px); height: auto; }

.chev {
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linejoin: round;
  fill: none;
  vector-effect: non-scaling-stroke;
  opacity: .34;
  animation: chev-pulse 2.1s ease-in-out infinite;
}
.chev-3 { animation-delay: 0s;   }
.chev-2 { animation-delay: .16s; }
.chev-1 { animation-delay: .32s; }

@keyframes chev-pulse {
  0%, 62%, 100% { opacity: .26; transform: translateY(0); }
  26%           { opacity: .85; transform: translateY(-3px); }
}

/* ---------------------------------------------------------- thread */

.thread {
  position: absolute;
  inset: 0;
  padding: calc(var(--safe-t) + 82px) var(--gutter) calc(var(--dock-h, 96px) + var(--safe-b) + 28px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
  opacity: var(--p);
  pointer-events: none;
}

/* ---------------------------------------------------------- scrims */

/* The thread scrolls under the top bar and the dock. These fade it out
   instead of letting text be sliced off mid-line. */
.scrim {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  pointer-events: none;
  opacity: var(--p);
}
.scrim--top {
  top: 0;
  height: calc(var(--safe-t) + 74px);
  background: linear-gradient(to bottom, var(--bg) 58%, transparent);
}
.scrim--bottom {
  bottom: 0;
  height: calc(var(--dock-h, 96px) + var(--safe-b) + 30px);
  background: linear-gradient(to top, var(--bg) 46%, transparent);
}

/* ---------------------------------------------------------- verdict */

.verdict { animation: rise .42s cubic-bezier(.2, .8, .2, 1) both; }

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

.claim {
  margin: 0 4px 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* Same line, but the whole statement is the hit target — a 13px word on its
   own would be a miserable thing to tap. Left as a <button> so it is
   keyboard-reachable and announces its expanded state. */
.claim--toggle {
  display: block;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  cursor: pointer;
}
.claim--toggle:active { opacity: .6; }

.claim-more {
  margin-left: 5px;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

/* The same 0fr → 1fr grid the verdict detail uses, so both unrolls move
   with one motion. */
.claim-full {
  display: grid;
  grid-template-rows: 0fr;
  margin: 0 4px 10px;
  transition: grid-template-rows .38s cubic-bezier(.2, .8, .2, 1);
}
.claim-full > div { overflow: hidden; }
.claim-full.open { grid-template-rows: 1fr; }

.claim-raw {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
  /* The pasted original carries its own paragraph breaks; collapsing them
     turned it into one unreadable block. */
  white-space: pre-wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 15px 16px 14px;
}

/* The payoff. Same face as the wordmark, so the promise on the landing
   screen and the answer at the end of the run speak in one voice.
   Signal is still carried by icon + word + colour together, never colour
   alone — the mark is not decorative. */
.verdict-head {
  display: flex;
  align-items: center;
  gap: .3em;
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(25px, 7.8vw, 34px);
  line-height: 1.06;
  letter-spacing: -.015em;
  text-wrap: balance;
}

/* "Not enough evidence" is three words where the others are one, so it
   steps down rather than wrapping into a wall. */
.verdict-head--long { font-size: clamp(19px, 5.7vw, 25px); }

.verdict-mark {
  flex: none;
  width: .92em;
  height: .92em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.verdict-head--ok    { color: var(--ok-ink); }
.verdict-head--no    { color: var(--no-ink); }

.verdict-head--maybe { color: var(--maybe-head); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 12px 5px 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.005em;
}
.pill svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Signal is carried by tint + icon + word together — never colour alone,
   because red/green is exactly the pair that dichromats cannot separate. */
.pill--ok    { background: var(--ok-tint);    color: var(--ok-ink);    }
.pill--no    { background: var(--no-tint);    color: var(--no-ink);    }
.pill--maybe { background: var(--maybe-tint); color: var(--maybe-ink); }

.explain {
  margin: 11px 0 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}

.meta {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* -- home ----------------------------------------------------- */

/* The cards on an empty thread. Built from the verdict card so the first
   screen and the answer look like one app. */
.home > * { animation: rise .42s cubic-bezier(.2, .8, .2, 1) both; }
.home > * + * { margin-top: 12px; }
.home > .more { margin-top: 2px; }

/* Welcome is the one big display line here, sized like the verdict. */
.home-welcome {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(25px, 7.8vw, 34px);
  line-height: 1.06;
  letter-spacing: -.015em;
  color: var(--ink);
}

/* Card titles: the display face a step up from the plan names, in plain
   ink — the accent is kept for things that can be tapped. */
.home-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -.005em;
  color: var(--ink);
}

.home-meter:first-child { margin-top: 0; }
.home-meter { margin-top: 12px; }
.home-meter + .home-meter { margin-top: 14px; }
.home-meter-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.home-meter-row span:first-child { color: var(--ink-soft); font-weight: 500; }
.home-meter .bar { margin-top: 7px; }

/* Rows run edge to edge so the press state fills the card like a list. */
.card--list { padding-bottom: 0; overflow: hidden; }
.home-rows { margin: 4px -16px 0; }
.home-rows .saved-claim { -webkit-line-clamp: 2; }
.home-empty {
  margin: 10px 0 0;
  padding-bottom: 15px;
  font-size: 13.5px;
  color: var(--ink-faint);
}

/* -- waiting -------------------------------------------------- */

.card--waiting {
  display: flex;
  align-items: center;
  gap: 12px;
}
.card--waiting .explain { margin: 0; color: var(--ink-soft); font-size: 14.5px; }

.working { display: flex; gap: 4px; flex: none; }
.working i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
  animation: working 1.25s ease-in-out infinite;
}
.working i:nth-child(2) { animation-delay: .16s; }
.working i:nth-child(3) { animation-delay: .32s; }

@keyframes working {
  0%, 70%, 100% { opacity: .3; transform: translateY(0); }
  35%           { opacity: 1;  transform: translateY(-3px); }
}

/* -- request failure ------------------------------------------ */

.card--problem { border-color: var(--line-strong); }

.problem-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.problem-head svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  color: var(--ink-soft);
}

.retry {
  margin-top: 13px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 13.5px/1 Manrope, sans-serif;
  cursor: pointer;
}
.retry:active { background: var(--press); }

/* ---------------------------------------------------------- more */

.more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  margin: 10px 0 0;
  padding: 11px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink-soft);
  font: 500 13.5px/1 Manrope, sans-serif;
  cursor: pointer;
  scroll-margin-top: calc(var(--safe-t) + 80px);
}
.more:active { background: var(--press); }
.more svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}
.more[aria-expanded="true"] svg { transform: rotate(180deg); }

/* 0fr → 1fr is the one grid trick that animates to a genuine auto height. */
.detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .38s cubic-bezier(.2, .8, .2, 1);
}
.detail > div { overflow: hidden; }
.detail.open { grid-template-rows: 1fr; }

.detail-inner { padding-top: 4px; }

.block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.block h3 {
  margin: 0 0 9px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.block p { margin: 0; font-size: 14px; line-height: 1.55; }
.block p + p { margin-top: 9px; }

.quote {
  color: var(--ink-soft);
  border-left: 2px solid var(--line-strong);
  padding-left: 11px;
}

.note {
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* -- sources ---------------------------------------------- */

.sources { list-style: none; margin: 0; padding: 0; }
.sources li + li { margin-top: 2px; }

.sources a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.sources a:active { opacity: .6; }
.sources svg {
  flex: none;
  width: 14px; height: 14px;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
  opacity: .75;
}

/* -- coverage meter ---------------------------------------- */

.cov { display: flex; align-items: baseline; gap: 9px; }
.cov + .cov { margin-top: 11px; }
.cov dt { flex: 1; font-size: 13.5px; color: var(--ink); }
.cov dd { margin: 0; display: flex; align-items: center; gap: 7px; }
.cov-label { font-size: 12.5px; color: var(--ink-soft); }

.meter { display: flex; gap: 3px; }
.meter i {
  width: 14px; height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
}
.meter i.on { background: var(--ink-soft); }

.cov-why { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--ink-faint); }

/* ---------------------------------------------------------- attach sheet */

.sheet {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: 194px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);

  /* JS pins the origin to the + button so the box grows out of it. */
  transform: scale(.68);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .22s cubic-bezier(.2, .9, .3, 1.05);
}
.app[data-attach="open"] .sheet {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

/* The + turns into a close cross, the way the stripes turn into an arrow. */
#attach svg { transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
.app[data-attach="open"] #attach svg { transform: rotate(45deg); }
.app[data-attach="open"] #attach { color: var(--ink); }

/* -- transient composer notice ------------------------------ */

.notice {
  padding: 4px 4px 7px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* -- attachment chips -------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 2px 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 5px 5px 10px;
  border-radius: 999px;
  background: var(--press);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}
.chip svg {
  flex: none;
  width: 14px; height: 14px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  color: var(--ink-soft);
}
.chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 148px;
}
/* Video compression progress, then the size it came out at. */
.chip-meta {
  flex: none;
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink-soft);
}
.chip button {
  flex: none;
  display: grid;
  place-items: center;
  width: 19px; height: 19px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.chip button svg { width: 12px; height: 12px; stroke-width: 2.1; color: inherit; }
.chip button:active { background: var(--line); }

/* ---------------------------------------------------------- dock */

.dock {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--safe-b) + var(--gutter));
  z-index: 4;
  display: grid;
  align-items: end;
  opacity: var(--composer-o, 0);
  transform: translateY(var(--composer-y, 120%));
  will-change: opacity, transform;
  pointer-events: none;
}
.dock > *:not(.sheet) {
  grid-area: 1 / 1;
  transition: opacity .26s ease, transform .26s ease;
}
.app[data-attach="open"] .dock { z-index: 7; }

.composer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 12px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  touch-action: auto;
}

.prompt {
  width: 100%;
  max-height: 8.5em;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font: 400 16px/1.42 Manrope, -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 5px 4px 2px;
  user-select: text;
  -webkit-user-select: text;
  scrollbar-width: none;
}
.prompt::placeholder { color: var(--ink-faint); }
.prompt::-webkit-scrollbar { display: none; }

.composer-row { display: flex; align-items: center; gap: 4px; }
.flex-spacer { flex: 1; }

.icon-btn, .send {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease, transform .15s ease;
}
.icon-btn svg, .send svg {
  width: 19px; height: 19px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.icon-btn { color: var(--ink-soft); }
.icon-btn:active { background: var(--press); }

.send { background: var(--accent); color: var(--accent-on); }
.send:disabled { background: var(--ink-faint); cursor: default; }
.send:not(:disabled):active { transform: scale(.92); }

/* -- action bar (replaces the composer once a verdict is in) -- */

.stopbar,
.actions {
  display: flex;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  touch-action: auto;
  opacity: 0;
  transform: translateY(6px);
}
.stopbar .action { flex: 0 0 auto; padding-inline: 30px; }
.stopbar { justify-content: center; }
.actions.on,
.stopbar.on { opacity: 1; transform: none; }

.action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 4px 8px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--ink-soft);
  font: 500 11.5px/1 Manrope, sans-serif;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.action:active { background: var(--press); }
.action svg {
  width: 21px; height: 21px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.action[aria-pressed="true"] { color: var(--accent); }
.action[aria-pressed="true"] svg { fill: currentColor; stroke: currentColor; }
.action--go { color: var(--ink); }

/* ---------------------------------------------------------- states */

.app[data-state="chat"] .dock   { pointer-events: auto; }
.app[data-state="chat"] .thread { pointer-events: auto; }
.app[data-state="chat"] .topbar { pointer-events: auto; }
.app[data-state="chat"] .hint   { display: none; }

.app[data-view="verdict"] .composer,
.app[data-view="checking"] .composer { opacity: 0; transform: translateY(6px); pointer-events: none; }
.app:not([data-view="verdict"])  .actions { pointer-events: none; }
.app:not([data-view="checking"]) .stopbar { pointer-events: none; }

.app[data-dragging="1"] .dock,
.app[data-dragging="1"] .thread { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .chev { animation: none; opacity: .4; }
  .verdict { animation: none; }
  .working i { animation: none; opacity: .55; }
  .menu { transition: opacity .12s ease; }
  .avatar i { transition: none; }
  .detail { transition: none; }
  .sheet-view, .app, .modal-scrim { transition-duration: .01s; }
}
