/* ==========================================================================
   Free Bird
   A calm, editorial design system. One typeface, restrained colour, thin
   rules, generous space. Cards are used only where hierarchy needs them.
   ========================================================================== */

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

:root {
  /* Colour. A warm off-white page, near-black ink, one deep teal accent,
     one secondary sky blue used only for the "after" state in charts. */
  --bg: #f7f6f2;
  --bg-sunk: #f1efe9;
  --surface: #fffefb;
  --surface-alt: #faf9f5;

  --ink: #191d1c;
  --ink-soft: #454e4b;
  /* Both greys are chosen to clear 4.5:1 against every surface they are
     actually used on, measured rather than eyeballed. */
  --ink-mute: #646c69;
  --ink-faint: #6b7370;

  --line: #e3e0d7;
  --line-strong: #cfcbbf;

  --accent: #245f5c;
  --accent-hover: #1b4a48;
  --accent-soft: #e8f0ee;
  --accent-line: #b7ccc8;

  --sky: #45718f;
  --sky-soft: #e8eef3;

  --warn: #8a5a13;
  --warn-soft: #fbf2e2;
  --danger: #97402c;
  --danger-soft: #f8ece8;
  --ok: #2f6b4f;

  /* Type */
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter,
          Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;

  /* Space */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4.5rem;

  /* Shape */
  --r-sm: 3px;
  --r: 5px;
  --r-lg: 8px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(24, 28, 27, 0.05);
  --shadow: 0 6px 24px -12px rgba(24, 28, 27, 0.28);
  --shadow-lg: 0 24px 60px -24px rgba(24, 28, 27, 0.35);

  --container: 1080px;
  --ease: cubic-bezier(0.2, 0.6, 0.25, 1);
}

/* ----------------------------------------------------------- Foundation */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.has-dialog { overflow: hidden; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: var(--ink);
}

/* Page titles inside a view are h1. The hero sets its own size; everywhere
   else an h1 should read at the same weight the section headings do. */
.view h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-2xl); }
.empty h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

ul, ol { margin: 0; padding: 0; }

img, svg { max-width: 100%; }

strong { font-weight: 600; }

::selection { background: var(--accent-soft); }

/* Focus: one visible treatment everywhere, never removed. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

.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-link {
  position: absolute;
  left: var(--s4);
  top: -4rem;
  z-index: 100;
  padding: var(--s2) var(--s4);
  background: var(--ink);
  color: #fff;
  border-radius: var(--r);
  font-weight: 500;
  text-decoration: none;
  transition: top 0.15s var(--ease);
}
.skip-link:focus { top: var(--s3); color: #fff; }

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --------------------------------------------------------------- Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(247, 246, 242, 0.94);
  backdrop-filter: saturate(150%) blur(6px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--s3) var(--s5);
  display: flex;
  align-items: center;
  gap: var(--s5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand:hover { color: var(--accent); }
.brand__mark { display: inline-flex; color: var(--accent); }
.brand__name { font-size: var(--fs-md); }

.nav { margin-left: auto; }

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--s1);
  list-style: none;
}

.nav__link {
  display: block;
  padding: var(--s2) var(--s3);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--r);
  white-space: nowrap;
}
.nav__link:hover { color: var(--ink); background: var(--bg-sunk); }
.nav__link.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.site-header__status { display: flex; }

.nav-toggle {
  display: none;
  align-items: center;
  gap: var(--s2);
  margin-left: auto;
  padding: var(--s2) var(--s3);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.nav-toggle__bars { display: inline-flex; flex-direction: column; gap: 3px; }
.nav-toggle__bars span {
  display: block;
  width: 15px; height: 1.5px;
  background: currentColor;
  border-radius: 2px;
}

/* ---------------------------------------------------------- Model chip */

.model-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  font: inherit;
  font-size: var(--fs-xs);
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
}
.model-chip:hover { border-color: var(--line-strong); color: var(--ink); }

.model-chip__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
  flex: none;
}
.model-chip--ok .model-chip__dot { background: var(--ok); }
.model-chip--busy .model-chip__dot {
  background: var(--sky);
  animation: pulse 1.4s ease-in-out infinite;
}
.model-chip--muted .model-chip__dot {
  background: transparent;
  border: 1.5px solid var(--ink-faint);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ----------------------------------------------------------- Main areas */

.main {
  flex: 1;
  outline: none;
}

.view-host {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--s6) var(--s5) var(--s8);
}

.view { display: block; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 0.5rem 0.95rem;
  min-height: 2.5rem;
  border: 1px solid transparent;
  border-radius: var(--r);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease), color 0.14s var(--ease);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon { flex: none; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn--secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn--secondary:hover:not(:disabled) { border-color: var(--ink-mute); color: var(--ink); background: var(--surface); }

.btn--text {
  background: none;
  border-color: transparent;
  color: var(--ink-soft);
  padding-inline: 0.4rem;
}
.btn--text:hover:not(:disabled) { color: var(--accent); }

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

.btn--small { min-height: 2.125rem; padding: 0.35rem 0.75rem; font-size: var(--fs-sm); }
.btn--tiny { min-height: 1.75rem; padding: 0.15rem 0.4rem; font-size: var(--fs-xs); }
.btn--text.btn--small { padding-inline: 0.35rem; }

.btn.is-busy { opacity: 0.8; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; height: 2rem;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--ink-mute);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-sunk); color: var(--ink); }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s4);
}
.row--tight { gap: var(--s2); margin-top: 0; }
.row--start { justify-content: flex-start; margin-top: 0; margin-bottom: var(--s4); }

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

.eyebrow {
  margin: 0 0 var(--s2);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.lede {
  font-size: var(--fs-md);
  color: var(--ink-soft);
  max-width: 62ch;
}

.meta {
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  line-height: 1.55;
}

.section-head { margin-bottom: var(--s5); max-width: 68ch; }
.section-head h2 { margin-bottom: var(--s2); }

.quoted {
  margin: 0 0 var(--s4);
  padding-left: var(--s4);
  border-left: 2px solid var(--accent-line);
  color: var(--ink-soft);
  font-style: normal;
}
.quoted--full { max-width: 68ch; }
.quoted p { margin: 0; }

/* -------------------------------------------------------------- Panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
  margin-bottom: var(--s5);
}
.panel__title {
  margin-bottom: var(--s3);
  font-size: var(--fs-md);
  letter-spacing: -0.005em;
}
.panel__lede { color: var(--ink-soft); }
.panel__note { margin-top: var(--s3); font-size: var(--fs-xs); color: var(--ink-mute); }
.panel--quiet { background: var(--surface-alt); }
.panel--error { border-color: var(--danger); }

.empty {
  padding: var(--s7) var(--s5);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
}
.empty h3 { margin-bottom: var(--s2); }
.empty p { max-width: 46ch; margin-inline: auto; color: var(--ink-soft); }
.empty .btn { margin-top: var(--s4); }

.notice {
  padding: var(--s3);
  background: var(--warn-soft);
  border: 1px solid #ecd9ae;
  border-radius: var(--r);
  color: var(--warn);
  font-size: var(--fs-sm);
}

.plain-list { list-style: none; }
.plain-list li {
  position: relative;
  padding-left: var(--s4);
  margin-bottom: var(--s2);
  color: var(--ink-soft);
}
.plain-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.66em;
  width: 5px; height: 1px;
  background: var(--line-strong);
}

.kv {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: var(--s2) var(--s4);
  margin: var(--s4) 0 0;
  font-size: var(--fs-sm);
}
.kv dt { color: var(--ink-mute); }
.kv dd { margin: 0; color: var(--ink); }

/* --------------------------------------------------------- Disclosures */

.disclosure {
  margin-top: var(--s4);
  border-top: 1px solid var(--line);
  padding-top: var(--s3);
}
.disclosure summary {
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-soft);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) 0;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before {
  content: "";
  width: 0; height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s var(--ease);
}
.disclosure[open] summary::before { transform: rotate(90deg); }
.disclosure summary:hover { color: var(--accent); }
.disclosure > *:not(summary) { margin-top: var(--s3); }
.disclosure--wide { margin-top: var(--s5); }

/* --------------------------------------------------------------- Table */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.table th, .table td {
  padding: var(--s2) var(--s3);
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table thead th {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  font-weight: 600;
}
.table tbody th { font-weight: 500; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:last-child th,
.table tbody tr:last-child td { border-bottom: none; }

/* ============================================================== HOME === */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: var(--s7);
  align-items: center;
  padding-bottom: var(--s7);
  margin-bottom: var(--s6);
  border-bottom: 1px solid var(--line);
}

.hero__eyebrow {
  margin: 0 0 var(--s3);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.hero__title {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 3.75rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.hero__word:last-child { color: var(--accent); }

.hero__tagline {
  margin: var(--s2) 0 var(--s4);
  font-size: var(--fs-lg);
  color: var(--ink-soft);
  letter-spacing: -0.01em;
}

.hero__lede {
  max-width: 34ch;
  margin-bottom: var(--s5);
  font-size: var(--fs-lg);
  line-height: 1.5;
  color: var(--ink);
}

.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.hero__note { margin-top: var(--s4); font-size: var(--fs-xs); color: var(--ink-mute); }

.hero__art { color: var(--accent); opacity: 0.5; }
.hero__art img { width: 100%; height: auto; }

.intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s5);
  padding-bottom: var(--s6);
  margin-bottom: var(--s6);
  border-bottom: 1px solid var(--line);
}
.intro-item { padding-top: var(--s3); border-top: 2px solid var(--ink); }
.intro-item__title { margin-bottom: var(--s2); font-size: var(--fs-md); }
.intro-item p { color: var(--ink-soft); margin: 0; }

.home-current {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--s5);
  margin-bottom: var(--s6);
}
.home-current__main {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
}
.home-current__title { margin-bottom: var(--s3); font-size: var(--fs-xl); }

.home-current__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
  margin: 0 0 var(--s2);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}
.fact { margin: 0; }
.fact__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.fact__value { margin: var(--s1) 0 0; font-weight: 600; font-size: var(--fs-md); }

.quick {
  align-self: start;
  padding: var(--s5);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-lg);
}
.quick h3 { margin-bottom: var(--s2); font-size: var(--fs-md); }
.quick p { color: var(--ink-soft); }
.quick .btn { margin-top: var(--s3); }

.loop { margin-bottom: var(--s6); }
.loop__title { margin-bottom: var(--s4); font-size: var(--fs-lg); }
.loop__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s5);
  list-style: none;
  counter-reset: loop;
}
.loop__item { padding-top: var(--s3); border-top: 1px solid var(--line-strong); }
.loop__num {
  display: block;
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}
.loop__name { margin: var(--s2) 0 var(--s2); font-size: var(--fs-md); color: var(--accent); }
.loop__item p { color: var(--ink-soft); margin: 0; }

.assure {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  background: var(--bg-sunk);
  border-radius: var(--r-lg);
}
.assure__text { margin: 0; max-width: 68ch; font-size: var(--fs-sm); color: var(--ink-soft); }

/* ====================================================== STRESS CHECK === */

.stress-form { max-width: 46rem; }

.field { margin-bottom: var(--s5); border: none; padding: 0; }
.field__label {
  display: block;
  margin-bottom: var(--s1);
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--ink);
}
.field__label--lead { font-size: var(--fs-xl); letter-spacing: -0.015em; }
.field__help { margin: 0 0 var(--s3); font-size: var(--fs-sm); color: var(--ink-mute); max-width: 60ch; }
.field__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
  margin-top: var(--s2);
}

.textarea {
  display: block;
  width: 100%;
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-md);
  line-height: 1.6;
  resize: vertical;
}
.textarea::placeholder { color: var(--ink-faint); }
.textarea:focus-visible { border-color: var(--accent); outline-offset: 0; }
.textarea.is-invalid { border-color: var(--danger); }
.textarea--small { font-size: var(--fs-base); }

.counter { font-size: var(--fs-xs); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.counter.is-warn { color: var(--warn); }

.field-error {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--danger);
  font-weight: 500;
}
.field-error:empty { display: none; }

.optional-block {
  padding: var(--s5);
  margin-bottom: var(--s5);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.optional-block__title {
  margin: 0;
  font-weight: 600;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-mute);
}
.optional-block__note { margin: var(--s1) 0 var(--s5); font-size: var(--fs-sm); color: var(--ink-mute); }
.optional-block .field:last-child { margin-bottom: 0; }

.field--chips legend { padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.chips--scale { gap: var(--s2); }

.chip { position: relative; }
.chip__input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  margin: 0;
  cursor: pointer;
}
.chip__label {
  display: block;
  padding: 0.4rem 0.8rem;
  min-height: 2.125rem;
  line-height: 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.14s var(--ease), background-color 0.14s var(--ease);
}
.chip__input:hover + .chip__label { border-color: var(--ink-mute); }
.chip__input:checked + .chip__label {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}
.chip__input:focus-visible + .chip__label {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.chip--wide .chip__label { padding-inline: 1rem; }

.field--chips .btn--tiny { margin-top: var(--s2); }

.field--slider { max-width: 32rem; }
.slider__row { display: flex; align-items: center; gap: var(--s3); }
.slider__end { font-size: var(--fs-xs); color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.slider {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 2rem;
  background: transparent;
  cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--line-strong);
  border-radius: 2px;
}
.slider::-moz-range-track {
  height: 3px;
  background: var(--line-strong);
  border-radius: 2px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  margin-top: -9.5px;
  background: var(--accent);
  border: 3px solid var(--surface);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
.slider::-moz-range-thumb {
  width: 22px; height: 22px;
  background: var(--accent);
  border: 3px solid var(--surface);
  border-radius: 50%;
}
.slider:focus-visible { outline-offset: 4px; }

.slider__out {
  display: block;
  margin-top: var(--s2);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-soft);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.form-status { margin: 0; font-size: var(--fs-sm); color: var(--ink-mute); }
.form-disclaimer { font-size: var(--fs-xs); color: var(--ink-mute); max-width: 60ch; }

/* =========================================================== SNAPSHOT === */

.snapshot-head { margin-bottom: var(--s5); }
.snapshot-head h2 { margin-bottom: var(--s4); }

.snapshot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s4);
  align-items: start;
}
.snapshot-grid .panel { margin-bottom: 0; height: 100%; }

.meter { margin-bottom: var(--s3); }
.meter__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s3);
}
.meter__value { display: flex; align-items: baseline; gap: 2px; }
.meter__value strong {
  font-size: 2.75rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.meter__scale { font-size: var(--fs-md); color: var(--ink-faint); }
.meter__band {
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}
.meter__track { display: flex; gap: 3px; }
.meter__mark {
  flex: 1;
  height: 6px;
  background: var(--bg-sunk);
  border-radius: 1px;
}
.meter__mark.is-filled { background: var(--accent); }
.meter--low .meter__mark.is-filled { background: var(--ok); }
.meter--high .meter__mark.is-filled { background: #a8622a; }
.meter--very-high .meter__mark.is-filled { background: var(--danger); }
.meter--high .meter__band { border-color: #dcbd9c; color: #8a5a13; }
.meter--very-high .meter__band { border-color: #e0b8ab; color: var(--danger); }
.meter--low .meter__band { border-color: #b6cfc0; color: var(--ok); }

.driver-list, .pattern-list { list-style: none; }
.driver, .pattern {
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
}
.driver:last-child, .pattern:last-child { border-bottom: none; padding-bottom: 0; }
.driver__label, .pattern__label {
  display: block;
  font-weight: 600;
  font-size: var(--fs-base);
}
.driver__detail, .pattern__detail {
  display: block;
  margin-top: var(--s1);
  font-size: var(--fs-sm);
  color: var(--ink-mute);
}

.panel--reading {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s5);
  margin-top: var(--s5);
}
.reading__lead { font-size: var(--fs-md); color: var(--ink); }
.reading p { color: var(--ink-soft); }

.transparency__bars { display: grid; gap: var(--s4); margin-bottom: var(--s4); }

.scorebar__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s1);
}
.scorebar__label { font-size: var(--fs-sm); font-weight: 500; }
.scorebar__value { font-size: var(--fs-xs); color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.scorebar__track { display: block; height: 5px; background: var(--bg-sunk); border-radius: 2px; overflow: hidden; }
.scorebar__fill { display: block; height: 100%; background: var(--accent); }
.scorebar__detail { margin: var(--s1) 0 0; font-size: var(--fs-xs); color: var(--ink-mute); }

.source-note { display: flex; align-items: flex-start; gap: var(--s2); margin-bottom: var(--s4); }
.source-note .icon { flex: none; margin-top: 2px; color: var(--accent); }

.snapshot-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }

/* =============================================================== PLAN === */

.plan-head { margin-bottom: var(--s6); }
.plan-head h2 { margin-bottom: var(--s3); }
.plan-head .lede { margin-bottom: var(--s4); }

.plan-progress { display: flex; align-items: center; gap: var(--s3); max-width: 24rem; }
.plan-progress__label {
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.plan-progress__track { flex: 1; height: 3px; background: var(--bg-sunk); border-radius: 2px; }
.plan-progress__fill { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s var(--ease); }

.plan-steps { list-style: none; margin-bottom: var(--s6); }

.plan-step {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: var(--s5);
  padding: var(--s5) 0;
  border-top: 1px solid var(--line);
}
.plan-step:last-child { border-bottom: 1px solid var(--line); }
.plan-step.is-done .plan-step__title > span:first-child { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.plan-step.is-done .plan-step__body { opacity: 0.72; }

.plan-step__marker { display: flex; flex-direction: column; gap: var(--s2); }
.plan-step__stage {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.plan-step__num {
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--line-strong);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.plan-step__tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem; height: 1.75rem;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
}

.plan-step__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s3);
  margin-bottom: var(--s2);
  font-size: var(--fs-lg);
}
.plan-step__duration {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-mute);
  text-transform: none;
  letter-spacing: 0;
}
.plan-step__rationale { color: var(--ink); }
.plan-step__summary { color: var(--ink-mute); font-size: var(--fs-sm); }
.plan-step__actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }

.nudge {
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s5);
  background: var(--bg-sunk);
  border-radius: var(--r-lg);
}
.nudge p:last-child { color: var(--ink-soft); }

.panel--checkin { border-color: var(--accent-line); }
.panel--checkin.is-done { background: var(--accent-soft); border-color: var(--accent-line); }
.checkin-form { margin-top: var(--s4); }

.checkin-result { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s5); margin-bottom: var(--s4); }
.checkin-result__pair { display: inline-flex; align-items: center; gap: var(--s3); }
.checkin-result__num {
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.checkin-result__arrow { color: var(--ink-faint); display: inline-flex; }
.checkin-result__label { margin: 0; font-weight: 500; color: var(--ink-soft); }

.plan-footer { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }

.swap-list { list-style: none; display: grid; gap: var(--s3); margin-top: var(--s4); }
.swap-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.swap-item__title { font-size: var(--fs-md); margin-bottom: var(--s1); }
.swap-item__meta { font-size: var(--fs-xs); color: var(--ink-mute); margin-bottom: var(--s2); }
.swap-item p:last-child { color: var(--ink-soft); font-size: var(--fs-sm); margin: 0; }
.swap-item .btn { flex: none; }

/* ======================================================= EXERCISE RUN === */

.exercise-run__why { color: var(--ink-soft); margin-bottom: var(--s4); }

.steps { list-style: none; counter-reset: step; margin-bottom: var(--s5); }
.steps li {
  counter-increment: step;
  position: relative;
  padding: var(--s2) 0 var(--s2) 2.25rem;
  border-bottom: 1px solid var(--line);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: var(--s2);
  width: 1.5rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.timer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s4);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.timer__label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-mute); }
.timer__value {
  font-size: var(--fs-xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-right: auto;
}

/* ============================================================ WINGMAN === */

.wingman-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s4);
}
.wingman-head h2 { margin: 0 0 var(--s2); }

.context-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s4);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.context-strip__list { display: flex; flex-wrap: wrap; gap: var(--s5); margin: 0; }
.context-strip__item dt {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.context-strip__item dd { margin: 0; font-size: var(--fs-sm); font-weight: 500; }
.context-strip .btn { margin-left: auto; }

.chat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
}

.chat__list {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  max-height: 26rem;
  overflow-y: auto;
  padding-right: var(--s2);
  margin-bottom: var(--s4);
  scroll-behavior: smooth;
}

.msg { max-width: 42rem; }
.msg--user { margin-left: auto; }
.msg__body {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-lg);
  font-size: var(--fs-base);
}
.msg--wingman .msg__body {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-top-left-radius: var(--r-sm);
  color: var(--ink);
}
.msg--user .msg__body {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-top-right-radius: var(--r-sm);
  color: var(--ink);
}
.msg__body p { margin-bottom: var(--s2); }
.msg__body p:last-child { margin-bottom: 0; }
.msg__meta { margin: var(--s1) 0 0 var(--s3); font-size: var(--fs-xs); color: var(--ink-faint); }

.chat__typing { display: flex; align-items: center; gap: var(--s2); padding-bottom: var(--s3); }
/* An author `display` rule outranks the user agent's [hidden] rule, so the
   hidden state has to be restated for every element styled with display. */
.chat__typing[hidden] { display: none; }
.chat__typing-dots { display: inline-flex; gap: 4px; }
.chat__typing-dots i {
  width: 6px; height: 6px;
  background: var(--ink-faint);
  border-radius: 50%;
  animation: bounce 1.1s infinite ease-in-out;
}
.chat__typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.chat__typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-3px); opacity: 1; }
}

.chat__suggestions { padding-top: var(--s4); border-top: 1px solid var(--line); }
.chat__suggestions-label { margin: 0 0 var(--s2); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-mute); }
.chat__suggestion-list { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; }
.suggestion {
  padding: 0.35rem 0.75rem;
  min-height: 2.125rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
}
.suggestion:hover { border-color: var(--accent); color: var(--accent); }

.chat__form { margin-top: var(--s4); }
.chat__input {
  display: block;
  width: 100%;
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font: inherit;
  font-size: var(--fs-md);
  line-height: 1.55;
  resize: vertical;
  color: var(--ink);
}
.chat__input:focus-visible { border-color: var(--accent); outline-offset: 0; }
.chat__form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-top: var(--s2);
}

.chat-privacy { margin-top: var(--s4); }

.switch { display: inline-flex; align-items: center; gap: var(--s3); }
.switch__input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 2.5rem; height: 1.4rem;
  flex: none;
  margin: 0;
  background: var(--line-strong);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background-color 0.16s var(--ease);
}
.switch__input::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 1.05rem; height: 1.05rem;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s var(--ease);
}
.switch__input:checked { background: var(--accent); }
.switch__input:checked::after { transform: translateX(1.1rem); }
.switch__label { font-size: var(--fs-sm); color: var(--ink-soft); cursor: pointer; }

/* =========================================================== PROGRESS === */

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s4);
  margin: 0 0 var(--s6);
  padding-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
}
.summary-item dt {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.summary-item dd {
  margin: var(--s1) 0 0;
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.chart__wrap { overflow-x: auto; margin: var(--s4) 0 var(--s3); }
.chart { width: 100%; max-width: 34rem; min-width: 320px; height: auto; display: block; }
.chart__guide { stroke: var(--line); stroke-width: 1; }
.chart__axis { fill: var(--ink-faint); font-size: 7px; font-family: var(--font); }
.chart__bar--before { fill: var(--ink-mute); }
.chart__bar--after { fill: var(--accent); }

.legend { display: flex; gap: var(--s4); list-style: none; }
.legend__item { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-xs); color: var(--ink-mute); }
.legend__item::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 2px;
}
.legend__item--before::before { background: var(--ink-mute); }
.legend__item--after::before { background: var(--accent); }

.catbars { list-style: none; display: grid; gap: var(--s3); margin-bottom: var(--s3); }
.catbar { display: grid; grid-template-columns: 5rem 1fr 4.5rem; align-items: center; gap: var(--s3); }
.catbar__label { font-size: var(--fs-sm); font-weight: 500; }
.catbar__track { display: block; height: 8px; background: var(--bg-sunk); border-radius: 2px; overflow: hidden; }
.catbar__fill { display: block; height: 100%; background: var(--accent); }
.catbar__count { font-size: var(--fs-xs); color: var(--ink-mute); text-align: right; font-variant-numeric: tabular-nums; }

.timeline { list-style: none; }
.timeline__item {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: var(--s4);
  padding: var(--s4) 0;
  border-top: 1px solid var(--line);
}
.timeline__item:first-child { border-top: none; padding-top: 0; }
.timeline__meta { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-sm); color: var(--ink-mute); }
.timeline__title { margin: 0 0 var(--s1); font-weight: 600; }
.timeline__detail { margin: 0 0 var(--s1); font-size: var(--fs-sm); color: var(--ink-mute); }
.timeline__result { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.tag {
  align-self: flex-start;
  padding: 0.05rem 0.4rem;
  background: var(--bg-sunk);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  color: var(--ink-mute);
}
.tag--live {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  white-space: nowrap;
}

/* The session that is open right now, shown above the recorded timeline. */
.panel--live { border-color: var(--accent-line); background: var(--accent-soft); }
.panel--live .plan-progress { max-width: none; margin-bottom: var(--s4); }
.panel--live .plan-progress__label { flex: 0 1 auto; }
.panel--live .plan-progress__track { background: var(--surface); min-width: 4rem; }
.panel--live .summary-row { border-bottom-color: var(--accent-line); }
.panel--live .meta { margin-top: var(--s3); }

.live-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.live-head .panel__title { margin-bottom: 0; }

.summary-row--tight {
  margin-bottom: var(--s4);
  padding-bottom: var(--s4);
}
.summary-row--tight .summary-item dd { font-size: var(--fs-lg); }
.summary-item__note {
  margin: var(--s1) 0 0;
  font-size: var(--fs-xs);
  color: var(--ink-mute);
}

.filebtn { display: inline-flex; }
.filebtn label { cursor: pointer; }
.filebtn input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ======================================================== HOW IT WORKS === */

.diagram__wrap { overflow-x: auto; margin: var(--s4) 0 var(--s5); }
.diagram { width: 100%; min-width: 620px; max-width: 46rem; height: auto; display: block; }

.diagram__box { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.diagram__box--safety { fill: var(--accent-soft); stroke: var(--accent-line); stroke-width: 1.5; }
.diagram__box--stop { fill: #fbeeea; stroke: #d9b3a8; }
.diagram__box--optional { fill: var(--surface-alt); stroke: var(--line); stroke-dasharray: 4 3; }

.diagram__label { fill: var(--ink); font-size: 12px; font-family: var(--font); font-weight: 500; }
.diagram__sub { fill: var(--ink-mute); font-size: 9.5px; font-family: var(--font); }
.diagram__note { fill: var(--ink-faint); font-size: 9px; font-family: var(--font); font-style: italic; }

.diagram__arrow { stroke: var(--ink-mute); stroke-width: 1.4; fill: none; marker-end: url(#fb-arrow); }
.diagram__arrow--dashed { stroke-dasharray: 4 3; stroke: var(--ink-faint); }
.diagram__head { fill: var(--ink-mute); }

.plainlist { list-style: none; display: grid; gap: var(--s3); margin: var(--s3) 0 0; }
.plainlist li { padding-left: var(--s4); position: relative; font-size: var(--fs-sm); color: var(--ink-soft); }
.plainlist li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent-line);
}

.twocol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); margin-top: var(--s3); }
.twocol__head {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-mute); margin: 0;
}

.modelcard { display: grid; gap: 0; margin-top: var(--s3); }
.modelcard__row {
  display: grid; grid-template-columns: 10rem minmax(0, 1fr);
  gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--line);
}
.modelcard__row:first-child { border-top: none; padding-top: 0; }
.modelcard__term { font-size: var(--fs-sm); font-weight: 600; margin: 0; }
.modelcard__detail { font-size: var(--fs-sm); color: var(--ink-soft); margin: 0; }

@media (max-width: 640px) {
  .twocol { grid-template-columns: 1fr; gap: var(--s4); }
  .modelcard__row { grid-template-columns: 1fr; gap: var(--s1); }
}

/* ============================================================== ABOUT === */

.panel--safety { border-color: var(--accent-line); background: var(--accent-soft); }
.panel--safety .panel__lede { font-size: var(--fs-md); color: var(--ink); }

.resource-list { list-style: none; margin-top: var(--s4); }
.resource {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s3) 0;
  border-top: 1px solid var(--accent-line);
}
.resource__name { margin: 0; font-weight: 600; }
.resource__detail { margin: var(--s1) 0 0; font-size: var(--fs-sm); color: var(--ink-soft); max-width: 52ch; }
.resource .btn { flex: none; }

.setting-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) 0;
  border-top: 1px solid var(--line);
}
.setting-row:first-of-type { border-top: none; }
.setting-row__label { margin: 0; font-weight: 600; font-size: var(--fs-base); cursor: pointer; }
.setting-row__help { margin: var(--s1) 0 0; font-size: var(--fs-sm); color: var(--ink-mute); max-width: 52ch; }
.setting-row--danger { border-top-color: var(--line-strong); }

.library { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--s5); margin-top: var(--s4); }
.library__title { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.library__blurb { margin: var(--s2) 0 var(--s3); font-size: var(--fs-xs); color: var(--ink-mute); }
.library__list { list-style: none; display: grid; gap: 2px; }
.library__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
  width: 100%;
  min-height: 2.25rem;
  padding: var(--s2);
  background: none;
  border: none;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
}
.library__item:hover { background: var(--bg-sunk); color: var(--ink); }
.library__item-meta { font-size: var(--fs-xs); color: var(--ink-faint); flex: none; }

/* ==================================================== SAFETY SUPPORT === */

.support {
  max-width: 44rem;
  padding: var(--s6);
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.support__title { font-size: var(--fs-2xl); margin-bottom: var(--s4); letter-spacing: -0.02em; }
.support__lede { font-size: var(--fs-lg); color: var(--ink); margin-bottom: var(--s4); }
.support p { color: var(--ink-soft); }
.resource-list--support .resource { border-top-color: var(--line); }
.support__note { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); }
.support__actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }

/* ============================================================== DEMO === */

.demo-bar {
  position: sticky;
  top: 3.6rem;
  z-index: 25;
  background: var(--ink);
  color: #f2f1ec;
}
.demo-bar[hidden] { display: none; }
.demo-bar__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--s2) var(--s5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s4);
}
.demo-bar__label { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s3); min-width: 0; }
.demo-bar__tag {
  padding: 0.05rem 0.45rem;
  background: #f2f1ec;
  color: var(--ink);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.demo-bar__step { font-size: var(--fs-sm); font-weight: 600; }
.demo-bar__detail { font-size: var(--fs-xs); color: #a8aeaa; }
.demo-bar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-left: auto; }
.demo-bar__note { font-size: var(--fs-xs); color: #9fc4bf; }
.demo-bar .btn--text { color: #cfd4d0; }
.demo-bar .btn--text:hover:not(:disabled) { color: #fff; }
.demo-bar .btn--secondary { background: transparent; border-color: #4a524f; color: #f2f1ec; }
.demo-bar .btn--secondary:hover { border-color: #f2f1ec; background: transparent; }

/* ============================================================ NOTICE === */

.notice-bar {
  max-width: var(--container);
  margin: var(--s5) auto 0;
  padding: var(--s4) var(--s5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-lg);
}
#notice-host { padding-inline: var(--s5); }
#notice-host[hidden] { display: none; }
.notice-bar__text { margin: 0; max-width: 62ch; font-size: var(--fs-sm); color: var(--ink-soft); }
.notice-bar__actions { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* ============================================================ DIALOG === */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
  background: rgba(25, 29, 28, 0.42);
  overflow-y: auto;
  animation: fade 0.14s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.dialog {
  width: 100%;
  max-width: 30rem;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.dialog--wide { max-width: 38rem; }

.dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s5) var(--s5) var(--s3);
  border-bottom: 1px solid var(--line);
}
.dialog__title { font-size: var(--fs-lg); }
.dialog__body { padding: var(--s5); overflow-y: auto; }
.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.progressbar { height: 4px; background: var(--bg-sunk); border-radius: 2px; overflow: hidden; margin-top: var(--s3); }
.progressbar__fill { display: block; height: 100%; background: var(--accent); transition: width 0.3s var(--ease); }

/* ============================================================= TOAST === */

.toast-host {
  position: fixed;
  bottom: var(--s4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  align-items: center;
  pointer-events: none;
  width: min(28rem, calc(100vw - 2rem));
}
.toast {
  padding: var(--s2) var(--s4);
  background: var(--ink);
  color: #f4f3ee;
  border-radius: var(--r);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow);
  animation: rise 0.2s var(--ease);
}
.toast.is-leaving { opacity: 0; transition: opacity 0.3s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============================================================ FOOTER === */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-sunk);
}
.site-footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--s6) var(--s5);
}
.site-footer__brand { font-weight: 600; margin-bottom: var(--s2); }
.site-footer__tagline { font-weight: 400; color: var(--ink-mute); }
.site-footer__note { max-width: 60ch; font-size: var(--fs-sm); color: var(--ink-soft); }
.site-footer__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); font-size: var(--fs-xs); color: var(--ink-mute); margin-top: var(--s3); }
/* Footer links are small text but still need a real touch target. */
.site-footer__meta a { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 2px; }

.unsupported { max-width: 34rem; margin: var(--s8) auto; padding: var(--s5); text-align: center; }

/* ======================================================== RESPONSIVE === */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: var(--s5); }
  .hero__art { display: none; }
  .intro-grid { grid-template-columns: 1fr; gap: var(--s4); }
  .home-current { grid-template-columns: 1fr; }
  .loop__list { grid-template-columns: 1fr; gap: var(--s4); }
  .snapshot-grid { grid-template-columns: 1fr; }
  .panel--reading { grid-template-columns: 1fr; gap: var(--s4); }
  .summary-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .site-header__inner { flex-wrap: wrap; gap: var(--s3); padding-inline: var(--s4); }
  .nav-toggle { display: inline-flex; order: 3; }
  .site-header__status { order: 2; margin-left: auto; }
  .nav {
    order: 4;
    width: 100%;
    margin-left: 0;
    display: none;
  }
  .nav.is-open { display: block; }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; padding-bottom: var(--s2); }
  .nav__link { padding: var(--s3) var(--s2); border-bottom: 1px solid var(--line); border-radius: 0; font-size: var(--fs-md); }
  .nav__link.is-active { background: none; }

  .view-host { padding: var(--s5) var(--s4) var(--s7); }
  .demo-bar { top: auto; position: static; }
  .demo-bar__inner { padding-inline: var(--s4); }
  #notice-host { padding-inline: var(--s4); }

  .plan-step { grid-template-columns: 1fr; gap: var(--s3); }
  .plan-step__marker { flex-direction: row; align-items: center; gap: var(--s3); }
  .plan-step__num { font-size: var(--fs-lg); }

  .timeline__item { grid-template-columns: 1fr; gap: var(--s2); }
  .timeline__meta { flex-direction: row; align-items: center; gap: var(--s3); }
  .catbar { grid-template-columns: 4.5rem 1fr 3.5rem; }

  .site-footer__inner { padding-inline: var(--s4); }
  .panel { padding: var(--s4); }
  .support { padding: var(--s5); }
  .resource { flex-direction: column; align-items: flex-start; }
  .swap-item { flex-direction: column; }
  .msg { max-width: 100%; }
  .chat { padding: var(--s4); }
}

@media (max-width: 520px) {
  .summary-row { grid-template-columns: 1fr; gap: var(--s3); }
  .hero__title { font-size: 2.5rem; }
  .field__label--lead { font-size: var(--fs-lg); }
  .btn { width: auto; }
  .hero__actions .btn, .form-actions .btn { flex: 1 1 auto; }
  .dialog__actions { flex-direction: column-reverse; }
  .dialog__actions .btn { width: 100%; }
  .setting-row { flex-direction: column; align-items: flex-start; }
  .context-strip .btn { margin-left: 0; }
}

/* ==================================================== MOTION AND MEDIA === */

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

/* The in-app preference, which is independent of the system setting. */
[data-reduced-motion="true"] { scroll-behavior: auto; }
[data-reduced-motion="true"] *,
[data-reduced-motion="true"] *::before,
[data-reduced-motion="true"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

@media (prefers-contrast: more) {
  :root {
    --line: #b9b5a9;
    --line-strong: #8f8b7e;
    --ink-mute: #4b524f;
    --ink-faint: #5d6461;
  }
}

@media print {
  .site-header, .site-footer, .demo-bar, .toast-host, #notice-host { display: none; }
  .panel { border-color: #ccc; box-shadow: none; }
}
