@import "tailwindcss";
@source "./app.jsx";

:root {
  color-scheme: light;
  font-family: Inter, "Inter Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none;
  --ground: #fbfaf7;
  --surface: #ffffff;
  --sunken: #f3f1ec;
  --ink: #1b1a18;
  --muted: #716d66;
  --faint: #77716a;
  --rule: #e4e0d8;
  --accent: #315ddc;
  --accent-hover: #244bc0;
  --accent-soft: #e9eeff;
  --positive: #17714a;
  --positive-soft: #e6f3eb;
  --attention: #875b0d;
  --attention-soft: #fbf0d8;
  --danger: #a7352e;
  --danger-soft: #fbeae7;
  --plot-1: #315ddc;
  --plot-2: #b24a32;
  --plot-3: #17714a;
  --plot-4: #875b0d;
  --plot-5: #7846a8;
  --plot-6: #08788a;
  --plot-7: #ad3e72;
  --plot-8: #52606d;
  --shadow: 0 20px 60px rgba(51, 43, 30, 0.08);
  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --column: 58rem;
}

* { box-sizing: border-box; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; }
html, body, #root { height: 100%; margin: 0; }
body { overflow: hidden; background: var(--ground); color: var(--ink); }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.scroll-region { scrollbar-color: #c8c2b8 transparent; scrollbar-width: thin; }

#mentor-rescue {
  position: fixed;
  top: 0.7rem;
  inset-inline-end: max(1rem, calc((100vw - var(--column)) / 2));
  z-index: 1000;
  display: none;
  min-height: 2.75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink);
  padding: 0 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(45, 40, 30, 0.1);
  backdrop-filter: blur(18px);
}
#mentor-rescue:hover { border-color: var(--ink); }
body[data-focus="work"]:not([data-rescue="1"]) #mentor-rescue,
body[data-focus="chat"][data-has-work="1"]:not([data-return-work="1"]) #mentor-rescue,
body[data-rescue="1"] #mentor-rescue,
body[data-return-work="1"] #mentor-rescue,
body[data-crashed="1"] #mentor-rescue { display: block; }

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0fr);
  height: 100%;
  overflow: hidden;
  background: var(--ground);
}
.workspace[data-focus="work"] { grid-template-columns: minmax(0, 0fr) minmax(0, 1fr); }
body[data-rescue="1"] .workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 0fr); }
body[data-return-work="1"] .workspace { grid-template-columns: minmax(0, 0fr) minmax(0, 1fr); }
.mentor-pane, .stage-pane {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms cubic-bezier(.2, 0, 0, 1), transform 180ms cubic-bezier(.2, 0, 0, 1);
}
.workspace[data-focus="chat"] .stage-pane,
body[data-rescue="1"] .stage-pane { opacity: 0; transform: translateY(8px); pointer-events: none; }
.workspace[data-focus="work"] .mentor-pane { opacity: 0; transform: translateY(8px); pointer-events: none; }
body[data-rescue="1"] .workspace .mentor-pane { opacity: 1; transform: none; pointer-events: auto; }
body[data-return-work="1"] .workspace .mentor-pane { opacity: 0; transform: translateY(8px); pointer-events: none; }
body[data-return-work="1"] .workspace .stage-pane { opacity: 1; transform: none; pointer-events: auto; }

.app-header, .stage-header {
  position: relative;
  z-index: 20;
  height: 3.75rem;
  display: grid;
  align-items: center;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 75%, transparent);
  padding-inline: var(--gutter);
  background: color-mix(in srgb, var(--ground) 92%, transparent);
  backdrop-filter: blur(20px);
}
.app-header { grid-template-columns: 1fr auto 1fr; }
.brand-lockup { display: flex; align-items: center; gap: 0.65rem; color: var(--muted); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; }
.brand-mark { display: grid; width: 1.75rem; height: 1.75rem; place-items: center; border-radius: 0.55rem; background: var(--ink); color: var(--ground); font-family: Georgia, serif; font-size: 1rem; }
.app-header h1 { justify-self: center; margin: 0; font-size: 0.95rem; font-weight: 600; }
.header-actions { justify-self: end; display: flex; min-width: 0; align-items: center; gap: 0.9rem; }
.model-picker-wrap { position: relative; display: flex; min-width: 0; align-items: center; gap: 0.4rem; }
.model-picker { display: flex; min-width: 0; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.72rem; }
.model-picker input { width: min(17rem, 26vw); min-height: 2rem; border: 1px solid var(--rule); border-radius: 0.55rem; background: var(--surface); color: var(--ink); padding: 0.2rem 0.55rem; font: inherit; font-weight: 600; text-overflow: ellipsis; }
.model-picker input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.model-picker input:disabled { opacity: 0.55; }
.model-picker-error { color: var(--danger); font-size: 0.72rem; white-space: nowrap; }
.model-options { position: fixed; top: 3.35rem; inset-inline-end: var(--gutter); z-index: 2000; width: min(27rem, calc(100vw - 2rem)); max-height: min(24rem, calc(100vh - 5rem)); overflow-y: auto; border: 1px solid var(--rule); border-radius: 0.8rem; background: var(--surface); padding: 0.35rem; box-shadow: 0 18px 50px rgba(45, 40, 30, 0.16); }
.model-options-summary, .model-options-more { padding: 0.45rem 0.55rem; color: var(--muted); font-size: 0.7rem; }
.model-options button { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; border: 0; border-radius: 0.5rem; background: transparent; color: var(--ink); padding: 0.55rem; text-align: start; }
.model-options button:hover, .model-options button[data-active="1"] { background: var(--accent-soft); }
.model-options button[aria-selected="true"] { color: var(--accent); }
.model-options button span { overflow: hidden; font-size: 0.78rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.model-options button small { color: var(--muted); font-size: 0.68rem; }
body[data-focus="work"] .stage-header,
body[data-focus="chat"][data-has-work="1"] .app-header,
body[data-rescue="1"] .app-header,
body[data-return-work="1"] .stage-header {
  padding-inline-end: max(calc(var(--gutter) + 8rem), calc((100vw - var(--column)) / 2 + 8rem));
}
body[data-focus="work"] .stage-header .model-options,
body[data-focus="chat"][data-has-work="1"] .app-header .model-options,
body[data-rescue="1"] .app-header .model-options,
body[data-return-work="1"] .stage-header .model-options {
  inset-inline-end: max(calc(var(--gutter) + 8rem), calc((100vw - var(--column)) / 2 + 8rem));
}
.workspace-status { display: flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: 0.76rem; white-space: nowrap; }
.status-dot { width: 0.46rem; height: 0.46rem; border-radius: 50%; background: var(--attention); }
.status-dot.is-connected { background: var(--positive); }
.status-detail { margin-inline-start: 0.45rem; padding-inline-start: 0.75rem; border-inline-start: 1px solid var(--rule); }

.mentor-pane { display: flex; flex-direction: column; background: var(--ground); }
.welcome-shell { display: grid; width: min(var(--column), calc(100% - 2 * var(--gutter))); flex: 1; align-content: center; gap: 2rem; margin: -5vh auto 0; }
.welcome-copy { max-width: 46rem; }
.welcome-kicker { color: var(--accent); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.welcome-copy h1 { margin: 0.65rem 0 0.8rem; font-family: Georgia, "Iowan Old Style", serif; font-size: clamp(2.45rem, 6vw, 4.8rem); font-weight: 400; letter-spacing: -0.045em; line-height: 1.02; }
.welcome-copy p { max-width: 42rem; margin: 0; color: var(--muted); font-family: Georgia, "Iowan Old Style", serif; font-size: clamp(1.05rem, 2vw, 1.25rem); line-height: 1.65; }

.chat-stream { display: flex; width: min(48rem, calc(100% - 2 * var(--gutter))); min-height: 0; flex: 1; flex-direction: column; gap: 2.25rem; overflow-y: auto; margin: 0 auto; padding: 3.5rem 0 2.5rem; }
.chat-message { max-width: 68ch; color: var(--ink); font-family: Georgia, "Iowan Old Style", serif; font-size: 1.08rem; line-height: 1.75; }
.chat-message-user { align-self: stretch; max-width: 100%; border-inline-start: 2px solid var(--accent); border-radius: 0.25rem; background: color-mix(in srgb, var(--surface) 72%, transparent); padding: 0.9rem 1.1rem; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 0.92rem; line-height: 1.55; }
.chat-message-mentor { padding: 0 0 1.5rem; }
.message-role { display: none; }
.message-markdown p { margin: 0.65rem 0; }
.message-markdown pre { overflow: auto; border-radius: 0.7rem; background: var(--sunken); padding: 1rem; font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }
.message-markdown code { color: var(--accent-hover); font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; }

.chat-composer { width: min(48rem, calc(100% - 2 * var(--gutter))); margin: 0 auto; padding: 0.75rem 0 1.25rem; }
.chat-composer-centered { width: 100%; margin: 0; padding: 0; }
.mentor-presence { display: flex; min-height: 1.25rem; align-items: center; gap: 0.45rem; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.75rem; }
.thinking-dot { width: 0.42rem; height: 0.42rem; border-radius: 50%; background: var(--accent); animation: breathe 1.1s ease-in-out infinite alternate; }
.mentor-stop { margin-inline-start: 0.25rem; border: 0; background: transparent; color: var(--danger); padding: 0.15rem 0.3rem; font-size: 0.75rem; font-weight: 600; }
.mentor-stop:hover { text-decoration: underline; }
.composer-control { display: flex; gap: 0.75rem; border: 1px solid color-mix(in srgb, var(--rule) 82%, transparent); border-radius: 1rem; background: color-mix(in srgb, var(--surface) 94%, transparent); padding: 0.65rem; box-shadow: 0 12px 38px rgba(51, 43, 30, 0.08); transition: border-color 120ms ease, box-shadow 120ms ease; backdrop-filter: blur(20px); }
.composer-control:focus-within { border-color: color-mix(in srgb, var(--accent) 48%, var(--rule)); box-shadow: 0 16px 44px rgba(49, 93, 220, 0.12); }
.composer-control textarea { min-height: 3.2rem; flex: 1; resize: none; border: 0; background: transparent; color: var(--ink); padding: 0.45rem 0.55rem; font-size: 0.95rem; line-height: 1.55; outline: 0; }
.chat-composer-centered .composer-control textarea { min-height: 5.4rem; font-size: 1rem; }
.composer-control textarea::placeholder, .work-question-input::placeholder { color: var(--faint); }
.composer-control button, .work-question-control button, .surface-toolbar button {
  align-self: flex-end;
  min-height: 2.55rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--accent);
  color: white;
  padding: 0 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 120ms ease, transform 120ms ease;
}
.composer-control button:hover, .work-question-control button:hover, .surface-toolbar button:hover { background: var(--accent-hover); }
.composer-control button:active, .work-question-control button:active, .surface-toolbar button:active { transform: translateY(1px); }
.composer-control button:disabled, .work-question-control button:disabled, .surface-toolbar button:disabled { cursor: default; opacity: 0.35; }
.surface-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
.surface-toolbar .submit-code { border: 1px solid #596171; background: transparent; color: #eef1f6; }
.surface-toolbar .submit-code:hover:not(:disabled) { border-color: #88a7ff; background: #262b36; }
.composer-hint { margin: 0.55rem 0 0 0.35rem; color: var(--faint); font-size: 0.72rem; }
.send-error { margin: 0.5rem 0 0; color: var(--danger); font-size: 0.78rem; }

.stage-pane { display: flex; flex-direction: column; background: var(--ground); }
.stage-header { grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; }
.stage-topic { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.stage-header h2 { overflow: hidden; margin: 0.1rem 0 0; font-family: Georgia, "Iowan Old Style", serif; font-size: 1.15rem; font-weight: 400; letter-spacing: -0.015em; text-overflow: ellipsis; white-space: nowrap; }
.stage-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 2.5rem var(--gutter) 8rem; }
.stage-column { width: min(var(--column), 100%); margin: 0 auto; }
.a2ui-column { display: grid; gap: 2.25rem; }
.a2ui-row { display: flex; flex-wrap: wrap; align-items: start; gap: 1.25rem; }
.stage-component { min-width: 0; animation: canvas-in 160ms cubic-bezier(.2, 0, 0, 1); }

.prose-surface { max-width: 68ch; color: var(--ink); font-family: Georgia, "Iowan Old Style", serif; font-size: 1.1rem; line-height: 1.7; }
.prose-surface h1, .prose-surface h2, .prose-surface h3 { font-family: Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: -0.02em; }
.stage-card { border: 0; background: transparent; }
.callout-surface { border-inline-start: 3px solid var(--accent); background: var(--accent-soft); padding: 1rem 1.2rem; }
.callout-surface.is-success { border-color: var(--positive); background: var(--positive-soft); }
.callout-surface.is-warning { border-color: var(--attention); background: var(--attention-soft); }
.callout-surface h3 { margin: 0 0 0.25rem; font-size: 0.9rem; font-weight: 600; }
.activity-error { border-inline-start: 3px solid var(--danger); background: var(--danger-soft); padding: 1rem 1.2rem; color: var(--danger); font-size: 0.85rem; }
.diagram-surface { overflow: auto; text-align: center; }
.diagram-surface svg { display: block; width: auto; max-width: 100%; height: auto; margin-inline: auto; }

.playground-surface { direction: ltr; overflow: hidden; border: 1px solid #2b2e36; border-radius: 1rem; background: #171a21; box-shadow: 0 18px 50px rgba(27, 26, 24, 0.14); }
.surface-toolbar { display: flex; min-height: 3.2rem; align-items: center; justify-content: space-between; border-bottom: 1px solid #31343c; padding: 0.55rem 0.75rem 0.55rem 1rem; color: #a8afbd; }
.surface-toolbar > span { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }
.editor-shell { min-height: 0; }
.code-fallback { width: 100%; min-height: 8.8rem; resize: none !important; border: 0; background: #171a21 !important; color: #f3f5f9 !important; padding: 1.1rem !important; font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace !important; font-size: 0.88rem !important; line-height: 1.65 !important; outline: 0; caret-color: #88a7ff; }
.execution-result { border-top: 1px solid #31343c; background: #111319; padding: 1rem; color: #eef1f6; animation: result-in 160ms ease-out; }
.execution-result .data-surface { color: #eef1f6; }
.execution-result .data-surface figcaption { color: #9ba5b6; }
.execution-result .data-surface th { color: #9ba5b6; }
.execution-result .data-surface tbody tr:hover { background: rgba(126, 157, 255, 0.08); }
.execution-result .console-output { margin: 0; max-height: 17rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.8rem; }
.run-meta { margin-top: 0.55rem; color: #7f8898; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.68rem; }
.submit-error { margin: 0; border-top: 1px solid #31343c; background: #111319; padding: 0.75rem 1rem; color: #ffaaa3; font-size: 0.78rem; }

.data-surface { overflow: hidden; }
.data-surface figcaption { margin-bottom: 0.6rem; color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.data-surface table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-surface th { height: 2.75rem; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-align: start; text-transform: uppercase; }
.data-surface td { height: 2.75rem; padding-inline-end: 1.25rem; color: inherit; }
.data-surface tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.execution-result .data-surface th { border-color: #31343c; }

.passage-surface { max-width: 62ch; padding: 1rem 0; }
.passage-surface blockquote { margin: 0; color: #332d25; font-family: Georgia, "Iowan Old Style", serif; font-size: clamp(1.25rem, 2.4vw, 1.7rem); line-height: 1.75; }
.passage-surface figcaption { margin-top: 1rem; color: var(--muted); font-size: 0.75rem; }
.passage-surface aside { display: grid; grid-template-columns: minmax(7rem, 0.3fr) 1fr; gap: 1.25rem; margin-top: 1.5rem; border-top: 1px solid var(--rule); padding-top: 1rem; font-size: 0.9rem; line-height: 1.6; }
.passage-surface aside strong { color: var(--accent-hover); }
.figure-surface { text-align: center; }
.figure-surface > div { overflow: auto; }
.figure-surface > figcaption { margin-top: 0.7rem; color: var(--muted); font-size: 0.85rem; }
.math-surface { max-width: 100%; overflow-x: auto; padding: 0.75rem 0; text-align: center; }
.math-surface math { color: var(--ink); font-size: clamp(1.15rem, 2.6vw, 1.75rem); }
.math-surface figcaption, .plot-surface > figcaption { margin-top: 0.75rem; color: var(--muted); font-family: Georgia, "Iowan Old Style", serif; font-size: 0.88rem; line-height: 1.55; text-align: start; }
.plot-surface { margin: 0; }
.plot-surface h3 { margin: 0 0 0.85rem; font-family: Georgia, "Iowan Old Style", serif; font-size: 1.25rem; font-weight: 400; }
.plot-surface > svg { display: block; width: 100%; min-height: 18rem; overflow: visible; border-block: 1px solid var(--rule); background: var(--surface); }
.plot-grid line { stroke: color-mix(in srgb, var(--rule) 70%, transparent); stroke-width: 1; }
.plot-axes line { stroke: var(--muted); stroke-width: 1.25; }
.plot-axes text { fill: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; }
.plot-axes .axis-label { fill: var(--ink); font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 13px; }
.plot-surface circle { cursor: pointer; transition: r 120ms ease, fill 120ms ease; }
.plot-surface circle:hover { r: 7px; fill: var(--accent-soft); }
.plot-legend { display: flex; flex-wrap: wrap; gap: 0.65rem 1.25rem; margin-top: 0.85rem; color: var(--muted); font-size: 0.78rem; }
.plot-legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.plot-legend i { width: 1.7rem; height: 0; border-top: 3px solid var(--series-color); }
.plot-data { margin-top: 0.8rem; color: var(--muted); font-size: 0.78rem; }
.plot-data summary { width: max-content; cursor: pointer; }
.plot-data .data-surface { margin-top: 1rem; color: var(--ink); }
.parameter-surface { display: grid; gap: 1rem; }
.parameter-surface h3 { margin: 0; font-family: Georgia, serif; font-size: 1.2rem; font-weight: 400; }
.parameter-surface label { display: grid; grid-template-columns: minmax(8rem, 0.35fr) 4rem 1fr; align-items: center; gap: 1rem; border-bottom: 1px solid var(--rule); padding: 0.75rem 0; font-size: 0.9rem; }
.parameter-surface output { color: var(--accent-hover); font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.parameter-surface input[type="range"] { accent-color: var(--accent); }
.interaction-list h3 { margin: 0 0 0.75rem; font-family: Georgia, serif; font-size: 1.1rem; font-weight: 400; }
.interaction-list > div { display: grid; }
.interaction-list button { min-height: 2.9rem; border: 0; border-bottom: 1px solid var(--rule); background: transparent; color: var(--ink); padding: 0.6rem 0; text-align: start; font-size: 0.9rem; }
.interaction-list button:hover, .interaction-list button.is-selected { color: var(--accent-hover); }
.interaction-list button.is-selected::before { content: "✓"; margin-inline-end: 0.55rem; }
.checklist-list label { display: flex; min-height: 2.9rem; align-items: center; gap: 0.75rem; border-bottom: 1px solid var(--rule); font-size: 0.9rem; }
.checklist-list input { accent-color: var(--accent); }
.checklist-list .is-done { color: var(--muted); text-decoration: line-through; }
.unknown-surface { overflow: auto; background: var(--sunken); padding: 1rem; color: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.75rem; }

.ask-component { display: block; margin: 0.55rem 0 0 auto; border: 0; background: transparent; color: var(--muted); padding: 0.35rem 0; font-size: 0.75rem; opacity: 0.55; transition: color 120ms ease, opacity 120ms ease; }
.stage-component:hover .ask-component, .ask-component:focus-visible { color: var(--accent-hover); opacity: 1; }
.anchored-mentor-note, .work-mentor-reply, .work-mentor-lead, .course-continuation { margin-top: 0.85rem; border-inline-start: 2px solid var(--accent); background: color-mix(in srgb, var(--accent-soft) 70%, transparent); padding: 1rem 1.2rem; font-family: Georgia, serif; font-size: 0.95rem; line-height: 1.65; }
.work-mentor-lead { margin: 0 0 1.25rem; }
.course-continuation { width: min(var(--column), calc(100% - (2 * var(--gutter)))); margin: 0 auto 1rem; }
.course-continuation.is-current-step { position: sticky; top: 0; z-index: 12; width: 100%; margin: 0 0 1rem; border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--rule)); border-inline-start: 4px solid var(--accent); border-radius: 0.25rem; background: color-mix(in srgb, var(--surface) 96%, var(--accent-soft)); box-shadow: 0 10px 28px rgba(51, 43, 30, 0.12); }
.course-continuation.is-current-step p { margin: 0; font-size: 1.02rem; }
.stage-component.is-current-target { scroll-margin-top: 7rem; outline: 2px solid color-mix(in srgb, var(--accent) 52%, transparent); outline-offset: 0.55rem; }
.work-history-note { margin: 1.5rem 0 0; border-top: 1px solid var(--rule); padding-top: 0.8rem; color: var(--muted); font-size: 0.85rem; }
.work-history-note summary { width: max-content; cursor: pointer; color: var(--accent-hover); font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-weight: 600; }
.work-history-note > :not(summary) { margin-inline-start: 1rem; }
.anchored-note-label { margin: 0 0 0.45rem; color: var(--accent-hover); font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 0.67rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; }
.anchored-mentor-note blockquote { border-inline-start: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); padding-inline-start: 0.75rem; color: var(--accent-hover); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.75rem; }

.work-question-bar { position: relative; z-index: 20; background: color-mix(in srgb, var(--ground) 88%, transparent); padding: 1rem var(--gutter); backdrop-filter: blur(16px); }
.work-question-inner { width: min(var(--column), 100%); margin: 0 auto; border: 1px solid color-mix(in srgb, var(--rule) 82%, transparent); border-radius: 1rem; background: color-mix(in srgb, var(--surface) 94%, transparent); padding: 0.6rem 0.75rem; box-shadow: 0 12px 38px rgba(51, 43, 30, 0.08); backdrop-filter: blur(20px); }
.work-question-control { display: flex; gap: 0.6rem; }
.work-question-input { min-height: 2.5rem; flex: 1; resize: none; border: 0; background: transparent; color: var(--ink); padding: 0.65rem 0.2rem; font-size: 0.9rem; outline: 0; }
.work-question-input:focus { border-color: var(--accent); }
.work-question-control button { border-radius: 0.65rem; }
.context-chip { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.55rem; color: var(--accent-hover); font-size: 0.75rem; }
.context-chip button { border: 0; background: transparent; color: var(--muted); font-size: 0.75rem; }

.selection-actions { position: fixed; z-index: 1400; display: flex; transform: translate(-50%, -100%); gap: 0.25rem; border: 1px solid #343843; border-radius: 0.7rem; background: #171a21; padding: 0.3rem; box-shadow: 0 10px 30px rgba(20, 20, 24, 0.24); }
.selection-actions[data-below="1"] { transform: translateX(-50%); }
.selection-actions button { min-height: 2rem; border: 0; border-radius: 0.45rem; background: transparent; color: #eef1f6; padding: 0 0.7rem; font-size: 0.78rem; font-weight: 600; }
.selection-actions button:hover { background: #2a2f3a; }

.connection-issue { position: fixed; top: 5rem; left: 50%; z-index: 1200; display: flex; width: min(42rem, calc(100% - 2rem)); transform: translateX(-50%); gap: 0.8rem; border-inline-start: 3px solid var(--attention); background: var(--attention-soft); padding: 0.9rem 1rem; color: var(--ink); box-shadow: var(--shadow); }
.connection-issue-mark { display: grid; width: 1.5rem; height: 1.5rem; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--attention); color: white; font-weight: 600; }
.connection-issue strong { font-size: 0.88rem; }
.connection-issue p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.root-fallback { display: grid; height: 100%; place-content: center; gap: 0.75rem; padding: 2rem; text-align: center; background: var(--ground); color: var(--ink); }
.root-fallback h1 { margin: 0; font-family: Georgia, serif; font-size: 1.7rem; font-weight: 400; }
.root-fallback p { color: var(--muted); }

@keyframes breathe { to { opacity: 0.3; transform: scale(0.78); } }
@keyframes result-in { from { opacity: 0; transform: translateY(2px); } }
@keyframes canvas-in { from { opacity: 0; transform: translateY(4px); } }

@media (max-width: 1000px) {
  .app-header { grid-template-columns: auto minmax(0, 1fr); }
  .app-header h1, .brand-lockup > span:last-child, .model-picker > span:not(.visually-hidden) { display: none; }
  .header-actions { gap: 0.55rem; }
  .model-picker input { width: min(13rem, 25vw); }
}

@media (max-width: 700px) {
  :root { --gutter: 1rem; }
  #mentor-rescue { top: 0.55rem; inset-inline-end: 0.65rem; min-height: 2.45rem; }
  .app-header { grid-template-columns: 1fr auto; }
  .app-header h1 { display: none; }
  .status-detail, .brand-lockup > span:last-child, .model-picker > span { display: none; }
  .header-actions { gap: 0.5rem; }
  .model-picker input { width: min(9rem, 36vw); }
  .welcome-shell { width: calc(100% - 2rem); }
  .welcome-copy h1 { font-size: clamp(2.2rem, 13vw, 3.7rem); }
  .chat-stream, .chat-composer { width: calc(100% - 2rem); }
  .stage-header { padding-inline-end: 8.5rem; }
  .stage-scroll { padding-top: 1.75rem; }
  .passage-surface aside, .parameter-surface label { grid-template-columns: 1fr; gap: 0.35rem; }
  .plot-surface > svg { min-height: 14rem; }
  .ask-component { opacity: 1; }
}

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