/* Self-hosted, not a CDN: a cross-origin font request is returned early by the
   service worker (sw.js leaves cross-origin to the browser), so an offline
   launch would silently fall back to system fonts. */
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('./fonts/dm-sans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('./fonts/dm-sans-700.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('./fonts/plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('./fonts/plex-mono-600.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('./fonts/plex-mono-700.woff2') format('woff2');
}

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

/* viewport-fit=cover + black-translucent means content sits under the notch and
   home indicator. Without these insets the top of the UI is unreachable. */
body {
  margin: 0;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--color-bg);
  background-image:
    radial-gradient(120% 60% at 50% -10%, rgb(94 200 255 / 0.10), transparent 60%),
    linear-gradient(var(--color-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px, 24px 24px;
  background-attachment: fixed;
  color: var(--color-text);
  font-family: var(--font-prose);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body.is-busy { overflow: hidden; }

.wrap { max-width: 40rem; margin: 0 auto; padding: 1.25rem 1rem calc(3rem + var(--safe-bottom)); }

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

h1 { margin: 0.2rem 0 0.4rem; font-size: clamp(1.6rem, 6.4vw, 2.1rem); line-height: 1.15; letter-spacing: -0.015em; }
h1:focus { outline: none; }
.eyebrow {
  margin: 0; font-family: var(--font-data); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-accent);
}
.lede { margin: 0 0 1.25rem; color: var(--color-text-dim); max-width: 36rem; }
.hint { margin: 0.1rem 0 0.6rem; font-size: 0.88rem; color: var(--color-text-dim); }

.icon { width: 1.35em; height: 1.35em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── app bar ─────────────────────────────────────────────────────────── */
/* First thing on every screen, so it gets the processing animation's level of
   care: a retro wordmark, Gus peeking at it from a hard-hat-orange badge, a
   progress rail that fills as the report moves along, and a hazard-tape edge.
   No backdrop-filter: a blurred sticky layer is a known blank-render risk on
   Android Chrome, and a solid blueprint panel reads better anyway. */
.app-bar {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--safe-top);
  background:
    linear-gradient(var(--color-grid) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, var(--color-grid) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(180deg, #0f2440, var(--color-bg-deep));
  box-shadow: 0 10px 24px rgb(0 0 0 / 0.35);
}
.app-bar-main {
  display: flex; align-items: center; gap: 0.75rem;
  max-width: 40rem; margin: 0 auto; padding: 1rem 1rem 0.55rem;   /* room for Gus's hat above the badge */
}
.brand { display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1; }
.brand-name {
  font-family: var(--font-data); font-weight: 700; font-size: 1.32rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: #fff4e6;
  /* Two hard offsets, no blur: the stepped shadow of an arcade marquee. */
  text-shadow: 2px 2px 0 #b85300, 4px 4px 0 rgb(0 0 0 / 0.4);
}
.brand-tag {
  margin-top: 0.4rem; font-family: var(--font-data); font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-blueprint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-badge {
  position: relative; flex: none; width: 48px; height: 48px; border-radius: 13px;
  background:
    radial-gradient(circle at 50% 75%, rgb(255 138 31 / 0.28), transparent 70%),
    linear-gradient(180deg, #1c3a60, var(--color-surface-2));
  border: 2px solid var(--color-accent);
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / 0.28), 0 0 0 3px rgb(255 138 31 / 0.14);
}
/* Larger than the frame and anchored to its floor, so the hard hat pops out
   over the top edge; clipped only along the bottom, where the close-up is cropped. */
.brand-badge .gus-canvas {
  position: absolute; left: 50%; bottom: 2px; width: 62px; height: 62px;
  transform: translateX(-50%);
  clip-path: inset(-50% -50% 0 -50%);
}
.app-bar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.45rem; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 13px; border: 1px solid var(--color-border);
  background: rgb(255 255 255 / 0.03); color: var(--color-text-dim); cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.icon-btn:hover { color: var(--color-text); border-color: var(--color-blueprint); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn .icon { width: 21px; height: 21px; }

.rail {
  --progress: 0;
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  max-width: 40rem; margin: 0 auto; padding: 0.1rem 1rem 0.75rem; list-style: none;
  font-family: var(--font-data); font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-text-dim);
}
/* Track and fill run centre-to-centre between the first and last markers. */
.rail::before, .rail::after {
  content: ""; position: absolute; top: calc(0.1rem + 9px); height: 3px; border-radius: 2px;
  left: calc(1rem + (100% - 2rem) / 6);
}
.rail::before { width: calc((100% - 2rem) * 2 / 3); background: var(--color-border); }
.rail::after {
  width: calc((100% - 2rem) * 2 / 3 * var(--progress));
  background: linear-gradient(90deg, var(--color-hivis), var(--color-accent));
  box-shadow: 0 0 10px rgb(255 138 31 / 0.45);
  transition: width 0.7s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.rail li { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.rail-dot {
  display: grid; place-items: center; width: 21px; height: 21px; border-radius: 6px;
  background: var(--color-bg-deep); border: 2px solid var(--color-border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.rail-dot::after { content: ""; width: 6px; height: 6px; border-radius: 2px; }
.rail li.is-complete { color: var(--color-hivis); }
.rail li.is-complete .rail-dot { background: var(--color-hivis); border-color: var(--color-hivis); }
.rail li.is-complete .rail-dot::after {
  width: 9px; height: 5px; border-radius: 0;
  border: solid var(--color-accent-ink); border-width: 0 0 2.5px 2.5px;
  transform: translateY(-1px) rotate(-45deg);
}
.rail li.is-current { color: var(--color-text); }
.rail li.is-current .rail-dot {
  background: var(--color-accent); border-color: var(--color-accent);
  animation: rail-pulse 2.4s ease-in-out infinite;
}
.rail li.is-current .rail-dot::after { background: var(--color-accent-ink); }

/* Hazard tape along the bottom edge, crawling slowly. One animation cycle
   shifts the stripes by exactly two periods (16px stripe / sin 45deg), so the
   loop is seamless. */
.hazard {
  height: 6px;
  background: repeating-linear-gradient(-45deg, var(--color-accent) 0 8px, #17120c 8px 16px);
  animation: tape 7s linear infinite;
}

@media (max-width: 23rem) {
  .brand-name { font-size: 1.1rem; letter-spacing: 0.1em; }
  .brand-tag { display: none; }
}

.net-banner {
  position: relative; z-index: 25;
  margin: 0; padding: 0.55rem 1rem; text-align: center; font-size: 0.9rem; font-weight: 700;
  color: var(--color-accent-ink); background: var(--color-hivis);
}

/* ── controls ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: var(--tap); min-width: var(--tap);
  padding: 0 1.1rem;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--color-surface-2); color: var(--color-text);
  font: 700 1rem/1.1 var(--font-prose);
  text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary {
  background: var(--color-accent); color: var(--color-accent-ink);
  box-shadow: 0 6px 18px rgb(255 138 31 / 0.28), inset 0 -2px 0 rgb(0 0 0 / 0.14);
}
.btn-primary:hover:not(:disabled) { background: var(--color-accent-strong); }
.btn-secondary { background: var(--color-surface-2); border-color: var(--color-border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--color-blueprint); }
.btn-ghost { background: transparent; border-color: var(--color-border); font-weight: 400; }
.btn-ghost:hover:not(:disabled) { background: var(--color-surface); }
.btn-link {
  background: none; border: 0; color: var(--color-text-dim); font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
}
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.08rem; }
.btn-small { min-height: 40px; min-width: 40px; padding: 0 0.8rem; font-size: 0.88rem; }
:where(button, input, textarea, a, select):focus-visible {
  outline: 3px solid var(--color-blueprint); outline-offset: 2px;
}

.card {
  margin: 0 0 1rem; padding: 1.1rem 1rem 0.6rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 96%, white 4%), var(--color-surface));
  border: 1px solid var(--color-border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
fieldset.card { min-width: 0; }
.card-title {
  display: flex; align-items: center; gap: 0.6rem; float: left; width: 100%;
  margin: 0 0 0.9rem; padding: 0; font-size: 1.12rem; font-weight: 700;
}
.card-title + * { clear: both; }
.card-num {
  font-family: var(--font-data); font-size: 0.72rem; color: var(--color-blueprint);
  border: 1px solid color-mix(in srgb, var(--color-blueprint) 50%, transparent);
  border-radius: 6px; padding: 0.1rem 0.35rem;
}

.field { margin-bottom: 0.35rem; min-width: 0; }
.field label, .label-row label, .q-text { display: block; margin-bottom: 0.3rem; font-weight: 700; font-size: 0.95rem; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.count { font-family: var(--font-data); font-size: 0.75rem; color: var(--color-text-dim); }
.count[data-warn="true"] { color: var(--color-accent); }
.optional {
  margin-left: 0.35rem; font-family: var(--font-data); font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-dim);
}
.field-row { display: grid; gap: 0 0.75rem; }
@media (min-width: 30rem) { .field-row { grid-template-columns: 1fr 1fr; } }
.field-row-tight { grid-template-columns: 1fr 1fr; }

.input {
  display: block; width: 100%;
  min-height: var(--tap); padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-bg-deep); color: var(--color-text);
  font: 16px/1.4 var(--font-prose);   /* below 16px, iOS Safari zooms the page on focus */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: color-mix(in srgb, var(--color-text-dim) 70%, transparent); }
.input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgb(255 138 31 / 0.22); }
.input[aria-invalid="true"] { border-color: var(--color-danger); box-shadow: 0 0 0 3px rgb(255 107 107 / 0.16); }
.input-mono { font-family: var(--font-data); letter-spacing: 0.02em; }
input[type="date"].input, input[type="time"].input { color-scheme: dark; min-width: 0; }
.textarea { resize: vertical; min-height: 4.5rem; }
.textarea-lg { min-height: 12rem; line-height: 1.55; }
.field-error { min-height: 1.3rem; margin: 0.25rem 0 0.1rem; font-size: 0.86rem; font-weight: 700; color: var(--color-danger); }
.field-error:empty { min-height: 0.5rem; }

/* ── dictation ───────────────────────────────────────────────────────── */
.dictate-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.2rem 0 0.8rem; }
.mic-btn {
  --level: 0;
  position: relative; padding-left: 0.4rem; padding-right: 1.2rem;
  background: var(--color-surface-2); border-color: var(--color-border);
}
.mic-icon {
  position: relative; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--color-accent); color: var(--color-accent-ink);
}
.mic-icon .icon { width: 20px; height: 20px; grid-area: 1 / 1; }
.icon-stop { display: none; fill: currentColor; stroke: none; }
.mic-btn[data-state="recording"] { background: #3a1620; border-color: #ff6b6b; }
.mic-btn[data-state="recording"] .mic-icon {
  background: #ff5a5a; color: #fff;
  box-shadow: 0 0 0 calc(4px + var(--level) * 16px) rgb(255 90 90 / 0.28);
  transition: box-shadow 0.08s linear;
}
.mic-btn[data-state="recording"] .icon-mic { display: none; }
.mic-btn[data-state="recording"] .icon-stop { display: block; }
.mic-btn[data-state="working"] .mic-icon::after,
.mic-btn[data-state="starting"] .mic-icon::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2.5px solid transparent; border-top-color: var(--color-accent);
  animation: spin 0.8s linear infinite;
}
.mic-btn-small { min-height: 44px; }
.mic-btn-small .mic-icon { width: 32px; height: 32px; }
.dictate-status { flex: 1 1 12rem; margin: 0; font-size: 0.9rem; color: var(--color-text-dim); }
.dictate-status[data-tone="live"] { color: #ff9b9b; font-family: var(--font-data); font-size: 0.85rem; }
.dictate-status[data-tone="ok"] { color: var(--color-ok); }
.dictate-status[data-tone="error"] { color: var(--color-danger); font-weight: 700; }

/* ── photos ──────────────────────────────────────────────────────────── */
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; margin: 0 0 0.8rem; padding: 0; list-style: none; }
@media (min-width: 30rem) { .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.photo-grid:empty { display: none; }
.photo-tile { display: flex; flex-direction: column; gap: 0.4rem; animation: pop-in 0.25s ease both; }
.photo-frame { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-bg-deep); border: 1px solid var(--color-border); }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-label {
  position: absolute; left: 0.4rem; bottom: 0.4rem;
  padding: 0.1rem 0.4rem; border-radius: 6px;
  font-family: var(--font-data); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  background: rgb(7 17 31 / 0.78); color: var(--color-text);
}
.photo-remove {
  position: absolute; top: 0.3rem; right: 0.3rem;
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: rgb(7 17 31 / 0.78); color: #fff; cursor: pointer;
}
.photo-remove .icon { width: 18px; height: 18px; }
.input-caption { min-height: 40px; padding: 0.45rem 0.6rem; font-size: 16px; border-radius: 8px; }
.photo-tile.is-pending {
  aspect-ratio: 1; align-items: center; justify-content: center; position: relative;
  border: 1.5px dashed var(--color-border); border-radius: var(--radius-sm); background: var(--color-bg-deep);
}
.photo-tile.is-pending .photo-label { position: static; background: none; color: var(--color-text-dim); }
.meter { height: 6px; margin: 0 0 0.8rem; border-radius: 999px; background: var(--color-bg-deep); overflow: hidden; }
.meter span { display: block; height: 100%; width: var(--fill, 0%); background: var(--color-blueprint); border-radius: inherit; transition: width 0.3s ease; }
.meter[data-warn="true"] span { background: var(--color-accent); }

/* ── alerts, notes ───────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  margin: 0 0 1rem; padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm); border: 1px solid rgb(255 107 107 / 0.45);
  background: var(--color-danger-bg); color: #ffd0d0;
  animation: pop-in 0.2s ease both;
}
.alert p { flex: 1 1 14rem; margin: 0; font-weight: 700; }
.alert[data-tone="info"] { border-color: rgb(94 200 255 / 0.45); background: var(--color-info-bg); color: #d4efff; }
.note { margin: 0 0 1rem; padding: 0.75rem 1rem; border-left: 3px solid var(--color-hivis); border-radius: 6px; background: rgb(212 236 58 / 0.07); }
.note-title { margin: 0 0 0.25rem; font-weight: 700; color: var(--color-hivis); }
.note ul { margin: 0; padding-left: 1.1rem; color: var(--color-text-dim); }

.form-actions {
  position: sticky; bottom: 0; z-index: 5;
  margin: 1.2rem -1rem 0; padding: 0.9rem 1rem calc(0.9rem + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, var(--color-bg) 30%);
}
.form-actions-split { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; }

/* ── login ───────────────────────────────────────────────────────────── */
.login-hero { text-align: center; padding-top: 0.5rem; }
.login-hero .lede { margin-left: auto; margin-right: auto; }
.login-hero .gus { margin: 0 auto 0.4rem; }
.login-card { padding-bottom: 1.1rem; }
.password-row { display: flex; gap: 0.5rem; }
.password-row .input { flex: 1; }
.shake { animation: shake 0.4s ease; }

/* ── clarify ─────────────────────────────────────────────────────────── */
.clarify-head { display: flex; align-items: center; gap: 0.85rem; }
.clarify-head .lede { margin-bottom: 1rem; }
.question-list { margin: 0; padding: 0; list-style: none; counter-reset: q; }
.question { padding-top: 0.9rem; animation: rise-in 0.35s ease both; }
.question:nth-child(2) { animation-delay: 0.06s; }
.question:nth-child(3) { animation-delay: 0.12s; }
.question:nth-child(4) { animation-delay: 0.18s; }
.question:nth-child(5) { animation-delay: 0.24s; }
.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.45rem; }
.q-number { font-family: var(--font-data); font-size: 0.75rem; font-weight: 700; color: var(--color-blueprint); }
.q-badge {
  font-family: var(--font-data); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.15rem 0.5rem; border-radius: 999px; border: 1px solid var(--color-border); color: var(--color-text-dim);
}
.question[data-required="true"] .q-badge { color: var(--color-accent-ink); background: var(--color-accent); border-color: transparent; }
.q-text { font-size: 1.05rem !important; line-height: 1.35; }
.q-reason { margin: -0.1rem 0 0.6rem; font-size: 0.86rem; color: var(--color-text-dim); }

/* ── done ────────────────────────────────────────────────────────────── */
.screen-done { text-align: center; }
.screen-done .lede { margin-left: auto; margin-right: auto; }
.done-hero { position: relative; display: grid; place-items: center; margin: 0.5rem auto 0.4rem; width: fit-content; }
.done-hero .stamp { position: absolute; right: -1.6rem; top: 1.2rem; animation: stamp-in 0.5s 0.9s cubic-bezier(.2,1.6,.4,1) both; }
.file-card { display: flex; align-items: center; gap: 0.8rem; text-align: left; padding: 0.9rem 1rem; }
.file-icon { width: 2.4rem; height: 2.4rem; color: var(--color-accent); }
.file-text { display: flex; flex-direction: column; min-width: 0; }
.file-text strong { font-family: var(--font-data); font-size: 0.9rem; overflow-wrap: anywhere; }
.file-text span { font-size: 0.85rem; color: var(--color-text-dim); }
.done-actions { display: grid; gap: 0.6rem; margin-top: 1rem; }

/* ── Gus ─────────────────────────────────────────────────────────────── */
.gus { display: grid; place-items: end center; }
.gus-canvas { width: 100%; height: auto; display: block; }
.gus-canvas.is-pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
.gus-lg { width: 176px; height: 176px; }
.gus-md { width: 150px; height: 150px; }
.gus-sm { width: 84px; height: 84px; flex: none; }

.stamp {
  display: inline-block; padding: 0.15rem 0.6rem;
  font-family: var(--font-data); font-size: 1.05rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--color-accent); border: 3px solid var(--color-accent); border-radius: 8px;
  transform: rotate(-12deg); background: rgb(7 17 31 / 0.6);
  box-shadow: inset 0 0 0 2px rgb(255 138 31 / 0.25);
}

/* ── processing overlay ──────────────────────────────────────────────── */
.processing {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(1.5rem + var(--safe-top)) 1.25rem calc(1.5rem + var(--safe-bottom));
  background:
    radial-gradient(70% 50% at 50% 40%, rgb(94 200 255 / 0.13), transparent 70%),
    var(--color-bg-deep);   /* opaque: at 97% the report form ghosted through behind Gus on a phone */
  animation: fade-in 0.25s ease both;
  outline: none;
}
.processing-stage { position: relative; width: min(94vw, 440px); aspect-ratio: 320 / 200; }
.blueprint { width: 100%; height: 100%; color: var(--color-blueprint); overflow: visible; }
.blueprint path, .blueprint rect { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.blueprint > rect { stroke: none; }
.blueprint .thin { stroke-width: 1.1; stroke-opacity: 0.7; }
.bp-ground { stroke-opacity: 0.5; stroke-dasharray: 3 5; }
.draw { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draft 5.2s var(--d, 0s) ease-in-out infinite; }
.bp-hook { transform-origin: 238px 40px; animation: swing 3.2s ease-in-out infinite; }
.bp-cable { stroke-width: 1.2 !important; }
.bp-load { fill: rgb(255 138 31 / 0.25) !important; stroke: var(--color-accent) !important; }
.bp-page rect { fill: rgb(238 243 249 / 0.05) !important; stroke: var(--color-text) !important; stroke-opacity: 0.8; }
.bp-line { stroke: var(--color-text) !important; stroke-width: 2.4 !important; stroke-dasharray: 44; stroke-dashoffset: 44; animation: type-line 5.2s var(--d, 0s) ease-out infinite; }
.processing-gus { position: absolute; left: 20%; bottom: 3%; width: 38%; height: auto; aspect-ratio: 1; }
.stamp-processing { position: absolute; left: 3%; top: 40%; opacity: 0; transform: rotate(-14deg) scale(2.4); }
.processing.is-final .stamp-processing { animation: stamp-in 0.45s cubic-bezier(.2,1.6,.4,1) forwards; }
.processing.is-final .draw, .processing.is-final .bp-line { animation: none; stroke-dashoffset: 0; }
.processing-text {
  margin: 1.4rem 0 0.35rem; min-height: 2.6em; max-width: 22rem;
  font-size: clamp(1.15rem, 5vw, 1.4rem); font-weight: 700; text-align: center; line-height: 1.3;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.processing-text.is-swapping { opacity: 0; transform: translateY(4px); }
.processing-sub { margin: 0; font-size: 0.88rem; color: var(--color-text-dim); text-align: center; }
.processing.is-final .processing-sub { visibility: hidden; }

.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--color-border); border-top-color: var(--color-accent); animation: spin 0.8s linear infinite; }

/* ── banner + toast ──────────────────────────────────────────────────── */
.banner, .toast {
  position: fixed; left: 1rem; right: 1rem; z-index: 40;
  bottom: calc(1rem + var(--safe-bottom));
  display: flex; align-items: center; gap: var(--gap);
  padding: 0.75rem 1rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.banner-text, .toast-text { flex: 1; margin: 0; font-size: 0.92rem; }
.toast { border-color: var(--color-accent); }
@media (min-width: 34rem) {
  .banner, .toast { left: auto; right: 1rem; max-width: 26rem; }
}

/* ── motion ──────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.96); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes draft {
  0% { stroke-dashoffset: 100; opacity: 1; }
  45%, 82% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0.15; }
}
@keyframes type-line {
  0% { stroke-dashoffset: 44; opacity: 1; }
  30%, 85% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0.2; }
}
@keyframes swing { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes tape { to { background-position: 45.255px 0; } }
@keyframes rail-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgb(255 138 31 / 0.22); }
  50% { box-shadow: 0 0 0 7px rgb(255 138 31 / 0.06); }
}
@keyframes stamp-in {
  0% { opacity: 0; transform: rotate(-14deg) scale(2.4); }
  100% { opacity: 1; transform: rotate(-12deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .draw, .bp-line { stroke-dashoffset: 0; animation: none !important; }
  .bp-hook { animation: none; }
  .processing-text::after { content: ""; }
  .processing.is-final .stamp-processing, .done-hero .stamp { opacity: 1; transform: rotate(-12deg); animation: none !important; }
  .mic-btn[data-state="working"] .mic-icon::after, .mic-btn[data-state="starting"] .mic-icon::after, .spinner {
    animation: none !important; border-top-color: var(--color-accent); opacity: 0.8;
  }
}
