.session-id { color: var(--muted); font-size: 10px; }
.locale-switch {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 2px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.locale-switch button {
    min-width: 58px;
    min-height: 44px;
    padding: 0 9px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    transition: color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}
.locale-switch button:hover { color: var(--primary-strong); background: #fff; }
.locale-switch button[aria-pressed="true"] {
    color: #fff;
    background: var(--primary);
}
.locale-switch button:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px var(--focus);
}
.error-banner {
    margin: 14px 16px 0;
    padding: 10px 12px;
    color: #8a2f2f;
    background: #fff2f2;
    border: 1px solid #e9bcbc;
    border-radius: var(--radius-sm);
    font-size: 12px;
}
.error-banner[hidden] { display: none; }

.stage-view {
    background: #153a32 url('/assets/classroom-background.png') center / cover no-repeat;
}
#video {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #102c25;
    opacity: 0;
}
.stage-view.is-connected #video { opacity: 1; }
#teacher3dCanvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease-out;
}
.stage-view.is-3d-mode #video { opacity: 0; pointer-events: none; }
.stage-view.is-3d-mode.is-3d-ready #teacher3dCanvas { opacity: 1; }
.stage-view.is-3d-mode.is-3d-ready .stage-placeholder { display: none; }
.teacher-3d-status {
    position: absolute;
    z-index: 4;
    top: 12px;
    right: 12px;
    max-width: min(240px, calc(100% - 24px));
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    color: rgba(255, 255, 255, 0.88);
    background: rgba(9, 30, 25, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-sm);
    font-size: 10px;
    line-height: 1.35;
    backdrop-filter: blur(8px);
}
.teacher-3d-status::before {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    content: '';
    background: #efc35c;
    border-radius: 50%;
}
.teacher-3d-status[data-state="ready"]::before { background: #4ade80; }
.teacher-3d-status[data-state="error"]::before { background: #f87171; }
.teacher-3d-status[hidden] { display: none; }
.stage-placeholder {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    width: min(340px, calc(100% - 36px));
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 18px;
    color: #fff;
    background: rgba(10, 35, 28, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    text-align: center;
    transform: translate(-50%, -50%);
}
.stage-placeholder > i { color: #efc35c; font-size: 28px; }
.stage-placeholder strong { font-size: 15px; }
.stage-placeholder span { color: rgba(255, 255, 255, 0.72); font-size: 11px; }
.stage-view.is-connected .stage-placeholder { display: none; }
.stage-id, .subtitle { z-index: 3; }
.subtitle[hidden] { display: none; }

.voice-panel {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}
.control-column {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 12px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.control-column .voice-panel {
    position: static;
    max-height: none;
    overflow: hidden;
}
.pose-preview-panel {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.pose-preview-header {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 6px 4px 14px;
}
.pose-preview-title, .pose-preview-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
}
.pose-preview-title { color: var(--ink); font-size: 13px; font-weight: 760; }
.pose-preview-title i { color: var(--primary); font-size: 17px; }
.pose-preview-status {
    max-width: 116px;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pose-preview-status[data-state="tracking"] { color: var(--primary-strong); }
.pose-preview-status[data-state="error"],
.pose-preview-status[data-state="processing-error"] { color: var(--danger); }
.pose-preview-toggle {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 44px;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color 180ms ease, background-color 180ms ease;
}
.pose-preview-toggle:hover { color: var(--primary); background: var(--primary-soft); }
.pose-preview-toggle:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--focus); }
.pose-preview-body {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #17352e;
    border-top: 1px solid var(--border);
}
#echoPoseVideo, #echoPoseSkeleton {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transform: scaleX(-1);
}
#echoPoseVideo { z-index: 1; }
#echoPoseSkeleton { z-index: 2; pointer-events: none; }
.pose-preview-empty {
    position: absolute;
    z-index: 3;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 11px;
    text-align: center;
}
.pose-preview-body.is-live .pose-preview-empty { display: none; }
.pose-preview-error {
    margin: 0;
    padding: 9px 12px;
    color: #8a2f2f;
    background: #fff2f2;
    border-top: 1px solid #e9bcbc;
    font-size: 11px;
    line-height: 1.5;
}
.voice-session { border-bottom: 1px solid var(--border); }
.control-status { color: var(--muted); font-size: 10px; font-weight: 700; }
.voice-duplex-status {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 9px;
}
.voice-duplex-status-item {
    display: grid;
    gap: 3px;
    padding: 8px 10px;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 10px;
}
.voice-duplex-status-item strong { color: var(--ink); font-size: 11px; }
.voice-panel[data-pipeline="echo"] .voice-duplex-status { display: none; }
.voice-draft { display: grid; gap: 8px; margin-top: 12px; }
.voice-draft[hidden] { display: none; }
.voice-draft-label { color: var(--ink); font-size: 11px; font-weight: 700; }
.voice-draft textarea {
    width: 100%;
    min-height: 62px;
    padding: 9px 10px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    line-height: 1.5;
    resize: vertical;
}
.voice-draft textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.voice-draft-status { min-height: 15px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.voice-draft-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.voice-draft-actions .button { min-height: 36px; }
.voice-draft-actions .button:disabled { cursor: not-allowed; opacity: 0.5; }
.microphone-zone { padding-block: 14px; }
.microphone-button:disabled { cursor: not-allowed; opacity: 0.48; }
.voice-panel[data-state="listening"] .microphone-button,
.voice-panel[data-state="speaking"] .microphone-button {
    background: var(--primary);
    box-shadow: 0 0 0 8px rgba(15, 118, 110, 0.1), 0 9px 22px rgba(15, 118, 110, 0.2);
}
.voice-panel[data-state="listening"] .mic-rings,
.voice-panel[data-state="speaking"] .mic-rings { animation: mic-pulse 1.6s ease-out infinite; }
.voice-panel[data-state="waiting_llm"] .microphone-button,
.voice-panel[data-state="assistant_speaking"] .microphone-button { background: #65736d; }
.voice-panel[data-state="overloaded"] .microphone-button { background: var(--danger); }

#waveform { position: relative; z-index: 1; width: 100%; height: 48px; display: block; }
.transcript-text { min-height: 38px; }
.transcript-text.partial { color: var(--primary); }
.transcript-text.empty { color: var(--muted-light); }
.caret {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 4px;
    vertical-align: -0.12em;
    background: currentColor;
    animation: caret-blink 0.9s steps(1) infinite;
}
.error-message { margin: 10px 0 0; color: var(--danger); font-size: 11px; line-height: 1.55; }
.error-message[hidden], .relay-status[hidden], .echo-options[hidden], [hidden] { display: none !important; }
.language-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.language-buttons button {
    min-height: 38px;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}
.language-buttons button[aria-pressed="true"] { color: #fff; background: var(--primary); border-color: var(--primary); }
.relay-status { margin: 10px 0 0; color: var(--muted); font-size: 10px; }

.digital-human-picker {
    display: grid;
    gap: 6px;
    padding: 0 15px 12px;
}
.digital-human-picker label { color: var(--muted); font-size: 10px; font-weight: 700; }
.digital-human-picker select {
    width: 100%;
    min-height: 44px;
    padding: 0 34px 0 10px;
    color: var(--ink);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 11px;
    font-weight: 700;
}
.digital-human-picker select:disabled { cursor: not-allowed; opacity: 0.62; }
.digital-human-picker select:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.22);
    outline-offset: 2px;
}
.digital-human-status { min-height: 16px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.digital-human-status.is-error { color: var(--danger); }

.conversation-picker { position: relative; padding: 0 15px 10px; }
.conversation-trigger {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px;
    color: var(--ink);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.conversation-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; }
.conversation-popover {
    position: absolute;
    z-index: 20;
    top: calc(100% - 6px);
    right: 15px;
    left: 15px;
    max-height: 310px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.conversation-search-wrap {
    min-height: 40px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    margin: 8px;
    padding: 0 9px;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.conversation-search-wrap input { width: 100%; min-width: 0; height: 36px; padding: 0; border: 0; outline: 0; }
.conversation-list { max-height: 230px; overflow-y: auto; border-top: 1px solid var(--border); }
.conversation-row {
    position: relative;
    min-height: 42px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 32px;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.conversation-row.current { background: var(--primary-soft); }
.conversation-select, .conversation-menu {
    min-width: 0;
    height: 41px;
    padding: 0 9px;
    overflow: hidden;
    color: var(--ink);
    background: transparent;
    border: 0;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conversation-time { color: var(--muted); font-size: 9px; }
.conversation-menu { width: 32px; padding: 0; text-align: center; }
.conversation-actions {
    position: absolute;
    z-index: 3;
    top: 36px;
    right: 7px;
    min-width: 94px;
    display: grid;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.conversation-actions button { min-height: 34px; padding: 0 10px; color: var(--ink); background: #fff; border: 0; text-align: left; }
.conversation-actions button:last-child { color: var(--danger); }
.conversation-row.actions-open { grid-template-rows: 42px auto; }
.conversation-row.actions-open .conversation-actions { position: static; grid-column: 1 / -1; margin: 0 7px 7px; }
.conversation-empty, .message-empty { margin: 20px 0; color: var(--muted); text-align: center; font-size: 11px; }
.message-error { color: var(--danger); }
.message-pending { opacity: 0.7; }
.message-status { grid-column: 2; color: var(--muted); font-size: 9px; }
.message-failed .message-status { color: var(--danger); }
.message-cancelled { opacity: 0.7; }
.message-cancelled .message-status { font-style: italic; }
.message-citations {
    grid-column: 2;
    min-width: 0;
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.message-citations > li { min-width: 0; }
.message-citations details {
    min-width: 0;
    overflow: hidden;
    background: #f4faf8;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.message-citations summary {
    box-sizing: border-box;
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    overflow-wrap: anywhere;
    color: var(--primary-strong);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
}
.message-citations summary::marker { color: var(--primary); }
.message-citations details[open] summary { border-bottom: 1px solid var(--border); }
.message-citations details p {
    margin: 0;
    padding: 9px 10px;
    overflow-wrap: anywhere;
    color: var(--ink);
    background: #fff;
    border: 0;
    border-radius: 0;
    font-size: 11px;
    line-height: 1.6;
}
.message-grounding {
    grid-column: 2;
    min-width: 0;
    color: #805600;
    font-size: 10px;
    line-height: 1.5;
}
.message-grounding.is-no_retrieval { color: var(--muted); }
.message-grounding.is-failed,
.message-grounding.is-citation_failed { color: var(--danger); }

.message-feedback {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 3px;
}
.message-feedback > button,
.message-feedback-details button,
.message-feedback-details select {
    min-height: 44px;
    padding: 0 11px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 10px;
}
.message-feedback > button[aria-pressed="true"] {
    color: var(--primary-strong);
    background: var(--primary-soft);
    border-color: var(--primary);
}
.message-feedback-details {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 7px;
    width: 100%;
}
.message-feedback-details[hidden] { display: none; }
.message-feedback-details label {
    display: grid;
    min-width: 150px;
    gap: 4px;
    color: var(--muted);
    font-size: 10px;
}
.message-feedback-status {
    min-height: 16px;
    color: var(--muted);
    font-size: 10px;
}
.message-feedback .message-feedback-remove { color: var(--danger); }

.conversation-dialog {
    width: min(420px, calc(100vw - 28px));
    padding: 20px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.conversation-dialog::backdrop { background: rgba(7, 18, 14, 0.55); }
.conversation-dialog form { display: grid; gap: 14px; }
.conversation-dialog h2, .conversation-dialog p { margin: 0; }
.conversation-dialog p { color: var(--muted); font-size: 12px; }
.conversation-dialog label { display: grid; gap: 6px; font-size: 11px; font-weight: 700; }
.conversation-dialog input { min-height: 40px; padding: 0 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions button { min-width: 72px; min-height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.dialog-actions button[type="submit"] { color: #fff; background: var(--primary); border-color: var(--primary); }

.settings-status-error { color: var(--danger); }

.auth-gate {
    min-height: 100vh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 12px;
    color: #17312e;
    background: #f5f8f7;
}
.auth-gate button, .teacher-link {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: #17312e;
    padding: 6px 10px;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}
.teacher-identity { font-weight: 600; }
.teacher-logout { white-space: nowrap; }

@keyframes caret-blink { 50% { opacity: 0; } }

@media (max-width: 1120px) {
    .voice-panel { max-height: none; }
    .control-column { position: static; max-height: none; overflow: visible; }
}

@media (max-width: 760px) {
    .session-id { display: none; }
    .topbar-status { flex-wrap: wrap; }
}

@media (max-width: 560px) {
    .network-state { display: none; }
    .stage-id { top: 9px; left: 9px; }
    .teacher-3d-status { top: 9px; right: 9px; max-width: calc(100% - 118px); }
    .subtitle { bottom: 10px; }
    .voice-session { padding: 13px; }
    .message-list { max-height: 300px; }
    .stage-view { aspect-ratio: 16 / 9; }
    .pose-preview-status { max-width: 104px; }
    .locale-switch { flex: 0 0 auto; }
    .locale-switch button { min-width: 48px; padding-inline: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    #teacher3dCanvas, .pose-preview-toggle { transition: none; }
    .caret, .mic-rings { animation: none !important; }
}

/* 文本验收入口与语音共用当前会话，允许在连接前准备问题。 */
.text-chat {
    display: grid;
    gap: 8px;
    margin: 12px 16px 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.text-chat > label { color: var(--ink); font-size: 12px; font-weight: 700; }
.text-chat textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 76px;
    max-height: 240px;
    resize: vertical;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 13px;
    line-height: 1.6;
}
.text-chat textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.text-chat-hint, .text-chat-actions > p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}
.text-chat-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.text-chat-actions > p { flex: 1 1 120px; }
.text-chat-actions button { min-height: 44px; }
.text-chat-actions button[hidden] { display: none; }

/* 教材证据沿用课堂令牌；动态文字和原页图片独立于播报链路。 */
.knowledge-evidence { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface, #fff); }
.knowledge-evidence[hidden] { display: none; }
.knowledge-evidence h2 { margin: 0 0 10px; font-size: 18px; }
.knowledge-evidence h3 { margin: 0 0 8px; font-size: 16px; overflow-wrap: anywhere; }
.knowledge-evidence-help, #knowledgeEvidenceStatus { color: var(--muted); font-size: 14px; line-height: 1.6; }
.knowledge-evidence form label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.knowledge-evidence input, .knowledge-evidence select { box-sizing: border-box; width: 100%; min-height: 44px; padding: 9px 12px; color: var(--ink); background: var(--surface, #fff); border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; }
.knowledge-evidence-actions, .knowledge-evidence-pages { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.knowledge-evidence button { min-height: 44px; cursor: pointer; }
.knowledge-evidence button:disabled { cursor: not-allowed; opacity: 0.55; }
.knowledge-evidence button:focus-visible, .knowledge-evidence input:focus-visible, .knowledge-evidence select:focus-visible { outline: 3px solid var(--focus, #5e85ca); outline-offset: 2px; }
.knowledge-evidence-card { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.knowledge-evidence-coordinate { font-size: 14px; color: var(--primary-strong); }
.knowledge-evidence-text { max-height: 360px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.7; }
.knowledge-evidence-warning { padding: 10px; background: var(--surface-soft); border-left: 3px solid var(--primary); font-size: 14px; line-height: 1.6; }
.knowledge-evidence-choices { display: grid; gap: 8px; margin-top: 12px; }
.knowledge-evidence-choice { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-soft); color: var(--ink); text-align: left; overflow-wrap: anywhere; font: inherit; }
.knowledge-evidence-image { display: block; width: 100%; height: auto; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
@media (max-width: 640px) { .knowledge-evidence { padding: 14px; } .knowledge-evidence-actions > button { flex: 1; } }
