/* Classroom 骨架樣式 — 功能可用優先；正式視覺由 UIUX session 交付後替換本檔。
   原則：pro 引擎 DOM 全數保留在場（boot 必需），僅視覺隱藏；教室 UI = 全螢幕 overlay。 */

/* 隱藏 pro 介面（保留 DOM；JS click()/classList 對 display:none 元素照常工作） */
body.classroom-mode > :not(#classroomOverlay):not(script):not(style):not(link) {
    display: none !important;
}

/* ============================================================
   Hiểu — classroom teacher skin
   來源：design/tokens.css + design/mockups/classroom-teacher.html（v3,production scale）
   字體自托管（Be Vietnam Pro 400/600/700/800,latin+vietnamese subset）
   ============================================================ */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/be-vietnam-pro-400-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/be-vietnam-pro-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/be-vietnam-pro-600-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/be-vietnam-pro-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/be-vietnam-pro-700-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/be-vietnam-pro-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/be-vietnam-pro-800-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/be-vietnam-pro-800-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --green: #24513F; --green-panel: #2C5C49; --green-hair: #3B6A55;
  --chalk: #F5F1E3; --chalk-dim: #A9BCA6;
  --paper: #FAF6EA; --paper2: #FFFDF4;
  --ink: #1F3D31; --ink-soft: #57685C; --hair: #E6DEC8;
  --gold: #E9C46A; --gold-soft: #F6E7C3; --gold-ink: #6B5416;
  --red: #D8432F;
  --font-hieu: "Be Vietnam Pro", -apple-system, system-ui, sans-serif;
  --r-card: 14px; --r-btn: 14px; --r-pill: 999px;
  --motion-caption: 220ms;
}

/* ══ Classroom overlay skin(取代舊視覺段;engine 隱藏規則見上)══ */
#classroomOverlay {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column;
  background: radial-gradient(130% 100% at 50% 26%, #2B5B48 0%, var(--green) 58%, #1E4636 100%); /* 板光,非死平塗(v3) */
  color: var(--chalk);
  font-family: var(--font-hieu);
}
#classroomHeader { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 20px 10px; }
#classroomBrand { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
/* TLC-031:app 原生 ⋮ 鈕落在右上——恆讓 48px(瀏覽器=標籤不貼邊,無害);
   長 title 單行截斷不換行(Gate-1 U1 hardening) */
#classroomSession { font-size: 12px; color: var(--chalk-dim); padding-right: 48px;
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#classroomMain { flex: 1; display: flex; flex-direction: column; padding: 8px 16px 16px; overflow-y: auto; }

/* Authority-first panel projection. The HTML boots in lifecycle-unresolved, so no
   actionable Start/LIVE/ended surface exists even for one paint before auth. */
#lifecycleBootPanel, #uncertaintyPanel, #preClassPanel, #onAirPanel, #endedPanel {
  display: none;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
body.lifecycle-unresolved #lifecycleBootPanel { display: flex; }
body.pre-class #preClassPanel, body.starting #preClassPanel,
body.ended #preClassPanel { display: flex; }
body.on-air #onAirPanel, body.ending #onAirPanel { display: flex; }
body.ended #onAirPanel, body.ended #endedPanel { display: none; }
body.stop-unknown #uncertaintyPanel,
body.cleanup-unknown #uncertaintyPanel,
body.role-lost #uncertaintyPanel { display: flex; }

.lifecycle-status-card {
  margin: auto 0;
  padding: 24px 20px;
  border: 1px solid color-mix(in srgb, var(--chalk) 28%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--green) 84%, #fff 4%);
}
.lifecycle-status-card h2 { margin: 14px 0 8px; font-size: 24px; line-height: 1.2; }
.lifecycle-status-card p { margin: 0; color: var(--chalk-dim); line-height: 1.55; }
.lifecycle-status-card button {
  width: 100%; min-height: 52px; margin-top: 22px; border: 0; border-radius: var(--r-btn);
  background: var(--gold); color: #17251f; font: 800 17px/1 var(--font-hieu); cursor: pointer;
}
.lifecycle-status-card button[hidden] { display: none; }
.lifecycle-spinner, .lifecycle-warning {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
}
.lifecycle-spinner { border: 3px solid color-mix(in srgb, var(--chalk) 20%, transparent); border-top-color: var(--gold); animation: lifecycle-spin .8s linear infinite; }
.lifecycle-warning { background: var(--gold); color: #17251f; font-size: 22px; font-weight: 900; }
#uncertaintyRoom { margin-top: 12px; font: 700 13px/1.4 ui-monospace, monospace; color: var(--chalk-dim); }
body.role-lost #uncertaintyRetryBtn { display: none; }
#endedPanel { display: none; }
@keyframes lifecycle-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lifecycle-spinner { animation: none; } }

/* v3 板書層:班級直接寫在板上(id 全保留,樣式透明化;spec §4) */
.subject-card { background: none; padding: 0; color: var(--chalk); font-size: 44px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.subject-card .eyebrow { display: block; font-size: 12px; letter-spacing: .22em; color: var(--chalk-dim); font-weight: 700; margin-bottom: 10px; }
.subject-card small#subjectCardSub { display: block; font-weight: 400; font-size: 14px; color: var(--chalk-dim); margin-top: 14px; }
.chalk-stroke { display: block; margin-top: 10px; } /* 簽名元素:金粉筆線,一畫面一條 */

#pageRangeField {
  display: grid; grid-template-columns: minmax(120px, auto) 1fr; align-items: center;
  gap: 6px 14px; padding: 14px 16px; border: 1px solid rgba(245, 241, 227, .24);
  border-radius: 14px; background: rgba(255, 255, 255, .045);
}
#pageRangeField[hidden] { display: none; }
#pageRangeField > label { font-size: 14px; font-weight: 700; color: var(--chalk); }
.page-range-inputs { display: flex; align-items: center; gap: 9px; }
.page-range-inputs input {
  width: 82px; min-height: 44px; box-sizing: border-box; border: 1px solid var(--chalk-dim);
  border-radius: 10px; background: rgba(0, 0, 0, .12); color: var(--chalk);
  font: 700 17px/1 var(--font-hieu); text-align: center;
}
.page-range-inputs input:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
#pageRangeField.invalid .page-range-inputs input { border-color: #FFB4A6; }
#pageRangeHint { grid-column: 1 / -1; color: var(--chalk-dim); font-size: 12px; line-height: 1.45; }
#pageRangeHint[hidden] { display: none; }
#pageRangeField.invalid #pageRangeHint { color: #FFB4A6; }

/* 主鈕(金=CTA;高 ≥52px) */
#startClassBtn, #endClassBtn, #restartClassBtn {
  border: none; border-radius: var(--r-btn); padding: 18px 12px; min-height: 56px;
  font-family: var(--font-hieu); font-size: 19px; font-weight: 800; cursor: pointer; margin-top: auto;
}
#startClassBtn, #restartClassBtn { background: var(--gold); color: var(--green); }
#startClassBtn:active, #endClassBtn:active, #restartClassBtn:active { transform: scale(.98); }
#startClassBtn:disabled { opacity: .5; }
#courseCardContent { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
#preClassTask { display: flex; flex-direction: column; gap: 8px; margin-top: auto; min-width: 0; }
/* pre-class 重構:主構圖(課名+actions)= #preClassMain;次要(頁碼+回執)= #preClassFooter 壓底部條 */
#preClassMain { display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 0; }
#preClassFooter { display: flex; flex-direction: column; gap: 12px; }
#preClassActions { display: flex; flex-direction: column; gap: 10px; }
#preClassActions #startClassBtn { margin-top: 0; }
#classRecordsBtn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 52px; padding: 13px 12px; border: 1.5px solid var(--chalk-dim);
  border-radius: var(--r-btn); background: transparent; color: var(--chalk);
  font-family: var(--font-hieu); font-size: 16px; font-weight: 700; cursor: pointer;
}
#classRecordsBtn svg { width: 19px; height: 19px; flex: 0 0 auto; }
#classRecordsBtn:active { transform: scale(.98); }
#classRecordsBtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
#classRecordsBtn:disabled { opacity: .45; cursor: default; }
/* 紅鈕:19px/800 = WCAG large-text(3.9:1 AA-Large;紅底禁小字——en 副行也粗體放大到 12px 以上仍屬輔助,主文案已達標) */
#endClassBtn { background: var(--red); color: #FBEFE8; }
/* 樂觀關閉 undo 條：body.ending 才顯（同時藏 endClassBtn，同位置換手）。
   gold-soft = 進行中/可反悔（非紅＝非危險、非死等），與 health chip 同語彙。 */
/* TLC-033:收課鈕/undo 條=唯一出口,無條件可見——sticky 貼 #classroomMain
   捲動口底(A26 實測:上方內容+46vh 字幕卡總高超出視窗,而卡的 overscroll
   contain 刻意不連動頁捲=鈕被推出視窗、卡上滑動又找不回)。z=30 蓋流內容、
   讓 sheet(60/61);max 捲動時鈕回歸流內自然位(卡後 12px gap)=末句不被永久遮。 */
#onAirPanel > #endClassBtn, #onAirPanel > #endingBar {
  position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
}
body.ending #endClassBtn { display: none; }
body.ending #endingBar { display: flex; }
#endingBar {
  display: none; align-items: center; justify-content: center; gap: 10px; margin-top: auto;
  background: var(--gold-soft); color: var(--gold-ink);
  border-radius: var(--r-btn); padding: 14px; min-height: 56px; font-size: 15px; font-weight: 700;
}
#endingCountdown { opacity: .65; font-variant-numeric: tabular-nums; }
#undoEndBtn {
  background: var(--gold); color: var(--gold-ink); border: none; border-radius: 10px;
  padding: 9px 18px; font-size: 15px; font-weight: 800; cursor: pointer;
}
#undoEndBtn:active { transform: scale(.97); }
#classroomHint { min-height: 20px; font-size: 13px; color: #FFB4A6; text-align: center; }

/* 課後只留可掃讀的上一堂收據；歷史全文仍在獨立頁，開下一堂保持主工作。 */
/* 開課頁 receipt=安靜一行收尾確認(金勾 + 「Lớp trước · 時長 · đã lưu」);非數據卡。
   attendance 已移除(設計盤查:數位加入≠班級人數、0 打臉信心);極短課由 JS 判 <30s 不顯。 */
/* VT-6043: the school's hours, one quiet line; gold when running low, the hint's
   warm red when a class cannot start. */
#schoolBalance { color: var(--chalk-dim); font-size: 13px; font-weight: 600; }
#schoolBalance[hidden] { display: none !important; }
#schoolBalance[data-tone="low"] { color: var(--gold); }
#schoolBalance[data-tone="out"] { color: #FFB4A6; }
/* VT-6856: a quiet text button under the school line; the sheet reuses the roster's look. */
#studentPwBtn, #buyMinutesBtn { background: none; border: none; padding: 6px 0; color: var(--chalk-dim); font: inherit;
  font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
#studentPwBtn[hidden], #buyMinutesBtn[hidden] { display: none !important; }
#studentPwSheetBackdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; animation: bdIn .22s ease-out; }
#studentPwSheet { --cell-inset: 14px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--green); color: var(--chalk); border-radius: 20px 20px 0 0;
  padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 78vh; overflow-y: auto;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .5); animation: ssUp .22s ease-out; }
#studentPwSheet[hidden], #studentPwSheetBackdrop[hidden] { display: none; }
#studentPwSheet.sheet-out { animation: ssDown .18s ease-in forwards; pointer-events: none; }
#studentPwSheetBackdrop.sheet-out { animation: bdOut .18s ease-in forwards; pointer-events: none; }
#studentPwTitle { font-size: 15px; font-weight: 800; letter-spacing: .14em; color: var(--chalk-dim); }
#studentPwClose { background: none; border: none; color: var(--chalk-dim); font-size: 18px; padding: 6px 8px; cursor: pointer; }
#studentPwLead { margin: 4px 0 12px; font-size: 13px; line-height: 1.5; color: var(--chalk-dim); }
#studentPwSearch { width: 100%; box-sizing: border-box; min-height: 44px; border-radius: 12px; border: none;
  padding: 0 var(--cell-inset); font: inherit; font-size: 15px; background: var(--paper); color: var(--ink); }
.sp-sub { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.sp-off { font-size: 12px; color: var(--ink-soft); justify-self: end; padding-right: 10px; }
.sp-reset { justify-self: end; background: none; border: none; padding: 0 10px; color: var(--gold-ink);
  font-weight: 800; font-size: 13px; min-height: 44px; cursor: pointer; }
.sp-result { grid-column: 1 / -1; padding: 2px 10px var(--cell-inset) 0; font-size: 13px; line-height: 1.45; }
.sp-pw { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 6px; }
.sp-pw b { font: 800 24px/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .08em; user-select: all; }
.sp-pw button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--ink-soft);
  background: none; color: var(--ink); font-weight: 700; font-size: 13px; cursor: pointer; }
.sp-note { padding: 18px 4px; font-size: 13px; color: var(--chalk-dim); line-height: 1.5; }
#studentPwBody .rs-row { grid-template-columns: 1fr auto; }
@media (prefers-reduced-motion: reduce) {
  #studentPwSheet, #studentPwSheetBackdrop, #studentPwSheet.sheet-out, #studentPwSheetBackdrop.sheet-out { animation: none; }
}
#lastClassReceipt { display: none; align-items: center; gap: 8px; color: var(--chalk-dim); font-size: 13px; font-weight: 600; }
#lastClassReceipt[hidden] { display: none !important; }
body.ended #lastClassReceipt:not([hidden]) { display: flex; }
#lastClassReceipt .rc-check { color: var(--gold); flex: 0 0 auto; }
#lastClassReceipt #receiptDuration { color: var(--chalk); font-weight: 800; font-variant-numeric: tabular-nums; }
#lastClassReceipt #receiptStudents[hidden] { display: none; }

/* 低高度橫向才重新 composition：H6 用寬度換回完整首屏，roomy tablet/desktop 不擴 blast radius。 */
@media (orientation: landscape) and (min-width: 700px) and (max-height: 500px) {
  /* pre-class 橫版重排(Tesla,user 拍板 mockup):主構圖(課名+開課大鈕)水平置中成一組、
     頁碼+上堂回執壓成底部 compact 條 → 一屏塞下、零裁切、留白對稱。 */
  body.pre-class #preClassPanel,
  body.starting #preClassPanel,
  body.ended #preClassPanel {
    display: flex; flex-direction: column; justify-content: safe center;
    width: 100%; max-width: 1000px; margin: 0 auto;
    /* 內容自然高垂直置中;鍵盤/更矮視口時 safe center 靠上不壓疊,#classroomMain 捲動把焦點輸入推到鍵盤上方 */
  }
  #preClassMain {
    flex: none; display: flex; flex-direction: row; align-items: center; justify-content: center;
    gap: clamp(36px, 7vw, 96px);
  }
  #courseCardContent { flex: 0 1 auto; gap: 8px; }
  .subject-card { font-size: clamp(30px, 4.6vw, 42px); }
  /* 兩主角同線:task 欄「鈕下方 caption+hint」固定 ~82px、鈕上方無物 → 把鈕頂高 ~28px(近定值,
     不隨鈕高變);微下移 task 讓「開課大鈕」中心落到「課名」中心線上(align-items 只對齊區塊,不對錨點)。 */
  #preClassTask { flex: none; width: clamp(200px, 30%, 300px); align-self: center; margin-top: 0;
    transform: translateY(28px); }
  /* 鈕高綁視口「高度」(vh),真 H6 397px 才塞得下(prev bug:綁 22vw→150px 在矮屏溢框) */
  #preClassActions #startClassBtn { min-height: clamp(78px, 22vh, 138px); }
  /* 底部 compact 條:頁碼 + 上堂回執並排、拿掉高卡外框、hairline 分隔貼底(空時不顯線) */
  /* row-gap 小:hours 行一長就自成一列、其下的連結鈕(44px)要在 397px 矮屏內塞得下(VT-7401) */
  #preClassFooter { flex-direction: row; align-items: center; gap: 8px clamp(14px, 3vw, 30px); flex-wrap: wrap; }
  #preClassFooter:has(> :not([hidden])) { border-top: 1px solid var(--green-hair); padding-top: 12px; margin-top: 10px; }
  #preClassFooter #pageRangeField { align-items: center; gap: 10px; padding: 0; border: none; background: none; grid-template-columns: none; }
  #preClassFooter #pageRangeField:not([hidden]) { display: flex; }
  #preClassFooter #pageRangeField > label { font-size: 12px; }
  #preClassFooter .page-range-inputs input { min-height: 44px; width: 54px; font-size: 15px; }
  #preClassFooter #pageRangeHint { display: none; }
  /* 回執(唯讀一行)推到右側、以 hairline 分隔線與「頁碼(要輸入)」隔開——兩種概念 */
  #preClassFooter #lastClassReceipt { gap: 8px; padding: 0 0 0 clamp(14px, 3vw, 26px);
    border: none; border-left: 1px solid var(--green-hair); background: none; margin-left: auto; }
  #preClassFooter #lastClassReceipt:not([hidden]) { display: flex; }

  /* 課中(on-air)橫向:結束鈕從全寬縮成右角。老師極少按結束,但 TLC-033 讓紅鈕 sticky 浮在
     #classroomMain 捲動口底、疊在字幕卡上(z-index:30);原全寬紅鈕(一整列 ≥56px)在 397px 矮機
     恰好遮住字幕卡「整條」底列——老師最需要看的最新翻譯行被蓋掉(VT-3224 實機實證)。縮成右角
     自適寬小鈕後,只遮字幕卡右下角、露出更多最新行。後續(收合態字幕卡改 flex 填滿、見收合規則)卡底更收
     斂到 End 鈕「之上」,矮機也不再壓到字幕。保留 sticky(唯一出口、無條件可見、捲到底落回字幕下方自然位)。純 CSS、無 JS、無新動畫
     (低配平板 Adreno 306 弱 GPU,避重效果)。 */
  #onAirPanel > #endClassBtn,
  #onAirPanel > #endingBar {
    align-self: flex-end;
    width: auto; min-width: 0; margin: 0;
    padding: 10px 20px; min-height: 44px;
  }
  /* 矮橫版:QR 已填滿高度(下方無空間)、End 佔右下角——copy(QR 下方)會撞 End,故隱藏。copy 是 bonus
     分享(開課自動 copy 已入剪貼簿;QR+code 為主要加入途徑),橫向打包態省它零損。 */
  .code-qr-col #copyJoinBtn { display: none; }
}

/* ON AIR HUD(v3:輕量單行,不做粗 pill) */
#onAirBar {
  display: flex; align-items: center; gap: 10px; white-space: nowrap; flex-wrap: wrap;
  color: var(--chalk-dim); padding: 4px 2px;
  font-weight: 800; letter-spacing: .14em; font-size: 13px;
}
/* 右群組:收合 code chip + 提問徽章 + 門禁 pill 貼右成一組(chip 貼 pill 左緣);
   收合態不再多吃一整列(矮 landscape 把高度還字幕)。窄視口整組 flex-wrap 掉第二行避免撐破。 */
#onAirBar .bar-right { margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
#onAirBar .bar-right #qaBadge { margin-left: 0; }
#onAirBar .bar-right #viewerCountMirror { margin-left: 0; }
.onair-dot { width: 9px; height: 9px; border-radius: 50%; background: #FF6B52; animation: onairPulse 1.6s ease-in-out infinite; }
@keyframes onairPulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .onair-dot { animation: none; } }
#classTimer { font-variant-numeric: tabular-nums; color: var(--gold); letter-spacing: 0; font-size: 14px; }
#viewerCountMirror { margin-left: auto; font-weight: 500; font-size: 12px; color: var(--chalk-dim); letter-spacing: .04em; }

/* v3:code=板書(spec §3 display 例外;後排可抄)。classroom.js 顯示格式:
   ClassroomCore.formatRoomCodeDisplay(roomId) → width:min-content 於空格自然斷成三行 */
/* codeRow:code 左、QR 右上並列(填右上空白;feedback 2026-07-08） */
#codeRow { display: flex; align-items: flex-start; gap: 12px; }
#classCodeWrap { text-align: left; flex: 1; min-width: 0; }
#classCodeWrap .lbl { font-size: 12px; letter-spacing: .22em; font-weight: 700; color: var(--chalk-dim); }
#classCode { font-size: 52px; font-weight: 800; letter-spacing: .04em; line-height: 1.12; font-variant-numeric: tabular-nums; width: min-content; margin: 8px 0 4px; }
#classCodeHint { font-size: 13px; color: var(--chalk-dim); line-height: 1.5; margin: 8px 0 0; }
/* TLC-021③:分享鈕——chalk 外框藥丸,copied 態翻金(行動=金;不進 pro/standard)。
   置於右欄(.code-qr-col,flex-end)貼 QR 下方=真正貼右緣、與 QR 同組「取得加入連結」;
   不再浮在 classCodeWrap 中段(QR 佔右上、下方留白)顯醜。 */
#copyJoinBtn { align-self: flex-end; padding: 7px 14px; border: 1.5px solid var(--chalk-dim);
  border-radius: 999px; background: none; color: var(--chalk); font-size: 13px; font-weight: 700;
  white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#copyJoinBtn.copied { border-color: var(--gold); color: var(--gold); }
#classQr { flex: 0 0 auto; background: var(--paper); border-radius: 12px; padding: 10px 10px 6px; text-align: center; box-shadow: 0 10px 20px -10px rgba(0,0,0,.45); cursor: pointer; } /* QR=憑證:紙質保留、角度歸零(歪讀成印壞;紙隱喻留給內容卡);點=投影模式 */
/* QR 顏色契約(HANDOFF 6):vendor svg 硬編碼 fill 為呈現屬性,CSS 覆蓋之(ink/paper=11:1 掃碼對比) */
#classQr svg rect { fill: var(--paper); }
#classQr svg path { fill: var(--ink); }
#classQr svg, #classQr .qr-slot { width: 108px; height: 108px; display: block; }
.qr-slot { background: repeating-conic-gradient(var(--ink) 0% 25%, var(--paper) 0% 50%) 0 0/12px 12px; opacity: .85; }
#classQr .qr-cap { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 10px; color: #6E6A58; font-weight: 700; letter-spacing: .06em; margin-top: 4px; }
#classQr .qr-max { width: 12px; height: 12px; flex: 0 0 auto; } /* 放大角標貼標籤旁,不碰 QR 靜區 */

/* ── QR 投影模式(2026-07-14):收班物理=可掃距離≈QR 邊長×10。108px 紙條→講台前排隊;
     全螢幕紙底(對比最大化)→70cm、投影機→全教室。z70>sheet 61;ending 進場即關(undo 條不可被蓋)。 ── */
#qrProjection { position: fixed; inset: 0; z-index: 70; background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; cursor: pointer; animation: qrProjIn .18s ease-out;
  outline: none; } /* dialog 程式 focus(tabindex=-1)不畫系統藍框;鍵盤仍 Esc/Enter 可關 */
#classQr:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; } /* 鍵盤走訪=金色系統色,非瀏覽器藍 */
#qrProjection[hidden] { display: none; }
@keyframes qrProjIn { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #qrProjection { animation: none; } }
#qrProjQr svg { width: min(80vw, 52vh); height: min(80vw, 52vh); display: block; }
#qrProjQr svg rect { fill: var(--paper); }  /* vendor 硬編碼 white/black;paper/ink 覆蓋同 #classQr 規則 */
#qrProjQr svg path { fill: var(--ink); }
#qrProjMeta { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#qrProjCode { font-size: clamp(30px, 9.5vw, 58px); font-weight: 800; letter-spacing: .04em; color: var(--ink); font-variant-numeric: tabular-nums; max-width: 92vw; text-align: center; } /* 房號字母表含 W:最寬碼 4-4-4 空格自然換行,不溢視口(Gate-2 #4) */
#qrProjHint { font-size: 15px; font-weight: 700; color: var(--ink-soft); }
#qrProjClose { font-size: 12px; color: #6E6A58; letter-spacing: .08em; margin-top: 10px; }
@media (orientation: landscape) { /* 橫向=row(Gate-1 U3:56vh 只剩 231px 不配叫全螢幕) */
  #qrProjection { flex-direction: row; gap: 7vw; }
  #qrProjQr svg { width: min(74vh, 44vw); height: min(74vh, 44vw); }
  #qrProjCode { font-size: clamp(30px, 9.5vh, 58px); max-width: 42vw; }
}

/* 字幕預覽紙卡:貼合內容(非撐滿→captions 少時不空白大白板)、新句靠底、interim 即時行。
   feedback 2026-07-09:白塊改貼合內容 + interim 即時感 + 溢出頂部柔化(不硬切半行)。 */
#onAirPanel > #captionPreview { margin-top: auto; }  /* 靠下,上方留給 code/QR */
/* 展開 code 態(非收合):sticky 全寬 End 浮在捲動口底,會蓋住 auto-scroll 貼底的字幕最新句
   (實測 overlap 直版 92px / 橫版 274px)。給字幕內捲內容「底部預留 = End 高度」的淨空 → 最新句永遠
   浮在 End 上方不被吃。收合態的 End↔字幕淨空由既有 flex 修法(code-collapsed)處理,故 :not() 排除。 */
#onAirPanel:not(.code-collapsed) > #captionPreview { margin-bottom: calc(72px + env(safe-area-inset-bottom)); }
#captionPreview {
  background: var(--paper); color: var(--ink);
  border-radius: var(--r-card); padding: 12px 16px;
  font-size: 15px; line-height: 1.5;
  display: flex; flex-direction: column; gap: 9px;
  /* 卡片內捲動:少字幕時內容高(短卡、不留白塊),多字幕到 46vh 上限就在卡內捲，
     老師可用手指往上捲看歷史(user 回饋 2026-07-09「滑不太動、想往上看」)。
     移除舊的 justify-content:flex-end——Safari/WKWebView 對 column+flex-end+overflow
     有頂端捲不到的已知 bug;卡片本就內容高,少字幕短卡故無需 flex 對齊。 */
  max-height: 46vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;   /* 捲到頂/底不連動外層頁面 */
}
#captionPreview:empty { display: none; }             /* 沒字幕就不佔位、不留白塊 */
/* 展開態直版字幕 fit(2026-07-21 H6 實機):base max-height:46vh 是「高度相對、位置盲」——展開態卡從 code 下方
   起,再 +46vh 就伸出視口底、最新句躲進 sticky End 後(實測三視口 endOverlaps/newestBehindEnd 皆真、頁捲 178px)。
   line 355 的 72px 只在「捲到最底」才淨空,但展開態停在頂端秀 code,故失效。直版有垂直空間 → 對稱「收合態
   flex-shrink」同一機制(Tesla 一致性):kill 頁捲 + 字幕卡 flex:0 1 auto 填「code 與 End 之間的可用空間」,少字幕
   content-hug、多字幕封頂內捲貼底,最新句永遠在有界卡底、End 淨空、不出視口、不页捲。橫版矮機(code+QR 本就
   溢出、End 已縮右下角小鈕)維持 line 355 的 72px 捲動淨空,不進本分支。 */
/* min-height:660 = 只在「直版且夠高裝下大 code + 一行字幕 + End」時才 kill 頁捲做 flex-fit。涵蓋 H6(770)、
   iPhone SE(667)以上所有現代手機;更矮/更窄的老機(codeRow 因窄寬撐高)裝不下 → 退回 line 355 的 72px
   捲動淨空(如橫版),避免 overflow:hidden 反把 code/End 裁掉。 */
@media (orientation: portrait) and (min-height: 660px) {
  body.on-air:not(.code-collapsed) #classroomMain { overflow: hidden; min-height: 0; }
  #onAirPanel:not(.code-collapsed) { min-height: 0; }
  #onAirPanel:not(.code-collapsed) > #captionPreview:not(:empty) {
    flex: 0 1 auto; min-height: 4.5em; max-height: none; margin-top: 0;
    margin-bottom: env(safe-area-inset-bottom, 0px);
  }
}
/* interim 即時行:僅 vi、較淡、金色游標(老師看到「正在講」) */
#captionPreview .cp-interim .vi { color: var(--ink-soft); }
#captionPreview .cp-interim::after { content: "▍"; color: var(--gold); animation: cpBlink 1s steps(1) infinite; }
@keyframes cpBlink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #captionPreview .cp-interim::after { animation: none; } }
/* 復原/健康列:gold-soft chip 幾何(非填色鈕;金色消歧規則) */
#classHealth {
  display: flex; align-items: center; gap: 8px;
  background: var(--gold-soft); color: var(--gold-ink);
  border-radius: 11px; padding: 8px 10px 8px 12px; font-size: 12px; font-weight: 700;
}
#classHealth .ch-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex: 0 0 auto; animation: cpBlink 1.2s steps(1) infinite; }
#classHealth .ch-msg { flex: 1; }
#classHealthBtn {
  border: none; border-radius: 8px; padding: 6px 12px; font-family: var(--font-hieu);
  font-size: 12px; font-weight: 700; background: var(--gold); color: var(--green); cursor: pointer;
}
#classHealthBtn:active { transform: scale(.97); }
#captionPreview .cp-pair .vi { display: block; font-size: 12px; color: var(--ink-soft); }
#captionPreview .cp-pair .en { display: block; font-weight: 700; margin-top: 2px; }

/* starting:loading 進 Start 鈕內——回饋就在老師按下的那顆鈕(spinner+文字換掉標籤);
   文字走 i18n(修掉原 CSS `content` 硬編越南文的 i18n 洩漏:英文介面也吐越南 loading)。 */
#startClassBtn { display: flex; align-items: center; justify-content: center; }
body.starting #startClassBtn { pointer-events: none; }
#startClassBtn .btn-loading { display: none; align-items: center; justify-content: center; gap: 8px; }
#startClassBtn .btn-spinner { width: 16px; height: 16px; flex: 0 0 auto; border: 2.5px solid rgba(23, 37, 31, .25);
  border-top-color: var(--green); border-radius: 50%; animation: button-spin .8s linear infinite; }
body.starting #startClassBtn .btn-label { display: none; }
body.starting #startClassBtn .btn-loading { display: inline-flex; }
@media (prefers-reduced-motion: reduce) { #startClassBtn .btn-spinner { animation: none; } }

/* v3:ended 成績單寫在板上(display 例外) */
#endedMsg { font-size: 12px; font-weight: 700; letter-spacing: .22em; color: var(--chalk-dim); text-transform: uppercase; }
#endedStats { display: flex; gap: 34px; margin: 18px 0 6px; }
#endedStats div b { display: block; font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
#endedStats div span { font-size: 11px; letter-spacing: .14em; color: var(--chalk-dim); font-weight: 700; }

/* ── 科目×年級×冊別切換──
   卡片=切換入口(Apple:狀態即控制;點卡片→底部選單)。
   中文成功 toast(vocabulary-standard 共用字串「已載入…詞庫」)不進 Hiểu 皮:卡片 sub 已承載
   「Đã nạp…」回饋 → 只遮 success/info(Gate-2 必修#4:error/warning 承載 auth/quota/裝置錯誤,
   寧可中文可見也不可盲)。classroom.css 僅 classroom 載,C4 零共用面。 */
body.classroom-mode .operation-toast.success,
body.classroom-mode .operation-toast.info { display: none !important; }

/* 入口=科目名本身(Tesla 裁決 2026-07-10:點狀態行不該有副作用——唯一熱區=標題+⌄,
   眉標/詞庫狀態行純顯示;「Chạm để đổi」微文案刪除,金 ⌄ 即 affordance)。 */
#subjectTitleTap { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; }
#subjectTitleTap:active { opacity: .82; }
#subjectChevron { flex-shrink: 0; margin-top: 6px; }

#subjectSheetBackdrop, #vocabSheetBackdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; }
#subjectSheet, #vocabSheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--green); color: var(--chalk);
  border-radius: 20px 20px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 78vh; overflow-y: auto; box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
  animation: ssUp .22s ease-out; }
@keyframes ssUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
#subjectSheet[hidden], #subjectSheetBackdrop[hidden],
#vocabSheet[hidden], #vocabSheetBackdrop[hidden] { display: none; }
.ss-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
#subjectSheetTitle, #vocabSheetTitle { font-size: 15px; font-weight: 800; letter-spacing: .14em; color: var(--chalk-dim); text-transform: uppercase; }
#subjectSheetClose, #vocabSheetClose { background: none; border: none; color: var(--chalk-dim); font-size: 18px; padding: 6px 8px; cursor: pointer; }
.ss-group { margin-top: 14px; }
.ss-group .ss-subject { font-size: 14px; font-weight: 700; color: var(--chalk); margin-bottom: 8px; }
.ss-grades { display: flex; flex-wrap: wrap; gap: 8px; }
.ss-chip { min-width: 52px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(245, 241, 227, .22);
  background: none; color: var(--chalk); font-size: 15px; font-weight: 700; cursor: pointer; }
.ss-chip.ss-active { background: var(--gold); border-color: var(--gold); color: var(--green); }
.ss-row { display: block; width: 100%; text-align: left; margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(245, 241, 227, .22); background: none; color: var(--chalk); font-size: 15px; font-weight: 700; cursor: pointer; }
.ss-row.ss-active { background: var(--gold); border-color: var(--gold); color: var(--green); }
.ss-empty { color: var(--chalk-dim); font-size: 14px; padding: 18px 0; }

/* ── 詞彙行 + 詞彙清單(2026-08-04)──
   副標改 button 是為了拿原生鍵盤與 a11y;這裡把 UA 預設全部歸零,
   讓它在版面上與原本的 span 完全等價(H6 卡片幾何由 browser_contract 守著)。 */
.vocab-line { display: flex; align-items: center; gap: 5px; margin-top: 14px;
  position: relative; width: 100%; background: none; border: 0; padding: 0;
  font: inherit; color: inherit; text-align: left; -webkit-appearance: none; appearance: none; }
.vocab-line:not(:disabled) { cursor: pointer; }
/* 44px 觸控目標不改變盒高——H6 橫向卡片沒有多餘垂直空間可讓。 */
.vocab-line:not(:disabled)::after { content: ''; position: absolute; left: 0; right: 0;
  top: 50%; transform: translateY(-50%); height: 44px; }
.vocab-chevron { margin-left: auto; flex-shrink: 0; color: var(--chalk-dim); }
.vocab-line:disabled .vocab-chevron { visibility: hidden; }
/* 零詞=引擎那堂課只吃 general context;金色讓它在餘光裡就能被發現。 */
.vocab-line.vocab-zero #subjectCardSub { color: var(--gold); }
.vs-group { margin-top: 14px; }
.vs-group-head { font-size: 13px; font-weight: 700; letter-spacing: .06em;
  color: var(--chalk); margin-bottom: 6px; }
.vs-group.vs-nearby .vs-group-head, .vs-group.vs-nearby .vs-row { opacity: .55; }
.vs-row { display: flex; gap: 10px; padding: 4px 0; font-size: 14px; }
.vs-term { color: var(--chalk); flex: 0 0 45%; }
.vs-en { color: var(--chalk-dim); flex: 1; }
.vs-actions { margin-top: 14px; }
#vocabUseWholeBtn { background: none; border: 1px solid var(--gold); color: var(--gold);
  border-radius: 8px; padding: 10px 14px; font: inherit; cursor: pointer; }

/* ── Q&A v1:學生提問卡(2026-07-10)。紙=內容(品牌:板=狀態、紙=內容);
   正常流置於 classHealth 後 codeRow 前,不 absolute(一張 active 卡,不推擠 QR/字幕)。 */
#questionCard { background: var(--paper); color: var(--ink); border-radius: 14px;
  padding: 14px 16px; margin: 6px 0 2px; cursor: pointer;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5); transform: rotate(-.4deg);
  animation: qcIn .25s ease-out; -webkit-tap-highlight-color: transparent; }
/* 矮橫版(H6/Q8 in-app)問題卡與收合字幕卡(flex 填滿)共存時,問題卡的 chrome(~120px)在 ~397px 高上會
   把總高擠爆——給它一個上限 + 內捲(長問題卡內捲),使「問題卡 + 字幕(至少一行)+ footer」永遠塞得下、字幕
   不被切、footer 不壓。只在矮橫版生效(Q8 600/直向自然高度低於此上限,不受影響)。 */
@media (orientation: landscape) and (max-height: 500px) {
  /* scope 到 .code-collapsed:問題卡是「第一個問題→收合」後才與填滿字幕卡共存的;非收合(入班期)不動。
     16vh 上限(+內捲):在最緊的 ~397px 上,讓「問題卡 + 字幕(至少完整一句,見 min-height)+ footer」都塞得下、
     不捲不重疊;長問題卡內捲。此為對無界問題卡的針對性護欄(非核心機制)。 */
  #onAirPanel.code-collapsed #questionCard { max-height: 16vh; overflow-y: auto; }
  /* Block 3 消擠:全寬 band 停止堆疊吃高——健康列縮單行 chip、code chip/bar 收邊距。
     還出的高度由字幕卡(已 flex:0 1 auto 填滿可用空間)自然吃回,最新句不再被切。 */
  #classHealth { padding: 5px 8px 5px 10px; font-size: 11px; }
  #classHealth .ch-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #classHealthBtn { padding: 4px 10px; font-size: 11px; flex: 0 0 auto; }
  #onAirBar { padding: 2px 2px; }
}
@keyframes qcIn { from { transform: translateY(8px) rotate(-.4deg); opacity: 0; } to { transform: rotate(-.4deg); opacity: 1; } }
#questionCard[hidden] { display: none; }
#questionCard .qc-eyebrow { display: block; font-size: 11px; letter-spacing: .18em;
  font-weight: 800; color: var(--gold-ink); margin-bottom: 6px; }
#qcVi { font-size: 18px; font-weight: 700; line-height: 1.35; }
#qcEn { font-size: 13px; color: var(--ink-soft); margin-top: 4px; line-height: 1.35; }
#qcEn:empty { display: none; }
#questionCard .qc-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; }
#qcMore { font-size: 12px; font-weight: 700; color: var(--gold-ink); }
#questionCard .qc-hint { font-size: 11px; color: var(--ink-soft); }

/* ── Q&A 相位化+徽章+回看(2026-07-10 user 現場回饋)──
   房號/QR 過了入班期=死重量 → 收 chip;點卡=收進徽章不丟;點徽章=回看列表。 */
#qaBadge { margin-left: 10px; padding: 3px 10px; border-radius: 999px; border: none;
  background: var(--gold); color: var(--gold-ink); font-size: 12px; font-weight: 800;
  cursor: pointer; font-family: inherit; }
#qaBadge[hidden] { display: none; }
#qaBadge.qa-pulse { animation: qaPulse 1s ease-in-out 2; }
@keyframes qaPulse { 50% { transform: scale(1.15); } }
/* Block 2 收合 chip:對齊 mockup 的極簡藥丸——content-hug、qr 圖示 + code + 圓形展開鈕,
   拿掉 Mã:/QR/「Chạm để phóng to」冗字(展開鈕已表達;鎖態改由頂條 pill 常駐,chip 鎖角標只在鎖時小顯)。
   整條 chip 仍是單一點擊目標=展開(自動收合 VT-3166 不動)。 */
#codeChip { display: inline-flex; align-items: center; gap: 8px; margin: 0;
  padding: 5px 5px 5px 12px; border-radius: 999px; border: 1px solid var(--chalk-dim);
  color: var(--chalk); font-size: 13px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#codeChip[hidden] { display: none; }
#codeChip b { letter-spacing: .12em; font-weight: 800; }
#codeChip .cc-qr-ic { flex: 0 0 auto; opacity: .85; }
#codeChip .cc-expand-ic { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 27px; height: 27px; border-radius: 999px; background: rgba(244, 241, 224, .1); color: var(--chalk); }
#classCodeWrap .lbl { display: flex; align-items: center; gap: 6px; }
/* 展開 splash:Collapse 錨在 QR 正上方、右對齊(面板右上角=「最小化」慣例位,不浮在中間) */
.code-qr-col { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 0 0 auto; }
/* 收合鈕=icon-only 圓鈕(去「Thu gọn」文字,右欄瘦身;整片大 code 仍可點收合=主要 affordance) */
#collapseCodeBtn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 34px; height: 34px; background: rgba(244, 241, 224, .06); border: 1px solid rgba(244, 241, 224, .26);
  border-radius: 999px; color: var(--chalk); cursor: pointer; -webkit-tap-highlight-color: transparent; }
#collapseCodeBtn:active { transform: scale(.97); }
#collapseCodeBtn svg { width: 15px; height: 15px; flex: 0 0 auto; }
#codeRow[hidden] { display: none; }
#classCodeWrap { cursor: pointer; -webkit-tap-highlight-color: transparent; }
#qaSheetBackdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; }
#qaSheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--green); color: var(--chalk);
  border-radius: 20px 20px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 78vh; overflow-y: auto; box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
  animation: ssUp .22s ease-out; }
#qaSheet[hidden], #qaSheetBackdrop[hidden] { display: none; }
#qaSheetTitle { font-size: 15px; font-weight: 800; letter-spacing: .14em; color: var(--chalk-dim); }
#qaSheetClose { background: none; border: none; color: var(--chalk-dim); font-size: 18px; padding: 6px 8px; cursor: pointer; }
.qa-row { background: var(--paper); color: var(--ink); border-radius: 12px; padding: 12px 14px;
  margin-top: 10px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.qa-row .qr-meta { font-size: 11px; letter-spacing: .12em; font-weight: 800; color: var(--gold-ink); }
.qa-row .qr-vi { font-size: 15px; font-weight: 700; margin-top: 3px; line-height: 1.35; }
.qa-row .qr-en { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.qa-row .qr-en:empty { display: none; }

/* ── 動效(2026-07-10 Gate-1):出場鏡像進場語彙(進場 ssUp 只 24px 位移 → 出場 24px 下沉
   +淡出,不做全幅 drawer 滑落);backdrop 補淡入+淡出(原本瞬現瞬滅);出場中鎖 pointer
   (必修#2);hidden 由 JS 在 animationend/backstop 後落地。reduced-motion 動畫全滅,
   JS 端 MOTION_OK 同步走硬切。 ── */
@keyframes ssDown { to { transform: translateY(24px); opacity: 0; } }
@keyframes bdIn { from { opacity: 0; } }
@keyframes bdOut { to { opacity: 0; } }

/* ── P2-8b roster sheet(對齊格照 mockup:--cell-inset 14px;列 grid 1fr 128px 44px;
   min-height 52px;lockRow 邊框內縮 1px 對齊)── */
#rosterSheetBackdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; }
#rosterSheet { --cell-inset: 14px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--green); color: var(--chalk);
  border-radius: 20px 20px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 78vh; overflow-y: auto; box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
  animation: ssUp .22s ease-out; }
#rosterSheet[hidden], #rosterSheetBackdrop[hidden] { display: none; }
#rosterSheetTitle { font-size: 15px; font-weight: 800; letter-spacing: .14em; color: var(--chalk-dim); }
#rosterSheetClose { background: none; border: none; color: var(--chalk-dim); font-size: 18px; padding: 6px 8px; cursor: pointer; }
/* 門禁 pill:從無邊框純計數 → 可見控制藥丸(邊框+底+chevron 一眼可點;鎖態常駐)。
   右錨 margin-left:auto 必保且用非 shorthand(免蓋 Gate-2 #8);縱向負 margin 收在 bar 內不撐高。 */
#viewerCountMirror { display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(244, 241, 224, .28); border-radius: 999px; background: rgba(244, 241, 224, .05);
  font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--chalk);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  padding: 5px 10px; margin-left: auto; margin-top: -3px; margin-bottom: -3px;
  flex-shrink: 0; white-space: nowrap; }
#viewerCountMirror:active { transform: scale(.98); }
/* 窄手機直版:pill 不縮不折;蛻去存取「文字」只留鎖/開圖示(狀態仍由圖示+金色表達),
   免「TRỰC TIẾP + 計時 + pill」在 ≤380px 撐爆換行。landscape fleet(769+)不受影響。 */
@media (max-width: 380px) {
  #viewerCountMirror .vc-sep, #viewerCountMirror #viewerAccessTxt { display: none; }
}
#viewerCountMirror .vc-sep { width: 1px; height: 12px; background: rgba(244, 241, 224, .24); flex: 0 0 auto; }
#viewerCountMirror .vc-access { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
#viewerCountMirror .vc-ic { width: 12px; height: 12px; flex: 0 0 auto; }
#viewerCountMirror .vc-ic-lock { display: none; }
#viewerCountMirror.access-locked .vc-ic-open { display: none; }
#viewerCountMirror.access-locked .vc-ic-lock { display: inline-block; }
#viewerCountMirror .vc-chev { width: 13px; height: 13px; opacity: .8; flex: 0 0 auto; }
#viewerCountMirror.access-locked { border-color: var(--gold); background: rgba(230, 195, 77, .13); }
#viewerCountMirror.access-locked .vc-access { color: var(--gold); }
#lockRow { margin-top: 12px; }
#lockToggle { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start;
  width: 100%; text-align: left; background: var(--paper); color: var(--ink);
  border: none; border-radius: 12px; padding: calc(var(--cell-inset) - 1px) var(--cell-inset);
  min-height: 52px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#lockToggle:disabled { opacity: .55; cursor: default; }
#lockToggle .lk-track { width: 40px; height: 24px; border-radius: 999px; background: var(--chalk-dim);
  position: relative; margin-top: 2px; transition: background .15s; }
#lockToggle .lk-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: left .15s; }
#lockToggle[aria-checked="true"] .lk-track { background: var(--gold); }
#lockToggle[aria-checked="true"] .lk-knob { left: 19px; }
#lockToggle .lk-title { display: block; font-weight: 800; font-size: 14px; }
#lockToggle .lk-hint { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 3px; line-height: 1.45; }
#rosterClassName { font-size: 12px; color: var(--chalk-dim); margin-top: 2px; }
#rosterClassName:empty { display: none; }
#rosterStale { margin-top: 10px; font-size: 12px; color: var(--chalk-dim); }
#rosterBody { margin-top: 10px; }
.rs-row { display: grid; grid-template-columns: 1fr 128px auto; gap: 8px; align-items: center;
  background: var(--paper); color: var(--ink); border-radius: 12px;
  /* mockup 對齊格:左 inset、右 4px(⋯ 鈕自帶內縮,右緣觸標貼齊)。
     尾欄 auto:Thử lại/Hoàn tác 比 44px 寬,固定欄會溢出(A26 實照設計盤點) */
  padding: 0 4px 0 var(--cell-inset); min-height: 52px; margin-top: 8px; }
/* blocked 列=單行一個事實「已移除,可復原」:note+Hoàn tác 同行,不留版面洞 */
.rs-row.rs-blocked { grid-template-columns: 1fr auto auto; }
.rs-row.rs-blocked { opacity: .72; }
.rs-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-presence { font-size: 12px; color: var(--ink-soft); }
.rs-presence .on { color: var(--clsrm-green, #24513F); font-weight: 700; }
.rs-more { justify-self: end; width: 44px; height: 44px; display: inline-flex; align-items: center;
  justify-content: center; background: none; border: none; color: var(--ink-soft);
  font-size: 18px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* 確認句=此刻主資訊:滿寬讀完,按鈕列落下行右對齊拇指區(A26 實照:
   擠成窄柱 4 行=可讀性坍塌) */
.rs-confirm { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: flex-end; align-items: center;
  padding: 2px 10px var(--cell-inset) 0; font-size: 13px; }
.rs-confirm .rc-q { flex: 1 1 100%; line-height: 1.45; }
.rs-confirm button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: none;
  font-weight: 700; font-size: 13px; cursor: pointer; }
.rs-confirm .rc-cancel { background: none; border: 1.5px solid var(--ink-soft); color: var(--ink); }
.rs-confirm .rc-kick { background: var(--red, #C1440E); color: #fff; }
.rs-undo, .rs-retry { justify-self: end; background: none; border: none; padding: 0 10px;
  color: var(--gold-ink); font-weight: 800; font-size: 13px; min-height: 44px; cursor: pointer; }
.rs-retry { color: var(--red, #C1440E); }
.rs-kicked-note { font-size: 12px; color: var(--ink-soft); }
.rs-spin { width: 14px; height: 14px; border: 2px solid rgba(0, 0, 0, .15);
  border-top-color: var(--ink-soft); border-radius: 50%; display: inline-block;
  animation: button-spin .8s linear infinite; vertical-align: -2px; }
.rs-skel { height: 52px; border-radius: 12px; margin-top: 8px;
  background: rgba(250, 246, 234, .18); animation: onairPulse 1.6s ease-in-out infinite; }
#rosterEmpty { padding: 18px 4px; font-size: 13px; color: var(--chalk-dim); line-height: 1.5; }
#codeLockBadge, #chipLockBadge { color: var(--gold); margin-left: 6px; vertical-align: -1px; }
/* SVG 不在 HTML namespace,UA 的 [hidden]{display:none} 不套用(prod 實照抓到:
   未鎖也顯示)→ 顯式規則;JS 端用 set/removeAttribute(SVGElement 無 .hidden 屬性) */
#codeLockBadge[hidden], #chipLockBadge[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .rs-skel, .rs-spin { animation: none; } }

#subjectSheetBackdrop, #qaSheetBackdrop, #rosterSheetBackdrop, #vocabSheetBackdrop { animation: bdIn .22s ease-out; }
#subjectSheet.sheet-out, #qaSheet.sheet-out, #rosterSheet.sheet-out, #vocabSheet.sheet-out { animation: ssDown .18s ease-in forwards; pointer-events: none; }
#subjectSheetBackdrop.sheet-out, #qaSheetBackdrop.sheet-out, #rosterSheetBackdrop.sheet-out,
#vocabSheetBackdrop.sheet-out { animation: bdOut .18s ease-in forwards; pointer-events: none; }
/* QR 收合展開:進場件(chip/row)fade-slide;字幕卡位移連續=JS FLIP inline transform */
#codeChip.code-in, #codeRow.code-in { animation: codeIn .2s ease-out; }
@keyframes codeIn { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) {
  #subjectSheet, #qaSheet, #rosterSheet, #subjectSheetBackdrop, #qaSheetBackdrop,
  #rosterSheetBackdrop, #subjectSheet.sheet-out, #qaSheet.sheet-out,
  #rosterSheet.sheet-out, #subjectSheetBackdrop.sheet-out, #qaSheetBackdrop.sheet-out,
  #rosterSheetBackdrop.sheet-out, #vocabSheet, #vocabSheetBackdrop, #vocabSheet.sheet-out,
  #vocabSheetBackdrop.sheet-out, #codeChip.code-in, #codeRow.code-in { animation: none; }
}

/* ── 相位化 v2(2026-07-10 user 現場截圖回饋)──
   收合態:字幕卡=主角(入班期 margin-top:auto 讓位規則換相,不再中央死白);
   空字幕時紙卡顯提示句(:empty 純 CSS,不碰引擎鏡射)。 */
/* 收合態(字幕升主角,margin-top:0 緊跟 chip):有字幕的卡「填滿」chip 與 End 鈕之間的空間、卡內捲動 →
   最新句永遠貼底可見、End 鈕永在卡下方不壓字幕,任何視口高度自適應。
   —— 更正舊 62vh 常數:矮橫版(H6/Q8 在 app WebView ~394–420px 高)62vh 太高會把 auto-scroll 貼底的最新句
      擠出框(老師看不到最新一句)、且 sticky End 鈕浮在卡上壓字幕(sunny/實機回報;實測 flex 版各高度零溢出、
      零重疊)。
   —— 呼應 Gate #5(當初以 62vh 否決 plain flex:1,因無字幕時 flex:1 會撐成全屏白板、違反「貼合內容」):
      本次用 :not(:empty) 把 fill 限定在「有字幕」才生效。收合態幾乎必有字幕(VT-3166 第一句才收合),而萬一
      手動收合尚無字幕 → :empty 分支仍 content-hug 顯提示短卡、不撐白板 → Gate #5 的原始理由已消解。 */
/* 收合態把字幕卡的高度交給 flex-shrink 決定(content-hug 少字幕、shrink+內捲多字幕)——需整條 flex 鏈能收:
   #classroomMain 收合態不自捲(overflow:hidden)並 min-height:0、#onAirPanel min-height:0,flex-shrink 才會把
   字幕卡壓到「可用空間」而非讓外層頁面捲(否則卡=content 全高、最新句在頁底看不到)。入班期(非收合)維持
   #classroomMain overflow-y:auto(大 code/QR 可捲)不受影響。 */
body.code-collapsed #classroomMain { overflow: hidden; min-height: 0; }
#onAirPanel.code-collapsed { min-height: 0; }
#onAirPanel.code-collapsed > #captionPreview { margin-top: 0; }
/* max-height:none 覆蓋 base 的 46vh 上限——收合態要「真填滿」可用空間(不被 46vh 這個 enrollment 用的常數
   反而封頂變小);flex:1 才是唯一的高度來源,由 flex 父容器(=視口−chrome−footer)界定。
   margin-bottom = safe-area inset:sticky footer 的 bottom=10px+inset,會把 footer 上抬 10+inset;caption 與
   footer 間本有 12px flex gap 吸收(inset=0 的機隊零影響),但瀏海機大 inset 時 10+inset>12 會抬進字幕——
   在 caption 下方補 inset 的 margin 讓 footer 永遠落在字幕外(fleet inset=0 → margin=0、無任何改變)。 */
#onAirPanel.code-collapsed > #captionPreview:not(:empty) {
    /* min-height = 一整個字幕 pair + 卡片上下 padding(4.5em≈67px、隨字級縮放,非硬編 px):即使問題卡/health
       擠壓,字幕卡也不縮到裝不下一句、最新句永遠完整可見(不被卡自身 overflow 裁掉);唯有極端多 banner 疊加
       塞不下時整體才捲。 */
    flex: 0 1 auto; min-height: 4.5em; max-height: none; margin-bottom: env(safe-area-inset-bottom, 0px);
}
/* 空字幕提示句:既有 #captionPreview:empty{display:none} 會整個藏掉(Gate #2)——
   收合態改為顯示短紙卡+::before 提示 */
#onAirPanel.code-collapsed > #captionPreview:empty { display: flex; }
#captionPreview:empty::before { content: 'Phụ đề sẽ hiện khi thầy cô bắt đầu nói…';
  color: var(--ink-soft); font-size: 14px; }
/* 徽章 v2:紙底墨字(黃底+黃✋對比差)+右錨定(timer 寬度變動不再推擠)+tabular 計數。
   HS 保留 auto 右錨(徽章 hidden 時仍靠右);徽章可見時由相鄰 selector 歸零、父層 gap 供距。 */
#qaBadge { margin-left: auto; background: var(--paper); color: var(--ink);
  min-width: 48px; text-align: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
#qaBadgeN { font-variant-numeric: tabular-nums; }
#qaBadge:not([hidden]) + #viewerCountMirror { margin-left: 0; }

/* ── Q&A v1.5:sheet 票數/已答/行內回覆 ── */
.qa-row .qr-ans { font-size: 13px; color: var(--ink); margin-top: 6px; padding: 6px 8px;
  background: var(--gold-soft); border-radius: 8px; }
.qr-reply-btn { margin-top: 8px; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--gold-ink);
  background: none; color: var(--gold-ink); font-size: 12px; font-weight: 700; cursor: pointer; }
.qr-reply { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.qr-reply input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--hair); font-size: 14px; }
.qr-reply button { padding: 8px 14px; border-radius: 8px; border: none;
  background: var(--gold); color: var(--gold-ink); font-weight: 800; font-size: 13px; cursor: pointer; }
.qr-reply-st { font-size: 11px; color: var(--ink-soft); }

/* ── 圖標語言統一(2026-07-10 user 裁決):lucide 線條 inline SVG,currentColor;棄 emoji ── */
.qa-ic { width: 14px; height: 14px; vertical-align: -2px; }
#qaBadge { display: inline-flex; align-items: center; gap: 5px; }
#qaBadge .qa-ic { width: 15px; height: 15px; }
#qcVotes { display: inline-flex; margin-left: 8px; }
.qr-votes { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; color: var(--gold-ink); }
.qr-done { margin-left: 10px; color: var(--gold-ink); }

/* ── VT-8621 老師按鈕暫停 ──
   HUD 內小藥丸(次要動作;下課紅鈕仍是唯一大出口)。暫停中:HUD 改「TẠM DỪNG」、
   紅點轉靜止金點、HUD 下方 gold-soft 條給大顆「Tiếp tục」(≥48px)。 */
#onAirBar .onair-held { display: none; }
body.class-held #onAirBar .onair-live { display: none; }
body.class-held #onAirBar .onair-held { display: inline; color: var(--gold); }
body.class-held .onair-dot { animation: none; background: var(--gold); }
#pauseClassBtn {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 12px; border: 1.5px solid var(--chalk-dim); border-radius: 999px;
  background: none; color: var(--chalk); font: inherit; font-size: 13px; font-weight: 700;
  letter-spacing: .02em; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
#pauseClassBtn::after { content: ""; position: absolute; inset: -6px -2px; } /* 觸控熱區 ≥44px */
#pauseClassBtn:active { transform: scale(.97); }
#pauseClassBtn:focus-visible, #resumeClassBtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
body.class-held #pauseClassBtn, body:not(.on-air) #pauseClassBtn { display: none; }
#heldBar {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px;
  background: var(--gold-soft); color: var(--gold-ink); border-radius: var(--r-btn);
}
#heldBar[hidden], body.ending #heldBar { display: none; }
#heldBar .hb-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
#heldBar .hb-text b { font-size: 16px; font-weight: 800; }
#heldBar .hb-text span { font-size: 13px; font-weight: 600; line-height: 1.4; }
#resumeClassBtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: 0 0 auto;
  min-height: 48px; padding: 10px 20px; border: none; border-radius: 12px;
  background: var(--gold); color: var(--gold-ink); font: inherit; font-size: 17px; font-weight: 800; cursor: pointer;
}
#resumeClassBtn:active { transform: scale(.97); }
