@charset "UTF-8";

:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #fbfcff;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #0b63ce;
  --accent-dark: #074ea4;
  --orange: #9a6700;
  --focus: #0b63ce;
  --ok: #16794c;
  --fail: #b42318;
  --wait: #9a6700;
}

@media (min-width: 750px) {
  body:not(.mobile-preview-mode) .stage-panel > .lesson-context {
    box-sizing: border-box;
    max-height: none;
    padding-top: 12px;
    padding-bottom: 12px;
    overflow: visible;
  }

  body:not(.mobile-preview-mode) .stage-panel > .lesson-context strong {
    display: block;
    max-height: none;
    overflow: visible;
    font-size: 15px;
    line-height: 1.38;
    overflow-wrap: anywhere;
    -webkit-line-clamp: unset;
  }

  body:not(.mobile-preview-mode) .stage-panel > .lesson-context p {
    display: block;
    max-height: none;
    overflow: visible;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    -webkit-line-clamp: unset;
  }
}

.lesson-context p[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:where(.legacy-runtime, .app-shell) button,
:where(.legacy-runtime, .app-shell) input,
:where(.legacy-runtime, .app-shell) textarea {
  font: inherit;
}

:where(.legacy-runtime, .app-shell) button {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}

:where(.legacy-runtime, .app-shell) button:hover {
  background: #2c3842;
}

:where(.legacy-runtime, .app-shell) button.is-loading {
  cursor: wait;
  opacity: 0.82;
}

:where(.legacy-runtime, .app-shell) button:focus-visible,
:where(.legacy-runtime, .app-shell) input:focus-visible,
:where(.legacy-runtime, .app-shell) textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(520px, 1fr) minmax(170px, 220px);
  gap: 12px;
  align-items: start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 740;
  white-space: nowrap;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--accent), #6cae75 58%, var(--orange));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.promptbar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.input-group {
  display: grid;
  gap: 6px;
}

.input-group span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.problem-input-group,
.json-input-group {
  grid-column: auto;
}

.json-input-group,
.prompt-actions .secondary-action,
.examples {
  display: none;
}

body.debug-mode .json-input-group {
  display: grid;
}

body.debug-mode .prompt-actions .secondary-action {
  display: inline-flex;
  align-items: center;
}

body.debug-mode .examples {
  display: flex;
}

body.debug-mode .promptbar {
  grid-template-columns: minmax(220px, 0.42fr) minmax(320px, 0.58fr) auto;
}

.promptbar textarea {
  width: 100%;
  min-height: 62px;
  max-height: 88px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
}

.json-input-group textarea {
  min-height: 62px;
}

.promptbar button,
.prompt-actions button {
  background: var(--accent);
}

.promptbar button:hover,
.prompt-actions button:hover {
  background: var(--accent-dark);
}

.prompt-actions .secondary-action {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.prompt-actions .secondary-action:hover {
  background: var(--surface-2);
}

.prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  align-self: end;
}

.flyai-lesson-status {
  grid-column: 1 / -1;
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.flyai-lesson-status.is-loading::before,
.tutor-question-status.is-loading::before {
  content: "";
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 6px;
  border: 2px solid color-mix(in srgb, var(--accent) 26%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -1px;
  animation: loading-spin 0.8s linear infinite;
}

.flyai-lesson-status.is-error {
  color: #b3261e;
}

.stage-loading-overlay.is-error .loading-card {
  border-color: color-mix(in srgb, #b3261e 46%, var(--line));
  background: color-mix(in srgb, #fff 92%, #fce8e6);
}

.stage-loading-overlay.is-error .loading-spinner,
.stage-loading-overlay.is-error .loading-stream-panel,
.stage-loading-overlay.is-error .loading-reason-status {
  display: none;
}

.stage-loading-overlay.is-error #stageLoadingTitle {
  color: #b3261e;
}

.stage-loading-overlay.is-error .loading-detail {
  max-width: 560px;
  color: color-mix(in srgb, #b3261e 82%, var(--ink));
  white-space: normal;
}

.stage-loading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.stage-loading-actions[hidden],
.stage-loading-actions [hidden] { display: none !important; }

.stage-loading-overlay .stage-loading-actions button,
.stage-loading-overlay .stage-loading-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: var(--surface, #fff);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.examples {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.examples button {
  min-height: 26px;
  border-color: var(--line);
  padding: 0 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}

.examples button:hover {
  background: var(--surface-2);
}

body:not(.debug-mode) .json-input-group,
body:not(.debug-mode) .prompt-actions .secondary-action,
body:not(.debug-mode) .examples {
  display: none;
}

.json-error {
  grid-column: 1 / -1;
  min-height: 16px;
  margin: 0;
  color: #b3261e;
  font-size: 12px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.speed-control {
  min-width: 150px;
  min-height: 34px;
  display: grid;
  grid-template-columns: auto minmax(78px, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.speed-control input {
  width: 100%;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
}

.stage-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 46px;
  align-content: start;
  padding: 12px;
  gap: 10px;
}

#stage {
  justify-self: center;
  width: min(100%, 900px);
  height: auto;
  aspect-ratio: 16 / 11;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.stage-loading-overlay {
  position: absolute;
  inset: 12px 12px 68px;
  z-index: 12;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.stage-loading-overlay[hidden] {
  display: none;
}

.loading-card {
  width: min(560px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 3px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 8px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(29, 37, 44, 0.14);
}

.loading-card.has-stream {
  width: min(560px, calc(100% - 32px));
  grid-template-rows: auto auto auto;
}

.stage-loading-overlay:not(.is-error) #stageLoadingTitle,
.stage-loading-overlay:not(.is-error) .loading-detail {
  display: none;
}

.stage-loading-overlay:not(.is-error) .loading-card:not(.has-stream) .loading-stream-panel {
  display: none;
}

.stage-loading-overlay:not(.is-error) .loading-card {
  width: min(560px, calc(100% - 32px));
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
}

.stage-loading-overlay:not(.is-error) .loading-card:not(.has-stream) .loading-spinner {
  grid-row: 1 / 3;
}

.stage-loading-overlay:not(.is-error) .loading-card.has-stream .loading-spinner {
  grid-row: 1 / 2;
}

#flywait-entry {
  grid-column: 2;
  min-width: 0;
  margin-top: 0 !important;
}

.loading-reason-status {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  border-top: 1px solid color-mix(in srgb, var(--accent) 12%, var(--line));
  color: color-mix(in srgb, var(--ink) 82%, var(--muted));
  font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.loading-reason-status[hidden] {
  display: none;
}

.loading-reason-text {
  display: block;
  min-width: 0;
  white-space: inherit;
  padding: 8px 11px 10px;
}

.loading-spinner {
  grid-row: 1 / 3;
  width: 30px;
  height: 30px;
  border: 4px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loading-spin 0.82s linear infinite;
}

.loading-card strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.loading-detail {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.loading-stream-panel {
  grid-column: 1 / -1;
  min-width: 0;
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(210px, 0.85fr) minmax(300px, 1.25fr);
  grid-template-areas:
    "header header"
    "timeline output";
  gap: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 10px;
  padding: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 6%, #fff), #fff 66%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 85%);
}

.loading-stream-panel[hidden] {
  display: none;
}

.loading-stream-header {
  grid-area: header;
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.loading-thinking-pulse {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 30%, transparent);
  animation: loading-thinking-pulse 1.5s ease-out infinite;
}

.loading-stream-label {
  min-width: 0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.loading-stream-state {
  margin-left: auto;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 999px;
  padding: 3px 8px;
  color: #52637a;
  background: #fff;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.loading-stream-state.is-live {
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 9%, #fff);
}

.loading-thinking-stream {
  grid-area: timeline;
  min-width: 0;
}

.loading-stream-section-label {
  display: block;
  margin-bottom: 6px;
  color: #667b96;
  font-size: 11.5px;
  font-weight: 650;
}

.loading-thinking-timeline {
  position: relative;
  min-height: 0;
  max-height: min(126px, 18vh);
  margin: 0;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-left: 3px solid color-mix(in srgb, var(--accent) 58%, var(--line));
  border-radius: 7px;
  padding: 9px 10px;
  white-space: pre-line;
  color: #71839b;
  background: rgb(255 255 255 / 78%);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.6;
}

.loading-model-stream {
  grid-area: output;
  min-width: 0;
}

.loading-model-output {
  min-height: 72px;
  max-height: min(126px, 18vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 7px;
  background: #fff;
}

.loading-model-output pre {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  overflow: auto;
  border: 0;
  padding: 10px 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #8292a8;
  background: transparent;
  font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.loading-model-output pre.is-waiting {
  color: #71839b;
  font-family: inherit;
  font-style: normal;
}

@keyframes loading-thinking-pulse {
  70% {
    box-shadow: 0 0 0 8px transparent;
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-thinking-pulse,
  .loading-thinking-timeline,
  .loading-spinner {
    animation-duration: 3.5s;
  }
}

.timeline {
  min-height: 44px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
}

.timeline span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.timeline input {
  width: 100%;
  accent-color: var(--accent);
}

.inspector {
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  padding: 12px;
  overflow: auto;
}

.inspector section + section {
  margin-top: 18px;
}

.inspector h2 {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
  text-transform: uppercase;
}

.action-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.action-list li {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: var(--surface);
  color: var(--ink);
}

.action-list li.is-active {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, #fff);
}

.action-list time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.action-list span {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.step-text {
  min-height: 70px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.tutor-question-section {
  position: sticky;
  top: 12px;
  z-index: 4;
  width: 100%;
  max-height: none;
  overflow: visible;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 8px;
  padding: 12px;
  background: #f6fffc;
  box-shadow: 0 8px 22px rgba(36, 124, 107, 0.12);
}

.inspector .tutor-question-section h2 {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.2;
  text-transform: none;
}

.tutor-question-form {
  display: grid;
  gap: 8px;
}

.tutor-question-form textarea {
  width: 100%;
  min-height: 84px;
  max-height: 140px;
  resize: vertical;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 8px;
  padding: 10px 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.tutor-question-section.is-automatic-followup-locked textarea,
.tutor-question-section.is-automatic-followup-locked .tutor-question-tips button,
.tutor-question-section.is-automatic-followup-locked .tutor-image-picker span,
.tutor-question-section.is-automatic-followup-locked #tutorQuestionButton {
  cursor: not-allowed;
  opacity: 0.58;
}

.tutor-question-section.is-automatic-followup-locked textarea {
  background: color-mix(in srgb, var(--surface) 72%, var(--canvas-grid, #d8e3f1));
}

.tutor-image-row,
.question-image-row {
  display: grid;
  gap: 7px;
}

.tutor-image-picker,
.question-image-picker {
  width: max-content;
  max-width: 100%;
}

.tutor-image-picker input,
.question-image-picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.tutor-image-picker span,
.question-image-picker span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 8px;
  padding: 5px 10px;
  background: #ffffff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
  cursor: pointer;
}

.tutor-image-picker:focus-within span,
.tutor-image-picker span:hover,
.question-image-picker:focus-within span,
.question-image-picker span:hover {
  border-color: var(--accent);
  background: #f2fffb;
}

.tutor-image-preview,
.question-image-preview {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 8px;
  padding: 7px 8px;
  background: #ffffff;
}

.tutor-image-preview[hidden],
.question-image-preview[hidden] {
  display: none;
}

.tutor-image-preview span,
.question-image-preview span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tutor-image-preview button,
.question-image-preview button {
  min-height: 28px;
  flex: 0 0 auto;
  border-color: color-mix(in srgb, #b3261e 28%, var(--line));
  padding-inline: 8px;
  color: #8b1d17;
  font-size: 12px;
}

.recognized-visual-summary {
  margin-top: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 10px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--accent) 5%, #fff);
}

.recognition-data-cache {
  display: none !important;
}

.recognized-visual-summary[hidden] {
  display: none;
}

.recognized-visual-summary h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
}

.recognized-visual-summary h3 span {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.recognized-visual-summary textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 8px;
  padding: 9px 10px;
  white-space: pre-wrap;
  color: var(--ink-soft);
  background: #fff;
  font-size: 13px;
  line-height: 1.65;
}

.tutor-question-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tutor-question-actions button {
  min-height: 34px;
}

.tutor-question-actions button[type="submit"] {
  background: var(--accent);
  padding-inline: 14px;
  font-weight: 700;
}

.tutor-question-actions button[type="submit"]:hover {
  background: var(--accent-dark);
}

.tutor-question-status {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.tutor-question-status.is-error {
  color: #b3261e;
}

.lesson-summary-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.92);
}

.inspector .lesson-summary-section h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 780;
  line-height: 1.25;
  text-transform: none;
}

.lesson-summary {
  display: grid;
  gap: 14px;
}

.summary-group {
  display: grid;
  gap: 7px;
}

.summary-group h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 780;
  line-height: 1.25;
}

.summary-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.48;
}

.summary-list li::marker {
  color: var(--accent);
  font-weight: 700;
}

.summary-answer {
  margin: 0;
  border-left: 4px solid var(--accent);
  padding: 8px 0 8px 11px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.summary-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.debug-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.debug-panel[hidden] {
  display: none;
}

.debug-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.2;
  text-transform: uppercase;
}

.debug-panel section {
  margin-top: 14px;
}

.problem-text {
  min-height: 58px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.reasoning-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.reasoning-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface);
}

.reasoning-list strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 13px;
}

.reasoning-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.meta-list {
  margin: 0;
  display: grid;
  gap: 6px;
}

.meta-list div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  min-height: 28px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.meta-list dt {
  color: var(--muted);
  font-size: 12px;
}

.meta-list dd {
  margin: 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.domain-expression-list div {
  grid-template-columns: 92px minmax(0, 1fr);
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .controls {
    justify-content: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .inspector {
    border-top: 1px solid var(--line);
    border-left: 0;
    overflow: visible;
  }

  .tutor-question-section {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    overflow-x: hidden;
  }

  .topbar {
    gap: 10px;
    padding: 10px;
  }

  .brand {
    min-height: 28px;
  }

  .promptbar {
    grid-template-columns: 1fr;
  }

  .prompt-actions,
  .question-image-row,
  .examples,
  .json-error {
    grid-column: 1 / -1;
  }

  .promptbar textarea {
    min-height: 54px;
    max-height: 84px;
    font-size: 12px;
  }

  .json-input-group textarea {
    min-height: 46px;
    max-height: 68px;
  }

  .prompt-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-self: stretch;
  }

  .prompt-actions button {
    width: 100%;
    min-height: 38px;
    padding-inline: 8px;
  }

  .question-image-picker,
  .question-image-picker span {
    width: 100%;
  }

  .question-image-picker span {
    justify-content: center;
  }

  .examples {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .examples button {
    flex: 0 0 auto;
  }

  .controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .controls button {
    min-width: 0;
    padding-inline: 8px;
  }

  .speed-control {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .stage-panel {
    padding: 8px;
    gap: 8px;
  }

  #stage {
    width: 100%;
    border-radius: 8px;
  }

  .stage-loading-overlay {
    inset: 8px 8px 60px;
  }

  .loading-card {
    width: min(330px, calc(100% - 20px));
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 13px 14px;
  }

  .loading-card.has-stream {
    width: min(520px, calc(100% - 20px));
  }

  .stage-loading-overlay:not(.is-error) .loading-card.has-stream {
    width: min(330px, calc(100% - 20px));
  }

  .loading-stream-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "header"
      "timeline"
      "output";
  }

  .loading-spinner {
    width: 26px;
    height: 26px;
    border-width: 3px;
  }

  .timeline {
    min-height: 42px;
    grid-template-columns: 50px minmax(0, 1fr);
    padding-inline: 10px;
  }

  .inspector {
    padding: 10px;
  }

  .inspector section + section {
    margin-top: 14px;
  }

  .tutor-question-form textarea {
    min-height: 78px;
  }

  .tutor-question-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .tutor-question-actions button {
    width: 100%;
  }

  .action-list {
    max-height: 220px;
    overflow: auto;
  }
}

@media (max-width: 430px) {
  .topbar {
    padding: 8px;
  }

  .brand span:last-child {
    font-size: 15px;
  }

  .prompt-actions {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-panel {
    padding-inline: 6px;
  }

  .loading-card strong {
    font-size: 14px;
  }

  .loading-detail {
    font-size: 12px;
  }

  .loading-stream-panel {
    gap: 8px;
    padding: 10px;
  }

  .loading-thinking-timeline {
    min-height: 0;
    max-height: min(96px, 14vh);
    padding: 7px 8px;
    font-size: 10.5px;
    line-height: 1.45;
  }

  .loading-model-output {
    min-height: 64px;
    max-height: min(108px, 16vh);
  }

  .loading-model-output pre {
    padding: 8px 9px;
    font-size: 10.5px;
  }

  .loading-reason-status {
    font-size: 10.5px;
  }

  .loading-reason-text {
    padding: 7px 9px 8px;
  }
}

body.mobile-preview-mode {
  min-height: 100vh;
  overflow: auto;
  background: #20272d;
}

body.mobile-preview-mode .app-shell {
  width: min(390px, 100vw);
  min-height: 844px;
  margin: 16px auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

body.mobile-preview-mode .topbar {
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 8px;
  align-items: stretch;
}

body.mobile-preview-mode .brand {
  min-height: 28px;
}

body.mobile-preview-mode .brand span:last-child {
  font-size: 18px;
}

body.mobile-preview-mode .promptbar {
  grid-template-columns: 1fr;
}

body.mobile-preview-mode .prompt-actions,
body.mobile-preview-mode .question-image-row,
body.mobile-preview-mode .examples,
body.mobile-preview-mode .json-error {
  grid-column: 1 / -1;
}

body.mobile-preview-mode .promptbar textarea {
  min-height: 150px;
  max-height: 220px;
  padding: 12px 13px;
  font-size: 16px;
  line-height: 1.5;
}

body.mobile-preview-mode .prompt-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-self: stretch;
}

body.mobile-preview-mode .prompt-actions button {
  width: 100%;
  min-height: 52px;
  padding-inline: 8px;
  font-size: 16px;
}

body.mobile-preview-mode .question-image-picker,
body.mobile-preview-mode .question-image-picker span {
  width: 100%;
}

body.mobile-preview-mode .question-image-picker span {
  justify-content: center;
  min-height: 44px;
  font-size: 15px;
}

body.mobile-preview-mode.debug-mode .examples {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

body.mobile-preview-mode.debug-mode .examples button {
  flex: 0 0 auto;
}

body.mobile-preview-mode .controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  justify-content: stretch;
}

body.mobile-preview-mode .controls button {
  min-width: 0;
  padding-inline: 8px;
}

body.mobile-preview-mode .speed-control {
  grid-column: 1 / -1;
  min-width: 0;
}

body.mobile-preview-mode .workspace {
  grid-template-columns: 1fr;
}

body.mobile-preview-mode .stage-panel {
  padding: 6px;
  gap: 8px;
}

body.mobile-preview-mode #stage {
  width: 100%;
  border-radius: 8px;
}

body.mobile-preview-mode .stage-loading-overlay {
  inset: 6px 6px 60px;
}

body.mobile-preview-mode .loading-card {
  width: min(330px, calc(100% - 20px));
  grid-template-columns: 28px minmax(0, 1fr);
  padding: 13px 14px;
}

body.mobile-preview-mode .loading-card.has-stream {
  width: min(520px, calc(100% - 20px));
}

body.mobile-preview-mode .stage-loading-overlay:not(.is-error) .loading-card.has-stream {
  width: min(330px, calc(100% - 20px));
}

body.mobile-preview-mode .loading-spinner {
  width: 26px;
  height: 26px;
  border-width: 3px;
}

body.mobile-preview-mode .timeline {
  min-height: 42px;
  grid-template-columns: 50px minmax(0, 1fr);
  padding-inline: 10px;
}

body.mobile-preview-mode .inspector {
  border-top: 1px solid var(--line);
  border-left: 0;
  padding: 10px;
  overflow: visible;
}

body.mobile-preview-mode .inspector section + section {
  margin-top: 14px;
}

body.mobile-preview-mode .tutor-question-section {
  position: static;
}

body.mobile-preview-mode .tutor-question-form textarea {
  min-height: 112px;
  font-size: 16px;
  line-height: 1.5;
}

body.mobile-preview-mode .tutor-image-picker,
body.mobile-preview-mode .tutor-image-picker span {
  width: 100%;
}

body.mobile-preview-mode .tutor-image-picker span {
  justify-content: center;
  min-height: 40px;
  font-size: 15px;
}

body.mobile-preview-mode .tutor-question-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

body.mobile-preview-mode .tutor-question-actions button {
  width: 100%;
}

body.mobile-preview-mode .action-list {
  max-height: 220px;
  overflow: auto;
}

body.mini-program-mode {
  min-height: 100dvh;
  overflow: auto;
  background: var(--bg);
}

body.mini-program-mode .app-shell {
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: var(--bg);
  box-shadow: none;
}

body.mini-program-mode .brand {
  display: none;
}

body.mini-program-mode .topbar {
  padding: 8px;
}

body.mini-program-mode .promptbar textarea {
  min-height: 132px;
  max-height: 210px;
}

body.mini-program-mode .workspace {
  min-height: 0;
}

body.mini-program-mode.question-entry-mode .stage-panel,
body.mini-program-mode.question-entry-mode .inspector {
  display: none;
}

body.mini-program-mode.lesson-rendered-mode .prompt-actions,
body.mini-program-mode.lesson-rendered-mode .question-image-row,
body.mini-program-mode.lesson-rendered-mode .flyai-lesson-status {
  display: none;
}

body.mini-program-mode.lesson-rendered-mode .promptbar textarea {
  min-height: 76px;
  max-height: 92px;
  font-size: 14px;
  line-height: 1.45;
}

/* Runner-inspired workbench layout for the main tutor page. */
body:not(.mobile-preview-mode) {
  overflow: hidden;
  background: var(--bg);
  font: 16px/1.48 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body:not(.mobile-preview-mode) :where(.legacy-runtime, .app-shell) button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  background: var(--appearance-surface, #fff);
  color: var(--ink);
  font: inherit;
}

body:not(.mobile-preview-mode) :where(.legacy-runtime, .app-shell) button:hover {
  background: var(--appearance-soft, #f3f6fb);
}

body:not(.mobile-preview-mode) .app-shell {
  display: grid;
  grid-template-columns: minmax(420px, 520px) minmax(0, 1fr);
  grid-template-rows: 100vh;
  min-height: 100vh;
  background: var(--bg);
}

body:not(.mobile-preview-mode) .topbar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: stretch;
  padding: 0;
  border-right: 1px solid var(--line);
  border-bottom: 0;
  background: var(--surface);
  overflow: auto;
  backdrop-filter: none;
}

body:not(.mobile-preview-mode) .brand {
  min-height: auto;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  font-size: 20px;
  line-height: 1.2;
}

body:not(.mobile-preview-mode) .brand-mark {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 5px;
  background: var(--accent);
  box-shadow: none;
}

body:not(.mobile-preview-mode) .promptbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-content: start;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

body:not(.mobile-preview-mode) .input-group {
  align-content: start;
  grid-auto-rows: max-content;
}

body:not(.mobile-preview-mode).debug-mode .promptbar {
  grid-template-columns: 1fr;
}

body:not(.mobile-preview-mode) .input-group span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

body:not(.mobile-preview-mode) .promptbar textarea,
body:not(.mobile-preview-mode) .tutor-question-form textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(23, 32, 51, 0.02);
}

body:not(.mobile-preview-mode) .promptbar textarea {
  min-height: 148px;
  max-height: 230px;
  padding: 12px 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body:not(.mobile-preview-mode) .json-input-group textarea {
  min-height: 160px;
  max-height: 280px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

body:not(.mobile-preview-mode) .prompt-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-self: start;
}

body:not(.mobile-preview-mode) .question-image-row {
  gap: 8px;
}

body:not(.mobile-preview-mode).debug-mode .prompt-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

body:not(.mobile-preview-mode) .prompt-actions button,
body:not(.mobile-preview-mode) .tutor-question-actions button[type="submit"] {
  min-height: 48px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 650;
}

body:not(.mobile-preview-mode) .prompt-actions button:hover,
body:not(.mobile-preview-mode) .tutor-question-actions button[type="submit"]:hover {
  background: var(--accent-dark);
}

body:not(.mobile-preview-mode) .prompt-actions .secondary-action {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

body:not(.mobile-preview-mode) .prompt-actions .secondary-action:hover {
  background: #f3f6fb;
}

body:not(.mobile-preview-mode) .flyai-lesson-status,
body:not(.mobile-preview-mode) .json-error {
  font-size: 14px;
}

body:not(.mobile-preview-mode) .examples {
  gap: 6px;
  padding-top: 2px;
}

body:not(.mobile-preview-mode) .examples button {
  min-height: 28px;
  border-color: var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

body:not(.mobile-preview-mode) .examples button:hover {
  color: var(--accent);
  background: #eef5ff;
}

body:not(.mobile-preview-mode) .topbar > .controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  justify-content: stretch;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

body:not(.mobile-preview-mode) .topbar > .controls button {
  min-width: 0;
  color: var(--ink);
}

body:not(.mobile-preview-mode) .stage-panel > .controls {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(128px, 0.7fr) repeat(3, minmax(112px, 0.6fr)) minmax(280px, 3fr);
  gap: 12px;
  align-items: stretch;
  justify-content: start;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px 18px;
  background: var(--surface);
}

body:not(.mobile-preview-mode) .stage-panel > .controls button {
  min-width: 0;
  min-height: 58px;
  padding: 10px 16px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 720;
}

body:not(.mobile-preview-mode) .stage-panel > .controls #playPauseButton {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

body:not(.mobile-preview-mode) .stage-panel > .controls #playPauseButton:hover {
  background: var(--accent-dark);
}

body:not(.mobile-preview-mode) .stage-panel > .controls .speed-control {
  grid-column: auto;
  min-width: 260px;
  min-height: 58px;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  padding-inline: 18px;
  font-size: 18px;
  font-weight: 650;
}

body:not(.mobile-preview-mode) .stage-panel > .controls .speed-control input {
  height: 28px;
}

body:not(.mobile-preview-mode) .speed-control {
  grid-column: 1 / -1;
  min-width: 0;
  min-height: 38px;
  border-radius: 6px;
  background: var(--surface-2);
}

body:not(.mobile-preview-mode) .speed-control input,
body:not(.mobile-preview-mode) .timeline input {
  accent-color: var(--accent);
}

body:not(.mobile-preview-mode) .workspace {
  min-height: 0;
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(260px, 34vh);
  overflow: hidden;
}

body:not(.mobile-preview-mode) .stage-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 46px;
  gap: 10px;
  align-content: stretch;
  padding: 14px;
  background: var(--bg);
}

body:not(.mobile-preview-mode) #stage {
  align-self: start;
  justify-self: center;
  width: min(100%, 900px);
  max-height: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

body:not(.mobile-preview-mode) .timeline,
body:not(.mobile-preview-mode) .lesson-summary-section,
body:not(.mobile-preview-mode) .tutor-question-section,
body:not(.mobile-preview-mode) .step-text,
body:not(.mobile-preview-mode) .problem-text,
body:not(.mobile-preview-mode) .reasoning-list li,
body:not(.mobile-preview-mode) .action-list li {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}

body:not(.mobile-preview-mode) .timeline {
  min-height: 44px;
  padding: 0 12px;
}

body:not(.mobile-preview-mode) .inspector {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  align-content: start;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-left: 0;
  background: var(--surface);
  padding: 12px;
  overflow: auto;
}

body:not(.mobile-preview-mode) .inspector section + section {
  margin-top: 0;
}

body:not(.mobile-preview-mode) .inspector h2,
body:not(.mobile-preview-mode) .inspector .tutor-question-section h2,
body:not(.mobile-preview-mode) .inspector .lesson-summary-section h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
}

body:not(.mobile-preview-mode) .tutor-question-section {
  position: static;
  border-color: var(--line);
  padding: 10px;
  background: #fff;
}

body:not(.mobile-preview-mode) .tutor-question-form textarea {
  min-height: 76px;
  max-height: 120px;
  padding: 9px 10px;
  font-size: 14px;
  line-height: 1.4;
}

body:not(.mobile-preview-mode) .tutor-image-picker span,
body:not(.mobile-preview-mode) .tutor-image-preview,
body:not(.mobile-preview-mode) .question-image-picker span,
body:not(.mobile-preview-mode) .question-image-preview {
  border-color: var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
}

body:not(.mobile-preview-mode) .tutor-image-picker span:hover,
body:not(.mobile-preview-mode) .tutor-image-picker:focus-within span,
body:not(.mobile-preview-mode) .question-image-picker span:hover,
body:not(.mobile-preview-mode) .question-image-picker:focus-within span {
  border-color: var(--accent);
  background: #eef5ff;
  color: var(--accent);
}

body:not(.mobile-preview-mode) .tutor-question-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

body:not(.mobile-preview-mode) .tutor-question-actions button {
  width: 100%;
}

body:not(.mobile-preview-mode) .lesson-summary-section {
  padding: 12px;
}

body:not(.mobile-preview-mode) .lesson-summary {
  gap: 10px;
  font-size: 16px;
  line-height: 1.5;
}

body:not(.mobile-preview-mode) .summary-group {
  gap: 8px;
}

body:not(.mobile-preview-mode) .summary-group h3 {
  font-size: 16px;
  line-height: 1.32;
}

body:not(.mobile-preview-mode) .summary-list {
  font-size: 16px;
  line-height: 1.5;
}

body:not(.mobile-preview-mode) .summary-list li::marker {
  color: var(--accent);
}

body:not(.mobile-preview-mode) .summary-answer {
  border-left-color: var(--accent);
  font-size: 17px;
  line-height: 1.45;
}

body:not(.mobile-preview-mode) .debug-panel {
  grid-column: 1 / -1;
  margin-top: 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

body:not(.mobile-preview-mode) .action-list {
  max-height: 220px;
  overflow: auto;
}

body:not(.mobile-preview-mode) .action-list li.is-active {
  border-color: var(--accent);
  background: #eef5ff;
}

body:not(.mobile-preview-mode) .stage-loading-overlay {
  inset: 14px 14px 70px;
  border-radius: 7px;
  background: rgba(245, 247, 251, 0.72);
}

body:not(.mobile-preview-mode) .loading-card {
  border-color: var(--line);
  border-radius: 7px;
}

body:not(.mobile-preview-mode) .loading-spinner {
  border-color: #d8e6fb;
  border-top-color: var(--accent);
}

@media (max-width: 1180px) {
  body:not(.mobile-preview-mode) {
    overflow: auto;
  }

  body:not(.mobile-preview-mode) .app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  body:not(.mobile-preview-mode) .topbar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  body:not(.mobile-preview-mode) .brand {
    padding: 12px 14px;
  }

  body:not(.mobile-preview-mode) .promptbar {
    padding: 12px 14px;
  }

  body:not(.mobile-preview-mode) .workspace {
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto;
    overflow: visible;
  }

  body:not(.mobile-preview-mode) .stage-panel {
    min-height: 0;
  }

  body:not(.mobile-preview-mode) #stage {
    max-height: none;
  }

  body:not(.mobile-preview-mode) .inspector {
    grid-template-columns: 1fr;
    overflow: visible;
  }
}

@media (max-width: 720px) {
  body:not(.mobile-preview-mode) .topbar > .controls,
  body:not(.mobile-preview-mode) .tutor-question-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:not(.mobile-preview-mode) .stage-panel > .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
  }

  body:not(.mobile-preview-mode) .stage-panel > .controls button {
    min-height: 44px;
    padding-inline: 8px;
    font-size: 15px;
  }

  body:not(.mobile-preview-mode) .stage-panel > .controls .speed-control {
    grid-column: 1 / -1;
    min-width: 0;
    min-height: 44px;
    font-size: 15px;
  }

  body:not(.mobile-preview-mode) .prompt-actions,
  body:not(.mobile-preview-mode).debug-mode .prompt-actions {
    grid-template-columns: 1fr;
  }

  body:not(.mobile-preview-mode) .promptbar textarea {
    min-height: 150px;
    font-size: 16px;
    line-height: 1.5;
  }

  body:not(.mobile-preview-mode) .prompt-actions button {
    min-height: 52px;
    font-size: 16px;
  }

  body:not(.mobile-preview-mode) .question-image-picker span {
    min-height: 44px;
    font-size: 15px;
  }

  body:not(.mobile-preview-mode) .stage-panel {
    padding: 8px;
  }

  body:not(.mobile-preview-mode) .stage-loading-overlay {
    inset: 8px 8px 60px;
  }
}

/* One-screen desktop layout: prompt, stage, and tutor panels fit in one viewport. */
@media (min-width: 1181px) {
  body:not(.mobile-preview-mode) {
    height: 100dvh;
    overflow: hidden;
  }

  body:not(.mobile-preview-mode) .app-shell {
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-columns: clamp(380px, 20vw, 440px) minmax(620px, 1fr) clamp(460px, 24vw, 540px);
    grid-template-rows: minmax(0, 1fr);
  }

  body:not(.mobile-preview-mode) .topbar {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    overflow: hidden;
  }

  body:not(.mobile-preview-mode) .workspace {
    display: contents;
  }

  body:not(.mobile-preview-mode) .brand {
    min-height: 52px;
    padding: 14px 16px;
    font-size: 20px;
  }

  body:not(.mobile-preview-mode) .brand-mark {
    width: 18px;
    height: 18px;
    border-radius: 5px;
  }

  body:not(.mobile-preview-mode) .promptbar {
    flex: 0 0 auto;
    min-height: 0;
    padding: 14px 16px;
    gap: 10px;
    align-content: start;
    grid-auto-rows: max-content;
  }

  body:not(.mobile-preview-mode).debug-mode .promptbar {
    overflow: hidden;
  }

  body:not(.mobile-preview-mode) .promptbar textarea {
    height: clamp(148px, 20vh, 190px);
    min-height: 148px;
    max-height: 190px;
    resize: none;
  }

  body:not(.mobile-preview-mode) .json-input-group textarea {
    height: clamp(110px, 22vh, 170px);
    min-height: 110px;
    max-height: 170px;
  }

  body:not(.mobile-preview-mode) .prompt-actions {
    gap: 6px;
    align-self: start;
  }

  body:not(.mobile-preview-mode) .prompt-actions button {
    min-height: 50px;
    height: 52px;
  }

  body:not(.mobile-preview-mode) .question-image-picker span,
  body:not(.mobile-preview-mode) .question-image-preview {
    min-height: 42px;
    padding: 8px 11px;
    font-size: 15px;
  }

  body:not(.mobile-preview-mode) .flyai-lesson-status,
  body:not(.mobile-preview-mode) .json-error {
    min-height: 16px;
    line-height: 1.25;
  }

  body:not(.mobile-preview-mode) .topbar > .controls {
    margin-top: 10px;
    padding: 10px 12px 12px;
    gap: 6px;
    border-top: 1px solid var(--line);
  }

  body:not(.mobile-preview-mode) .topbar > .controls button {
    min-height: 32px;
    padding-inline: 8px;
  }

  body:not(.mobile-preview-mode) .speed-control {
    min-height: 34px;
  }

  body:not(.mobile-preview-mode) .stage-panel {
    grid-column: 2;
    grid-row: 1;
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) 40px;
    gap: 12px;
    padding: 12px;
  }

  body:not(.mobile-preview-mode) #stage {
    width: min(100%, 900px, calc((100dvh - 174px) * 16 / 11));
    max-width: 100%;
    max-height: calc(100dvh - 174px);
  }

  body:not(.mobile-preview-mode) .timeline {
    min-height: 40px;
    padding-inline: 10px;
  }

  body:not(.mobile-preview-mode) .inspector {
    grid-column: 3;
    grid-row: 1;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    gap: 12px;
    overflow: hidden;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 14px;
  }

  body:not(.mobile-preview-mode) .tutor-question-section,
  body:not(.mobile-preview-mode) .lesson-summary-section {
    min-width: 0;
    padding: 14px;
  }

  body:not(.mobile-preview-mode) .inspector h2,
  body:not(.mobile-preview-mode) .inspector .tutor-question-section h2,
  body:not(.mobile-preview-mode) .inspector .lesson-summary-section h2 {
    margin-bottom: 10px;
    font-size: 18px;
  }

  body:not(.mobile-preview-mode) .tutor-question-form {
    gap: 6px;
  }

  body:not(.mobile-preview-mode) .tutor-question-form textarea {
    height: 78px;
    min-height: 78px;
    max-height: 78px;
    resize: none;
  }

  body:not(.mobile-preview-mode) .tutor-image-row {
    gap: 5px;
  }

  body:not(.mobile-preview-mode) .tutor-image-picker span,
  body:not(.mobile-preview-mode) .tutor-image-preview {
    min-height: 36px;
    padding: 7px 10px;
  }

  body:not(.mobile-preview-mode) .tutor-question-actions {
    gap: 6px;
  }

  body:not(.mobile-preview-mode) .tutor-question-actions button {
    min-height: 42px;
    padding-inline: 10px;
  }

  body:not(.mobile-preview-mode) .tutor-question-status {
    min-height: 14px;
    line-height: 1.2;
  }

  body:not(.mobile-preview-mode) .lesson-summary-section {
    min-height: 0;
    overflow: auto;
    scrollbar-width: thin;
  }

  body:not(.mobile-preview-mode) .lesson-summary {
    min-height: 0;
    gap: 10px;
    overflow: visible;
  }

  body:not(.mobile-preview-mode) .summary-group {
    gap: 8px;
  }

  body:not(.mobile-preview-mode) .summary-group h3 {
    font-size: 16px;
    line-height: 1.32;
  }

  body:not(.mobile-preview-mode) .summary-list {
    gap: 5px;
    padding-left: 20px;
    font-size: 16px;
    line-height: 1.5;
  }

  body:not(.mobile-preview-mode) .summary-answer {
    padding: 8px 0 8px 12px;
    font-size: 17px;
    line-height: 1.45;
  }

  body:not(.mobile-preview-mode) .debug-panel {
    grid-column: 1;
  }

  body:not(.mobile-preview-mode) .stage-loading-overlay {
    inset: 12px 12px 60px;
  }
}

/* Narrow desktop preview: keep the same one-screen contract inside Codex side-by-side panes. */
@media (min-width: 750px) and (max-width: 1180px) {
  body:not(.mobile-preview-mode) {
    height: 100dvh;
    overflow: hidden;
  }

  body:not(.mobile-preview-mode) .app-shell {
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-columns: clamp(210px, 26vw, 290px) minmax(0, 1fr) clamp(250px, 30vw, 350px);
    grid-template-rows: minmax(0, 1fr);
    flex-direction: initial;
  }

  body:not(.mobile-preview-mode) .topbar {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    overflow: hidden;
  }

  body:not(.mobile-preview-mode) .workspace {
    display: contents;
  }

  body:not(.mobile-preview-mode) .brand {
    min-height: 46px;
    padding: 10px;
    font-size: 17px;
  }

  body:not(.mobile-preview-mode) .brand-mark {
    width: 15px;
    height: 15px;
    border-radius: 4px;
  }

  body:not(.mobile-preview-mode) .promptbar {
    flex: 0 0 auto;
    min-height: 0;
    padding: 9px 10px;
    gap: 7px;
    align-content: start;
    grid-auto-rows: max-content;
  }

  body:not(.mobile-preview-mode) .promptbar textarea {
    height: 140px;
    min-height: 140px;
    max-height: 140px;
    resize: none;
    font-size: 14px;
    line-height: 1.45;
  }

  body:not(.mobile-preview-mode) .prompt-actions {
    align-self: start;
  }

  body:not(.mobile-preview-mode) .prompt-actions button {
    min-height: 44px;
    height: 46px;
    padding-inline: 8px;
    font-size: 14px;
    white-space: normal;
  }

  body:not(.mobile-preview-mode) .question-image-picker span,
  body:not(.mobile-preview-mode) .question-image-preview {
    min-height: 36px;
    padding: 6px 9px;
    font-size: 13px;
  }

  body:not(.mobile-preview-mode) .flyai-lesson-status,
  body:not(.mobile-preview-mode) .json-error {
    min-height: 14px;
    line-height: 1.2;
  }

  body:not(.mobile-preview-mode) .topbar > .controls {
    margin-top: 8px;
    padding: 8px 10px 10px;
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
  }

  body:not(.mobile-preview-mode) .topbar > .controls button {
    min-height: 31px;
    padding-inline: 6px;
  }

  body:not(.mobile-preview-mode) .speed-control {
    min-height: 32px;
    grid-column: 1 / -1;
  }

  body:not(.mobile-preview-mode) .stage-panel > .controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
  }

  body:not(.mobile-preview-mode) .stage-panel > .controls button {
    min-height: 44px;
    padding-inline: 8px;
    font-size: 15px;
  }

  body:not(.mobile-preview-mode) .stage-panel > .controls .speed-control {
    grid-column: 1 / -1;
    min-width: 0;
    min-height: 44px;
    font-size: 15px;
  }

  body:not(.mobile-preview-mode) .stage-panel {
    grid-column: 2;
    grid-row: 1;
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) 38px;
    gap: 8px;
    padding: 8px;
  }

  body:not(.mobile-preview-mode) #stage {
    width: min(100%, 820px, calc((100dvh - 154px) * 16 / 11));
    max-height: calc(100dvh - 154px);
  }

  body:not(.mobile-preview-mode) .timeline {
    min-height: 38px;
    padding-inline: 8px;
  }

  body:not(.mobile-preview-mode) .inspector {
    grid-column: 3;
    grid-row: 1;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    align-content: stretch;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 8px;
    overflow: hidden;
  }

  body:not(.mobile-preview-mode) .tutor-question-section,
  body:not(.mobile-preview-mode) .lesson-summary-section {
    padding: 10px;
  }

  body:not(.mobile-preview-mode) .inspector h2,
  body:not(.mobile-preview-mode) .inspector .tutor-question-section h2,
  body:not(.mobile-preview-mode) .inspector .lesson-summary-section h2 {
    margin-bottom: 8px;
    font-size: 15px;
  }

  body:not(.mobile-preview-mode) .tutor-question-form {
    gap: 5px;
  }

  body:not(.mobile-preview-mode) .tutor-question-form textarea {
    height: 68px;
    min-height: 68px;
    max-height: 68px;
    resize: none;
    font-size: 14px;
    line-height: 1.45;
  }

  body:not(.mobile-preview-mode) .tutor-image-row {
    gap: 5px;
  }

  body:not(.mobile-preview-mode) .tutor-image-picker span,
  body:not(.mobile-preview-mode) .tutor-image-preview {
    min-height: 32px;
    padding: 5px 8px;
  }

  body:not(.mobile-preview-mode) .tutor-question-actions {
    gap: 5px;
    grid-template-columns: 1fr;
  }

  body:not(.mobile-preview-mode) .tutor-question-actions button {
    min-height: 36px;
    padding-inline: 7px;
    font-size: 14px;
  }

  body:not(.mobile-preview-mode) .tutor-question-status {
    min-height: 13px;
    line-height: 1.18;
  }

  body:not(.mobile-preview-mode) .lesson-summary-section {
    min-height: 0;
    overflow: auto;
    scrollbar-width: thin;
  }

  body:not(.mobile-preview-mode) .lesson-summary {
    min-height: 0;
    gap: 8px;
    overflow: visible;
  }

  body:not(.mobile-preview-mode) .summary-group {
    gap: 3px;
  }

  body:not(.mobile-preview-mode) .summary-group h3 {
    font-size: 14px;
    line-height: 1.25;
  }

  body:not(.mobile-preview-mode) .summary-list {
    gap: 4px;
    padding-left: 18px;
    font-size: 14px;
    line-height: 1.42;
  }

  body:not(.mobile-preview-mode) .summary-answer {
    padding: 6px 0 6px 10px;
    font-size: 15px;
    line-height: 1.36;
  }

  body:not(.mobile-preview-mode) .stage-loading-overlay {
    inset: 8px 8px 54px;
  }
}

/* 语音讲解切换圆形按钮 */
.step-actions #boardNarrationToggle,
#boardNarrationToggle {
  display: inline-grid !important;
  place-items: center !important;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 1px solid color-mix(in srgb, var(--brand, #176ee0) 24%, transparent) !important;
  border-radius: 50% !important;
  background: var(--brand-soft, color-mix(in srgb, var(--brand, #176ee0) 12%, #fff)) !important;
  color: var(--brand, #176ee0) !important;
  box-shadow: none !important;
  cursor: pointer;
  line-height: 1;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
  vertical-align: middle;
}

.step-actions #boardNarrationToggle:hover,
#boardNarrationToggle:hover {
  background: color-mix(in srgb, var(--brand, #176ee0) 22%, #fff) !important;
  border-color: color-mix(in srgb, var(--brand, #176ee0) 45%, transparent) !important;
  color: var(--brand-strong, #0d5fc7) !important;
}

.step-actions #boardNarrationToggle:active,
#boardNarrationToggle:active {
  background: color-mix(in srgb, var(--brand, #176ee0) 32%, #fff) !important;
  transform: scale(.95);
}

.step-actions #boardNarrationToggle:focus-visible,
#boardNarrationToggle:focus-visible {
  outline: 2px solid var(--brand, #176ee0) !important;
  outline-offset: 2px;
}

#boardNarrationToggle svg {
  display: block;
  width: 17px;
  height: 17px;
  pointer-events: none;
}

/* 讲解音色下拉组件 */
.step-actions .board-narration-voice-dropdown,
.board-narration-voice-dropdown {
  position: relative;
  display: inline-block;
  margin: 0 0 0 2px;
  vertical-align: middle;
}

.step-actions .board-narration-voice-trigger,
.board-narration-voice-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  height: 32px;
  min-height: 32px;
  padding: 0 10px 0 12px;
  border: 1.5px solid #368a87;
  border-radius: 10px;
  background: #fff;
  color: #105958;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  user-select: none;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s ease, background-color .15s ease;
}

.board-narration-voice-trigger::-webkit-details-marker,
.board-narration-voice-trigger::marker {
  display: none;
}

.step-actions .board-narration-voice-trigger:hover,
.board-narration-voice-trigger:hover {
  border-color: #267774;
  background: #f7fbfa;
}

.step-actions .board-narration-voice-trigger:focus-visible,
.board-narration-voice-trigger:focus-visible {
  outline: 2px solid #368a87;
  outline-offset: 2px;
}

.board-narration-voice-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: #105958;
  transition: transform .2s ease;
}

.board-narration-voice-arrow svg {
  display: block;
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.board-narration-voice-dropdown[open] .board-narration-voice-arrow {
  transform: rotate(180deg);
}

.board-narration-voice-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  padding: 6px 4px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
  box-sizing: border-box;
}

.board-narration-voice-dropdown:not([open]) .board-narration-voice-options {
  display: none;
}

.board-narration-voice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 90px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1e293b;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  outline: none;
  transition: background-color .15s ease, color .15s ease;
}

.board-narration-voice-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.board-narration-voice-item:focus-visible {
  outline: 2px solid #368a87;
  outline-offset: -2px;
}

.board-narration-voice-item.is-active {
  background-color: #e3f4f1;
  color: #105958;
  font-weight: 600;
}

.board-narration-voice-item.is-active:hover {
  background-color: #d8ece7;
}

.board-narration-voice-item-check {
  display: none;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 10px;
  color: #0c8755;
  flex-shrink: 0;
}

.board-narration-voice-item-check svg {
  display: block;
  width: 15px;
  height: 15px;
  stroke: #0c8755;
}

.board-narration-voice-item.is-active .board-narration-voice-item-check {
  display: inline-flex;
}

.board-narration-voice-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.step-actions #boardNarrationVoice:not(.board-narration-voice-hidden),
#boardNarrationVoice:not(.board-narration-voice-hidden) {
  display: inline-block;
  height: 32px;
  max-width: 96px;
  margin: 0 0 0 2px;
  padding: 0 8px;
  border: 1.5px solid #368a87;
  border-radius: 10px;
  color: #105958;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  vertical-align: middle;
  transition: border-color .15s ease;
}

/* 浏览器音频确认对话框 */
.narration-confirm-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  border: none;
  background: transparent;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  overflow: visible;
  z-index: 1000;
}

.narration-confirm-dialog:not([open]) {
  display: none !important;
}

.narration-confirm-dialog[open] {
  display: grid !important;
  place-items: center;
}

.narration-confirm-dialog::backdrop {
  background: rgba(12, 29, 54, 0.65);
  backdrop-filter: blur(5px);
}

.narration-confirm-card {
  position: relative;
  width: min(90vw, 400px);
  padding: 30px 24px 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.06);
  text-align: center;
  box-sizing: border-box;
}

.narration-confirm-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 50%;
  background: var(--paper, #fff);
  box-shadow: none;
  color: var(--muted, #64748b);
  line-height: 1;
  cursor: pointer;
  transition: all 150ms ease;
}

.narration-confirm-close svg {
  display: block;
  width: 24px;
  height: 24px;
}

.narration-confirm-close:hover {
  border-color: var(--brand-muted, #80afea);
  background: var(--brand-soft, #e4efff);
  color: var(--brand-strong, #0d5fc7);
}

.narration-confirm-close:focus-visible {
  outline: 2px solid var(--brand, #176ee0);
  outline-offset: 2px;
}

.dialog-close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  max-width: 36px;
  max-height: 36px;
  flex: 0 0 36px;
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line, #e2e8f0);
  background: var(--paper, #ffffff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  color: var(--muted, #64748b);
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
  flex-shrink: 0;
  transition: all 150ms ease;
}

.dialog-close-button:hover {
  border-color: var(--brand-muted, #80afea);
  background: var(--brand-soft, #e4efff);
  color: var(--brand-strong, #0d5fc7);
  box-shadow: 0 2px 6px rgba(13, 95, 199, 0.12);
}

.dialog-close-button:active {
  transform: scale(0.95);
}

.dialog-close-button:focus-visible {
  outline: 2px solid var(--brand, #176ee0);
  outline-offset: 2px;
}

.dialog-close-button-icon {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.narration-confirm-icon-wrap {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--brand-soft, color-mix(in srgb, var(--brand, #176ee0) 12%, #fff));
  color: var(--brand, #176ee0);
}

.narration-confirm-icon-wrap svg {
  width: 28px;
  height: 28px;
}

.narration-confirm-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink, #0f172a);
}

.narration-confirm-card p {
  margin: 0 0 24px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #64748b;
}

.narration-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.narration-confirm-btn-secondary {
  flex: 1;
  height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.narration-confirm-btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.narration-confirm-btn-primary {
  flex: 1;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--brand, #176ee0);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand, #176ee0) 35%, transparent);
  transition: background-color .15s ease, transform .1s ease;
}

.narration-confirm-btn-primary:hover {
  background: var(--brand-strong, #0d5fc7);
}

.narration-confirm-btn-primary:active {
  transform: scale(0.98);
}
/* Out-of-flow feedback: a failed voice toggle must not look like a dead button. */
.board-narration-notice {
  position: fixed;
  z-index: 10020;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: max-content;
  max-width: min(440px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  background: var(--paper, #fff);
  color: var(--ink, #23334b);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.board-narration-notice[hidden] { display: none; }
.board-narration-notice-icon {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: var(--brand-soft, #edf5ff);
  color: var(--brand, #176ee0);
}
.board-narration-notice-icon svg { display: block; width: 16px; height: 16px; }
.board-narration-notice [role="status"] { flex: 1 1 auto; min-width: 0; }
@media (max-width: 440px) {
  .board-narration-notice { gap: 10px; padding: 12px; }
}

/* Already-projected detail views; leave the main lesson viewport unchanged. */
.projection-gallery-toggle {
  position: absolute; bottom: 16px; right: 16px; z-index: 8;
  border: 1px solid #dbe2eb; border-radius: 9px; padding: 9px 13px;
  color: #52647a; background: #fff; font: 400 13px/1.4 system-ui, sans-serif; cursor: pointer;
}
.projection-gallery-toggle[hidden] { display: none; }
.projection-gallery-dialog {
  box-sizing: border-box; width: min(1220px, 96vw); max-width: 96vw; max-height: 92dvh;
  padding: 0 24px 24px; border: 1px solid #e4e9ef; border-radius: 16px; background: #fff; color: #243649;
  font-family: system-ui, sans-serif;
}
.answer-review-status { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; color: var(--canvas-label, #52647a); font-size: 12px; line-height: 1.6; font-weight: 400; }
.answer-review-status[hidden], .answer-review-status button[hidden] { display: none; }
.answer-review-status > span { flex: 1 1 180px; }
.teaching-board-panel .answer-review-status button { min-height: 32px; padding: 3px 12px; border: 1px solid var(--canvas-grid, #d8e1ed); border-radius: 9999px; background: var(--canvas-background, #fff); color: inherit; font: inherit; white-space: nowrap; cursor: pointer; }
.answer-review-status button:focus-visible { outline: 2px solid #708297; outline-offset: 2px; }
.answer-review-status button:disabled { opacity: .6; cursor: wait; }
.projection-gallery-dialog::backdrop { background: #23354c55; }
.projection-gallery-header { position: sticky; top: 0; z-index: 1; display: flex; gap: 14px; align-items: center; padding: 20px 0; background: #fff; }
.projection-gallery-header strong { font-size: 17px; font-weight: 500; }
.projection-gallery-header span { flex: 1; color: #718096; font-size: 13px; }
.projection-gallery-header button { border: 1px solid #e4e9ef; border-radius: 8px; padding: 7px 10px; background: #fff; color: #52647a; cursor: pointer; }
.projection-gallery-header button[hidden] { display: none; }
.projection-gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 22px 14px; }
.projection-gallery-grid figure { margin: 0; }
.projection-gallery-grid canvas { display: block; width: 100%; height: auto; }
.projection-gallery-grid figcaption { padding: 4px 12px 10px; line-height: 1.6; }
.projection-gallery-grid figcaption strong { display: block; color: #33485e; font-size: 14px; font-weight: 500; }
.projection-gallery-grid figcaption span { display: block; color: #718096; font-size: 12px; }
.projection-gallery-dialog button:focus-visible, .projection-gallery-toggle:focus-visible { outline: 2px solid #708297; outline-offset: 3px; }
@media (max-width: 850px) { .projection-gallery-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 480px) {
  .projection-gallery-dialog { padding: 0 14px 18px; }
  .projection-gallery-grid { grid-template-columns: 1fr; }
  .projection-gallery-header { flex-wrap: wrap; gap: 8px; }
}

/* Keep complete provider/voice names readable inside the playback toolbar. */
.stage-panel .step-actions .board-narration-voice-dropdown {
  flex: 0 0 auto;
  height: 32px;
}
.stage-panel .step-actions .board-narration-voice-trigger {
  width: max-content;
  min-width: max-content;
  white-space: nowrap;
  border: 1px solid var(--line, #dce5f2);
  border-radius: 9999px;
  color: var(--appearance-ink, #263656);
  box-shadow: 0 1px 2px #0f172a0a;
}
.stage-panel .step-actions .board-narration-voice-current { white-space: nowrap; }
.stage-panel .step-actions .board-narration-voice-options {
  left: auto;
  right: 0;
  width: max-content;
  min-width: 216px;
  max-width: calc(100vw - 32px);
}
.stage-panel .step-actions .board-narration-voice-options .board-narration-voice-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 36px !important;
  padding: 0 12px !important;
  border-radius: 9999px !important;
  white-space: nowrap;
}
@media (max-width: 760px) {
  .stage-panel .step-actions .board-narration-voice-trigger {
    width: 48px;
    min-width: 48px;
    padding: 0;
    justify-content: center;
  }
  .stage-panel .step-actions .board-narration-voice-trigger::before { content: "音色"; }
  .stage-panel .step-actions :is(.board-narration-voice-current, .board-narration-voice-arrow) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}
