/* Compatibility-only rules. These preserve the legacy Canvas runtime while
   giving its DOM loading state a stable width in the Next.js shell. */
/* Student loading: presentation only. Keep streaming nodes for the host/SDK. */
.legacy-runtime .canvas-shell:has(> #stageLoadingOverlay.is-automatic-question-progress:not([hidden])) #autoFollowupSequence {
  position: relative;
  z-index: 101;
  pointer-events: auto;
  background: var(--surface, #fff);
}

/* The lesson scrubber is rendered inside the left canvas column. */
.legacy-runtime.lesson-page .stage-panel:has(#stageLoadingOverlay[data-initial-loading="true"]:not([hidden])) .lesson-stage-toolbar:has(#returnToLessonButton:not([hidden])) {
  position: relative;
  z-index: 101;
  pointer-events: auto;
}

body:not(.mobile-preview-mode) .legacy-runtime.lesson-page .canvas-stage-panel > .timeline {
  display: flex !important;
}

.legacy-runtime #stageLoadingOverlay[data-initial-loading="true"] {
  position: fixed !important;
  inset: 64px 0 0 !important;
  z-index: 100;
  border-radius: 0;
  background: var(--bg, #faf9fd);
  backdrop-filter: none;
  pointer-events: auto;
}
.legacy-runtime .stage-loading-overlay.student-loading {
  background: color-mix(in srgb, var(--bg, #f7f8fb) 96%, transparent);
  pointer-events: none;
  overflow-y: auto;
  padding: 24px 12px;
}
.legacy-runtime #stageLoadingOverlay.student-loading .loading-card,
.legacy-runtime #stageLoadingOverlay.student-loading .loading-card.has-stream {
  --loading-mascot-size: clamp(240px, 33vh, 300px);
  --loading-console-width: 248px;
  --loading-console-height: 52px;
  --loading-controller-width: 30px;
  --loading-console-radius: 16px;
  --loading-companion-gap: 24px;
  --loading-connector-width: 64px;
  --loading-connector-rise: 100px;
  width: min(580px, 100%);
  min-width: 0;
  max-height: none;
  border: 0;
  padding: 24px 16px;
  gap: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
  pointer-events: auto;
}
.legacy-runtime .student-loading #stageStreamingPanel,
.legacy-runtime .student-loading:not(.is-error) #stageLoadingDetail {
  display: none !important;
}
.legacy-runtime .student-loading #stageLoadingTitle {
  display: block;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.6;
}
.legacy-runtime .student-loading:not(.is-error):not(.flywait-user-hold):has(#stageThinkingHint:not([hidden])) #stageLoadingTitle {
  display: none;
}
.legacy-runtime .student-loading #flywait-entry {
  width: auto !important;
  max-width: 100%;
  margin-top: 0 !important;
}
.loading-companion {
  position: relative;
  z-index: 1;
  width: 100%;
  height: calc(var(--loading-mascot-size) + var(--loading-console-height));
  margin-bottom: var(--loading-companion-gap);
}
.loading-break {
  position: absolute;
  top: 0;
  right: 12px;
  width: max-content;
  max-width: 100%;
  border-radius: var(--loading-console-radius);
  background: var(--bg, #faf9fd);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ink, #172033) 3%, transparent);
}
.student-loading.is-error .loading-companion,
.student-loading.flywait-user-hold .loading-companion {
  order: 2;
  height: auto;
  margin: 20px 0 0;
}
.student-loading.is-error .loading-break,
.student-loading.flywait-user-hold .loading-break {
  position: static;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.legacy-runtime .student-loading .loading-duration-hint {
  position: relative;
  grid-column: 1 / -1;
  width: max-content;
  max-width: calc(100% - 64px);
  margin: 14px auto 0;
  color: var(--appearance-muted, var(--ui-muted, var(--muted, #64748b)));
  font-size: 13px;
  font-weight: 400;
  line-height: 22px;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}
.legacy-runtime .student-loading .loading-duration-hint::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: calc(100% + 10px);
  bottom: 50%;
  width: var(--loading-connector-width);
  height: calc(var(--loading-mascot-size) + var(--loading-connector-rise));
  border: 1px dashed color-mix(in srgb, var(--appearance-muted, var(--muted, #64748b)) 50%, transparent);
  border-left: 0;
  border-radius: 0 14px 14px 0;
  pointer-events: none;
}
/* The SVG wire follows the measured launcher instead of a fixed CSS border. */
.legacy-runtime .student-loading.has-draggable-console .loading-duration-hint::after {
  content: none;
}
.loading-console-wire {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke: color-mix(in srgb, var(--appearance-muted, var(--muted, #64748b)) 50%, transparent);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.legacy-runtime .student-loading.is-error .loading-duration-hint,
.legacy-runtime .student-loading:not([data-host-loading="true"]) .loading-duration-hint {
  display: none;
}
.legacy-runtime .student-loading #stageThinkingHint {
  display: block;
  grid-column: 1 / -1;
  width: min(360px, 100%);
  min-width: 0;
  height: 24px;
  margin: 0 auto;
  color: color-mix(in srgb, var(--brand, #1774dc) 36%, var(--appearance-muted, var(--ui-muted, var(--muted, #64748b))));
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.legacy-runtime .student-loading #stageThinkingHint::before {
  --thinking-dot-dim: color-mix(in srgb, currentColor 25%, transparent);
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 17px;
  vertical-align: 2px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 5px 0 0 var(--thinking-dot-dim), 10px 0 0 var(--thinking-dot-dim);
  animation: thinking-hint-flow 1.8s ease-in-out infinite;
}
.legacy-runtime .student-loading #stageThinkingHint[data-thinking-state="offline"] {
  color: var(--appearance-muted, var(--ui-muted, var(--muted, #64748b)));
}
.legacy-runtime .student-loading #stageThinkingHint[data-thinking-state="offline"]::before {
  animation: none;
  background: currentColor;
  box-shadow: 5px 0 0 currentColor, 10px 0 0 currentColor;
  opacity: .35;
}
@keyframes thinking-hint-flow {
  0%, 100% {
    opacity: .5;
    background: currentColor;
    box-shadow: 5px 0 0 var(--thinking-dot-dim), 10px 0 0 var(--thinking-dot-dim);
  }
  33% {
    opacity: .9;
    background: var(--thinking-dot-dim);
    box-shadow: 5px 0 0 currentColor, 10px 0 0 var(--thinking-dot-dim);
  }
  66% {
    opacity: .7;
    background: var(--thinking-dot-dim);
    box-shadow: 5px 0 0 var(--thinking-dot-dim), 10px 0 0 currentColor;
  }
}
.legacy-runtime .student-loading #stageThinkingHint[hidden],
.legacy-runtime .student-loading.is-error #stageThinkingHint,
.legacy-runtime .student-loading.flywait-user-hold #stageThinkingHint { display: none; }
.loading-mascot { position: absolute; bottom: 0; left: 50%; width: var(--loading-mascot-size); aspect-ratio: 1; transform: translateX(-50%); }
.loading-writing-sprite { position: absolute; inset: 5%; background-size: 200% 200%; background-repeat: no-repeat; background-position: 0 0; animation: student-write .56s steps(1, end) infinite; }
.loading-mascot-halo { position: absolute; inset: 14% 5% 4%; border-radius: 50%; background: color-mix(in srgb, var(--brand) 7%, transparent); }
.loading-spark { position: absolute; color: var(--brand); font: 500 22px/1 sans-serif; animation: student-spark 3s ease-in-out infinite; }
.loading-spark-one { left: 5%; top: 28%; }
.loading-spark-two { right: 1%; top: 16%; animation-delay: -.8s; }
.loading-spark-three { right: 0; top: 56%; animation-delay: -1.6s; }
.student-loading.is-error .loading-mascot,
.student-loading.flywait-user-hold .loading-mascot { display: none; }
.legacy-runtime .student-loading.is-error #stageLoadingDetail { display: block; margin-top: 8px; color: var(--danger, #b42318); }
@media (max-width: 600px), (max-height: 650px) {
  .legacy-runtime #stageLoadingOverlay.student-loading .loading-card,
  .legacy-runtime #stageLoadingOverlay.student-loading .loading-card.has-stream {
    --loading-mascot-size: clamp(176px, 29vh, 236px);
    --loading-console-width: 220px;
    --loading-console-height: 48px;
    --loading-controller-width: 28px;
    --loading-console-radius: 15px;
    --loading-companion-gap: 18px;
    --loading-connector-width: 20px;
    --loading-connector-rise: 90px;
    width: min(480px, 100%);
  }
  .legacy-runtime .student-loading .loading-duration-hint {
    margin-top: 12px;
    font-size: 12px;
    line-height: 20px;
  }
}
@keyframes student-write {
  0%, 100% { background-position: 0 0; }
  25% { background-position: 100% 0; }
  50% { background-position: 0 100%; }
  75% { background-position: 100% 100%; }
}
@keyframes student-spark { 0%, 100% { opacity: .35; transform: translateY(3px); } 50% { opacity: .85; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .loading-writing-sprite, .loading-spark { animation: none; }
  .legacy-runtime .student-loading #stageThinkingHint::before { animation: none; }
}
/* Entry mode hides lesson-only actions. Keep the signed-in learner's route to
   saved practice visible without restoring the redundant new-question button. */
body.question-entry-mode .legacy-runtime .practice-navigation-button {
  display: inline-flex !important;
}

.legacy-runtime .stage-loading-overlay .loading-card {
  display: flex;
  width: min(520px, calc(100% - 48px));
  min-width: min(360px, calc(100% - 48px));
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.legacy-runtime .stage-loading-overlay .loading-card.has-stream {
  width: min(720px, calc(100% - 48px));
}

.legacy-runtime .stage-loading-overlay .loading-card > strong,
.legacy-runtime .stage-loading-overlay .loading-card > span:not(.loading-spinner) {
  width: 100%;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
}

.legacy-runtime .stage-loading-overlay .loading-card > strong {
  font-size: 16px;
  line-height: 1.45;
}

.legacy-runtime .stage-loading-overlay .loading-card > span:not(.loading-spinner) {
  color: #60718b;
  font-size: 13px;
  line-height: 1.65;
}

.legacy-runtime .stage-loading-overlay .loading-stream-panel {
  width: 100%;
  align-self: stretch;
  text-align: left;
}

/* Long reasoning steps must remain readable in the host shell. The step card
   grows with projected text instead of silently cutting it at two lines. */
@media (min-width: 761px), (min-width: 750px) and (max-width: 760px) and (orientation: landscape) {
  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel .lesson-context {
    max-height: none;
    overflow: visible;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel .lesson-context strong,
  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel .lesson-context p {
    display: block;
    max-height: none;
    overflow: visible;
    overflow-wrap: anywhere;
    white-space: normal;
    -webkit-line-clamp: unset;
  }
}

@media (max-width: 560px) {
  .legacy-runtime .stage-loading-overlay .loading-card {
    min-width: 0;
    width: calc(100% - 32px);
  }

  .legacy-runtime .stage-loading-overlay .loading-card.has-stream {
    width: calc(100% - 20px);
  }

}

/* Mobile learning flow: keep the animation first, then surface the lesson and Q&A
   as readable, independently scrolled cards. These selectors intentionally leave
   the legacy renderer's IDs and canvas sizing contract untouched. */
@media (max-width: 749px), (min-width: 750px) and (max-width: 760px) and (orientation: portrait) {
  body:not(.mobile-preview-mode) .legacy-runtime .app-shell {
    padding: 8px 8px 16px;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .topbar {
    height: 54px;
    min-height: 54px;
    margin: -8px -8px 8px;
    padding: 0 10px;
    gap: 10px;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .topbar .tagline,
  body:not(.mobile-preview-mode) .legacy-runtime .topbar .top-links > span {
    display: none;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .topbar .top-links {
    display: flex;
    margin-left: auto;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .workspace {
    display: flex;
    gap: 12px;
    width: 100%;
    min-width: 0;
    align-items: stretch;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
    padding: 14px 12px 16px;
    overflow: visible;
  }

  body:not(.mobile-preview-mode) .legacy-runtime.lesson-page .stage-panel {
    padding: 0 0 16px !important;
    margin: 0 !important;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel .panel-heading {
    padding-bottom: 8px;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel > .stage-speed {
    position: static;
    align-self: flex-end;
    margin: 0 0 12px;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .lesson-context {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
    padding: 11px 12px;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .lesson-guide-rail > .lesson-context {
    order: 1;
    width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border-top: 0 !important;
    border-bottom: 1px solid var(--canvas-grid, #cbdcf0) !important;
    border-left: 0 !important;
    border-right: 0 !important;
    padding: 10px 16px !important;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .lesson-context p {
    white-space: normal;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel .lesson-context .step-actions {
    position: static;
    display: flex;
    justify-content: flex-end;
    transform: none;
  }

  body:not(.mobile-preview-mode) .legacy-runtime #stage {
    width: 100% !important;
    margin: 0;
    border-radius: 7px;
  }

  /* The runtime still updates this element internally, but learners do not need
     a separate scrubber below the animation. */
  body:not(.mobile-preview-mode) .legacy-runtime .timeline {
    display: none;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .learning-steps {
    margin-top: 14px;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .inspector {
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: none;
    display: block;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .inspector > section {
    margin: 0 0 12px;
    border: 1px solid #dce5f2;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 14px #18376608;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .inspector > .lesson-summary-section {
    min-height: 180px;
    overflow: visible;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .inspector > .tutor-question-section {
    border-top: 1px solid #dce5f2;
    padding: 0;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .tutor-question-form {
    padding: 8px 10px 10px;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .tutor-question-footer {
    gap: 6px;
  }
}

/* Tablet keeps the current one-surface lesson contract. The historical split
   workspace reserved a hidden inspector column and then subtracted another
   300px from the canvas shell, which could collapse the teaching canvas to 2px. */
@media (min-width: 761px) and (max-width: 1180px), (min-width: 750px) and (max-width: 760px) and (orientation: landscape) {
  body:not(.mobile-preview-mode):not(.question-entry-mode) {
    height: 100dvh;
    overflow: hidden;
  }

  body:not(.mobile-preview-mode):not(.question-entry-mode) .legacy-runtime .app-shell {
    display: flex;
    height: 100dvh;
    min-height: 0;
    flex-direction: column;
  }

  body:not(.mobile-preview-mode):not(.question-entry-mode) .legacy-runtime .topbar {
    display: flex;
    flex-direction: row;
    height: 62px;
    min-height: 62px;
    flex: 0 0 62px;
    margin: -16px -18px 16px;
    padding: 0 20px;
    overflow: visible;
  }

  body:not(.mobile-preview-mode):not(.question-entry-mode) .legacy-runtime .workspace {
    display: block;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel,
  body:not(.mobile-preview-mode) .legacy-runtime .inspector {
    grid-column: auto;
    grid-row: auto;
    width: auto;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel {
    display: flex;
    width: 100%;
    padding: 16px;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .canvas-shell {
    width: min(100%, 1080px);
    margin-right: auto;
    margin-left: auto;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel > .stage-speed {
    top: 15px;
    right: 16px;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .stage-panel #stage,
  body:not(.mobile-preview-mode) .legacy-runtime #stage {
    width: 100% !important;
    min-height: 0 !important;
    height: auto;
    max-height: calc(100dvh - 280px);
    margin: 0;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .timeline {
    display: none;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .inspector {
    display: flex;
    flex-direction: column;
    padding: 0;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .inspector > section {
    margin: 0;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .inspector > .question-context {
    flex: 0 0 auto;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .inspector > .lesson-summary-section {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body:not(.mobile-preview-mode) .legacy-runtime .inspector > .tutor-question-section {
    flex: 0 0 auto;
    margin-top: 8px;
    border-top: 1px solid #e8edf5;
    padding-top: 8px;
  }
}

/* Portrait tablets use the stacked lesson flow, so the document must own
   vertical scrolling instead of the fixed one-surface tablet frame. */
@media (min-width: 761px) and (max-width: 1180px) and (orientation: portrait) {
  body:not(.mobile-preview-mode):not(.question-entry-mode) {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
    touch-action: pan-y;
  }

  body:not(.mobile-preview-mode):not(.question-entry-mode) .legacy-runtime .app-shell {
    height: auto;
    min-height: 100dvh;
  }

  body:not(.mobile-preview-mode):not(.question-entry-mode) .legacy-runtime .workspace {
    min-height: 0;
  }

  body:not(.mobile-preview-mode):not(.question-entry-mode) .legacy-runtime .stage-panel,
  body:not(.mobile-preview-mode):not(.question-entry-mode) .legacy-runtime .inspector {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body:not(.mobile-preview-mode):not(.question-entry-mode) .legacy-runtime .stage-panel {
    min-height: 0;
  }

  body:not(.mobile-preview-mode):not(.question-entry-mode) .legacy-runtime .stage-panel #stage,
  body:not(.mobile-preview-mode):not(.question-entry-mode) .legacy-runtime #stage {
    max-height: none !important;
  }
}

/* 语音讲解切换圆形按钮 */
.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 .complete-answer-button,
.complete-answer-button,
#completeAnswerButton {
  box-shadow: none !important;
}

.step-actions .complete-answer-button:hover,
.complete-answer-button:hover,
#completeAnswerButton:hover {
  box-shadow: none !important;
}

.step-actions .complete-answer-button::before,
.complete-answer-button::before {
  content: none !important;
  display: none !important;
}

/* 播放/暂停主操作按钮增强视觉权重 */
.step-actions #playPauseButton {
  border: 1px solid var(--brand, #176ee0) !important;
  background: var(--brand, #176ee0) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--brand, #176ee0) 32%, transparent), 0 1px 2px rgba(15, 23, 42, 0.08) !important;
}

.step-actions #playPauseButton:hover {
  border-color: var(--brand-strong, #0d5fc7) !important;
  background: var(--brand-strong, #0d5fc7) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--brand, #176ee0) 40%, transparent) !important;
}

/* 讲解音色下拉组件 */
.step-actions .board-narration-voice-dropdown,
.board-narration-voice-dropdown {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  flex: 0 0 34px !important;
  order: 0 !important;
}

.step-actions .board-narration-voice-trigger,
.board-narration-voice-trigger {
  position: relative;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50% !important;
  border: 1px solid var(--ui-line, #dfe7f1) !important;
  background: #fff !important;
  color: var(--ui-muted, #64748b) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  box-sizing: border-box !important;
  font-weight: 400 !important;
  cursor: pointer;
  outline: none;
  list-style: none;
  flex: 0 0 34px !important;
  order: 0 !important;
  gap: 0 !important;
  transition: all 140ms 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 {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: var(--ui-ink, #0f172a) !important;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--brand, #176ee0) 15%, transparent) !important;
  transform: translateY(-1px);
}

.step-actions .board-narration-voice-trigger:active,
.board-narration-voice-trigger:active {
  transform: scale(0.95);
}

.step-actions .board-narration-voice-trigger:focus-visible,
.board-narration-voice-trigger:focus-visible {
  outline: 2px solid var(--brand, #176ee0) !important;
  outline-offset: 2px;
}

.step-actions :is(.board-narration-voice-current, .board-narration-voice-arrow),
:is(.board-narration-voice-current, .board-narration-voice-arrow) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.step-actions .board-narration-voice-trigger::before,
.board-narration-voice-trigger::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 19px;
  height: 19px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='7' r='3.2'/%3E%3Cpath d='M3.5 20v-1.8a6 6 0 0 1 12 0V20M17.5 9a3.5 3.5 0 0 1 0 6M20.5 7a6.5 6.5 0 0 1 0 10'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='7' r='3.2'/%3E%3Cpath d='M3.5 20v-1.8a6 6 0 0 1 12 0V20M17.5 9a3.5 3.5 0 0 1 0 6M20.5 7a6.5 6.5 0 0 1 0 10'/%3E%3C/svg%3E") center / contain no-repeat;
}

.board-narration-voice-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  min-width: 110px;
  width: max-content;
  padding: 6px 4px;
  border: 1px solid var(--ui-line, #dfe7f1);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
  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;
}

.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);
}
