/* Henlabs V2 · foundation. White page, black type, fuchsia / lime / sky accents.
   Ink cards hold the answers; the sky card holds the coop. Red is reserved for
   errors. Financial values never animate. View styles live in views/*.css.
   The look is a cartoon sticker sheet, drawn like the hens: what you can press
   or read an answer from wears an ink outline and a hard drop beneath it. */

@font-face { font-family: 'Atkinson Hyperlegible Next'; font-weight: 400; font-display: swap; src: url(./assets/fonts/atkinson-400.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible Next'; font-weight: 600; font-display: swap; src: url(./assets/fonts/atkinson-600.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible Next'; font-weight: 700; font-display: swap; src: url(./assets/fonts/atkinson-700.woff2) format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 700; font-display: swap; src: url(./assets/fonts/bricolage-700.woff2) format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 800; font-display: swap; src: url(./assets/fonts/bricolage-800.woff2) format('woff2'); }

/* ---------------------------------------------------------------- Tokens -- */

:root {
  --page: #fafafc;
  --surface: #ffffff;
  --raised: #ffffff;
  --text: #0e0e12;
  --muted: #5d6070;
  --faint: #8a8d9b;
  --line: #e6e7ee;
  --line-strong: #d5d7e0;
  --soft: #f2f3f7;
  --soft-2: #e7e8ef;
  --link: #086cae;
  --focus: #1688d4;

  --fuchsia: #ff0088;
  --fuchsia-ink: #c40067;
  --lime: #aaff37;
  --lime-bar: #91ed2b;
  --sky: #55b7ff;
  --blue: #1688d4;
  --danger: #c42b1c;

  --warn-text: #c40067;
  --warn-bg: #fff0f7;
  --good-text: #2f6b06;
  --good-bg: #efffdc;
  --info-text: #086cae;
  --info-bg: #eaf6ff;

  --btn-bg: #0e0e12;
  --btn-text: #ffffff;
  --chart-burn: #ff0088;
  --chart-keep: #1688d4;
  --chart-rest: #c9ccd8;

  --shadow-lg: 0 34px 80px -24px rgba(14, 14, 18, .4);
  --header-h: 113px; /* the sticky header: its bar and the live strip */
  /* Stickers. --ink outlines coloured stickers (lime, pink, sky) in both themes;
     --sticker-line outlines plain ones and --card-line the cards; --sticker-drop
     is the hard shadow under them. Gloss and candy are the bar's own fills. */
  --ink: #0e0e12;
  --sticker-line: #0e0e12;
  --card-line: #0e0e12;
  --sticker-drop: #0e0e12;
  --gloss: linear-gradient(rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 55%);
  --candy: repeating-linear-gradient(-45deg, var(--fuchsia) 0 9px, #ff4fae 9px 18px);

  --r-xl: 28px;
  --r-lg: 20px;
  --r: 14px;
  --r-sm: 10px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --display: 'Arial Black', 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  /* Text sizes below the headings: capital labels, small print, interface text. */
  --fs-label: 12.5px;
  --fs-small: 14px;
  --fs-ui: 15px;

  color-scheme: light;
}

:root[data-theme=dark] {
  --page: #0b0c10;
  --sticker-line: #f4f4f7;
  --card-line: #3d4052;
  --sticker-drop: #3d4052;
  --surface: #15161c;
  --raised: #2a2c37;
  --text: #f4f4f7;
  --muted: #a3a6b4;
  --faint: #7d8090;
  --line: #272935;
  --line-strong: #363846;
  --soft: #1e1f27;
  --soft-2: #292b35;
  --link: #7cc8ff;
  --focus: #7cc8ff;
  --fuchsia-ink: #ff6fbb;
  --warn-text: #ff7ac0;
  --warn-bg: rgba(255, 0, 136, .13);
  --good-text: #aaff37;
  --good-bg: rgba(170, 255, 55, .1);
  --info-text: #7cc8ff;
  --info-bg: rgba(85, 183, 255, .12);
  --btn-bg: #f4f4f7;
  --btn-text: #0e0e12;
  --chart-burn: #ff2f9d;
  --chart-keep: #55b7ff;
  --chart-rest: #474a59;
  --shadow-lg: 0 34px 80px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* Ink scope: the answer cards. Components inside read the same tokens. */
.ink,
.today-card,
.lab-result {
  --surface: #0e0e12;
  --raised: rgba(255, 255, 255, .16);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .68);
  --faint: rgba(255, 255, 255, .5);
  --line: rgba(255, 255, 255, .13);
  --line-strong: rgba(255, 255, 255, .22);
  --soft: rgba(255, 255, 255, .08);
  --soft-2: rgba(255, 255, 255, .14);
  --link: #7cc8ff;
  --focus: #aaff37;
  --warn-text: #ff7ac0;
  --warn-bg: rgba(255, 0, 136, .16);
  --good-text: #aaff37;
  --good-bg: rgba(170, 255, 55, .12);
  --info-text: #7cc8ff;
  --info-bg: rgba(85, 183, 255, .14);
  --btn-bg: #ffffff;
  --btn-text: #0e0e12;
  --chart-burn: #ff2f9d;
  --chart-keep: #55b7ff;
  --chart-rest: rgba(255, 255, 255, .28);
  --sticker-line: #ffffff;
  --card-line: rgba(255, 255, 255, .22);
  --sticker-drop: #000000;
  color-scheme: dark;
  color: var(--text);
  background:
    radial-gradient(110% 130% at 100% 0%, rgba(255, 0, 136, .2), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(85, 183, 255, .16), transparent 60%),
    var(--surface);
  border: 2.5px solid #0e0e12;
  border-radius: var(--r-xl);
  box-shadow: 0 6px 0 var(--fuchsia), var(--shadow-lg);
}
:root[data-theme=dark] :is(.ink, .today-card, .lab-result) { --surface: #17181f; border-color: rgba(255, 255, 255, .16); }

/* Sky scope: coop cards keep dark type in both themes. */
.sky,
.pool-card {
  --text: #0e0e12;
  --muted: rgba(14, 14, 18, .7);
  --faint: rgba(14, 14, 18, .55);
  --line: rgba(14, 14, 18, .14);
  --soft: rgba(255, 255, 255, .45);
  --soft-2: rgba(255, 255, 255, .6);
  --link: #0e0e12;
  --focus: #0e0e12;
  --sticker-line: #0e0e12;
  --card-line: #0e0e12;
  --sticker-drop: #0e0e12;
  color-scheme: light;
  color: var(--text);
  background:
    radial-gradient(80% 120% at 0% 0%, rgba(255, 255, 255, .35), transparent 60%),
    var(--sky);
  border: 2.5px solid #0e0e12;
  border-radius: var(--r-xl);
  box-shadow: 0 6px 0 #0e0e12;
}

/* ------------------------------------------------------------------ Base -- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 460px at 88% -120px, rgba(85, 183, 255, .16), transparent 70%),
    radial-gradient(900px 420px at -8% -80px, rgba(255, 0, 136, .07), transparent 70%),
    var(--page);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-synthesis: none;
}

:root[data-theme=dark] body {
  background:
    radial-gradient(1100px 460px at 88% -120px, rgba(85, 183, 255, .1), transparent 70%),
    radial-gradient(900px 420px at -8% -80px, rgba(255, 0, 136, .07), transparent 70%),
    var(--page);
  background-repeat: no-repeat;
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
p, h1, h2, h3, dl, dd, figure, ol, ul { margin: 0; }
p, li, dd { text-wrap: pretty; }
ol, ul { padding: 0; }
small { font-size: .78em; }
code { font-family: var(--mono); }

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

.i,
.reset-chip svg,
.theme-toggle svg,
.dock svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 24px;
}

main:focus { outline: none; }

/* ------------------------------------------------------------------ Type -- */

.display {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(42px, 6.2vw, 82px);
  line-height: .98;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.display-sm { font-size: clamp(36px, 4.6vw, 60px); }
.pop { color: var(--fuchsia); }

.title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.05;
  letter-spacing: -.03em;
}

.h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.h3 { font-size: 19px; font-weight: 700; line-height: 1.3; }

.kicker {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 5px 10px 4px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--gloss), var(--lime);
  box-shadow: 0 2px 0 var(--ink);
  color: #0e0e12;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  transform: rotate(-2deg);
  transform-origin: left center;
}
/* On the lime tag the live dot turns pink. */
.kicker .live-dot { background: var(--fuchsia); animation-name: pulse-pink; }
@keyframes pulse-pink {
  0% { box-shadow: 0 0 0 0 rgba(255, 0, 136, .55); }
  100% { box-shadow: 0 0 0 7px rgba(255, 0, 136, 0); }
}

.label {
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  max-width: 34em;
  margin-top: 18px;
  font-size: 19px;
  line-height: 1.5;
  color: var(--muted);
}

.sub { font-size: var(--fs-ui); color: var(--muted); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.fineprint { margin-top: 14px; font-size: var(--fs-small); line-height: 1.5; color: var(--muted); }
.center { text-align: center; }

/* Dollar values beside GLD (ui.js dollarsOf): empty, and hidden, until a live price arrives. */
.usd:empty { display: none; }
.usd-line { display: block; margin: -6px 0 16px; font-size: var(--fs-ui); font-weight: 600; color: var(--muted); }
.usd-sub { display: block; margin-top: 2px; font-size: .9em; font-weight: 600; color: var(--muted); text-align: right; }

.warn-text {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--warn-text);
}
.warn-text .i { margin-top: 1px; }

.mega {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(44px, 5.8vw, 72px);
  line-height: 1;
  letter-spacing: -.035em;
  margin: 8px 0 10px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.mega > span { font-size: .42em; letter-spacing: -.01em; color: var(--lime); }
:is(.sky, .pool-card) .mega > span { color: var(--text); opacity: .7; }
.mega-text { font-size: clamp(38px, 4.6vw, 58px); }

/* ------------------------------------------------------------------ Bits -- */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--soft);
  font-size: var(--fs-label);
  font-weight: 700;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  margin-left: 6px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft);
  font-family: var(--body);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0;
  vertical-align: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-label);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.badge .i { width: 14px; height: 14px; stroke-width: 3; }

.live-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--lime-bar);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(145, 237, 43, .65); }
  100% { box-shadow: 0 0 0 9px rgba(145, 237, 43, 0); }
}

.notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.note {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border: 2px solid var(--card-line);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 0 var(--sticker-drop);
  font-size: var(--fs-ui);
}
.note > .i { width: 22px; height: 22px; margin-top: 1px; }
.note p { color: var(--muted); }
.note .note-title { margin-bottom: 2px; color: var(--text); font-size: 15.5px; font-weight: 700; }
.note-warn { background: var(--warn-bg); }
.note-warn > .i { color: var(--warn-text); }
.note-info { background: var(--info-bg); }
.note-info > .i { color: var(--info-text); }
.note-good { background: var(--good-bg); }
.note-good > .i { color: var(--good-text); }

/* --------------------------------------------------------------- Buttons -- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border: 2px solid var(--sticker-line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  /* The drop is the sticker's edge: it grows on hover and vanishes as the button presses in. */
  --btn-drop: var(--sticker-drop);
  box-shadow: 0 3px 0 var(--btn-drop);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background-color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--btn-drop); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--btn-drop); }
.btn-ink { --btn-drop: var(--fuchsia); border-color: var(--ink); background: var(--btn-bg); color: var(--btn-text); }
.btn-lime { --btn-drop: var(--ink); border-color: var(--ink); background: var(--gloss), var(--lime); color: #0e0e12; }
.btn-ghost { background: var(--surface); }
.btn-small { height: 40px; padding: 0 16px; font-size: var(--fs-ui); }
.btn-block { width: 100%; }

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--link);
  font-size: var(--fs-ui);
  font-weight: 700;
  text-decoration: none;
}
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  transition: background-color .15s ease, color .15s ease;
}
.icon-button:hover { background: var(--soft); color: var(--text); }
.icon-button.is-busy { color: var(--fuchsia-ink); cursor: progress; }
.icon-button.is-busy .i { animation: spin .9s linear infinite; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background-color .15s ease, border-color .15s ease;
}
.chip:hover { background: var(--soft-2); }
.chip[aria-pressed=true] { background: var(--gloss), var(--lime); color: #0e0e12; box-shadow: inset 0 0 0 2px var(--ink), 0 2px 0 var(--ink); }

/* Segmented control: a soft track with the chosen option raised. */
.segmented {
  display: inline-flex;
  gap: 2px;
  max-width: 100%;
  padding: 4px 4px 6px;
  border-radius: 999px;
  background: var(--soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-ui);
  font-weight: 700;
  white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s ease, box-shadow .2s ease;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed=true] { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 2px var(--sticker-line), 0 2px 0 var(--sticker-line); }
.segmented button span { font-weight: 600; opacity: .7; }
.segmented-fill { display: flex; }
/* Filled across a row, options share the width and give up side padding before clipping. */
.segmented-fill button { flex: 1 1 0; min-width: 0; padding: 0 10px; }

/* ----------------------------------------------------------------- Forms -- */

.input {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  border: 2px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus-within { border-color: var(--sticker-line); box-shadow: 0 3px 0 var(--fuchsia); }
.input input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 48px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.input input::placeholder { color: var(--faint); font-weight: 400; }
.input .unit { flex: none; color: var(--muted); font-size: var(--fs-ui); font-weight: 700; }
.input.is-invalid { border-color: var(--danger); }
:root[data-theme=dark] .input.is-invalid,
.ink .input.is-invalid { border-color: #ff8a7a; }

.field-label { display: block; margin-bottom: 8px; font-size: var(--fs-ui); font-weight: 700; }
.field-help { margin-top: 8px; font-size: var(--fs-small); color: var(--muted); }
.field-error { margin-top: 8px; font-size: var(--fs-small); font-weight: 700; color: var(--danger); }
:root[data-theme=dark] .field-error,
.ink .field-error { color: #ff8a7a; }

.select {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 2px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  font-size: 16px;
}

.range {
  display: block;
  width: 100%;
  height: 28px;
  margin: 12px 0 6px;
  accent-color: var(--fuchsia);
  cursor: pointer;
}
.range:disabled { cursor: not-allowed; opacity: .5; }

/* Radio cards: one choice per card, with a short line on what it means. */
.choices { display: grid; gap: 10px; }
.choice {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 2px 12px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .2s ease;
}
.choice:hover { border-color: var(--line-strong); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice::before {
  content: '';
  grid-row: span 2;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.choice:has(input:checked) { border-color: var(--sticker-line); box-shadow: 0 3px 0 var(--sticker-drop); }
.choice:has(input:checked)::before { border-color: var(--ink); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 10px var(--fuchsia); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice-title { font-weight: 700; }
.choice-text { color: var(--muted); font-size: var(--fs-small); }

/* ----------------------------------------------------------------- Steps -- */

/* Numbered steps joined by a rail; each one asks one question. */
.steps { display: grid; gap: 0; list-style: none; counter-reset: step; }
.step { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 16px; padding-bottom: 30px; }
.step:last-child { padding-bottom: 0; }
.step::before {
  counter-increment: step;
  content: counter(step);
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--gloss), var(--lime);
  box-shadow: 0 2px 0 var(--ink);
  color: #0e0e12;
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
}
.step::after {
  content: '';
  position: absolute;
  top: 40px;
  bottom: 4px;
  left: 17px;
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}
.step:last-child::after { display: none; }
.step-main { min-width: 0; }
.step-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; min-height: 36px; padding-top: 5px; }
.step-title { font-size: 17.5px; font-weight: 700; line-height: 1.35; }
.step-value { color: var(--muted); font-size: var(--fs-ui); font-weight: 700; font-variant-numeric: tabular-nums; }
.step-help { margin-top: 2px; color: var(--muted); font-size: var(--fs-ui); }
.step-body { margin-top: 14px; }

/* Assumptions read like a receipt: a label, a dotted leader, the value. A row
   too narrow for both drops the value onto its own line, right-aligned. */
.receipt { display: grid; gap: 10px; }
.receipt div { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; font-size: var(--fs-ui); }
.receipt dt { display: flex; flex: 1 0 auto; align-items: baseline; gap: 10px; max-width: 100%; color: var(--muted); }
.receipt dt::after { content: ''; flex: 1; min-width: 16px; border-bottom: 1.5px dotted var(--line-strong); transform: translateY(-4px); }
.receipt dd { margin-left: auto; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* A details block whose summary carries a chevron. */
.disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after {
  content: '';
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg) translateY(-3px);
  transition: transform .2s ease;
}
.disclosure[open] > summary::after { transform: rotate(-135deg) translateY(-3px); }

/* ---------------------------------------------------------------- Topbar -- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

/* The tabs sit in the middle until a side needs more room, then shift over rather than squeeze it. */
.topbar-inner {
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  align-items: center;
  gap: 16px;
  height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-self: start;
  color: var(--text);
  text-decoration: none;
  border-radius: 12px;
}
/* The mark: the Henlabs scientist hen in a lime badge, her comb over its rim. */
.brand img { width: 44px; height: 44px; transition: transform .3s var(--ease); }
.brand:hover img { transform: rotate(-8deg) translateY(-1px); }

.wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 25px;
  line-height: 1;
  letter-spacing: -.045em;
  white-space: nowrap;
}
.wordmark b { font-weight: inherit; color: var(--fuchsia); }
.wordmark i { font-style: normal; color: var(--lime-bar); }
.brand .wordmark { font-size: 33px; }

/* Tabs: the indicator slides to the current tab (app.js sets its position). */
.tabs {
  position: relative;
  display: inline-flex;
  gap: 2px;
  padding: 4px 4px 6px;
  border-radius: 999px;
  background: var(--soft);
}
.tabs::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 6px;
  left: 0;
  width: var(--tab-w, 0);
  border-radius: 999px;
  background: var(--gloss), var(--lime);
  box-shadow: inset 0 0 0 2px var(--ink), 0 2px 0 var(--ink);
  transform: translateX(var(--tab-x, 0));
}
/* Placed before it may move, so the first paint doesn't slide in from the left. */
.tabs.is-ready::before { transition: transform .32s var(--ease), width .32s var(--ease); }
.tabs:not([style]) a[aria-current=page] { background: var(--gloss), var(--lime); box-shadow: inset 0 0 0 2px var(--ink), 0 2px 0 var(--ink); }
.tabs a {
  position: relative;
  padding: 9px 20px;
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--fs-ui);
  font-weight: 700;
  text-decoration: none;
  transition: color .2s ease;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current=page] { color: #0e0e12; }

.topbar-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.reset-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: var(--fs-small);
  white-space: nowrap;
}
.reset-chip [data-countdown] { color: var(--text); font-weight: 700; }

/* Shows the mode it switches to: a moon in light mode, a sun in dark mode. */
/* Jump anywhere: the header button that opens it, and its keys. */
.jump-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 8px 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 600;
  transition: border-color .15s ease, box-shadow .15s ease, color .15s ease;
}
.jump-button:hover { border-color: var(--sticker-line); color: var(--text); box-shadow: 0 2px 0 var(--sticker-drop); }
.jump-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1.5px solid var(--line-strong);
  border-bottom-width: 3px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--muted);
  font: 700 11.5px/1 var(--body);
  white-space: nowrap;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.theme-toggle:hover { border-color: var(--sticker-line); color: var(--text); box-shadow: 0 2px 0 var(--sticker-drop); }
.theme-toggle svg { width: 20px; height: 20px; }
.i-sun { display: none; }
:root[data-theme=dark] .i-sun { display: block; }
:root[data-theme=dark] .i-moon { display: none; }

.wallet-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border: 2px solid var(--sticker-line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 2px 0 var(--sticker-drop);
  color: var(--text);
  font-size: var(--fs-ui);
  font-weight: 700;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.wallet-chip:hover { transform: translateY(-1px); box-shadow: 0 3px 0 var(--sticker-drop); }
.wallet-chip img { width: 28px; height: 28px; margin-left: -8px; border-radius: 50%; object-fit: cover; }
.chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip-spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border: 2.5px solid var(--soft-2);
  border-top-color: var(--fuchsia);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 4px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--fuchsia), var(--sky), var(--lime-bar));
  transform-origin: left center;
  transition: transform .35s ease;
}

/* The live strip under the header: the pool and prices on every page, on ink. It scrolls
   sideways inside itself on narrow screens rather than squeezing. */
.strip { background: #0e0e12; color: #ffffff; }
:root[data-theme=dark] .strip { background: var(--surface); border-top: 1px solid var(--line); }
.strip-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 36px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  font-size: 13px;
}
.strip-inner::-webkit-scrollbar { display: none; }
.strip-item { display: inline-flex; flex: none; align-items: baseline; gap: 7px; color: inherit; text-decoration: none; }
.strip-item + .strip-item { padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, .14); }
.strip-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .58); }
.strip-item strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.strip-item em { font-style: normal; font-weight: 600; color: var(--lime); font-variant-numeric: tabular-nums; }
a.strip-item:hover strong, a.strip-item:focus-visible strong { text-decoration: underline; text-underline-offset: 3px; }
a.strip-item:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; border-radius: 4px; }
.strip-note { flex: none; font-size: 12px; color: rgba(255, 255, 255, .5); }
/* The figures sit straight in the row; the countdown joins them on phones, where the header has no room for it. */
.strip-items { display: contents; }
.strip-clock { display: none; }

/* ----------------------------------------------------------------- Jump -- */

.jump {
  width: min(640px, calc(100vw - 32px));
  max-height: min(72vh, 580px);
  margin: 12vh auto auto;
  padding: 0;
  border: 2.5px solid var(--sticker-line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 6px 0 var(--sticker-drop), 0 30px 60px rgba(14, 14, 18, .3);
  overflow: hidden;
}
.jump::backdrop { background: rgba(14, 14, 18, .5); backdrop-filter: blur(4px); }
.jump-box { display: flex; flex-direction: column; max-height: min(72vh, 580px); }
.jump-field { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1.5px solid var(--line); }
.jump-field label { display: grid; color: var(--muted); }
.jump-field label .i { width: 22px; height: 22px; }
.jump-close { display: grid; place-items: center; flex: none; padding: 0; border: 0; background: none; color: var(--muted); }
.jump-close > span { display: none; }
.jump-field input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font-size: 18px; font-weight: 600; }
.jump-field input::placeholder { color: var(--faint); font-weight: 500; }
.jump-list { margin: 0; padding: 8px; overflow-y: auto; list-style: none; }
.jump-list [role=option] {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
}
/* The match Enter goes to wears the lime sticker. */
.jump-list [aria-selected=true] { border-color: #0e0e12; background: var(--lime); color: #0e0e12; box-shadow: 0 3px 0 #0e0e12; }
.jump-kind { font-size: var(--fs-label); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.jump-label { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.jump-hint { color: var(--muted); font-size: var(--fs-small); white-space: nowrap; }
.jump-list [aria-selected=true] :is(.jump-kind, .jump-hint) { color: rgba(14, 14, 18, .72); }
.jump-empty { padding: 14px; color: var(--muted); }
.jump-foot { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 10px 18px; border-top: 1.5px solid var(--line); color: var(--muted); font-size: var(--fs-label); }
.jump-foot span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------------------------------------------------------------- Layout -- */

.view { padding-bottom: 24px; }
.view.is-entering > * { animation: rise .42s var(--ease) both; }
.view.is-entering > :nth-child(2) { animation-delay: .04s; }
.view.is-entering > :nth-child(3) { animation-delay: .08s; }
.view.is-entering > :nth-child(4) { animation-delay: .12s; }
.view.is-entering > :nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 24px;
  margin: 40px 0 24px;
}
.page-head .kicker { margin-bottom: 6px; }

.observed {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-small);
}
.observed a { font-weight: 700; text-decoration: none; }
.observed a:hover { text-decoration: underline; }
.observed.small { padding: 0; border: 0; background: none; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 16px;
}
.section-head .muted { font-size: var(--fs-ui); }

.card {
  padding: 28px;
  border: 2px solid var(--card-line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 0 4px 0 var(--sticker-drop);
}

/* -------------------------------------------------------------- Feedback -- */

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 12px 12px 18px;
  border-radius: var(--r-lg);
  background: var(--warn-bg);
  color: var(--text);
  font-size: var(--fs-ui);
}
.banner > .i { color: var(--warn-text); }
.banner-text { flex: 1; }

/* A refresh in progress: spinner, the step being read, and a meter. */
.banner-busy { padding: 14px 18px; background: var(--info-bg); }
.refresh-text { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.refresh-text strong { font-size: var(--fs-ui); }
.refresh-text span { font-size: var(--fs-small); color: var(--muted); }
.meter.meter-inline { width: min(200px, 30%); height: 6px; margin: 0; flex: none; }

.spinner {
  width: 20px;
  height: 20px;
  flex: none;
  border: 2.5px solid color-mix(in srgb, currentColor 18%, transparent);
  border-top-color: var(--fuchsia);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.refreshing { display: grid; justify-items: center; gap: 6px; padding: 30px 12px 22px; text-align: center; }
.refreshing img { width: 120px; margin-bottom: 10px; }
.refreshing .muted { min-height: 1.5em; }
.refreshing .meter { margin-top: 14px; }

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 36px 16px;
  text-align: center;
}
.empty img { width: 110px; margin-bottom: 8px; }
.empty .muted { max-width: 30em; }
.empty > .btn { margin-top: 14px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }

.bob { animation: bob 1.4s ease-in-out infinite alternate; }
@keyframes bob {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.meter {
  width: min(360px, 100%);
  height: 8px;
  margin-top: 18px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}
.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--fuchsia), var(--sky));
  transform-origin: left center;
  transition: transform .35s ease;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
  margin-top: 40px;
}
.skeleton {
  height: 236px;
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--soft) 30%, var(--soft-2) 50%, var(--soft) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.6s linear infinite;
}
.skeleton.tall { height: 300px; }
.view .skeleton-grid:has(.tall) { grid-template-columns: 1fr; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  width: max-content;
  max-width: min(520px, calc(100vw - 32px));
  padding: 13px 18px;
  border-radius: var(--r);
  background: var(--btn-bg);
  color: var(--btn-text);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-ui);
  font-weight: 600;
  transform: translateX(-50%);
  animation: toast-in .24s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------------------------------------------------------------- Lookup -- */

.lookup-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 20px;
  border: 2.5px solid var(--sticker-line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 4px 0 var(--sticker-drop);
  transition: box-shadow .15s ease;
}
.lookup-field:focus-within { box-shadow: 0 4px 0 var(--fuchsia); }
.lookup-field > .i { color: var(--muted); }
.lookup-field input {
  flex: 1;
  min-width: 0;
  height: 50px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 17px;
}
.lookup-field input::placeholder { color: var(--muted); opacity: .85; }
.lookup-field .btn { height: 50px; }

.lookup-hint { margin: 10px 4px 0; font-size: var(--fs-small); color: var(--muted); }
.lookup-hint.is-error { color: var(--danger); font-weight: 700; }
.lookup-hint.is-ok { color: var(--good-text); }
:root[data-theme=dark] .lookup-hint.is-error { color: #ff8a7a; }

.lookup-extra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-top: 14px;
}

.recent { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.recent-label { font-size: var(--fs-label); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.recent .chip { font-family: var(--mono); font-size: var(--fs-small); font-weight: 600; }

/* ---------------------------------------------------------------- Sheets -- */

dialog.sheet {
  width: 100%;
  max-width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: visible;
}
dialog.sheet::backdrop {
  background: rgba(10, 10, 14, .52);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
dialog.sheet[open] .sheet-body { animation: sheet-in .28s var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.sheet-body {
  position: relative;
  max-height: calc(100dvh - 32px);
  padding: 28px;
  border: 2.5px solid var(--sticker-line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 0 6px 0 var(--sticker-drop), var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
.sheet-head { padding-right: 48px; }
.sheet-head h2 { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.1; letter-spacing: -.03em; }
.sheet-head p { margin-top: 6px; color: var(--muted); }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.sheet-foot .btn { flex: 1 1 auto; }

#lookup-dialog .sheet-body { text-align: center; }
#lookup-dialog .lookup { margin-top: 20px; text-align: left; }
#lookup-dialog h2 { font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: -.03em; }
#lookup-dialog .sheet-body > .muted { margin-top: 4px; }
#lookup-dialog .lookup-field { border-width: 2px; box-shadow: 0 3px 0 var(--sticker-drop); }
#lookup-dialog .lookup-field:focus-within { box-shadow: 0 3px 0 var(--fuchsia); }
#lookup-dialog .lookup-field .btn { padding: 0 18px; }

.sheet-hen { width: 92px; margin: 0 auto 10px; }

/* The share sheet: the report card at full width, then what to do with it. */
@media (min-width: 761px) { #share-dialog { max-width: min(720px, calc(100vw - 32px)); } }
.share-preview { height: auto; margin-top: 20px; aspect-ratio: 16 / 9; border: 2px solid var(--ink); border-radius: var(--r-lg); overflow: hidden; background: var(--soft); box-shadow: 0 4px 0 var(--ink); }
.share-preview img { display: block; width: 100%; height: 100%; }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.share-actions .btn { flex: 1 1 auto; }
.share-error { display: flex; gap: 10px; margin-top: 20px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--warn-bg); }
.share-error .i { flex: none; color: var(--warn-text); }

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0 0 3px;
  border: 2px solid var(--sticker-line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 0 var(--sticker-drop);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}
.sheet-close:hover { background: var(--soft); }

.dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-small);
  text-align: left;
}

/* ---------------------------------------------------------------- Charts -- */

.chart svg { display: block; width: 100%; height: 230px; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-family: var(--body); font-size: 12px; }
.chart .band { fill-opacity: .22; stroke: none; }
.chart .line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.dashed { stroke-dasharray: 7 6; }
.chart .cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .dot { stroke: var(--surface); stroke-width: 3; }
.chart .area { fill-opacity: .14; stroke: none; }
.chart .slot-cursor { fill: var(--soft-2); opacity: .7; }
.chart .bar-missing { fill: var(--line-strong); }
/* Amounts side by side as bars, each sized against the largest (charts.js compareBars). */
.compare { display: grid; gap: 10px; }
.compare div { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.compare dt { font-size: var(--fs-small); font-weight: 700; }
.compare-bar { height: 16px; border: 2px solid var(--card-line); border-radius: 999px; background: var(--soft); box-shadow: 0 2px 0 var(--sticker-drop); overflow: hidden; }
.compare-bar i { display: block; height: 100%; border-radius: inherit; background-image: var(--gloss); }
.compare-figure { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tone-fuchsia { background: var(--fuchsia); }
.tone-lime { background: var(--lime-bar); }
.tone-faint { background: var(--chart-rest); }
@media (max-width: 560px) {
  .compare div { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; }
}

/* Dated events on a chart, such as halvings. */
.chart .mark { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 5; opacity: .7; }
.chart .mark-label { fill: var(--muted); font-family: var(--body); font-size: 11px; font-weight: 700; }

/* A chart's own heading inside a card; a second chart in the same card gets room above it. */
.chart-title { margin: 0 0 6px; font-size: var(--fs-ui); font-weight: 800; }
.chart-title:not(:first-of-type) { margin-top: 28px; }
.chart-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  margin-top: 10px;
  font-size: var(--fs-small);
}
.scrub { display: flex; flex: 1 1 260px; align-items: center; gap: 10px; max-width: 460px; color: var(--muted); }
.scrub span { min-width: 5.4em; white-space: nowrap; }
.scrub strong { color: var(--text); }
.scrub input { flex: 1; min-width: 0; accent-color: var(--chart-burn); }
.readouts { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); }
.readouts > span { display: inline-flex; flex-wrap: wrap; align-items: center; column-gap: 6px; }
.readouts i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.readouts strong { color: var(--text); white-space: nowrap; }

/* ---------------------------------------------------------------- Footer -- */

.footer {
  margin-top: 72px;
  padding: 34px 0 44px;
  border-top: 1px solid var(--line);
}
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px 32px;
}
.footer-mark { display: inline-flex; align-items: center; gap: 4px; }
.footer-brand .wordmark { font-size: 24px; }
.footer-brand p { margin-top: 8px; font-size: var(--fs-small); color: var(--muted); }
.footer-brand a { color: var(--text); font-weight: 700; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.footer-links a { color: var(--text); font-size: var(--fs-ui); font-weight: 700; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer-note { grid-column: 1 / -1; max-width: 70ch; font-size: var(--fs-small); color: var(--muted); }

.dock { display: none; }

/* ------------------------------------------------------------ Responsive -- */

/* The header's countdown keeps its clock and time but drops its label before anything else gives way. */
@media (max-width: 1100px) {
  .reset-label { display: none; }
}

/* Then the header tightens so tablets keep the tabs and the whole wallet chip: Jump shrinks to
   its icon, and the countdown moves into the live strip below, as on phones. */
@media (max-width: 1000px) {
  .jump-button { justify-content: center; width: 42px; padding: 0; }
  .jump-button .jump-text, .jump-button kbd { display: none; }
}
@media (max-width: 900px) {
  .topbar-inner { gap: 12px; }
  .brand .wordmark { font-size: 30px; }
  .tabs a { padding-inline: 14px; }
  .chip-more { display: none; }
  .reset-chip { display: none; }
  .strip-clock { display: inline-flex; }
  .strip-items > :first-child { padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, .14); }
}

@media (max-width: 760px) {
  :root { --header-h: 101px; }
  /* Search moves to the dock, leaving the header room for the whole wallet address. */
  .jump-button { display: none; }
  .jump { margin-top: 12px; }
  .jump-foot, .jump-close kbd { display: none; }
  .jump-close { width: 36px; height: 36px; margin: -6px -8px -6px 0; border-radius: 999px; background: var(--soft); font-size: 22px; line-height: 1; }
  .jump-close > span { display: block; }
  .jump-field input { font-size: 17px; }
  .jump-list [role=option] { grid-template-columns: minmax(0, 1fr) auto; }
  .jump-kind { display: none; }
  .wrap { padding-inline: 16px; }
  /* The strip runs on past the edge: fade it out there so it reads as more to swipe. */
  .strip-inner { gap: 16px; mask-image: linear-gradient(90deg, #000 82%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); }
  .strip-item + .strip-item { padding-left: 16px; }
  .topbar-inner { grid-template-columns: auto 1fr; height: 64px; gap: 8px; }
  .topbar-end { gap: 6px; }
  .brand .wordmark { font-size: 28px; }
  .brand img { width: 38px; height: 38px; }
  .tabs { display: none; }

  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 2px solid var(--card-line);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: saturate(1.6) blur(16px);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
  }
  .dock a,
  .dock button {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 7px 0 6px;
    border: 0;
    border-radius: 14px;
    background: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease;
  }
  .dock svg { width: 22px; height: 22px; }
  /* The current section wears the same lime sticker as the header tab. */
  .dock a[aria-current=page] { background: var(--gloss), var(--lime); color: #0e0e12; box-shadow: inset 0 0 0 2px var(--ink), 0 2px 0 var(--ink); }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }

  .page-head { margin: 28px 0 18px; }
  .card { padding: 20px; border-radius: 24px; }
  .ink, .sky { border-radius: 24px; }
  .footer { padding-bottom: 28px; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  .step { grid-template-columns: 32px minmax(0, 1fr); column-gap: 12px; padding-bottom: 26px; }
  .step::before { width: 32px; height: 32px; font-size: var(--fs-ui); }
  .step::after { top: 36px; left: 15px; }
  .step-head { min-height: 32px; padding-top: 3px; }

  dialog.sheet { max-width: 100%; margin: auto 0 0; max-height: calc(100dvh - 24px); }
  dialog.sheet .sheet-body {
    max-height: calc(100dvh - 24px);
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
  }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
}

@media (max-width: 560px) {
  .lookup-field { padding-left: 16px; }
  .lookup-field > .i { display: none; }
  .lookup-field .btn { padding: 0 16px; }
  .banner-busy { flex-wrap: wrap; }
  .meter.meter-inline { width: 100%; }
  .chart-foot { align-items: flex-start; flex-direction: column; }
  .scrub { flex: none; width: 100%; max-width: none; }
  /* A long step title pushes its value onto the next line; start it there every time. */
  .step-head { flex-direction: column; align-items: flex-start; gap: 2px; }
}

@media (max-width: 360px) {
  .segmented button { padding: 0 10px; }
}

/* Small phones: the header tightens in steps so the whole wallet address stays readable,
   dropping the Hen's picture from the chip only on the narrowest screens. */
@media (max-width: 380px) {
  .brand { gap: 3px; }
  .brand .wordmark { font-size: 26px; }
  .brand img { width: 36px; height: 36px; }
  .wallet-chip { padding: 0 10px; }
  .theme-toggle { width: 40px; height: 40px; }
}
@media (max-width: 374px) { .brand .wordmark { font-size: 23px; } }
@media (max-width: 359px) { .wallet-chip img { display: none; } }
@media (max-width: 340px) {
  .brand .wordmark { font-size: 21px; }
  .wallet-chip { padding: 0 8px; }
  .theme-toggle { width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .topbar, .dock, .footer, .toast { display: none !important; }
  body { background: #fff; }
}
