:root {
  color: #1d2935;
  background: #edf2f6;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  --topbar-height: 64px;
  --side-width: 332px;
  --line: #dce4eb;
  --muted: #637787;
  --ink: #152a39;
  --accent: #16866a;
  --accent-soft: #e3f4ee;
  --danger: #c8423a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, #app { width: 100%; min-width: 320px; height: 100%; min-height: 100%; }
body { margin: 0; overflow: hidden; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .44; }
button:focus { outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #4a9f86; outline-offset: 2px; }

.classroom-shell { display: grid; width: 100%; height: 100vh; grid-template-rows: var(--topbar-height) minmax(0, 1fr); background: #f4f7fa; }
.classroom-topbar { z-index: 20; display: grid; grid-template-columns: minmax(250px, 1fr) auto max-content; gap: 16px; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--line); background: #fff; }
.classroom-identity, .classroom-summary, .topbar-actions, .topbar-controls { display: flex; min-width: 0; align-items: center; }
.classroom-summary { justify-content: center; gap: 12px; }
.topbar-actions { flex: 0 0 auto; justify-content: flex-end; gap: 10px; }
.topbar-controls { justify-content: flex-end; gap: 8px; }
.classroom-elapsed, .classroom-timing { display: grid; height: 42px; flex: 0 0 auto; grid-template-rows: 16px 19px; align-content: center; padding: 3px 9px; border: 1px solid #cbd7e0; border-radius: 6px; background: #f8fafb; color: #607585; }
.classroom-elapsed { min-width: 88px; }
.classroom-timing { min-width: 126px; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; }
.classroom-elapsed > span, .classroom-timing > span { align-self: end; font-size: 9px; font-weight: 700; white-space: nowrap; }
.classroom-elapsed > strong, .classroom-timing > strong { grid-column: 1; color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; letter-spacing: 0; line-height: 19px; white-space: nowrap; }
.classroom-timing.warning { border-color: #e6b850; background: #fff9e8; }
.classroom-timing.warning > strong { color: #8a5b00; }
.classroom-timing.danger { border-color: #e29a95; background: #fff1f0; }
.classroom-timing.danger > strong { color: #b42318; }
.timing-extend-command { grid-column: 2; grid-row: 1 / 3; align-self: center; min-width: 42px; height: 28px; padding: 0 7px; border: 1px solid #4a9f86; border-radius: 5px; background: #fff; color: #116a54; font-size: 10px; font-weight: 720; }
.lesson-heading { min-width: 0; }
.eyebrow { margin: 0 0 2px; color: #688090; font-size: 10px; font-weight: 700; }
h1 { overflow: hidden; margin: 0; color: var(--ink); font-size: 17px; font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.session-state { display: flex; min-width: 0; align-items: center; gap: 7px; color: #607585; font-size: 11px; white-space: nowrap; }
.session-state > span:last-child { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.connection-status-icon { display: grid; width: 18px; height: 18px; flex: 0 0 auto; place-items: center; border: 1px solid #a8b6c0; border-radius: 50%; background: #f2f5f7; color: #667b89; font-size: 11px; font-weight: 800; line-height: 1; }
.connection-status-icon::before { content: "…"; transform: translateY(-2px); }
.session-state.state-connected { color: #116a54; }
.session-state.state-connected .connection-status-icon { border-color: #2a9d7d; background: #e3f4ee; color: #14745b; }
.session-state.state-connected .connection-status-icon::before { content: "✓"; transform: none; }
.session-state.state-warning { color: #8a5b00; }
.session-state.state-warning .connection-status-icon { border-color: #d69a23; background: #fff4cf; color: #8a5b00; }
.session-state.state-warning .connection-status-icon::before { content: "!"; transform: none; }
.session-state.state-error { color: #aa342e; }
.session-state.state-error .connection-status-icon { border-color: #d56861; background: #fff0ef; color: #b42318; }
.session-state.state-error .connection-status-icon::before { content: "!"; transform: none; }
.session-state.state-ended .connection-status-icon::before { content: "■"; transform: none; font-size: 7px; }
.network-quality { display: flex; align-items: center; gap: 6px; color: #607585; font-size: 11px; white-space: nowrap; }
.network-quality-icon { display: flex; width: 19px; height: 18px; flex: 0 0 auto; gap: 2px; align-items: flex-end; justify-content: center; padding: 3px 2px; border: 1px solid #a8b6c0; border-radius: 4px; background: #f2f5f7; color: #667b89; }
.network-quality-icon i { display: block; width: 3px; border-radius: 1px; background: currentColor; }
.network-quality-icon i:nth-child(1) { height: 4px; }
.network-quality-icon i:nth-child(2) { height: 7px; }
.network-quality-icon i:nth-child(3) { height: 10px; }
.network-quality.quality-excellent, .network-quality.quality-good { color: #116a54; }
.network-quality.quality-excellent .network-quality-icon, .network-quality.quality-good .network-quality-icon { border-color: #2a9d7d; background: #e3f4ee; color: #14745b; }
.network-quality.quality-poor { color: #8a5b00; }
.network-quality.quality-poor .network-quality-icon { border-color: #d69a23; background: #fff4cf; color: #a66a00; }
.network-quality.quality-poor .network-quality-icon i:nth-child(3) { background: #d4c5a5; }
.network-quality.quality-lost { color: #aa342e; }
.network-quality.quality-lost .network-quality-icon { border-color: #d56861; background: #fff0ef; color: #b42318; }
.network-quality.quality-lost .network-quality-icon i { height: 2px; }
.status-with-tooltip { position: relative; cursor: help; outline: none; }
.status-with-tooltip::after { position: absolute; z-index: 60; top: calc(100% + 12px); left: 50%; width: max-content; max-width: 260px; padding: 8px 10px; border: 1px solid #ced9e1; border-radius: 5px; background: #142630; box-shadow: 0 6px 18px rgb(18 38 48 / 22%); color: #fff; content: attr(data-tooltip); font-size: 11px; font-weight: 500; line-height: 1.45; opacity: 0; pointer-events: none; text-align: left; transform: translate(-50%, -4px); transition: opacity .14s ease, transform .14s ease; white-space: normal; }
.status-with-tooltip:hover::after, .status-with-tooltip:focus::after { opacity: 1; transform: translate(-50%, 0); }
.session-state.status-with-tooltip::after { left: 0; transform: translate(0, -4px); }
.session-state.status-with-tooltip:hover::after, .session-state.status-with-tooltip:focus::after { transform: translate(0, 0); }
.summary-divider { width: 1px; height: 18px; background: var(--line); }
.summary-button { display: flex; gap: 5px; align-items: center; border: 0; background: transparent; color: #607585; font-size: 11px; }
.summary-button strong { color: var(--ink); font-size: 13px; }
.view-tabs { display: inline-flex; overflow: hidden; border: 1px solid #cbd7e0; border-radius: 6px; background: #fff; }
.view-tab { min-width: 58px; height: 34px; border: 0; border-right: 1px solid #d6e0e7; background: transparent; color: #587080; font-size: 12px; font-weight: 700; }
.view-tab:last-child { border-right: 0; }
.view-tab.active { background: var(--accent-soft); color: #116a54; }
.diagnostic-command { display: inline-flex; height: 34px; flex: 0 0 auto; gap: 5px; align-items: center; padding: 0 9px; border: 1px solid #cbd7e0; border-radius: 6px; background: #fff; color: #526a7a; font-size: 11px; font-weight: 700; white-space: nowrap; }
.diagnostic-command > span:first-child { font-size: 16px; line-height: 1; }
.icon-command { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #cbd7e0; border-radius: 6px; background: #fff; color: #526a7a; font-size: 16px; }
.icon-command span { transition: transform .18s ease; }
.classroom-shell.side-collapsed .icon-command span { transform: rotate(180deg); }

.classroom-main { position: relative; display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1fr) var(--side-width); overflow: hidden; }
.classroom-shell.side-collapsed .classroom-main { grid-template-columns: minmax(0, 1fr) 0; }
.classroom-workspace { display: grid; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) 28px; background: #f7f9fb; }
.whiteboard-controls { display: flex; min-width: 0; min-height: 52px; gap: 12px; align-items: center; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.drawing-tools, .drawing-options { display: flex; min-width: 0; gap: 5px; align-items: center; }
.drawing-options { justify-content: flex-end; }
.tool-command, .clear-command { min-height: 32px; padding: 0 9px; border: 1px solid #d0dbe4; border-radius: 5px; background: #fff; color: #455d6d; font-size: 11px; font-weight: 680; white-space: nowrap; }
.tool-command.active { border-color: #6dbba4; background: var(--accent-soft); color: #116a54; }
.clear-command.danger-text { color: #ad3b35; }
.tool-divider { width: 1px; height: 24px; margin: 0 2px; background: var(--line); }
.stroke-width-control, .text-content-control, .toggle-control { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border: 1px solid #d0dbe4; border-radius: 5px; color: #4d6575; font-size: 11px; font-weight: 680; }
.stroke-width-control input { width: 58px; accent-color: var(--accent); }
.text-content-control input { width: 110px; height: 25px; border: 0; outline: 0; color: #243b4a; }
.toggle-control input { width: 28px; height: 16px; margin: 0; accent-color: var(--accent); }
.swatches { display: flex; flex: 0 0 auto; gap: 7px; padding: 0 5px; }
.swatch { width: 21px; height: 21px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px #d4dee6; }
.swatch[data-color="#1570ef"] { --swatch: #1570ef; }
.swatch[data-color="#d84f3d"] { --swatch: #d84f3d; }
.swatch[data-color="#16866a"] { --swatch: #16866a; }
.swatch[data-color="#22262d"] { --swatch: #22262d; }
.swatch.selected { box-shadow: 0 0 0 2px #607585; }

.teaching-stage { position: relative; min-width: 0; min-height: 0; }
.canvas-stage { position: relative; display: grid; width: 100%; height: 100%; min-height: 0; grid-template-rows: auto minmax(0, 1fr); gap: 8px; padding: 10px 14px 12px; }
.whiteboard-toolbar { display: flex; min-width: 0; gap: 12px; align-items: center; justify-content: space-between; }
.whiteboard-pages { display: flex; min-width: 0; gap: 6px; overflow-x: auto; }
.whiteboard-page, .page-command, .page-rename-command { height: 30px; flex: 0 0 auto; border: 1px solid #d0dbe4; border-radius: 5px; background: #fff; color: #587080; font-size: 11px; font-weight: 680; }
.whiteboard-page { max-width: 148px; overflow: hidden; padding: 0 10px; text-overflow: ellipsis; white-space: nowrap; }
.whiteboard-page.active { border-color: #69b69f; background: var(--accent-soft); color: #116a54; }
.whiteboard-page-actions { display: inline-flex; flex: 0 0 auto; gap: 5px; align-items: center; }
.page-command { width: 30px; padding: 0; font-size: 16px; }
.page-rename-command { padding: 0 9px; }
.page-rename-control input { width: 112px; height: 30px; border: 1px solid #d0dbe4; border-radius: 5px; padding: 0 8px; }
.board-surface { position: relative; width: 100%; height: 100%; min-height: 260px; overflow: hidden; border: 1px solid #d5dfe7; background: #fff; box-shadow: 0 1px 2px rgb(21 42 57 / 4%); }
.board-background { position: absolute; inset: 0; pointer-events: none; }
.board-background img, .board-background iframe { width: 100%; height: 100%; border: 0; object-fit: contain; background: #fff; }
#board { position: relative; z-index: 1; display: block; width: 100%; height: 100%; min-height: 260px; background: transparent; touch-action: none; }
#board.whiteboard-locked { cursor: not-allowed; }
.canvas-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #6a7f8f; pointer-events: none; }
.stage-status { display: flex; justify-content: space-between; align-items: center; padding: 0 14px; border-top: 1px solid var(--line); background: #fff; color: #6a7f8f; font-size: 10px; }

.courseware-stage { display: grid; width: 100%; height: 100%; min-height: 0; grid-template-columns: 220px minmax(0, 1fr); gap: 10px; padding: 10px 14px 12px; }
.material-browser { display: grid; min-height: 0; grid-template-rows: auto minmax(0, 1fr); border: 1px solid #d7e1e8; background: #fff; }
.material-heading { display: flex; justify-content: space-between; padding: 11px 12px; border-bottom: 1px solid var(--line); color: #2a4252; font-size: 12px; }
.material-heading span { color: #7a8d9b; }
.material-list { display: grid; align-content: start; gap: 7px; overflow: auto; padding: 10px; }
.material-empty { padding: 12px; border: 1px dashed #c5d2dc; border-radius: 5px; color: #738794; font-size: 11px; text-align: center; }
.material-item { display: grid; gap: 3px; width: 100%; border: 1px solid #d4dee6; border-radius: 5px; padding: 9px; background: #fff; color: #263d4c; text-align: left; }
.material-item:hover:not(:disabled), .material-item.selected { border-color: #69b69f; background: #eff9f5; }
.material-item strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.material-item span { color: #7b8e9b; font-size: 10px; }
.courseware-content { min-width: 0; min-height: 0; }
.courseware-empty { display: grid; width: 100%; height: 100%; min-height: 180px; place-items: center; border: 1px dashed #c4d2dc; color: #6a7f8f; }
.courseware-preview { display: grid; width: 100%; height: 100%; min-height: 0; grid-template-rows: auto minmax(0, 1fr); border: 1px solid #d5dfe7; background: #fff; }
.courseware-title { display: flex; min-width: 0; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.courseware-title strong { overflow: hidden; color: #1d394b; text-overflow: ellipsis; white-space: nowrap; }
.courseware-title a { color: #116a54; font-size: 11px; font-weight: 680; }
.courseware-preview iframe, .courseware-preview video { width: 100%; height: 100%; min-height: 0; border: 0; background: #fff; }

.classroom-side-panel { display: grid; min-width: 0; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; border-left: 1px solid var(--line); background: #fff; transition: opacity .16s ease; }
.classroom-shell.side-collapsed .classroom-side-panel { opacity: 0; pointer-events: none; }
.media-stack { display: grid; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); background: #f0f4f7; }
.media-tile { position: relative; width: 100%; min-width: 0; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 5px; background: #142630; }
.media-label { position: absolute; z-index: 2; top: 7px; left: 8px; padding: 3px 6px; border-radius: 3px; background: rgb(8 19 26 / 70%); color: #fff; font-size: 10px; }
.media-content { display: grid; width: 100%; height: 100%; place-items: center; color: #91a7b5; font-size: 11px; }
.media-content video, .media-content audio { width: 100%; height: 100%; object-fit: cover; }
.local-media-status { position: absolute; z-index: 3; top: 7px; right: 8px; max-width: calc(100% - 88px); overflow: hidden; padding: 3px 6px; border-radius: 3px; background: rgb(11 89 70 / 88%); color: #fff; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.local-media-status.error { background: rgb(179 49 43 / 92%); }
.tile-media-controls { position: absolute; z-index: 3; bottom: 10px; left: 50%; display: flex; gap: 8px; transform: translateX(-50%); }
.local-media-controls { right: 10px; left: auto; transform: none; }
.tile-media-command { position: relative; display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid rgb(255 255 255 / 42%); border-radius: 50%; background: rgb(16 36 47 / 82%); color: #fff; box-shadow: 0 2px 8px rgb(4 15 22 / 28%); transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.tile-media-command:hover:not(:disabled) { background: rgb(21 54 65 / 94%); transform: translateY(-1px); }
.tile-media-command:not(.active) { border-color: #df6a62; background: #c8423a; }
.tile-media-command:not(.active):hover:not(:disabled) { background: #b63832; }
.tile-media-command:not(.active)::after { position: absolute; width: 21px; height: 2px; border-radius: 1px; background: currentColor; content: ""; transform: rotate(-45deg); }
.tile-media-command.device-settings-command { border-color: rgb(255 255 255 / 42%); background: rgb(16 36 47 / 82%); }
.tile-media-command.device-settings-command:hover:not(:disabled) { background: rgb(21 54 65 / 94%); }
.tile-media-command.device-settings-command::after { content: none; }
.tile-media-command:disabled { opacity: .55; }
.tile-media-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.side-tab { position: relative; height: 42px; border: 0; background: #fff; color: #6b7f8d; font-size: 12px; font-weight: 700; }
.side-tab.active { color: #126b55; }
.side-tab.active::after { position: absolute; right: 24px; bottom: -1px; left: 24px; height: 2px; background: var(--accent); content: ""; }
.side-tab.has-raised-hand { padding-right: 34px; background: #fff8dc; color: #8b5700; }
.side-tab.has-raised-hand::before { position: absolute; top: 50%; right: 14px; display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: #e49c0f; color: #fff; content: "✋"; font-size: 13px; line-height: 1; transform: translateY(-50%); animation: raised-hand-tab-pulse .72s ease-in-out infinite; }
.chat-unread-indicator { position: absolute; top: 9px; right: calc(50% - 27px); width: 7px; height: 7px; border: 1px solid #fff; border-radius: 50%; background: #d9413a; box-shadow: 0 1px 2px rgb(101 31 28 / 28%); }
.side-content { min-height: 0; overflow: auto; padding: 10px; }
.participant-list { display: grid; align-content: start; gap: 7px; }
.participant-empty { padding: 14px 10px; border: 1px dashed #c5d2dc; border-radius: 5px; color: #738794; font-size: 11px; text-align: center; }
.participant-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 9px 10px; border: 1px solid #d8e1e8; border-radius: 5px; background: #fff; }
.participant-row.hand-raised { border-color: #e0a11e; border-left-width: 4px; padding-left: 7px; background: #fff8dc; box-shadow: 0 0 0 2px rgb(224 161 30 / 16%); animation: raised-hand-row-pulse 1.15s ease-in-out infinite; }
.participant-identity { display: grid; min-width: 0; gap: 2px; }
.participant-name-line { display: flex; min-width: 0; gap: 6px; align-items: center; }
.participant-identity strong { overflow: hidden; color: #263d4c; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.participant-identity span { color: #788c99; font-size: 10px; }
.participant-hand-indicator { display: grid; width: 23px; height: 23px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #e49c0f; color: #fff; font-size: 14px !important; line-height: 1; filter: saturate(.9); animation: raised-hand-icon-pulse .72s ease-in-out infinite; }
.participant-controls { display: flex; gap: 4px; }
.participant-controls button { min-height: 26px; border: 1px solid #c7d4de; border-radius: 4px; background: #fff; color: #4d6575; font-size: 10px; }
.participant-controls .hand-resolve-command { border-color: #cf8610; background: #d99213; color: #fff; font-weight: 750; }
.participant-controls .hand-resolve-command:hover { background: #bd7308; }
.chat-section { display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
.chat-messages { display: flex; min-height: 0; flex-direction: column; gap: 7px; overflow: auto; padding-bottom: 8px; }
.chat-message { display: grid; align-self: flex-start; max-width: 90%; gap: 2px; padding: 8px 9px; border-radius: 5px; background: #eef3f6; }
.chat-message.local { align-self: flex-end; background: var(--accent-soft); }
.chat-message strong { color: #708492; font-size: 9px; }
.chat-message span { overflow-wrap: anywhere; color: #2a4151; font-size: 11px; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.chat-form input { width: 100%; height: 34px; min-width: 0; border: 1px solid #cad6df; border-radius: 5px; padding: 0 9px; outline: none; color: #263d4c; }
.chat-form input:focus { border-color: #69b69f; }
.chat-form button { min-width: 54px; border: 0; border-radius: 5px; background: var(--accent); color: #fff; font-weight: 680; }
.side-panel-backdrop { display: none; }

.control-status { position: absolute; top: var(--topbar-height); right: 18px; min-width: 0; }
.screen-share-status { display: block; max-width: 250px; overflow: hidden; color: #126b55; font-size: 11px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.media-controls { display: flex; min-width: 0; flex: 0 1 auto; gap: 4px; align-items: center; }
.media-command { display: inline-flex; height: 34px; min-width: 34px; flex: 0 0 auto; gap: 5px; align-items: center; justify-content: center; padding: 0 7px; border: 0; border-radius: 5px; background: transparent; color: #536b7b; font-size: 10px; font-weight: 680; white-space: nowrap; }
.media-command:hover:not(:disabled) { background: #f0f4f7; }
.media-command.active { background: var(--accent-soft); color: #116a54; }
.media-command-icon { display: grid; width: 22px; height: 22px; flex: 0 0 auto; place-items: center; border: 1px solid #c8d4dd; border-radius: 50%; background: #fff; color: #415a6a; font-size: 10px; font-weight: 780; }
.media-command.active .media-command-icon { border-color: #72bca6; background: #fff; color: #116a54; }
.media-command.hand-raised { background: #fff0ba; color: #8b5700; box-shadow: inset 0 0 0 1px #e2a62e; }
.media-command.hand-raised .media-command-icon { border-color: #d58c10; background: #e49c0f; color: #fff; animation: raised-hand-icon-pulse .72s ease-in-out infinite; }
.hand-icon { font-size: 13px; }
.exit-controls { display: flex; flex: 0 0 auto; justify-content: flex-end; }
.session-actions { display: flex; gap: 7px; }
.primary-command, .secondary-command, .leave-command, .danger-command { min-height: 34px; padding: 0 11px; border-radius: 5px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.primary-command { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.secondary-command { border: 1px solid #9fb1bf; background: #fff; color: #334c5d; }
.leave-command { border: 1px solid #cbd7e0; background: #fff; color: #415968; }
.danger-command { border: 1px solid var(--danger); background: var(--danger); color: #fff; }

@keyframes raised-hand-row-pulse {
  0%, 100% { border-color: #e0a11e; background: #fff8dc; box-shadow: 0 0 0 2px rgb(224 161 30 / 12%); }
  50% { border-color: #c66d08; background: #ffedac; box-shadow: 0 0 0 4px rgb(224 133 20 / 24%); }
}
@keyframes raised-hand-icon-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.16); filter: brightness(1.18); }
}
@keyframes raised-hand-tab-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgb(224 133 20 / 20%); transform: translateY(-50%) scale(1); }
  50% { box-shadow: 0 0 0 5px rgb(224 133 20 / 22%); transform: translateY(-50%) scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
  .side-tab.has-raised-hand::before, .participant-row.hand-raised, .participant-hand-indicator, .media-command.hand-raised .media-command-icon { animation: none; }
}

.device-dialog, .capture-source-dialog, .extension-dialog, .diagnostic-dialog, .confirm-dialog { padding: 0; border: 0; border-radius: 7px; color: #1d2935; box-shadow: 0 20px 54px rgb(17 36 50 / 30%); }
.device-dialog::backdrop, .capture-source-dialog::backdrop, .extension-dialog::backdrop, .diagnostic-dialog::backdrop, .confirm-dialog::backdrop { background: rgb(14 29 40 / 54%); }
.device-dialog { width: min(520px, calc(100vw - 32px)); }
.device-panel { display: grid; background: #fff; }
.device-panel > header, .capture-source-panel > header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; padding: 18px 20px 13px; border-bottom: 1px solid var(--line); }
.device-panel h2, .capture-source-panel h2 { margin: 0; font-size: 18px; }
.dialog-close { width: 32px; height: 32px; padding: 0; border: 1px solid #d0dbe4; border-radius: 5px; background: #fff; color: #526a7a; font-size: 21px; }
.device-dialog-body { display: grid; gap: 14px; padding: 18px 20px; }
.device-heading { display: flex; justify-content: space-between; align-items: center; color: #334c5c; font-size: 12px; font-weight: 700; }
.device-refresh { border: 0; padding: 0; background: transparent; color: #13755d; font-size: 11px; font-weight: 700; }
.device-grid { display: grid; gap: 11px; }
.device-grid label { display: grid; gap: 6px; color: #5d7382; font-size: 11px; }
.device-grid select { width: 100%; height: 36px; border: 1px solid #cbd7e0; border-radius: 5px; background: #fff; padding: 0 9px; color: #263d4c; }
.device-test-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.device-test-actions button { min-height: 34px; border: 1px solid #cbd7e0; border-radius: 5px; background: #fff; color: #405969; font-size: 11px; }
.microphone-meter { height: 5px; overflow: hidden; border-radius: 3px; background: #dce5eb; }
.microphone-meter span { display: block; width: 0; height: 100%; background: #2eb58d; transition: width .08s linear; }
.device-status { min-height: 16px; margin: 0; color: #6d818e; font-size: 11px; line-height: 1.45; }
.device-panel > footer { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); background: #f8fafb; }

.capture-source-dialog { width: min(720px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); }
.capture-source-panel { display: grid; max-height: inherit; grid-template-rows: auto auto minmax(0, 1fr) auto auto; background: #fff; }
.capture-source-privacy { margin: 0; padding: 12px 20px; border-bottom: 1px solid #e3eaf0; background: #f5f8fa; color: #4f6575; font-size: 11px; line-height: 1.55; }
.capture-source-list { display: grid; min-height: 90px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; overflow: auto; padding: 16px 20px; }
.capture-source-item { display: grid; min-width: 0; grid-template-columns: 132px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px; border: 1px solid #d0dbe4; border-radius: 5px; background: #fff; color: #263d4c; text-align: left; }
.capture-source-thumbnail { display: block; width: 132px; height: 74px; border-radius: 3px; object-fit: cover; background: #dce5eb; }
.capture-source-details { display: grid; min-width: 0; gap: 4px; }
.capture-source-details span { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.capture-source-state { min-height: 18px; margin: 0; padding: 0 20px 14px; color: #587080; font-size: 11px; }
.capture-source-panel > footer { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); background: #f8fafb; }
.extension-dialog { width: min(480px, calc(100vw - 32px)); }
.extension-panel { display: grid; background: #fff; }
.extension-panel > header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; padding: 18px 20px 13px; border-bottom: 1px solid var(--line); }
.extension-panel h2 { margin: 0; font-size: 18px; }
.extension-body { display: grid; gap: 14px; padding: 18px 20px 10px; }
.extension-balance { display: flex; align-items: baseline; justify-content: space-between; color: #587080; font-size: 11px; }
.extension-balance strong { color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }
.extension-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.extension-option { display: grid; min-width: 0; height: 68px; place-content: center; gap: 4px; border: 1px solid #cbd7e0; border-radius: 6px; background: #fff; color: #334c5d; text-align: center; }
.extension-option strong { font-size: 14px; }
.extension-option span { color: #6a7f8f; font-size: 10px; }
.extension-option.selected { border-color: #4a9f86; background: var(--accent-soft); color: #116a54; box-shadow: inset 0 0 0 1px #4a9f86; }
.extension-option:disabled { background: #f2f5f7; }
.extension-notice { margin: 0; padding: 9px 10px; border-left: 3px solid #65aa96; background: #f2f8f6; color: #506b61; font-size: 10px; line-height: 1.55; }
.extension-error { min-height: 18px; margin: 0; color: #b42318; font-size: 11px; }
.extension-panel > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: #f8fafb; }
.diagnostic-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.diagnostic-panel { display: grid; max-height: inherit; grid-template-rows: auto auto minmax(180px, 1fr) auto auto; background: #fff; }
.diagnostic-panel > header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; padding: 18px 20px 13px; border-bottom: 1px solid var(--line); }
.diagnostic-panel h2 { margin: 0; font-size: 18px; }
.diagnostic-summary { display: flex; gap: 12px; align-items: center; padding: 11px 20px; border-bottom: 1px solid var(--line); color: #647988; font-size: 11px; }
.diagnostic-summary strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.diagnostic-log-output { min-height: 220px; max-height: min(480px, 58vh); overflow: auto; margin: 0; padding: 15px 18px; background: #12232d; color: #d6e3e9; font: 12px/1.65 Consolas, "Courier New", monospace; letter-spacing: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.diagnostic-copy-status { min-height: 30px; margin: 0; padding: 7px 20px; color: #587080; font-size: 11px; }
.diagnostic-panel > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: #f8fafb; }
.confirm-dialog { width: min(430px, calc(100vw - 32px)); }
.confirm-dialog section { padding: 22px; }
.confirm-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.confirm-dialog p { margin: 0; color: #587080; line-height: 1.6; }
.confirm-dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.confirm-error { min-height: 20px; margin-top: 10px; color: #b42318; font-size: 11px; }

@media (max-width: 1180px) {
  :root { --side-width: 292px; }
  .classroom-topbar { grid-template-columns: minmax(200px, 1fr) auto max-content; gap: 10px; padding: 0 12px; }
  .classroom-summary .session-state, .classroom-summary .network-quality, .classroom-summary .summary-divider { display: none; }
  .media-command-label { display: none; }
  .media-command { padding: 0 5px; }
  .classroom-timing { min-width: 112px; }
  .drawing-tools { overflow-x: auto; }
  .drawing-options .clear-command { display: none; }
}

@media (max-width: 900px) {
  .classroom-topbar { grid-template-columns: minmax(118px, 1fr) minmax(0, auto); }
  .classroom-summary { display: none; }
  .topbar-controls { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .topbar-controls::-webkit-scrollbar { display: none; }
  .classroom-main { grid-template-columns: minmax(0, 1fr); }
  .classroom-side-panel { position: absolute; z-index: 30; top: 0; right: 0; bottom: 0; width: min(340px, calc(100vw - 42px)); box-shadow: -12px 0 32px rgb(24 43 55 / 22%); transform: translateX(0); transition: transform .18s ease; }
  .classroom-shell.side-collapsed .classroom-side-panel { opacity: 1; transform: translateX(105%); }
  .side-panel-backdrop { position: absolute; z-index: 29; inset: 0; display: block; border: 0; background: rgb(17 34 45 / 25%); }
  .classroom-shell.side-collapsed .side-panel-backdrop { display: none; }
  .whiteboard-controls { align-items: flex-start; flex-direction: column; }
  .drawing-tools, .drawing-options { width: 100%; }
  .drawing-options { justify-content: flex-start; }
}

@media (max-width: 620px) {
  :root { --topbar-height: 58px; }
  .classroom-topbar { grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: 0 8px; }
  .lesson-heading .eyebrow { display: none; }
  h1 { max-width: 92px; font-size: 14px; }
  .topbar-controls { justify-content: flex-start; }
  .classroom-elapsed, .classroom-timing { height: 38px; }
  .classroom-elapsed { min-width: 84px; }
  .classroom-timing { min-width: 108px; }
  .topbar-actions { gap: 4px; }
  .view-tab { min-width: 48px; }
  .whiteboard-controls { gap: 6px; min-height: 44px; padding: 6px 8px; }
  .drawing-options { overflow-x: auto; }
  .stroke-width-control, .swatches, .tool-divider { display: none; }
  .canvas-stage { padding: 7px 8px 8px; }
  .whiteboard-toolbar { align-items: flex-start; flex-direction: column; gap: 6px; }
  .whiteboard-pages { width: 100%; }
  .whiteboard-page-actions { width: 100%; overflow-x: auto; }
  .courseware-stage { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); padding: 8px; }
  .material-browser { max-height: 150px; }
  .control-status { display: none; }
  .media-controls { flex: 0 0 auto; }
  .media-command { height: 32px; min-width: 30px; padding: 0 4px; }
  .media-command-icon { width: 21px; height: 21px; }
  .view-tab, .diagnostic-command, .icon-command { height: 32px; }
  .leave-command, .danger-command { min-height: 32px; padding: 0 8px; }
  .capture-source-list { grid-template-columns: 1fr; padding: 14px; }
  .extension-options { grid-template-columns: 1fr; }
  .extension-option { height: 52px; grid-template-columns: auto auto; column-gap: 8px; }
}
