/* FlyLab application */

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 14px; background: var(--text); color: #000; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 12px; }

.muted { color: var(--muted); }
.dim { color: var(--muted); }
.small { font-size: 0.86rem; }
.link { color: var(--text-2); text-decoration: none; font-size: 0.9rem; }
.link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- boot ---------- */
.boot {
  min-height: 100vh; min-height: 100svh;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  padding: 24px;
}
.boot-mark { display: flex; gap: 7px; align-items: flex-end; height: 34px; }
.boot-mark span { width: 4px; border-radius: 3px; background: var(--green); animation: bootTick 1.1s var(--ease-inout) infinite; transform-origin: bottom; }
.boot-mark span:nth-child(1) { height: 16px; }
.boot-mark span:nth-child(2) { height: 30px; background: var(--magenta); animation-delay: 0.12s; }
.boot-mark span:nth-child(3) { height: 22px; animation-delay: 0.24s; }
.boot-mark span:nth-child(4) { height: 12px; background: var(--cyan); animation-delay: 0.36s; }
@keyframes bootTick { 0%, 100% { opacity: 0.35; transform: scaleY(0.6); } 40% { opacity: 1; transform: none; } }
.boot-text { color: var(--muted); margin: 0; }
/* a fast boot never flashes the spinner; a slow one still shows it (opacity only) */
.mo .boot { animation: bootFade 240ms 400ms backwards; }
@keyframes bootFade { from { opacity: 0; } }
.boot-error { width: min(520px, 100%); }

/* ---------- auth ---------- */
.auth {
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}
.auth-art { position: relative; overflow: hidden; background: #000; }
.mo .auth:not([hidden]) .auth-plate { animation: plateIn 1.6s var(--ease-out) backwards; }
@keyframes plateIn { from { opacity: 0; transform: scale(1.1); } }
.auth-plate { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 80% 50%; opacity: 0.85; }
.auth-net { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(5,6,7,0) 40%, rgba(5,6,7,0.9) 100%), linear-gradient(90deg, rgba(5,6,7,0.5), rgba(5,6,7,0) 60%);
}
.auth-art-copy { position: absolute; left: clamp(20px, 4vw, 56px); right: 24px; bottom: clamp(24px, 5vw, 56px); z-index: 1; }
.auth-quote { margin: 0; font-size: clamp(2.2rem, 4.6vw, 4.6rem); max-width: 12ch; }
.auth-meta { margin: 16px 0 0; color: var(--text-2); }

.auth-panel {
  display: flex; flex-direction: column; gap: 40px;
  padding: clamp(24px, 4vw, 56px);
  background: var(--ink);
}
.auth-box { width: min(420px, 100%); margin: auto 0; display: flex; flex-direction: column; gap: 18px; }
.auth-title { margin: 0; font-size: clamp(2.2rem, 3.6vw, 3.2rem); }
.auth-sub { margin: -6px 0 4px; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-submit { width: 100%; min-height: 50px; margin-top: 4px; }
.auth-back { color: var(--muted); font-size: 0.88rem; text-decoration: none; }
.auth-back:hover { color: var(--text); }

/* ---------- segmented control ---------- */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  border-radius: 999px; background: var(--plate-2); border: 1px solid var(--line);
}
.seg button {
  border: 0; background: none; cursor: pointer;
  padding: 8px 16px; border-radius: 999px;
  color: var(--muted); font-weight: 600; font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-selected="true"], .seg button[aria-checked="true"] { background: var(--plate-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.seg-sm button { padding: 5px 11px; font-size: 0.8rem; }
.auth-tabs { align-self: flex-start; }
.seg button { transition: color var(--dur-2) var(--ease-out), scale var(--dur-2) var(--ease-ui); }
.seg button:active { scale: 0.96; }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { font-size: 0.82rem; font-weight: 600; color: var(--text-2); }
.field-label em { font-style: normal; color: var(--faint); font-weight: 500; margin-left: 4px; }
.field-hint { font-size: 0.76rem; color: var(--faint); }
/* a field's own problem, said on the field (invite code) */
.field-error { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; font-weight: 600; color: var(--red); overflow-wrap: anywhere; }
.field-error-meta { font-size: 0.58rem; font-weight: 500; color: var(--muted); }
.field input[aria-invalid="true"] { border-color: rgba(255, 93, 108, 0.7); }
.field input, .field select, .title-input, .seed-row input, .rate-row input[type="number"] {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--plate-2);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field input:focus, .field select:focus, .title-input:focus, .seed-row input:focus, .rate-row input:focus { outline: none; border-color: rgba(46, 242, 154, 0.7); background: var(--plate-3); }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 22px;
  padding: 12px var(--gutter);
  background: rgba(5, 6, 7, 0.86);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 4px; }
.tabs a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.92rem;
  padding: 8px 14px; border-radius: 999px; transition: color 0.2s, background 0.2s;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); background: var(--plate-2); }
.tabs.has-ind a[aria-current="page"] { background: none; }
.tabs .seg-ind { background: var(--plate-2); box-shadow: none; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu { position: relative; }
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--plate-3); border: 1px solid var(--line-strong);
  font-family: var(--f-display); font-variation-settings: "wdth" 80; font-weight: 700; color: var(--green);
}
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 10px);
  transform-origin: top right;
  min-width: 220px; padding: 8px;
  background: var(--plate); border: 1px solid var(--line-strong); border-radius: var(--r-m);
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
}
.menu-who { margin: 0; padding: 8px 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.menu-who b { font-weight: 650; }
.menu-who .mono { color: var(--muted); }
.menu-pop [role="menuitem"] {
  display: block; text-align: left; width: 100%;
  padding: 10px; margin-top: 2px; border-radius: var(--r-s);
  background: none; border: 0; cursor: pointer; text-decoration: none; color: var(--text-2); font-size: 0.92rem;
}
.menu-pop [role="menuitem"]:hover, .menu-pop [role="menuitem"]:focus-visible { background: var(--plate-2); color: var(--text); }
#global-banner:not(:empty) { padding: 12px var(--gutter) 0; }
.view { padding: 0 var(--gutter) 96px; outline: none; }

/* ---------- create ---------- */
.create { width: min(980px, 100%); margin: 0 auto; padding-top: clamp(36px, 7vw, 84px); display: flex; flex-direction: column; gap: 18px; }
.create-head { margin-bottom: 8px; }
.create-title { margin: 10px 0 0; font-size: clamp(2.6rem, 6.4vw, 5.6rem); }

.composer {
  position: relative;
  border-radius: var(--r-l);
  background: var(--plate);
  border: 1px solid var(--line-strong);
  padding: 20px 20px 14px;
  transition: border-color var(--dur-3) var(--ease-out);
}
/* raster underline: idles as a short stub, draws out to full width on focus and starts flowing */
.composer::before {
  content: ""; position: absolute; left: 22px; right: 22px; top: -1px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--magenta) 0 2px, transparent 2px 10px);
  background-size: 10px 100%;
  opacity: 0.55;
  transform: scaleX(0.28); transform-origin: left center;
  transition: transform 0.9s var(--ease-out), opacity var(--dur-3) var(--ease-out);
}
/* focus bloom: a soft GFP glow behind the box (opacity only) */
.composer::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 4px rgba(46, 242, 154, 0.07), 0 0 60px -12px rgba(46, 242, 154, 0.38), 0 0 120px -40px rgba(139, 234, 247, 0.35);
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}
.composer:focus-within { border-color: rgba(46, 242, 154, 0.45); }
.composer:focus-within::after { opacity: 1; }
.composer:focus-within::before { opacity: 1; transform: none; animation: tickflow 1.4s linear infinite; }
.composer.inject::after { animation: inject 0.7s var(--ease-out); }
@keyframes inject { 0% { opacity: 1; } 30% { opacity: 0.4; } 100% { opacity: 1; } }
@keyframes tickflow { to { background-position: 10px 0; } }
.composer textarea {
  display: block; width: 100%;
  min-height: 64px; resize: none;
  border: 0; outline: none; background: none;
  font-size: clamp(1.15rem, 2vw, 1.45rem); line-height: 1.4; color: var(--text);
}
.composer textarea::placeholder { color: var(--faint); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 10px; }
.count { color: var(--faint); }
.btn-ghost.on { background: var(--plate-2); color: var(--text); }
.gen-btn { min-height: 46px; }
.gen-btn[aria-busy="true"] { opacity: 0.75; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--text-2);
  padding: 8px 14px; border-radius: 999px; font-size: 0.86rem; cursor: pointer; text-align: left;
  transition: border-color var(--dur-2), color var(--dur-2), background var(--dur-2), scale 0.35s var(--ease-ui), translate 0.35s var(--ease-ui);
}
.chip:hover { border-color: var(--line-strong); color: var(--text); background: var(--plate); translate: 0 -1px; }
.chip:active { scale: 0.95; translate: 0 0; transition-duration: var(--dur-1); }

.advanced {
  border-radius: var(--r-l); border: 1px solid var(--line); background: var(--plate);
  padding: 22px;
}
.adv-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.adv-head p { margin: 0; }
.adv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 18px; }
.rate-row, .seed-row { display: flex; gap: 10px; align-items: center; }
.rate-row input[type="range"] { flex: 1; accent-color: var(--green); min-width: 0; }
.rate-row input[type="number"] { width: 84px; flex: none; }
.adv-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
.adv-form > div:not(.adv-grid):not(.adv-actions):not(:empty) { margin-top: 16px; }

/* drafting (parse in flight): a plate in the plan card's own geometry; three live membrane
   traces stand in for a spinner, skeleton bars hold the places of the plan's fields */
.plan-slot > * { scroll-margin-top: 88px; }
.drafting.plan-skel {
  display: flex; flex-direction: column; gap: 18px;
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--r-l);
  background: var(--plate);
  border: 1px dashed var(--line-strong);
}
.drafting-head { display: flex; align-items: center; gap: 18px; }
.drafting-trace { width: 132px; height: 48px; flex: none; }
.plan-skel .skel-quote { height: 14px; width: 55%; margin-left: 14px; }
.skel-sentence { display: flex; flex-direction: column; gap: 10px; }
.skel-sent { height: 22px; width: 92%; }
.skel-sent.short { width: 60%; }
.plan-skel .spec { padding: 12px 14px 12px 0; display: flex; flex-direction: column; gap: 8px; }
.skel-dt { height: 8px; width: 40%; }
.skel-dd { height: 12px; width: 75%; }
.skel-actions { display: flex; gap: 10px; }
.skel-input { flex: 1; height: 46px; border-radius: 999px; }
.skel-btn { width: 180px; height: 48px; border-radius: 999px; }
/* a fresh plan card that is not in view yet waits (invisible) to assemble where it can be seen */
.mo .plan-card.pending-assemble:not(:focus-within) { opacity: 0; }
.drafting-title { margin: 0; font-weight: 600; }
.drafting-sub { margin: 2px 0 0; color: var(--muted); font-size: 0.88rem; }

.notice-card {
  padding: 20px 22px; border-radius: var(--r-l);
  border: 1px solid rgba(139, 234, 247, 0.28); background: var(--cyan-dim);
}
.notice-card .eyebrow { color: var(--cyan); margin: 0 0 8px; }
.notice-msg { margin: 0 0 10px; font-size: 1.05rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tag { padding: 4px 9px; border-radius: 6px; background: var(--plate-2); border: 1px solid var(--line); color: var(--text-2); font-size: 0.66rem; }

/* ---------- plan card ---------- */
.plan-card {
  display: flex; flex-direction: column; gap: 18px;
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--r-l);
  background: var(--plate);
  border: 1px solid var(--line-strong);
}
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.plan-head .eyebrow { margin: 0; }
.plan-id { text-transform: none; color: var(--text-2); letter-spacing: 0; }
.source-tag {
  font-family: var(--f-mono); font-size: 0.64rem; color: var(--green);
  padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(46, 242, 154, 0.3);
}
.source-tag.warn { color: var(--amber); border-color: rgba(255, 181, 71, 0.4); }
.plan-prompt {
  margin: 0; padding-left: 14px; border-left: 2px solid var(--magenta);
  color: var(--text-2); font-style: italic; overflow-wrap: anywhere;
}
.plan-sentence {
  margin: 0;
  font-size: clamp(1.25rem, 2.3vw, 1.7rem); line-height: 1.32; letter-spacing: -0.01em;
  color: var(--text-2); text-wrap: pretty;
}
.plan-sentence b { color: var(--text); font-weight: 600; }
.plan-message { margin: 0; color: var(--muted); font-size: 0.92rem; }
.spec-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0; margin: 0;
  border-top: 1px solid var(--line);
}
.spec { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.spec dt { font-family: var(--f-mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.spec dd { margin: 0; overflow-wrap: anywhere; }
.spec-grid.compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.defaults { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.defaults .eyebrow { margin-right: 6px; }
.plan-note { margin: 0; }
.plan-actions { display: flex; gap: 10px; align-items: center; }
.title-input { flex: 1; min-width: 0; border-radius: 999px; padding: 0 18px; }
.run-btn { min-height: 48px; padding: 0 1.4rem; }

details.json { border-radius: var(--r-m); border: 1px solid var(--line); background: rgba(5,6,7,0.5); }
details.json summary { cursor: pointer; padding: 12px 16px; color: var(--text-2); font-size: 0.88rem; font-weight: 600; }
details.json summary:hover { color: var(--text); }
details.json pre { margin: 0; padding: 0 16px 16px; max-height: 420px; overflow: auto; color: var(--text-2); font-size: 0.68rem; line-height: 1.7; }

/* ---------- run / live ---------- */
.launching { display: inline-flex; align-items: center; gap: 12px; color: var(--text-2); padding: 10px 0; }
/* "spinner": three firing bars (the wordmark's raster ticks), not a rotating ring */
.spinner { position: relative; width: 15px; height: 14px; flex: none;
  background: linear-gradient(var(--cyan), var(--cyan)) 12px 100% / 3px 40% no-repeat; }
.spinner::before, .spinner::after {
  content: ""; position: absolute; bottom: 0; width: 3px; height: 100%; border-radius: 2px;
  transform-origin: bottom; animation: tick 0.9s var(--ease-inout) infinite;
}
.spinner::before { left: 0; background: var(--green); }
.spinner::after { left: 6px; background: var(--magenta); animation-delay: 0.22s; }
@keyframes tick { 0%, 100% { transform: scaleY(0.3); opacity: 0.5; } 45% { transform: none; opacity: 1; } }
/* waiting in a queue: the same bars, idling */
.spinner-slow::before, .spinner-slow::after { animation-duration: 2.4s; }
.run-slot:not(:empty) { margin-top: 6px; }
.b-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.banner .b-actions .btn { color: var(--text); }

.run-card {
  display: flex; flex-direction: column; gap: 18px;
  padding: clamp(20px, 3vw, 28px);
  border-radius: var(--r-l); background: var(--plate); border: 1px solid var(--line-strong);
}
.run-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.run-head .eyebrow { margin: 0; }
.run-head .eyebrow a { color: var(--text-2); text-transform: none; letter-spacing: 0; }
.run-title { margin: 6px 0 0; font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.run-head-end { display: flex; align-items: center; gap: 8px; flex: none; }
.progress { height: 4px; border-radius: 4px; background: var(--plate-3); overflow: hidden; }
.progress .bar {
  height: 100%; width: 100%; background: var(--green); border-radius: 4px; box-shadow: 0 0 12px rgba(46,242,154,0.6);
  transform: scaleX(0); transform-origin: left center;
  transition: transform 0.9s var(--ease-out), background-color var(--dur-3);
}
.run-card[data-status="failed"] .progress .bar { background: var(--red); box-shadow: none; }
.run-card[data-status="cancelled"] .progress .bar { background: var(--faint); box-shadow: none; }
.live-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.stages { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.stages li { font-family: var(--f-mono); font-size: 0.64rem; color: var(--faint); display: inline-flex; align-items: center; gap: 6px; transition: color var(--dur-3) var(--ease-out); }
.stages li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1px solid currentColor; transition: background-color var(--dur-3), border-color var(--dur-3), scale var(--dur-3) var(--ease-ui); }
.stages li.done { color: var(--text-2); }
.stages li.done::before { background: var(--green); border-color: var(--green); }
.mo .stages li.done::before { animation: stagePop 0.55s var(--ease-ui) backwards; animation-delay: calc(var(--si, 0) * 60ms); }
@keyframes stagePop { 0% { scale: 0.2; box-shadow: 0 0 0 0 rgba(46,242,154,0.6); } 60% { scale: 1.5; box-shadow: 0 0 0 5px rgba(46,242,154,0); } 100% { scale: 1; } }
.stages li.now { color: var(--text); }
.stages li.now::before { background: var(--magenta); border-color: var(--magenta); scale: 1.2; animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(255,63,210,0.25); } }
.live-nums { display: inline-flex; align-items: center; gap: 14px; color: var(--text-2); }
.run-pulse { width: 96px; height: 26px; transition: opacity 0.8s var(--ease-out); }
.live.finished .run-pulse { opacity: 0.35; }
/* A failed or cancelled run keeps its stage labels at full contrast: the undone ones say where it stopped. */
.run-card:not([data-status="failed"]):not([data-status="cancelled"]) .live.finished .stages { opacity: 0.7; transition: opacity 0.8s var(--ease-out); }

/* compact run (started from Create): the run's fingerprint develops beside its live status */
.run-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(16px, 3vw, 28px); align-items: start; }
.run-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.run-side .live-row { margin-top: 12px; }
.run-art { border-radius: var(--r-m); overflow: hidden; border: 1px solid var(--line); background: #07090a; }
.run-art canvas {
  width: 100%; aspect-ratio: 4 / 3;
  opacity: 1; filter: blur(0px) brightness(1) saturate(1); clip-path: inset(0 0 0 0);
  transition: filter 0.42s var(--ease-out), opacity 0.42s var(--ease-out), clip-path 0.42s var(--ease-out);
}
.mo .run-art.developing canvas {
  will-change: filter, opacity, clip-path;
  /* thin raster ticks vanish under a wide blur: a soft blur plus an exposure boost reads as an
     image still developing, and the reveal edge follows progress */
  filter: blur(calc((1 - var(--dev, 0)) * 5px)) brightness(calc(2.2 - var(--dev, 0) * 1.2)) saturate(calc(0.7 + var(--dev, 0) * 0.3));
  opacity: calc(0.7 + var(--dev, 0) * 0.3);
  clip-path: inset(0 calc((0.6 - 0.6 * var(--dev, 0)) * 100%) 0 0);
  transition-duration: 0.9s;
}
@media (max-width: 640px) { .run-body { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 400px) { .run-pulse { width: 64px; } }

/* status chip */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 0.62rem; letter-spacing: 0.04em;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(5,6,7,0.75); border: 1px solid var(--line-strong); color: var(--text-2);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-succeeded { color: var(--green); border-color: rgba(46,242,154,0.35); }
.status-running, .status-queued, .status-cancelling { color: var(--cyan); border-color: rgba(139,234,247,0.35); }
.status-running::before { animation: blinkDot 1s infinite; }
@keyframes blinkDot { 50% { opacity: 0.2; } }
.status-failed { color: var(--red); border-color: rgba(255,93,108,0.45); }
.status-cancelled { color: var(--muted); }

/* ---------- results ---------- */
.results { display: flex; flex-direction: column; gap: 18px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile { padding: 16px; border-radius: var(--r-m); background: var(--plate-2); border: 1px solid var(--line); min-width: 0; }
.tile-label { margin: 0 0 8px; font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.tile-value { margin: 0; font-family: var(--f-display); font-variation-settings: "wdth" 75; font-weight: 600; font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1; letter-spacing: -0.01em; }
.tile-note { margin: 6px 0 0; font-size: 0.76rem; color: var(--faint); }
.tile-bad .tile-value { color: var(--red); }
.sw { display: inline-block; width: 10px; height: 3px; border-radius: 2px; flex: none; }
.sw-a { background: var(--magenta); }
.sw-b { background: var(--green); }
.sw-ro { background: rgba(255,63,210,0.35); height: 8px; }

.results-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px; align-items: start; }
.panel { padding: 18px; border-radius: var(--r-m); background: var(--plate-2); border: 1px solid var(--line); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-title { margin: 0; font-size: 1rem; font-weight: 650; }
.legend { margin: 0; display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.table-wrap { overflow-x: auto; }
.ro-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ro-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.74rem; padding: 0 8px 10px 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.ro-table th .sw { margin-right: 6px; vertical-align: middle; }
.ro-table td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ro-table td .mono { font-size: 0.66rem; }
.ro-table .num { text-align: right; white-space: nowrap; }
.delta { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.dbar { position: relative; width: 56px; height: 8px; border-radius: 2px; background: var(--plate-3); }
.dbar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.dbar i { position: absolute; top: 0; bottom: 0; background: var(--text-2); border-radius: 2px; }
.mo .dbar i { animation: barGrow 0.75s var(--ease-out) backwards; animation-delay: calc(0.35s + var(--ri, 0) * 50ms); }
@keyframes barGrow { from { transform: scaleX(0); } }
.raster-wrap { position: relative; }
/* playhead that records the raster left to right on first draw */
.playhead {
  position: absolute; left: 0; top: 0; bottom: 22px; width: 2px; pointer-events: none;
  background: var(--green); box-shadow: 0 0 14px 2px rgba(46, 242, 154, 0.55);
}
canvas.raster { width: 100%; height: 160px; border-radius: var(--r-s); cursor: crosshair; }
.tip {
  position: absolute; left: 0; top: 0; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: 8px; max-width: 240px;
  background: var(--plate); border: 1px solid var(--line-strong); font-size: 0.78rem; color: var(--text-2);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.tip b { color: var(--text); font-weight: 500; font-size: 0.66rem; }
.raster-note { margin: 10px 0 0; font-size: 0.78rem; }
.empty-raster { padding: 30px 0; text-align: center; }
.downloads {
  display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 18px; border-radius: var(--r-m); border: 1px solid var(--line);
}
.downloads > div:first-child { max-width: 34rem; }
.downloads .panel-title + p { margin: 4px 0 0; }
.dl-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dl-status { flex-basis: 100%; }
.dl-status:empty { display: none; }
.dl-progress { color: var(--muted); }
.dl-progress.ok { color: var(--green); }

/* ---------- recent + cards ---------- */
.recent { width: min(1320px, 100%); margin: clamp(56px, 9vw, 100px) auto 0; }
.recent-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-title { margin: 0; font-family: var(--f-display); font-variation-settings: "wdth" 80; font-weight: 600; font-size: 1.6rem; letter-spacing: -0.01em; }
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 14px; }
.recent-empty { padding: 18px 0; border-top: 1px solid var(--line); }

.job-card {
  display: flex; flex-direction: column;
  border-radius: var(--r-m); overflow: hidden;
  background: var(--plate); border: 1px solid var(--line);
  text-decoration: none; color: inherit;
  transition: border-color var(--dur-2) var(--ease-out), translate 0.45s var(--ease-ui), box-shadow 0.45s var(--ease-out);
}
.job-card:hover { border-color: var(--line-strong); translate: 0 -4px; box-shadow: 0 26px 50px -30px rgba(255, 63, 210, 0.5), 0 10px 30px -20px rgba(46, 242, 154, 0.35); }
.job-card:active { translate: 0 -1px; transition-duration: var(--dur-1); }
/* the card is a frame: the link (thumbnail + text) and, for finished runs, the AI action row */
.job-link { display: flex; flex-direction: column; text-decoration: none; color: inherit; outline: none; }
.job-card:has(.job-link:focus-visible) { outline: 2px solid var(--green); outline-offset: 3px; }
/* thumbnails fade in once drawn; hover turns the exposure up */
.job-thumb canvas { transition: opacity 0.6s var(--ease-out), filter 0.45s var(--ease-out); }
.mo .job-thumb canvas:not(.drawn) { opacity: 0; }
.job-card:hover .job-thumb canvas { filter: brightness(1.28) saturate(1.25); }
.job-card.has-error { border-color: rgba(255, 93, 108, 0.45); }
.job-thumb { position: relative; }
.job-thumb canvas { width: 100%; }
.thumb-top { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; align-items: center; }
.thumb-error {
  position: absolute; right: 10px; top: 10px;
  font-family: var(--f-mono); font-size: 0.6rem; color: #fff;
  background: var(--red); padding: 4px 8px; border-radius: 999px;
}
.job-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.job-title { margin: 0; font-size: 0.94rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.job-err { margin: 0; color: var(--red); font-size: 0.6rem; overflow-wrap: anywhere; }
.job-meta { margin: 0; display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.62rem; flex-wrap: wrap; }
.card-counts { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.card-counts .sw-b { margin-left: 6px; }

/* ---------- library ---------- */
.library { width: min(1440px, 100%); margin: 0 auto; padding-top: clamp(32px, 5vw, 64px); }
.lib-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title { margin: 8px 0 0; font-size: clamp(2.6rem, 6vw, 5rem); }
.lib-count { margin: 10px 0 0; }
.lib-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.masonry { display: flex; gap: 16px; align-items: flex-start; }
.mcol { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.lib-foot { display: flex; justify-content: center; padding: 30px 0; }
.lib-loading { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.lib-foot .lib-loading:first-child { margin-top: -30px; }

/* ---------- skeletons ---------- */
.skel-grid { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 16px; align-items: start; }
.recent-grid .skel-card, .skel-grid .skel-card { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--plate); overflow: hidden; }
.skel-card .skel-thumb { border-radius: 0; width: 100%; }
.skel-line { height: 10px; margin: 0 14px; }
.skel-line.short { width: 45%; }
.skel-title { height: clamp(28px, 4vw, 48px); width: 80%; border-radius: var(--r-s); }
.skel-block { height: 120px; border-radius: var(--r-m); }
.skel-art { aspect-ratio: 4 / 3; border-radius: 0; }
.skel-tile { height: 92px; border-radius: var(--r-m); }
.lib-foot > .banner { width: min(640px, 100%); }
.end-note { margin: 0; }
.sentinel { height: 1px; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: clamp(40px, 8vw, 90px) 0; max-width: 560px; margin: 0 auto; }
.empty-art { width: min(360px, 90%); aspect-ratio: 16 / 9; border-radius: var(--r-m); }
.empty-title { margin: 0; font-size: clamp(2rem, 4.4vw, 3.4rem); }
.empty-state p { margin: 0; }

/* ---------- job page ---------- */
.back { display: inline-block; margin-top: 26px; }
.job-page { width: min(1240px, 100%); margin: 0 auto; padding-top: 20px; display: flex; flex-direction: column; gap: 22px; }
.job-hero { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: clamp(20px, 4vw, 48px); align-items: start; }
.job-art { border-radius: var(--r-l); overflow: hidden; border: 1px solid var(--line); position: sticky; top: 84px; }
.hero-thumb { width: 100%; aspect-ratio: 4 / 3; }
.job-info { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.job-info-top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.job-info-top .mono { font-size: 0.66rem; }
.job-h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); overflow-wrap: anywhere; }
.job-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.copy-status { color: var(--muted); }
.job-live:empty { display: none; }

/* shared-element flight: the library thumbnail travels into the run page's hero art */
.flip-ghost { position: fixed; z-index: 60; pointer-events: none; transform-origin: 0 0; border-radius: var(--r-m); will-change: transform, clip-path; }

/* route crossfade: the outgoing view is a non-interactive ghost above the incoming one */
.view-ghost { position: fixed; z-index: 5; pointer-events: none; margin: 0; }

/* ---------- account ---------- */
.account { width: min(980px, 100%); margin: 0 auto; padding-top: clamp(36px, 6vw, 72px); display: flex; flex-direction: column; gap: 24px; }
.acct-head { display: flex; gap: 22px; align-items: center; }
.acct-head .mono { font-size: 0.7rem; margin: 10px 0 0; }
.avatar-lg { width: 88px; height: 88px; font-size: 2.6rem; flex: none; }
.acct-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* AI usage: a single meter. The text says amount, state and reset; the bar repeats it. */
.usage {
  display: flex; flex-direction: column; gap: 12px;
  padding: clamp(16px, 2.6vw, 24px); border-radius: var(--r-m);
  background: var(--plate-2); border: 1px solid var(--line);
}
.usage-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px 18px; flex-wrap: wrap; }
.usage-eyebrow { margin: 0 0 8px; color: var(--cyan); display: inline-flex; align-items: center; gap: 8px; }
.usage-num { margin: 0; display: inline-flex; align-items: baseline; gap: 8px; font-family: var(--f-display); font-variation-settings: "wdth" 75; font-weight: 600; line-height: 1; }
.usage-spent { font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: -0.01em; color: var(--text); }
.usage-of { font-size: 1.05rem; color: var(--muted); }
.meter { position: relative; height: 8px; border-radius: 4px; background: var(--plate-3); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.meter-fill {
  position: absolute; inset: 0; border-radius: 4px; background: var(--green);
  clip-path: inset(0 calc((1 - var(--f, 0)) * 100%) 0 0 round 4px);
}
.mo .meter-fill { animation: meterIn var(--dur-5) var(--ease-out) 0.2s backwards; }
@keyframes meterIn { from { clip-path: inset(0 100% 0 0 round 4px); } }
.usage-high .meter-fill { background: var(--amber); }
.usage-out .meter-fill { background: var(--red); }
.usage-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 18px; flex-wrap: wrap; }
.usage-state { display: inline-flex; align-items: center; gap: 8px; font-size: 0.66rem; color: var(--text-2); }
.usage-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.usage-high .usage-dot { background: var(--amber); }
.usage-out .usage-dot { background: var(--red); }
.usage-reset { color: var(--text-2); font-size: 0.86rem; }
.usage-note { margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .results-grid { grid-template-columns: minmax(0, 1fr); }
  .job-hero { grid-template-columns: minmax(0, 1fr); }
  .job-art { position: static; }
  .adv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: 220px auto; }
  .auth-quote { font-size: 2rem; }
  .auth-panel { gap: 24px; }
  .auth-box { margin: 0; }
  .topbar-end .pill { display: none; }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adv-grid { grid-template-columns: minmax(0, 1fr); }
  .plan-actions { flex-direction: column; align-items: stretch; }
  .composer { padding: 16px 14px 12px; }
  .composer-bar { align-items: stretch; }
  .composer-right { width: 100%; justify-content: space-between; }
  .topbar { gap: 10px; }
  .tabs a { padding: 8px 10px; }
  .wordmark span { display: none; }
  .run-head { flex-direction: column; }
  .acct-head { flex-direction: column; align-items: flex-start; }
  .downloads .dl-row { width: 100%; }
}
@media (max-width: 400px) {
  .seg-sm button { padding: 5px 8px; }
  .chip { font-size: 0.8rem; }
}
@media (max-width: 640px) {
  .ro-table td .dim { display: none; }
  .dbar { display: none; }
  .ro-table td .mono { font-size: 0.58rem; }
}

/* Phones: comfortable tap targets (segmented controls, back link, run id link). */
@media (pointer: coarse) {
  .seg button { min-height: 44px; }
  .seg-sm button { min-height: 40px; }
  .back { display: inline-flex; align-items: center; min-height: 44px; margin-top: 14px; }
  .run-head .eyebrow a { display: inline-flex; align-items: center; min-height: 32px; }
}
.raster:focus-visible { outline-offset: 2px; }

/* ================================================================
   AI hypotheses (v3)
   Grammar: solid rules / plain chips = numbers FlyLab computed (or restated from them);
   dashed cyan outlines = proposed by Claude. Cyan is the AI channel throughout.
   ================================================================ */
.ai-slot:empty { display: none; }
.ai-slot { scroll-margin-top: 88px; }
.ai-glyph {
  display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px dashed currentColor; vertical-align: -1px;
}

.ai-panel {
  position: relative;
  display: flex; flex-direction: column; gap: 18px;
  padding: clamp(18px, 3vw, 30px);
  border-radius: var(--r-l); background: var(--plate); border: 1px solid var(--line-strong);
  scroll-margin-top: 88px;
}
/* the panel's top edge: a dashed cyan rule, the mark of everything proposed below it */
.ai-panel::before {
  content: ""; position: absolute; left: 22px; right: 22px; top: -1px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--cyan) 0 6px, transparent 6px 12px);
  opacity: 0.7;
}
.ai-panel[aria-busy="true"]::before { animation: tickflow 1.4s linear infinite; background-size: 12px 100%; }
.ai-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px 20px; flex-wrap: wrap; }
.ai-eyebrow { margin: 0; color: var(--cyan); display: inline-flex; align-items: center; gap: 8px; }
.ai-title { margin: 8px 0 0; font-size: clamp(2rem, 4vw, 3rem); }
.ai-title:focus { outline: none; }
.ai-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ai-regen { border-style: dashed; border-color: rgba(139, 234, 247, 0.5); }

/* permanent label + disclaimer: hatched like a specimen label, never collapsible */
.ai-stamp {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 16px 18px; border-radius: var(--r-m);
  border: 1px solid rgba(139, 234, 247, 0.5);
  background:
    repeating-linear-gradient(-45deg, rgba(139, 234, 247, 0.075) 0 7px, transparent 7px 15px),
    rgba(139, 234, 247, 0.05);
}
.ai-stamp-mark {
  width: 22px; height: 22px; margin-top: 1px; border-radius: 50%;
  border: 2px dashed var(--cyan); box-shadow: 0 0 14px rgba(139, 234, 247, 0.35);
}
.ai-stamp p { margin: 0; }
.ai-stamp-title { font-weight: 700; font-size: 1.02rem; color: var(--cyan); line-height: 1.35; }
.ai-stamp-body { margin-top: 4px !important; color: var(--text); font-size: 0.95rem; line-height: 1.5; text-wrap: pretty; }
.ai-stamp-meta { margin-top: 6px !important; color: var(--amber); }

.ai-legend { margin: -4px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); }
.ai-legend span { display: inline-flex; align-items: center; gap: 8px; }
.ai-legend i { display: inline-block; width: 22px; height: 0; }
.ai-legend .lg-solid { border-top: 2px solid var(--text-2); }
.ai-legend .lg-dash { border-top: 2px dashed var(--cyan); }

/* empty state */
.ai-empty { display: flex; flex-direction: column; gap: 16px; }
.ai-intro { margin: 0; color: var(--text-2); max-width: 46rem; font-size: 1.02rem; text-wrap: pretty; }
.ai-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ai-gen { min-height: 48px; }
.ai-model { font-size: 0.62rem; opacity: 0.6; font-weight: 500; }
.ai-queue-hint { margin: 0; color: var(--muted); font-size: 0.62rem; }
.ai-q-chip { margin-bottom: 8px; }
.ai-poll:empty { display: none; }

/* loading: the planner's drafting plate, in the AI channel */
.ai-loading {
  display: flex; flex-direction: column; gap: 16px;
  padding: clamp(16px, 2.6vw, 24px); border-radius: var(--r-m);
  border: 1px dashed rgba(139, 234, 247, 0.4); background: rgba(139, 234, 247, 0.025);
}
.ai-skel { display: flex; flex-direction: column; gap: 10px; }
.ai-skel-head { height: 26px; width: 78%; }
.ai-skel-line { height: 12px; width: 92%; }
.ai-skel-line.short { width: 56%; }
.ai-skel-hyp { display: flex; flex-direction: column; gap: 10px; padding: 16px; margin-top: 4px; border-radius: var(--r-m); border: 1px dashed var(--line-strong); }
.ai-load-note { margin: 0; color: var(--muted); font-size: 0.86rem; }
.ai-regen-strip {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: var(--r-m);
  border: 1px dashed rgba(139, 234, 247, 0.45); background: var(--cyan-dim);
}
.ai-regen-trace { width: 84px; height: 30px; flex: none; }
.ai-content { display: flex; flex-direction: column; gap: 22px; transition: opacity var(--dur-3) var(--ease-out); }
.ai-content.busy { opacity: 0.42; }

/* headline: Claude's sentence, marked like the user's prompt but dashed and cyan */
.ai-headline-wrap .hyp-label { margin-bottom: 8px; }
.ai-headline {
  margin: 0; padding: 2px 0 2px 18px; border-left: 2px dashed var(--cyan);
  font-family: var(--f-display); font-variation-settings: "wdth" 80; font-stretch: 80%;
  font-weight: 560; font-size: clamp(1.35rem, 2.6vw, 2rem); line-height: 1.14; letter-spacing: -0.01em;
  color: var(--text); text-wrap: balance; overflow-wrap: anywhere;
}

.ai-sec { display: flex; flex-direction: column; gap: 12px; }
.ai-sec-head { display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; }
.ai-sec-title { margin: 0; font-size: 1.08rem; font-weight: 650; }
.ai-sec-sub { margin: 0; color: var(--muted); font-size: 0.84rem; }

/* observations: styled as data — solid rules, a filled data mark */
.ai-obs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-strong); }
.ai-obs li {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 12px 0 12px 20px; border-bottom: 1px solid var(--line);
}
.ai-obs li::before { content: ""; position: absolute; left: 2px; top: 20px; width: 7px; height: 7px; border-radius: 2px; background: var(--text-2); }
.ai-obs p { margin: 0; color: var(--text); font-size: 0.97rem; overflow-wrap: anywhere; }

/* evidence chips: data references; clicking one filters "What the AI saw" */
.ev-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ev {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 5px 9px; border-radius: 6px; cursor: pointer; text-align: left;
  background: var(--plate-2); border: 1px solid var(--line); color: var(--text-2);
  font-size: 0.64rem; line-height: 1.4; overflow-wrap: anywhere;
  transition: border-color var(--dur-2) var(--ease-out), color var(--dur-2), scale var(--dur-2) var(--ease-ui);
}
.ev:hover { border-color: rgba(139, 234, 247, 0.55); color: var(--text); }
.ev:active { scale: 0.96; }
.ev[disabled] { cursor: default; }
.ev[disabled]:hover { border-color: var(--line); color: var(--text-2); }
.ev-warn { border: 1px dashed rgba(255, 93, 108, 0.7); color: var(--text); background: var(--red-dim); }
.ev-flag { color: var(--red); font-weight: 600; white-space: nowrap; }
.ev-flag::before { content: "· "; color: var(--faint); }
.ai-warn-list { margin: 8px 0 0; padding-left: 1.1em; color: var(--text-2); }
.ai-warn-list li { margin-top: 2px; overflow-wrap: anywhere; }

/* hypothesis cards: dashed, they are proposals */
.hyps { display: flex; flex-direction: column; gap: 14px; }
.hyp {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: clamp(16px, 2.4vw, 24px); border-radius: var(--r-m);
  border: 1px dashed rgba(139, 234, 247, 0.45);
  background: linear-gradient(180deg, rgba(139, 234, 247, 0.04), transparent 120px), var(--plate);
}
.hyp-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px 14px; align-items: baseline; }
.hyp-n { color: var(--cyan); font-size: 0.7rem; }
.hyp-title {
  margin: 0; font-family: var(--f-display); font-variation-settings: "wdth" 85; font-stretch: 85%;
  font-weight: 600; font-size: clamp(1.18rem, 2vw, 1.5rem); line-height: 1.15; letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.hyp-label {
  margin: 0 0 6px; font-family: var(--f-mono); font-variation-settings: "wdth" 87.5;
  font-size: 0.6rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
}
span.hyp-label { margin: 0; }
.hyp-reason { margin: -4px 0 0; color: var(--text-2); font-size: 0.88rem; }
.hyp-statement { margin: 0; font-size: 1.02rem; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; }
.hyp-block { min-width: 0; }
.hyp-caveats { margin: 0; padding-left: 1.1em; color: var(--text-2); font-size: 0.9rem; }
.hyp-caveats li::marker { color: var(--amber); }
.hyp-caveats li + li { margin-top: 3px; }
.hyp-test {
  display: flex; flex-direction: column; gap: 10px; margin-top: 2px;
  padding: 14px 16px; border-radius: var(--r-s); background: var(--plate-2); border: 1px solid var(--line);
}
.hyp-test .hyp-label { margin: 0; color: var(--cyan); }
.hyp-test p { margin: 0; }
.hyp-test-desc { color: var(--text); }
.hyp-expect { color: var(--text-2); font-size: 0.92rem; }
.hyp-test-plan { color: var(--text-2); overflow-wrap: anywhere; }
.hyp-test-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hyp-test-actions .mono { font-size: 0.6rem; overflow-wrap: anywhere; }
.run-test { border-color: rgba(139, 234, 247, 0.5); }
.hyp-test details.json summary { padding: 10px 14px; font-size: 0.8rem; }
.hyp-run-slot:empty { display: none; }

/* confidence: three raster ticks, lit by level */
.conf {
  display: inline-flex; align-items: center; gap: 8px; justify-self: end;
  padding: 4px 10px 4px 9px; border-radius: 999px; border: 1px solid var(--line-strong);
  font-family: var(--f-mono); font-variation-settings: "wdth" 87.5; font-size: 0.62rem; color: var(--text-2);
  white-space: nowrap;
}
.conf-ticks { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.conf-ticks i { display: block; width: 3px; border-radius: 2px; background: var(--plate-3); transform-origin: bottom; }
.conf-ticks i:nth-child(1) { height: 6px; }
.conf-ticks i:nth-child(2) { height: 9px; }
.conf-ticks i:nth-child(3) { height: 12px; }
.conf-ticks i.on { background: var(--cyan); box-shadow: 0 0 6px rgba(139, 234, 247, 0.55); }
.conf-bad { border: 1px dashed rgba(255, 93, 108, 0.6); color: var(--red); white-space: normal; }
.mo .ai-panel.arrive .conf-ticks i.on { animation: tickOn 0.5s var(--ease-ui) backwards; animation-delay: calc(380ms + var(--hi, 0) * 90ms + var(--ti, 0) * 90ms); }
@keyframes tickOn { from { transform: scaleY(0.15); opacity: 0.2; box-shadow: none; } }

.ai-sec-small .ai-sec-title { font-size: 0.95rem; }
.ai-lims, .ai-reading { margin: 0; padding-left: 1.1em; color: var(--text-2); font-size: 0.9rem; }
.ai-lims li + li, .ai-reading li + li { margin-top: 4px; }
.ai-reading li { font-style: italic; overflow-wrap: anywhere; }

/* "What the AI saw": the digest as tables */
.ai-digest { border-radius: var(--r-m); border: 1px solid var(--line); background: rgba(5, 6, 7, 0.5); scroll-margin-top: 88px; }
.ai-digest > summary {
  list-style: none; cursor: pointer; padding: 14px 16px;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px;
}
.ai-digest > summary::-webkit-details-marker { display: none; }
.ai-digest > summary::before {
  content: ""; align-self: center; width: 0; height: 0; flex: none;
  border-left: 6px solid var(--text-2); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform var(--dur-2) var(--ease-ui);
}
.ai-digest[open] > summary::before { transform: rotate(90deg); }
.ai-d-sum { font-weight: 650; color: var(--text); }
.ai-digest > summary:hover .ai-d-sum { text-decoration: underline; text-underline-offset: 3px; }
.ai-d-body { padding: 0 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.mo .ai-digest[open] .ai-d-body { animation: bannerIn var(--dur-3) var(--ease-out); }
.ai-d-filter { display: flex; align-items: flex-end; gap: 8px 12px; flex-wrap: wrap; }
.ai-d-flabel { display: flex; flex-direction: column; gap: 6px; flex: 1 1 240px; max-width: 380px; font-size: 0.78rem; font-weight: 600; color: var(--text-2); }
.ai-d-input {
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--plate-2); color: var(--text); font-weight: 400;
}
.ai-d-input:focus { outline: none; border-color: rgba(139, 234, 247, 0.7); background: var(--plate-3); }
.ai-d-input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.ai-d-content { display: flex; flex-direction: column; gap: 18px; }
.ai-d-none { margin: 0; }
.ai-d-sec { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ai-d-sec[data-depth="1"], .ai-d-sec[data-depth="2"] { padding-left: 12px; border-left: 1px solid var(--line); }
.ai-d-h {
  margin: 0; font-family: var(--f-mono); font-variation-settings: "wdth" 87.5;
  font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); font-weight: 600;
}
h5.ai-d-h { color: var(--muted); }
.ai-d-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ai-d-grid .spec dd { font-size: 0.9rem; }
.ai-d-list { margin: 0; padding-left: 1.1em; color: var(--text-2); font-size: 0.88rem; }
.ai-d-list li + li { margin-top: 3px; }
.ai-d-chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ai-d-chips li + li { margin-top: 0; }
.ai-d-pre { margin: 0; max-height: 280px; overflow: auto; color: var(--text-2); font-size: 0.64rem; line-height: 1.6; }
.ai-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.ai-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.7rem; padding: 0 12px 8px 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.ai-table td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
.ai-table td.mono { font-size: 0.62rem; white-space: nowrap; }
.ai-table .num { text-align: right; white-space: nowrap; }
.ai-table tr.hit td { background: rgba(139, 234, 247, 0.07); color: var(--text); }
.ai-d-list li.hit { color: var(--text); }

.ai-foot {
  display: flex; flex-wrap: wrap; gap: 4px 0; padding-top: 14px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.62rem;
}
.ai-foot span + span::before { content: "·"; margin: 0 9px; color: var(--faint); }

/* composer: the question after a successful run */
.ai-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap;
  margin-top: 14px; padding: 18px 20px; border-radius: var(--r-l);
  border: 1px dashed rgba(139, 234, 247, 0.5);
  background: repeating-linear-gradient(-45deg, rgba(139, 234, 247, 0.04) 0 7px, transparent 7px 15px), var(--plate);
}
.ai-cta > div { min-width: 0; flex: 1 1 280px; }
.ai-cta p { margin: 0; }
.ai-cta-title { font-weight: 650; font-size: 1.08rem; }
.ai-cta-sub { margin-top: 4px !important; color: var(--text-2); font-size: 0.9rem; max-width: 40rem; }
.run-slot .ai-slot .ai-panel { margin-top: 14px; }

/* run page hero: the way to the hypotheses */
.ai-hero-btn { border: 1px dashed rgba(139, 234, 247, 0.6); color: var(--cyan); }
.ai-hero-btn:hover { color: var(--text); border-color: var(--cyan); }

/* Library cards */
.card-ai {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px 12px; border-top: 1px dashed var(--line-strong);
}
.card-ai-btn { min-height: 32px; padding: 0 0.8rem; font-size: 0.8rem; border-style: dashed; border-color: rgba(139, 234, 247, 0.5); color: var(--cyan); }
.card-ai-btn:hover { color: var(--text); border-color: var(--cyan); }
.card-ai-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px;
  color: var(--cyan); text-decoration: none; font-size: 0.82rem; font-weight: 600;
}
.card-ai-link:hover { color: var(--text); }
.card-ai-link .arrow { transition: transform 0.25s var(--ease); }
.card-ai-link:hover .arrow { transform: translateX(3px); }
.card-ai-busy { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; color: var(--text-2); font-size: 0.82rem; }
.card-ai-busy .mono { font-size: 0.62rem; }
.card-ai-err { margin: 0; flex-basis: 100%; color: var(--text-2); font-size: 0.76rem; line-height: 1.45; overflow-wrap: anywhere; }
.card-ai-err b { color: var(--red); font-weight: 650; }
.card-ai-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 0.58rem; }
.card-ai-wait { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; flex-basis: 100%; }
.card-ai-wait .card-ai-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.card-ai-note { margin: 0; color: var(--muted); font-size: 0.74rem; line-height: 1.45; overflow-wrap: anywhere; }
.card-ai-err.warn b { color: var(--amber); }
.card-ai-err.info b { color: var(--cyan); }
.card-ai-inline-link { color: var(--cyan); font-weight: 600; text-underline-offset: 3px; }
.card-ai-inline-link:hover { color: var(--text); }
.card-ai-busy { flex-wrap: wrap; }

.ai-mark {
  font-family: var(--f-mono); font-size: 0.6rem; letter-spacing: 0.06em; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(5, 6, 7, 0.78); border: 1px dashed rgba(139, 234, 247, 0.7); color: var(--cyan);
}
.mo .ai-mark.new { animation: markIn 0.6s var(--ease-ui) backwards; }
@keyframes markIn { from { opacity: 0; transform: scale(0.5); } }

@media (max-width: 640px) {
  .ai-head { flex-direction: column; align-items: stretch; }
  .ai-tools { justify-content: space-between; }
  .hyp-head { grid-template-columns: auto minmax(0, 1fr); }
  .hyp-head .conf { grid-column: 1 / -1; justify-self: start; }
  .ai-stamp { padding: 14px; gap: 12px; }
  .ai-gen, .ai-cta-btn { width: 100%; white-space: normal; text-align: center; }
  .ai-d-flabel { max-width: none; }
  .ai-regen-trace { display: none; }
}
@media (pointer: coarse) {
  .ev { min-height: 34px; }
  .card-ai-btn, .card-ai-link { min-height: 40px; }
}
.ai-inline-warn {
  margin: -4px 0 0; padding: 6px 10px; border-radius: var(--r-s);
  border: 1px dashed rgba(255, 93, 108, 0.6); background: var(--red-dim);
  color: var(--text); font-size: 0.84rem; overflow-wrap: anywhere;
}
.hyp-calib { margin-top: 6px; }
.hyp-calib b { color: var(--amber); font-weight: 650; }
.ai-inline-warn::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 2px; background: var(--red); vertical-align: 1px; }
.ai-reading li.flagged span:first-child { text-decoration: underline dashed rgba(255, 93, 108, 0.7); text-underline-offset: 3px; }
.ai-reading .ev-flag { font-style: normal; font-weight: 500; white-space: normal; margin-left: 6px; font-size: 0.82rem; }
.ai-warn-list b { color: var(--text); font-weight: 600; }
