:root {
  --bg: #0a0a0a;
  --panel: #0e0e0e;
  --raise: #141414;
  --line: #1e1e1e;
  --line-2: #2e2e2e;
  --text: #ededed;
  --soft: #bdbdbd;
  --muted: #8c8c8c;
  --dim: #5c5c5c;
  --warn: #e3b04b;
  --fault: #ff6b6b;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --serif: "Newsreader", Georgia, serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --z-nav: 10;
  --z-grain: 20;
  --z-boot: 30;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.6 var(--mono); }
/* film grain: breaks the flat digital black */
body::after {
  content: ""; position: fixed; inset: 0; z-index: var(--z-grain); pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; transition: color 0.2s, border-color 0.2s, background-color 0.2s, transform 0.12s; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: 0.4; }
:focus-visible { outline: 1px solid var(--text); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--text); text-underline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: 16px; top: -48px; z-index: var(--z-boot); padding: 8px 12px; background: var(--text); color: #000; }
.skip:focus { top: 12px; }

.frame { max-width: 1320px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100dvh; }

/* ---------------------------------------------------------------- boot loader */
.boot {
  position: fixed; inset: 0; z-index: var(--z-boot); display: grid; place-content: center; justify-items: center; gap: 18px;
  background: var(--bg); color: var(--muted); font-size: 12px; letter-spacing: 0.04em;
  transition: opacity 0.6s var(--ease), visibility 0.6s;
}
.boot p { margin: 0; }
.boot.done { opacity: 0; visibility: hidden; }
.boot-mark { width: 120px; height: 120px; fill: var(--text); }
.boot-mark circle { animation: chase 1.4s linear infinite; opacity: 0.15; }
@keyframes chase { 0% { opacity: 1; } 60%, 100% { opacity: 0.15; } }

/* ---------------------------------------------------------------- nav */
.nav {
  position: sticky; top: 0; z-index: var(--z-nav);
  display: flex; align-items: center; gap: 28px; height: 60px; padding: 0 32px;
  background: rgba(10, 10, 10, 0.86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 500; letter-spacing: 0.08em; text-decoration: none; }
.steps { display: flex; gap: 4px; }
.steps a { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; color: var(--muted); text-decoration: none; font-size: 13px; border: 1px solid transparent; transition: color 0.2s, border-color 0.2s; }
.steps a span { display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--line-2); font-size: 10px; }
.steps a:hover { color: var(--text); }
.steps a[aria-current="page"] { color: var(--text); border-color: var(--line-2); }
.steps a[aria-current="page"] span { background: var(--text); color: #000; border-color: var(--text); }
.nav-now { flex: 1; min-width: 0; margin: 0; text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip { display: flex; gap: 3px; list-style: none; margin: 0; padding: 0; }
.strip li { width: 8px; height: 8px; border: 1px solid var(--line-2); }
.strip li[data-state="active"] { background: var(--text); animation: blink 1s steps(2) infinite; }
.strip li[data-state="done"] { background: var(--text); border-color: var(--text); }
.strip li[data-state="retry"] { background: var(--warn); border-color: var(--warn); }
.status {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 12px;
  border: 1px solid var(--line-2); font-size: 12px; color: var(--muted); white-space: nowrap;
}
.status .dot { width: 6px; height: 6px; background: var(--dim); }
.status[data-state="ok"] .dot { background: var(--text); }
.status[data-state="warn"] { color: var(--warn); }
.status[data-state="warn"] .dot { background: var(--warn); }
.status[data-state="down"] { color: var(--fault); }
.status[data-state="down"] .dot { background: var(--fault); }
.scroll-line { position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--text); transform: scaleX(0); transform-origin: left; }
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------------------------------------------------------------- hero */
.hero { position: relative; height: calc(100dvh - 61px); min-height: 620px; border-bottom: 1px solid var(--line); overflow: hidden; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-card {
  position: absolute; left: 32px; bottom: 32px; width: min(520px, calc(100% - 64px));
  padding: 22px 22px 18px; background: rgba(10, 10, 10, 0.82); border: 1px solid var(--line-2);
}
.tag { display: inline-block; margin: 0 0 18px; padding: 2px 8px; border: 1px solid var(--line-2); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tag[data-live] { color: var(--text); border-color: var(--text); }
.now { min-height: 1.6em; margin: -8px 0 14px; font-size: 13px; color: var(--text); }
.now:empty { display: none; }
.now::before, .live-now::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; background: var(--text); vertical-align: 1px; animation: blink 1s steps(2) infinite; }
h1 { margin: 0 0 18px; font-weight: 300; font-size: clamp(30px, 4.4vw, 46px); line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; }
.lede { margin: 0 0 22px; color: var(--soft); font-size: 13px; max-width: 46ch; text-wrap: pretty; }
.field { display: flex; border: 1px solid var(--line-2); background: var(--raise); transition: border-color 0.2s; }
.field input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; background: transparent; border: 0; outline: none; }
.field input::placeholder { color: var(--dim); }
.field:focus-within { border-color: var(--text); }
#run-btn { padding: 0 18px; border: 0; border-left: 1px solid var(--line-2); background: var(--text); color: #000; font-weight: 500; white-space: nowrap; }
#run-btn:hover:not(:disabled) { background: #fff; }
#run-btn[data-running] { background: transparent; color: var(--text); }
.opts { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.opts label { font-size: 12px; color: var(--muted); }
.opts select { flex: 1; min-width: 0; height: 36px; padding: 0 10px; background: var(--raise); border: 1px solid var(--line-2); font-size: 12px; }
.opts select:focus { outline: none; border-color: var(--text); }
.key { width: 100%; height: 38px; margin-top: 8px; padding: 0 14px; background: var(--raise); border: 1px solid var(--line-2); }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.example { padding: 3px 8px; background: none; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.example:hover:not(:disabled) { color: var(--text); border-color: var(--line-2); }
.alert { margin: 12px 0 0; padding: 8px 12px; border: 1px solid var(--fault); color: var(--fault); font-size: 12px; }

/* ---------------------------------------------------------------- app shell: sidebar + screen */
.app { display: grid; grid-template-columns: 280px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.sidebar { position: sticky; top: 61px; align-self: start; height: calc(100dvh - 61px); overflow-y: auto; border-right: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.side-toggle { display: none; }
.side-body { display: grid; gap: 22px; padding: 24px 20px 28px; }
.side-label { margin: 0 0 8px; font-size: 11px; color: var(--dim); }
.side-topic { margin: 0; font-size: 14px; line-height: 1.45; text-wrap: pretty; }
.side-model { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.side-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.side-link { font-size: 12px; color: var(--muted); }
.side-link:hover { color: var(--text); }
.stop-btn { padding: 4px 10px; background: none; border: 1px solid var(--fault); color: var(--fault); font-size: 11px; }
.side-note { margin: 12px 0 0; font-size: 11px; color: var(--dim); line-height: 1.5; }

.readout { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border: 1px solid var(--line); }
.readout div { padding: 8px 12px; }
.readout div:nth-child(even) { border-left: 1px solid var(--line); }
.readout div:nth-child(n + 3) { border-top: 1px solid var(--line); }
.readout dt { font-size: 11px; color: var(--muted); }
.readout dd { margin: 0; font-size: 18px; font-weight: 300; font-variant-numeric: tabular-nums; }
.readout dd[data-tone="warn"] { color: var(--warn); }

.agents { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.agents li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.agents li > .glyph { grid-row: 1 / 3; }
.agent-jump { padding: 0; background: none; border: 0; text-align: left; font-size: 13px; color: var(--soft); }
.agent-jump:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.agents li[data-state="active"] .agent-jump { color: var(--text); }
.agent-meta { grid-column: 2; font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; }
.agents li[data-state="retry"] .agent-meta { color: var(--warn); }
.rerun { grid-column: 3; grid-row: 1 / 3; padding: 4px 8px; background: none; border: 1px solid var(--line-2); font-size: 11px; color: var(--muted); }
.rerun:hover:not(:disabled) { color: var(--text); border-color: var(--text); }

.content { min-width: 0; padding: 40px 32px 56px; outline: none; }
.screen-head { margin-bottom: 22px; }
.screen-head h2 { margin: 0 0 6px; font-weight: 300; font-size: 30px; letter-spacing: -0.01em; outline: none; }
.screen-head p { margin: 0; color: var(--muted); font-size: 13px; max-width: 70ch; text-wrap: pretty; }
.blank { display: flex; align-items: center; gap: 20px; margin: 0 0 22px; padding: 20px 22px; border: 1px dashed var(--line-2); color: var(--muted); }

/* ---------------------------------------------------------------- dot-matrix agent icons */
.glyph { width: 16px; height: 16px; flex: none; fill: currentColor; color: var(--dim); transition: color 0.4s; }
.glyph.big { width: 64px; height: 64px; color: var(--soft); }
.glyph circle { transform-box: fill-box; transform-origin: center; }
@keyframes ripple { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.agents li[data-state="done"] .glyph, .panel[data-state="done"] .idx .glyph { color: var(--text); }
.agents li[data-state="retry"] .glyph, .panel[data-state="retry"] .idx .glyph { color: var(--warn); }
.agents li[data-state="active"] .glyph, .panel[data-state="active"] .idx .glyph { color: var(--text); }
.agents li[data-state="active"] .glyph circle, .panel[data-state="active"] .idx .glyph circle, .glyph.big circle {
  animation: ripple 1.3s ease-in-out infinite; animation-delay: calc(var(--d) * 90ms);
}
.idx { display: inline-flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- agent map */
.constellation {
  margin: 0 0 22px; border: 1px solid var(--line); background-color: var(--panel);
  background-image: radial-gradient(70% 90% at 50% 50%, rgba(237, 237, 237, 0.035), transparent 70%),
    radial-gradient(circle, var(--line) 1px, transparent 1.2px);
  background-size: auto, 18px 18px;
}
.constellation svg { display: block; width: 100%; height: auto; }
.edge { fill: none; stroke: var(--line-2); stroke-width: 1.2; stroke-dasharray: 2 5; transition: stroke 0.5s; }
.edge.lit { stroke: var(--soft); }
.loop { fill: none; stroke: var(--warn); stroke-width: 1.2; stroke-dasharray: 3 5; opacity: 0.75; animation: march 0.9s linear infinite; }
@keyframes march { to { stroke-dashoffset: -16; } }
.packet { fill: var(--text); filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8)); }
.packet.back { fill: var(--warn); filter: drop-shadow(0 0 4px rgba(227, 176, 75, 0.8)); }
.node { cursor: pointer; outline: none; }
.node .mask { fill: var(--panel); stroke: transparent; stroke-width: 1; transition: stroke 0.3s; }
.node:hover .mask, .node:focus-visible .mask { stroke: var(--line-2); }
.node .art circle { fill: var(--text); opacity: 0.22; transform-box: fill-box; transform-origin: center; transition: opacity 0.5s, fill 0.5s; }
.node[data-state="done"] .art circle { opacity: 0.95; }
.node[data-state="retry"] .art circle { fill: var(--warn); opacity: 0.95; }
.node[data-state="active"] .art circle { animation: pop 1.3s ease-in-out infinite; animation-delay: calc(var(--d) * 90ms); }
@keyframes pop { 0%, 100% { opacity: 0.25; transform: scale(0.7); } 50% { opacity: 1; transform: scale(1.15); } }
.node .orbit { opacity: 0; transform-box: fill-box; transform-origin: center; transition: opacity 0.4s; }
.node .orbit circle { fill: var(--text); }
.node[data-state="active"] .orbit { opacity: 1; animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.node text { font: 500 12px var(--mono); fill: var(--muted); text-anchor: middle; transition: fill 0.3s; }
.node .sub { font-size: 10px; font-weight: 400; fill: var(--dim); }
.node[data-state="active"] .t, .node[data-state="done"] .t { fill: var(--text); }
.node[data-state="retry"] .t, .node[data-state="retry"] .sub { fill: var(--warn); }
.empty { margin: 0; color: var(--dim); }

/* view bar: one toggle per panel */
.viewbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding: 12px 0; margin-bottom: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; background: none; border: 1px solid var(--line-2); font-size: 12px; color: var(--text); }
.chip::before { content: ""; width: 7px; height: 7px; border: 1px solid currentColor; background: currentColor; }
.chip[aria-pressed="false"] { color: var(--dim); border-color: var(--line); }
.chip[aria-pressed="false"]::before { background: none; }
.chip[data-state="active"]::before { animation: blink 1s steps(2) infinite; }
.chip:hover { border-color: var(--text); }
.view-actions { display: flex; gap: 6px; }
.view-actions button { padding: 4px 10px; background: none; border: 1px solid transparent; font-size: 12px; color: var(--muted); }
.view-actions button:hover { color: var(--text); border-color: var(--line-2); }

/* bento grid: spans set per panel, dense packing fills holes left by hidden panels */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: dense; gap: 12px; align-items: start; }
.panel { position: relative; min-width: 0; background: var(--panel); border: 1px solid var(--line); transition: border-color 0.3s; }
.panel[data-span="2"] { grid-column: span 2; }
.panel[data-span="full"] { grid-column: 1 / -1; }
.panel[data-state="active"] { border-color: var(--line-2); }
/* loading bar on the working panel */
.panel[data-state="active"]::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--text), transparent); background-size: 40% 100%; background-repeat: no-repeat;
  animation: scan 1.2s linear infinite;
}
@keyframes scan { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.panel[data-state="retry"] { border-color: rgba(227, 176, 75, 0.4); }

.panel-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 12px; padding: 14px 16px 12px; }
.idx { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.panel[data-state="active"] .idx { color: var(--text); }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 500; }
.panel-head .role { grid-column: 1 / -1; margin: 2px 0 0; color: var(--muted); font-size: 12px; text-wrap: pretty; }
.panel-ctl { display: flex; gap: 2px; }
.icon-btn { width: 26px; height: 26px; display: grid; place-items: center; padding: 0; background: none; border: 1px solid transparent; color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 1.5; fill: none; transition: transform 0.25s var(--ease); }
.panel[data-collapsed] .icon-btn.collapse svg { transform: rotate(-90deg); }
.cell-status { grid-column: 1 / -1; margin-top: 6px; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.panel[data-state="active"] .cell-status { color: var(--text); }
.panel[data-state="retry"] .cell-status { color: var(--warn); }

.panel-body { padding: 0 16px 16px; max-height: 460px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.panel-body:empty { display: none; }
.panel[data-collapsed] .panel-body { display: none; }
#panel-activity .panel-body { max-height: 420px; }

/* skeleton: shown while an agent thinks before its first words arrive */
.skel { display: grid; gap: 8px; margin-top: 4px; }
.skel i { display: block; height: 8px; background: linear-gradient(90deg, var(--raise) 0%, #222 50%, var(--raise) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel i:nth-child(2) { width: 82%; }
.skel i:nth-child(3) { width: 64%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.hint { margin: 8px 0 0; font-size: 11px; color: var(--muted); }
.hint.edited { color: var(--warn); }
textarea { width: 100%; padding: 12px 14px; background: var(--raise); border: 1px solid var(--line-2); resize: vertical; line-height: 1.6; font-size: 13px; transition: border-color 0.2s; }
textarea:focus { outline: none; border-color: var(--text); }
textarea.hyp { font: 400 18px/1.5 var(--serif); }

.live-now { margin: 0 0 10px; color: var(--text); font-size: 13px; }
.live-text { margin: 0; white-space: pre-wrap; font: inherit; font-size: 13px; color: var(--soft); }
.live-text::after { content: "\2588"; margin-left: 2px; animation: blink 1s steps(2) infinite; color: var(--text); }

.srcs { list-style: none; margin: 0; padding: 0; counter-reset: src; }
.srcs li { counter-increment: src; position: relative; padding: 0 0 14px 34px; }
.srcs li::before { content: "[" counter(src) "]"; position: absolute; left: 0; color: var(--dim); font-size: 12px; }
.srcs .meta { color: var(--dim); font-size: 11px; }
.srcs details summary { color: var(--muted); font-size: 11px; cursor: pointer; }
.srcs details p, .sums p { margin: 6px 0 0; color: var(--soft); font-size: 13px; max-width: 80ch; }
.sums { margin: 0; padding: 0; list-style: none; }
.sums li { padding-bottom: 14px; }
.small-btn { margin-top: 6px; padding: 4px 10px; background: none; border: 1px solid var(--line-2); color: var(--muted); font-size: 11px; }
.small-btn:hover { color: var(--text); border-color: var(--text); }

.score { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.score b { font-size: 34px; font-weight: 300; font-variant-numeric: tabular-nums; }
.score span { color: var(--muted); font-size: 12px; }
.reason { margin: 8px 0 0; color: var(--soft); max-width: 72ch; }
.gauge { position: relative; height: 10px; margin-top: 12px; background: repeating-linear-gradient(90deg, var(--line-2) 0 2px, transparent 2px 6px); }
.gauge i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, var(--text) 0 2px, transparent 2px 6px); }
.gauge.warn i { background: repeating-linear-gradient(90deg, var(--warn) 0 2px, transparent 2px 6px); }
.gauge .thr { position: absolute; top: -5px; bottom: -5px; width: 1px; background: var(--text); }
.verdict { display: inline-block; margin-top: 14px; padding: 2px 8px; border: 1px solid; font-size: 11px; }
.verdict.warn { color: var(--warn); }
.history { margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.history ol { margin: 6px 0 0; padding-left: 18px; }
.plan { margin: 0; white-space: pre-wrap; font: inherit; font-size: 13px; color: #d4d4d4; }

/* ---------------------------------------------------------------- paper screen */
.paper-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.paper-sheet { min-width: 0; padding: 28px 36px 40px; background: var(--panel); border: 1px solid var(--line); }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
.toolbar button { padding: 6px 12px; background: none; border: 1px solid var(--line-2); font-size: 12px; }
.toolbar button:hover:not(:disabled) { border-color: var(--text); }
.paper { max-width: 70ch; font: 400 18px/1.75 var(--serif); color: #dedede; white-space: pre-wrap; overflow-wrap: anywhere; }
.paper.live::after { content: "\2588"; margin-left: 2px; animation: blink 1s steps(2) infinite; font-family: var(--mono); }
.paper-meta { position: sticky; top: 85px; display: grid; gap: 22px; }
.meta-block { padding: 16px; border: 1px solid var(--line); background: var(--panel); }
.meta-block:empty { display: none; }
.meta-hyp { margin: 0 0 12px; font: 400 16px/1.5 var(--serif); }
.meta-line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.meta-line b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.refs { margin: 0; padding-left: 22px; font-size: 12px; }
.refs li { margin-bottom: 10px; color: var(--muted); }
.refs a { color: var(--soft); }

.log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.log > li { display: grid; grid-template-columns: 70px 120px 1fr 60px; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.log > li.empty { display: block; border: 0; }
.log > li.say { color: var(--muted); }
.log time { color: var(--dim); }
.log .conf { text-align: right; }
.log .conf.low { color: var(--warn); }
.log details { grid-column: 3 / 5; }
.log summary { cursor: pointer; }
.log pre { margin: 6px 0 0; padding: 10px; background: var(--raise); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow-y: auto; font-size: 11px; }

.foot { display: flex; justify-content: space-between; gap: 16px; padding: 20px 32px 24px; color: var(--dim); font-size: 11px; }
.foot span { display: inline-flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- scroll reveal (only when JS runs) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); transition-delay: var(--delay, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel[data-span="2"] { grid-column: 1 / -1; }
}
@media (max-width: 1180px) {
  .paper-layout { grid-template-columns: minmax(0, 1fr); }
  .paper-meta { position: static; }
}
@media (max-width: 900px) {
  .nav-now { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-toggle { display: flex; justify-content: space-between; width: 100%; padding: 14px 20px; background: none; border: 0; font-size: 13px; }
  .side-toggle::after { content: "+"; }
  .side-toggle[aria-expanded="true"]::after { content: "\2212"; }
  .side-body { display: none; padding-top: 4px; }
  .side-toggle[aria-expanded="true"] + .side-body { display: grid; }
  .log > li { grid-template-columns: 60px 1fr 50px; }
  .log .what { grid-column: 2 / 4; }
  .log details { grid-column: 1 / 4; }
}
@media (max-width: 700px) {
  .frame { border: 0; }
  .nav { padding: 0 16px; gap: 12px; }
  .strip { display: none; }
  .steps a { padding: 5px 6px; font-size: 0; gap: 0; }
  .steps a span { font-size: 10px; }
  .status { margin-left: auto; }
  .hero { height: auto; min-height: 0; }
  #field { position: relative; height: 240px; }
  .hero-card { position: static; width: auto; margin: 0 16px 24px; }
  .content { padding: 28px 16px 40px; }
  .paper-sheet { padding: 20px 18px 28px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .panel[data-span] { grid-column: 1 / -1; }
  .field { flex-wrap: wrap; }
  #run-btn { flex: 1 1 100%; height: 42px; border-left: 0; border-top: 1px solid var(--line-2); }
  .foot { padding: 20px 16px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  .boot-mark circle { opacity: 0.8; }
}

@media print {
  body { background: #fff; color: #000; }
  body::after { display: none; }
  body * { visibility: hidden; }
  #paper-text, #paper-text * { visibility: visible; }
  #paper-text { position: absolute; inset: 0 auto auto 0; width: 100%; max-width: none; color: #000; font-size: 11pt; }
}
