/* Vinci AI 品牌色（來自 logo 設計指引 2026.06.16）*/
[hidden] { display: none !important; }
/* 設計變數在 tokens.css（先載入）；這裏只保留無障礙面板調整的兩個變數 */
:root { --font-scale: 1; --line: 1.55; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { font-size: calc(14px * var(--font-scale)); }
body { background: var(--color-bg); color: var(--color-text); font-family: var(--font-sans); line-height: var(--line); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, h4 { color: var(--color-text-strong); line-height: 1.25; }
/* 雙色焦點框：2px 靛藍外移 2px，內側 2px 白色光環（憲法第 14.4 節） */
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--color-surface); }

.app { display: flex; height: 100vh; }

/* ---------- 側欄（設計憲法第 13.4 節）：導航物料、248px、可收合為 72px ---------- */
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 200; background: var(--color-surface); color: var(--color-accent-text); padding: 8px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-2); font-weight: 600; }
.skip-link:focus { top: 12px; }
.sidebar { width: var(--nav-width); flex-shrink: 0; background: var(--color-nav); -webkit-backdrop-filter: var(--nav-blur); backdrop-filter: var(--nav-blur); border-right: 1px solid var(--color-line);
  display: flex; flex-direction: column; gap: var(--space-16); padding: 20px 14px 14px; transition: width var(--dur-base) var(--ease-standard); overflow-y: auto; overflow-x: hidden; }
.side-top { display: flex; align-items: center; gap: 4px; }
.brand-link { flex: 1; min-width: 0; display: block; }
.logo-full { height: 44px; margin: -4px 0 -4px -8px; object-fit: contain; object-position: left; display: block; }
.logo-icon { width: 32px; height: 32px; display: none; }
.module-switch { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: var(--radius-md); background: transparent; text-align: left; cursor: pointer; color: inherit; }
.module-switch:hover, .module-switch[aria-expanded="true"] { background: var(--color-surface-2); }
.module-logo { width: 30px; height: 30px; flex-shrink: 0; }
.module-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.module-os { font-size: 11px; line-height: 1.3; color: var(--color-text-secondary); font-weight: 500; }
.module-name { font-size: var(--text-heading-size); line-height: 1.3; font-weight: 600; color: var(--color-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.module-chev { width: 18px; height: 18px; color: var(--color-text-secondary); }
.side-search { width: 100%; border: 0; cursor: pointer; text-align: left; }
.side-search .nav-text { flex: 1; }
.side-search kbd { font-family: inherit; font-size: var(--text-caption-size); color: var(--color-text-secondary); }
.nav { display: flex; flex-direction: column; gap: var(--space-16); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: var(--text-caption-size); font-weight: 600; color: var(--color-text-secondary); padding: 0 12px 4px; letter-spacing: 0; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: var(--nav-item-height); padding: 0 12px; border-radius: var(--radius-sm); font-size: var(--text-body-size); font-weight: 500; color: var(--color-text); white-space: nowrap; text-decoration: none; }
.nav-item > .icon { color: var(--color-text-secondary); }
.nav-item:hover { background: var(--color-surface-2); }
.nav-item.active { background: var(--color-accent-tint); color: var(--color-accent-text); font-weight: 600; }
.nav-item.active > .icon { color: var(--color-accent-text); fill: var(--color-accent-tint); }
.nav-text { overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { margin-left: auto; }
.nav-item.is-soon { color: var(--color-text-secondary); opacity: .55; cursor: default; }
.nav-item.is-soon:hover { background: transparent; }
.nav-soon { margin-left: auto; font-size: var(--text-caption-size); font-weight: 500; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.ai-entry > .icon, .ai-entry.active > .icon { color: var(--color-accent); fill: none; }
.ai-entry .ai-label-text { font-weight: 600; }
.ai-entry.active { background: var(--color-accent-tint); }
/* 試用帳戶切換（P0-6）：目前帳戶用靛藍淡底，其他帳戶可以按 */
.trial-switch { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--color-line); }
.trial-acc { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; background: none; border: 0; border-radius: var(--radius-sm); text-align: left; cursor: pointer; color: inherit; font: inherit; }
.trial-acc:hover { background: var(--color-surface-2); }
.trial-acc:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.trial-acc .avatar { width: 30px; height: 30px; background: var(--color-surface-2); color: var(--color-text-secondary); }
.trial-acc.is-current { background: var(--color-accent-tint); cursor: default; }
.trial-acc.is-current .avatar { background: var(--color-accent); color: var(--color-on-accent); }
.trial-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.trial-name { font-weight: 600; font-size: var(--text-small-size); color: var(--color-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trial-sub { font-size: var(--text-caption-size); color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trial-check { width: 16px; height: 16px; color: var(--color-accent-text); }
.user-row { display: flex; align-items: center; gap: 4px; padding-top: 10px; border-top: 1px solid var(--color-line); }
.user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px; background: none; border: 0; border-radius: var(--radius-sm); text-align: left; cursor: pointer; color: inherit; }
.user:hover { background: var(--color-surface-2); }
.user .avatar { width: 34px; height: 34px; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 600; font-size: var(--text-small-size); color: var(--color-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-sub { font-size: var(--text-caption-size); color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 收合：72px，只留圖示；滑鼠懸停或聚焦時顯示名稱（WCAG 1.4.13） */
@media (min-width: 1024px) {
  .app.collapsed .sidebar { width: var(--nav-width-collapsed); padding-inline: 12px; }
  .app.collapsed .side-top { flex-direction: column; gap: 8px; }
  .app.collapsed .logo-full, .app.collapsed .module-text, .app.collapsed .module-chev, .app.collapsed .nav-label, .app.collapsed .nav-text, .app.collapsed .sidebar .count, .app.collapsed .nav-soon, .app.collapsed .user-meta, .app.collapsed .side-search kbd { display: none; }
  .app.collapsed .logo-icon { display: block; }
  .app.collapsed .module-switch, .app.collapsed .nav-item, .app.collapsed .side-search { justify-content: center; padding-inline: 0; }
  .app.collapsed .user-row { flex-direction: column; }
  .app.collapsed .trial-acc { justify-content: center; padding-inline: 0; }
  .app.collapsed .nav { gap: var(--space-8); }
  .app.collapsed [data-tip]:hover::after, .app.collapsed [data-tip]:focus-visible::after { content: attr(data-tip); position: fixed; left: calc(var(--nav-width-collapsed) + 6px); transform: translateY(2px); background: var(--color-toast); color: var(--color-on-toast); font-size: var(--text-small-size); font-weight: 500; padding: 4px 10px; border-radius: var(--radius-xs); white-space: nowrap; z-index: 120; pointer-events: none; }
}

/* 模組切換選單：闊 300px，36px 圖示方塊，目前模組用靛藍方塊 */
.module-menu { width: 300px; padding: 8px; }
.module-menu button { align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); min-height: 56px; }
.module-menu .is-current { background: var(--color-accent-tint); }
.module-tile { width: 36px; height: 36px; border-radius: 11px; background: var(--color-surface-2); color: var(--color-text-secondary); display: grid; place-items: center; flex-shrink: 0; }
.module-tile .icon { width: 20px; height: 20px; }
.module-menu .is-current .module-tile { background: var(--color-accent); color: var(--color-on-accent); }
.module-item-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.module-item-name { font-weight: 600; color: var(--color-text-strong); }
.module-menu .is-current .module-item-name, .module-current { color: var(--color-accent-text); }
.module-current { font-size: var(--text-caption-size); font-weight: 600; }
.module-menu button[aria-disabled="true"] { opacity: .5; cursor: default; }
.module-menu button[aria-disabled="true"]:hover { background: none; }
.menu-note { font-size: var(--text-caption-size); color: var(--color-text-secondary); padding: 4px 12px 6px; }
.menu .menu-icon { width: 20px; display: inline-grid; place-items: center; flex-shrink: 0; }

/* 搜尋（⌘K） */
.search-dialog { display: flex; flex-direction: column; gap: var(--space-12); }
.search-big { min-height: 44px; font-size: var(--text-body-size); }
.search-big input { font-size: var(--text-body-size); }
.search-results { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.search-item { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--color-text); text-decoration: none; }
.search-item .icon { color: var(--color-text-secondary); }
.search-item.is-sel, .search-item:hover { background: var(--color-surface-2); }
.search-text { flex: 1; font-weight: 500; }
.search-none { padding: 8px 10px; margin: 0; }

/* 中學生手機的底部浮動分頁列（第 13.4 節） */
.tabbar { display: none; }
@media (max-width: 1023px) {
  .tabbar:not([hidden]) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); height: 68px; z-index: 50;
    border-radius: 24px; background: var(--color-nav); -webkit-backdrop-filter: var(--nav-blur); backdrop-filter: var(--nav-blur); border: 1px solid var(--color-line); box-shadow: var(--shadow-2); }
  .tabbar .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; font-size: 11px; font-weight: 600; color: var(--color-text-secondary); text-decoration: none; }
  .tabbar .tab-icon { width: 22px; height: 22px; stroke-width: 1.8; }
  .tabbar .tab.active { color: var(--color-accent-text); }
  .tabbar .tab.active .tab-icon { fill: var(--color-accent-tint); }
  .app.has-tabbar .content { padding-bottom: calc(68px + 24px + env(safe-area-inset-bottom)); scroll-padding-bottom: calc(68px + 24px); }
}

/* ---------- 主區 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--color-line); background: var(--color-nav); -webkit-backdrop-filter: var(--nav-blur); backdrop-filter: var(--nav-blur); flex-shrink: 0; position: relative; z-index: 5; }
.page-title { font-size: var(--text-heading-size); font-weight: 600; color: var(--color-text-strong); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.topbar .menu-btn { display: none; }
.topbar-right:empty { display: none; }
.topbar .bell-btn { margin-left: auto; }
.topbar-right:not(:empty) + .bell-btn { margin-left: 0; }
.content { flex: 1; overflow-y: auto; padding: 24px; position: relative; scroll-padding-top: 16px; }
.content:focus { outline: none; }
.bell-btn { position: relative; }
.bell-dot-badge { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--color-accent); box-shadow: 0 0 0 2px var(--color-surface); }
.scrim { position: fixed; inset: 0; background: var(--color-scrim); z-index: 55; }
.content.flush { padding: 0; overflow: hidden; }
.wrap { max-width: 1120px; margin: 0 auto; }
.narrow { max-width: 780px; margin: 0 auto; }

.h2 { font-size: 1.6rem; margin: 4px 0 2px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.section { margin-top: 30px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .85rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

.hero { background: var(--hero-grad); border: 1px solid var(--border); border-radius: 24px; padding: 30px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.hero h1 { font-size: 2.2rem; margin: 6px 0; }
.hero blockquote { margin: 0; color: var(--muted); max-width: 560px; }


.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.grid-4 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.update { border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; margin-top: 10px; display: block; background: var(--surface); }
.update-head { display: flex; justify-content: space-between; font-weight: 600; gap: 10px; }
.update-date { font-style: italic; font-size: .75rem; color: var(--faint); letter-spacing: .08em; white-space: nowrap; }

/* ---------- 表單 ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 38px; height: 22px; appearance: none; background: var(--border); border-radius: 99px; position: relative; transition: background .2s; cursor: pointer; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: left .2s; }
.switch input:checked::after { left: 18px; }
.search { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 4px 4px 4px 14px; }
.search input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; }
.drop { border: 1.5px dashed var(--border); border-radius: 14px; padding: 22px; text-align: center; background: var(--surface-2); }
.drop.over { border-color: var(--teal); background: rgba(26,134,232,.06); }
.drop .up { width: 40px; height: 40px; border-radius: 10px; margin: 0 auto 8px; display: grid; place-items: center; background: rgba(26,134,232,.12); color: var(--teal); font-size: 1.1rem; }
.file-list { margin-top: 10px; text-align: left; }
.file { display: flex; gap: 10px; align-items: center; padding: 7px 12px; border: 1px solid var(--border); border-radius: 10px; margin-top: 6px; background: var(--surface); }
.file .spacer { flex: 1; }



.code { font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; letter-spacing: .12em; font-weight: 700; }

/* ---------- 對話 ---------- */
.chat-layout { display: flex; height: 100%; }
.chat-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px; }
.chat-inner { max-width: 780px; margin: 0 auto; }
.chat-empty { text-align: center; padding: 40px 0 16px; }
.chat-empty img { width: 60px; height: 60px; }
.chat-empty h2 { font-size: 2rem; margin: 8px 0 0; }
.msg { margin: 14px 0; line-height: 1.65; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble { background: var(--accent-grad); color: #fff; border-radius: 16px 16px 4px 16px; padding: 10px 14px; max-width: 80%; white-space: pre-wrap; }
.msg.ai .who { font-size: .8rem; color: var(--faint); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.msg.ai .who img { width: 18px; }
.artifact-chip { display: inline-flex; gap: 10px; align-items: center; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 8px 12px; margin-top: 8px; cursor: pointer; }
.composer-wrap { padding: 12px 20px 16px; }
.composer { max-width: 780px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 10px 12px; box-shadow: var(--shadow); }
.composer textarea { width: 100%; border: 0; resize: none; background: transparent; outline: none; min-height: 46px; max-height: 200px; }
.composer-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.send { margin-left: auto; width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--accent-grad); color: #fff; font-size: 1rem; }
.chat-pane.is-empty .chat-scroll { flex: 0 0 auto; padding-top: 10vh; overflow: visible; }
.chat-pane.is-empty .composer-wrap { flex: 1; overflow-y: auto; }
.create-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.create-row .chip { padding: 8px 18px; font-weight: 600; }
.typing::after { content: "▍"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; } .md h1 { font-size: 1.35rem; } .md h2 { font-size: 1.15rem; } .md h3 { font-size: 1rem; }
.md p { margin: 6px 0; } .md ul, .md ol { margin: 6px 0; padding-left: 22px; }
.md table { border-collapse: collapse; margin: 8px 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; }
.md th { background: var(--surface-2); }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.md pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; }
.md blockquote { border-left: 3px solid var(--brand-lavender); margin: 8px 0; padding: 4px 12px; color: var(--muted); }

/* ---------- Canvas ---------- */
.canvas { width: 56%; min-width: 420px; border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; }
.canvas-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.canvas-head .title { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-tools { display: flex; gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.canvas-tools button, .canvas-tools select { border: 1px solid transparent; background: none; border-radius: 6px; padding: 3px 8px; }
.canvas-tools button:hover { background: var(--surface-2); border-color: var(--border); }
.canvas-body { flex: 1; overflow: auto; background: var(--surface-2); }
.canvas-body iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.doc-page { background: #fff; color: #1e2a44; max-width: 800px; margin: 20px auto; padding: 48px 56px; box-shadow: var(--shadow); min-height: 900px; outline: none; }
.doc-page table { border-collapse: collapse; } .doc-page td, .doc-page th { border: 1px solid #cfd6e4; padding: 6px 8px; }
.slide { background: linear-gradient(135deg, #0e1740, #1f2a6b); color: #fff; aspect-ratio: 16/9; max-width: 820px; margin: 18px auto; border-radius: 12px; padding: 5% 6%; position: relative; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.slide h2 { color: #fff; font-size: clamp(1.2rem, 3vw, 2.2rem); margin: 0 0 12px; outline: none; }
.slide .sub { color: #b9c6ff; }
.slide ul { margin: 0; padding-left: 1.2em; font-size: clamp(.9rem, 1.6vw, 1.25rem); } .slide li { margin: 6px 0; outline: none; }
.slide .emoji { position: absolute; right: 6%; top: 50%; transform: translateY(-50%); font-size: clamp(3rem, 9vw, 7rem); opacity: .9; }
.slide .num { position: absolute; right: 16px; bottom: 10px; font-size: .75rem; opacity: .6; }
.slide-tools { position: absolute; top: 8px; right: 8px; display: none; gap: 4px; }
.slide:hover .slide-tools { display: flex; }
.slide-tools button { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 6px; padding: 2px 7px; }
.present { position: fixed; inset: 0; background: #000; z-index: 100; display: grid; place-items: center; }
.present .slide { width: min(96vw, 170vh); max-width: none; margin: 0; }
.sheet-wrap { overflow: auto; height: 100%; background: #fff; }
.sheet { border-collapse: collapse; font-size: 13px; color: #1e2a44; }
.sheet th, .sheet td { border: 1px solid #dfe4ee; min-width: 84px; height: 26px; padding: 0 6px; }
.sheet th { background: #f3f5fa; font-weight: 600; color: #5b6784; position: sticky; top: 0; }
.sheet td.rh { background: #f3f5fa; color: #5b6784; text-align: center; min-width: 40px; position: sticky; left: 0; }
.sheet td.sel { outline: 2px solid #1a86e8; outline-offset: -2px; }
.sheet td.num { text-align: right; }
.formula { display: flex; gap: 8px; align-items: center; padding: 4px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.formula input { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; background: var(--surface-2); }
.sheet-tabs { display: flex; gap: 4px; padding: 6px 12px; border-top: 1px solid var(--border); background: var(--surface); }

/* ---------- 對話框、提示 ---------- */
.student-banner { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--green); color: #fff; padding: 8px 18px; border-radius: 99px; z-index: 90; border: 0; font-weight: 600; box-shadow: var(--shadow); }
.progress-steps li { list-style: none; padding: 5px 0; color: var(--muted); }
.progress-steps li.done::before { content: "✓ "; color: var(--green); font-weight: 700; }
.progress-steps li.cur::before { content: "◌ "; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 320px; max-width: 90vw; background: var(--surface); z-index: 85; box-shadow: 10px 0 40px rgba(0,0,0,.15); padding: 16px; overflow-y: auto; }

/* 班房 */
.room-nav { position: relative; }
.desk li { list-style: none; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.post { border-left: 3px solid var(--brand-sky); }
.post-body { white-space: pre-wrap; }
.write-canvas { position: relative; background: #fff; margin: 0 auto; box-shadow: var(--shadow); }
.write-canvas canvas { position: absolute; inset: 0; touch-action: none; }
.write-canvas .paper { padding: 40px 50px; color: #1e2a44; min-height: 1000px; }

/* 心智圖、閃卡 */
.flash { perspective: 1000px; height: 240px; cursor: pointer; }
.flash-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px; display: grid; place-items: center; padding: 24px; text-align: center; font-size: 1.25rem; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.flash-face.back { transform: rotateY(180deg); background: var(--hero-grad); }
.scene { background: var(--hero-grad); border-radius: 20px; padding: 36px; min-height: 320px; display: flex; flex-direction: column; justify-content: center; text-align: center; border: 1px solid var(--border); }
.scene .vis { font-size: 4.5rem; animation: pop .6s ease; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- 無障礙 ---------- */
.a11y-dyslexic body, .a11y-dyslexic button, .a11y-dyslexic input, .a11y-dyslexic textarea { font-family: "Lexend", var(--sans) !important; letter-spacing: .03em; word-spacing: .12em; }
.a11y-colorblind a, .a11y-colorblind .link { text-decoration: underline; }
.a11y-colorblind .tag.ok::before { content: "✓ "; } .a11y-colorblind .tag.bad::before { content: "✕ "; } .a11y-colorblind .tag.warn::before { content: "! "; }
.a11y-motion *, .a11y-motion *::before, .a11y-motion *::after { animation: none !important; transition: none !important; }
.a11y-keyboard :focus { outline: 3px solid #ff9f1c !important; outline-offset: 3px; }
.a11y-cursor, .a11y-cursor * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M4 2l26 14-12 3-5 12z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 4 2, auto !important; }
.a11y-simple .pill, .a11y-simple .hero blockquote, .a11y-simple .nav-label, .a11y-simple .eyebrow { display: none !important; }
.a11y-focus .card:not(:hover), .a11y-focus .nav-item:not(:hover):not(.active) { opacity: .45; transition: opacity .2s; }
.a11y-distraction .sidebar-foot .foot-links, .a11y-distraction .topbar-right, .a11y-distraction .pill { display: none !important; }
.a11y-wordhl .md span.w:hover, .a11y-wordhl .post-body span.w:hover { background: #fff3a8; color: #000; }
.reading-guide { position: fixed; left: 0; right: 0; height: 36px; pointer-events: none; background: rgba(255,230,120,.25); border-top: 2px solid rgba(216,154,29,.6); border-bottom: 2px solid rgba(216,154,29,.6); z-index: 110; display: none; }
.a11y-guide .reading-guide { display: block; }

/* ---------- 手機 ---------- */
/* 老師（< 1024px）不另作設計：頂欄加抽屜式側欄，確保可以開啟、不破版（第 13.4 節） */
@media (max-width: 1023px) {
  .sidebar, .app.collapsed .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(var(--nav-width), 86vw); padding-inline: 14px; background: var(--color-surface); transform: translateX(-100%); transition: transform var(--dur-base) var(--ease-standard); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-3); }
  .topbar .menu-btn { display: inline-grid; }
  .side-top .collapse-btn { display: none; }
  .topbar { padding: 0 12px; }
}
@media (max-width: 820px) {
  .content { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero { padding: 20px; } .hero h1 { font-size: 1.8rem; }
  .chat-layout { flex-direction: column; }
  .canvas { width: 100%; min-width: 0; height: 60%; border-left: 0; border-top: 1px solid var(--border); }
  .doc-page { padding: 24px; }
  .msg.user .bubble { max-width: 92%; }
}

/* 測驗成績 */
.qr-head { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.qr-ring { color: var(--text, inherit); flex: none; }
.qr-card { margin-top: 12px; }
.qr-row { margin-top: 8px; }
.qr-ans { white-space: pre-wrap; padding: 6px 10px; border-left: 3px solid var(--border); }

/* 測驗作答 */
.qz-progress { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.qz-progress > i { display: block; height: 100%; background: var(--brand-indigo); border-radius: 99px; transition: width .2s; }
.qz-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.qz-nav button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; }
.qz-nav button.done { background: var(--brand-lavender); border-color: var(--brand-indigo); color: var(--brand-navy); }
.qz-nav button.cur { background: var(--brand-indigo); border-color: var(--brand-indigo); color: #fff; }
.qz-opt { cursor: pointer; }
.qz-opt.sel { border-color: var(--brand-indigo); background: var(--surface-2); }
.qz-actions { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; }
.drag-handle { cursor: grab; user-select: none; color: var(--faint); padding: 0 6px; font-size: 1.1rem; letter-spacing: -2px; }
.q-card.dragging { opacity: .5; }
.q-card.dragover { outline: 2px dashed var(--brand-indigo); }
.math-preview { color: var(--muted); font-size: .85rem; margin-top: 4px; min-height: 0; overflow-x: auto; }
.math-preview:empty { display: none; }

/* 測驗分析與逐題批改 */
.qa-hist { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 8px; }
.qa-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.qa-col > i { display: block; width: 100%; max-width: 48px; min-height: 2px; background: var(--brand-indigo); border-radius: 6px 6px 0 0; }
.qa-stack { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--border); margin: 6px 0 4px; }
.qa-stack > i, .qa-key > i { display: inline-block; height: 100%; }
.qa-stack > i.ok, .qa-key > i.ok { background: var(--green); }
.qa-stack > i.warn, .qa-key > i.warn { background: var(--amber); }
.qa-stack > i.bad, .qa-key > i.bad { background: var(--danger); }
.qa-key { margin-left: 8px; white-space: nowrap; }
.qa-key > i { width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin: 0 2px 0 6px; }
.qa-q { overflow: hidden; text-overflow: ellipsis; }
.rv-card { cursor: pointer; border: 2px solid transparent; }
.rv-card.cur { border-color: var(--brand-indigo); }
.rv-lv.on.ok { background: var(--green); color: #fff; border-color: var(--green); }
.rv-lv.on.warn { background: var(--amber); color: #fff; border-color: var(--amber); }
.rv-lv.on.bad { background: var(--danger); color: #fff; border-color: var(--danger); }
kbd { font: inherit; font-size: .75em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface-2); }
.rv-lv.on kbd { background: transparent; color: inherit; border-color: rgba(255,255,255,.6); }

/* AI 批改：流程與工作區 */
.mk-steps { display: flex; gap: 8px; flex-wrap: wrap; color: var(--faint); }
.mk-steps .on { color: var(--text); font-weight: 700; }
.mk-steps .done { color: var(--brand-indigo); }
.mk-skel { height: 70px; border-radius: 10px; margin-top: 12px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: mkSkel 1.4s infinite; }
@keyframes mkSkel { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .mk-skel { animation: none; } }
.mk-wrap { max-width: 1400px; }
.mk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0 10px; }
.mk-title { max-width: 260px; font-weight: 600; }
.mk-files select { max-width: 220px; }
.mk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.mk-docwrap { padding: 10px; }
.mk-tools { flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mk-colors { display: inline-flex; gap: 4px; margin: 0 4px; }
.mk-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.mk-color.on { border-color: var(--text); }
.mk-doc { max-height: calc(100vh - 170px); overflow: auto; border-radius: 8px; background: var(--surface-2); }
.mk-side { display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 120px); overflow: auto; position: sticky; top: 60px; }
.mk-side .card { margin: 0; }
.mk-pq { border-left: 4px solid var(--border); padding: 6px 0 6px 10px; margin-top: 10px; }
.mk-pq.lv-full { border-left-color: var(--green); }
.mk-pq.lv-partial { border-left-color: var(--amber); }
.mk-pq.lv-none { border-left-color: var(--danger); }
.mk-qid { text-align: left; }
.mk-qid:disabled { color: inherit; cursor: default; text-decoration: none; }
.mk-sc { width: 70px; padding: 4px 6px; }
.mk-fb { margin-top: 6px; min-height: 0; font-size: .9rem; }
.mk-q { margin-top: 10px; }
@media (max-width: 1000px) {
  .mk-grid { grid-template-columns: 1fr; }
  .mk-side { position: static; max-height: none; }
  .mk-doc { max-height: 70vh; }
  .mk-title { max-width: 100%; flex: 1 1 100%; }
}

/* AI 批改：答卷檢視 */
.md-root { position: relative; width: 100%; }
.md-pages { display: flex; flex-direction: column; gap: 14px; }
.md-page { position: relative; width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; overflow: clip; box-shadow: var(--shadow); }
.md-page.loading::before { content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: .85rem; background: repeating-linear-gradient(135deg, #fff 0 14px, #f6f8fd 14px 28px); }
.md-pcv, .md-ocv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.md-ocv { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.md-root[data-tool="pan"] .md-ocv { pointer-events: none; }
.md-root[data-tool="pen"] .md-ocv { cursor: crosshair; }
.md-root[data-tool="text"] .md-ocv { cursor: text; }
.md-root[data-tool="erase"] .md-ocv { cursor: cell; }
.md-text-input { position: absolute; z-index: 2; min-width: 8em; margin: 0; padding: 0 2px; border: 1px dashed var(--brand-indigo); border-radius: 3px; background: rgba(255,255,255,.9); font-family: var(--sans); font-weight: 500; line-height: 1.25; outline: none; box-shadow: 0 0 0 3px rgba(70,194,255,.25); }
.md-flash { position: absolute; z-index: 1; pointer-events: none; border: 3px solid var(--brand-sky); border-radius: 6px; animation: md-flash 1.5s ease-out forwards; }
@keyframes md-flash { 0%, 40% { opacity: 1; box-shadow: 0 0 0 6px rgba(70,194,255,.35); } 100% { opacity: 0; box-shadow: 0 0 0 0 rgba(70,194,255,0); } }
.md-loading, .md-error { padding: 28px 16px; text-align: center; border-radius: 12px; font-size: .9rem; }
.md-loading { color: var(--muted); background: var(--surface-2); }
.md-error { color: var(--danger); background: var(--surface); border: 1px solid var(--danger); }
@media (prefers-reduced-motion: reduce) { .md-flash { animation-duration: .01s; animation-delay: 1.2s; } }
/* AI 批改：答題區模板編輯器（marker-template.js） */
.mt-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.mt-pages { display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 220px); min-height: 320px; overflow: auto; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.mt-page { position: relative; width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); flex-shrink: 0; }
.mt-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mt-layer { position: absolute; inset: 0; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.mt-pages[data-tool="draw"] .mt-layer { cursor: crosshair; touch-action: none; }
.mt-plabel { position: absolute; right: 8px; bottom: 6px; font-size: .72rem; color: var(--brand-navy); background: rgba(255,255,255,.85); border-radius: 99px; padding: 1px 8px; pointer-events: none; }
.mt-reg { position: absolute; border: 2px solid var(--brand-indigo); background: rgba(219,205,255,.22); border-radius: 6px; cursor: move; touch-action: none; }
.mt-reg.is-name { border-color: var(--brand-sky); background: rgba(70,194,255,.14); }
.mt-reg.is-todo { border-style: dashed; border-color: var(--amber); }
.mt-reg.sel { border-width: 3px; box-shadow: 0 0 0 3px rgba(70,194,255,.35); z-index: 2; }
.mt-reg/* 雙色焦點框：2px 靛藍外移 2px，內側 2px 白色光環（憲法第 14.4 節） */
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--color-surface); }
.mt-ghost { border-style: dashed; pointer-events: none; }
.mt-wrap.ro .mt-reg { cursor: pointer; touch-action: auto; }
.mt-tag { position: absolute; left: -2px; top: -2px; transform: translateY(-100%); background: var(--brand-indigo); color: #fff; font-size: .72rem; font-weight: 600; border-radius: 6px 6px 0 0; padding: 0 7px; line-height: 1.6; white-space: nowrap; pointer-events: none; }
.mt-reg.is-name .mt-tag { background: #0b79e6; }
.mt-reg.is-todo .mt-tag { background: var(--amber); }
.mt-reg.tag-in .mt-tag { transform: none; border-radius: 0 0 6px 0; }
.mt-h { position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid var(--brand-indigo); border-radius: 50%; margin: -7px 0 0 -7px; touch-action: none; }
.mt-h::after { content: ""; position: absolute; inset: -10px; } /* 觸控時較大的命中範圍 */
.h-nw { left: 0; top: 0; cursor: nwse-resize; } .h-n { left: 50%; top: 0; cursor: ns-resize; } .h-ne { left: 100%; top: 0; cursor: nesw-resize; }
.h-e { left: 100%; top: 50%; cursor: ew-resize; } .h-se { left: 100%; top: 100%; cursor: nwse-resize; } .h-s { left: 50%; top: 100%; cursor: ns-resize; }
.h-sw { left: 0; top: 100%; cursor: nesw-resize; } .h-w { left: 0; top: 50%; cursor: ew-resize; }
@media (pointer: coarse) { .mt-h { width: 20px; height: 20px; margin: -10px 0 0 -10px; } }
.mt-panel { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 60px; }
.mt-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.mt-actions .btn.is-on { background: var(--brand-lavender); border-color: var(--brand-indigo); color: var(--brand-navy); }
.mt-list { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow: auto; }
.mt-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.mt-item.sel { border-color: var(--brand-indigo); background: color-mix(in srgb, var(--brand-lavender) 25%, var(--surface)); }
.mt-item .mt-q { flex: 1; min-width: 0; padding: 4px 8px; }
.mt-item [data-go] { white-space: nowrap; }
.mt-prev canvas { display: block; max-width: 100%; height: auto; max-height: 220px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; margin-top: 4px; }
.mt-miss { color: var(--amber); margin: 0; }
.mt-note { margin: 0; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--brand-sky) 12%, var(--surface)); }
.mt-src { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mt-warn { border-left: 4px solid var(--amber); padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--amber) 8%, var(--surface)); }
@media (max-width: 900px) {
  .mt-wrap { grid-template-columns: 1fr; }
  .mt-panel { position: static; }
  .mt-pages { max-height: 70vh; }
}

/* AI 助理：圖表與作品卡片 */
.chart { margin: 10px 0; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.chart svg { width: 100%; height: auto; display: block; color: var(--text); }
.chart figcaption { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; font-size: .82rem; color: var(--muted); }
.chart-key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.chart-ec { width: 100%; height: 320px; touch-action: pan-y; }
@media (max-width: 600px) { .chart-ec { height: 280px; } }
.artifact-card { width: 100%; max-width: 420px; margin-top: 8px; cursor: pointer; background: var(--surface); }
.artifact-card:hover { border-color: var(--brand-indigo); }
.art-host { min-height: 70vh; border: 0; width: 100%; }
.art-img svg { width: 100%; height: auto; }
.mk-files { flex-wrap: nowrap; gap: 6px; }
.mk-files select.input { width: auto; min-width: 0; flex: 0 1 220px; }
.mk-bar > .input.mk-title { width: auto; flex: 0 1 260px; }
@media (max-width: 1000px) { .mk-bar > .input.mk-title { flex: 1 1 100%; } }

/* 概念動畫：大綱審閱 */
.vz-sc { margin-top: 12px; }
.vz-line { gap: 6px; margin-bottom: 6px; align-items: flex-start; }
.vz-line textarea { flex: 1; min-height: 38px; resize: vertical; }

/* AI 圖像 */
.ig-thumbs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.ig-thumb { position: relative; }
.ig-thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: block; }
.ig-thumb .icon-btn { position: absolute; top: -8px; right: -8px; background: var(--surface); min-width: 24px; height: 24px; }
.ig-aspects { display: flex; flex-wrap: wrap; gap: 6px; }
.ig-aspect { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 50px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: .72rem; color: var(--muted); cursor: pointer; }
.ig-aspect i { display: block; border: 2px solid currentColor; border-radius: 3px; }
.ig-aspect.on { border-color: var(--brand-indigo); color: var(--brand-indigo); background: var(--surface-2); }
.ig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 12px; }
.ig-item { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.ig-item.new { outline: 3px solid var(--brand-sky); }
.ig-item img { width: 100%; display: block; object-fit: cover; background: var(--surface-2); }
.ig-item figcaption { padding: 8px 10px 10px; }
.ig-item figcaption .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-img img { width: 100%; height: auto; border-radius: 8px; display: block; }

/* 故事書 */
.sb-page { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; margin-top: 14px; align-items: center; }
.sb-img img { width: 100%; border-radius: 14px; display: block; box-shadow: var(--shadow); }
.sb-noimg { aspect-ratio: 4/3; display: grid; place-items: center; font-size: 4rem; background: var(--surface-2); border-radius: 14px; }
.sb-text p { font-size: 1.25rem; line-height: 1.9; margin: 8px 0 0; }
.sb-dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.sb-dots button { width: 10px; height: 10px; border-radius: 50%; border: 0; background: var(--border); padding: 0; }
.sb-dots button.on { background: var(--brand-indigo); }
@media (max-width: 760px) { .sb-page { grid-template-columns: 1fr; } .sb-text p { font-size: 1.1rem; } }
/* 沒有插圖的故事（示範故事、關掉插圖）：單欄純文字 */
.sb-page.sb-textonly { grid-template-columns: minmax(0, 1fr); max-width: 760px; margin-left: auto; margin-right: auto; }
.sb-textonly .sb-text p { font-size: 1.15rem; }
/* 故事理解測驗（五種題型） */
.sq { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
.sq-head { margin-bottom: 4px; }
.sq-head .tag { font-size: .72rem; vertical-align: middle; }
.sq-opt { cursor: pointer; }
.sq-tf { display: flex; gap: 8px; flex-wrap: wrap; }
.sq-tf .sq-opt { flex: 1 1 120px; }
.sq-ans { width: 100%; margin-top: 4px; }
.sq-fb { margin-top: 6px; }
.sq-model { margin-top: 6px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--brand-sky, #46C2FF); }
.sq-grade { margin-top: 6px; }
.sq-actions { margin-top: 14px; flex-wrap: wrap; gap: 8px; }
/* 故事生成表單：各題型題數、上載詞彙表 */
.tool-loadtxt { display: inline-block; margin-top: 6px; cursor: pointer; }
.tool-src-tabs-l { margin-top: 0; max-width: 560px; }
@media (max-width: 480px) { .tool-src-tabs-l button { white-space: normal; padding: 7px 4px; font-size: .85rem; line-height: 1.3; } }
.tool-demo-label { margin-top: 12px; }
.qcounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.qcount { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.qcount-l { font-weight: 600; font-size: .9rem; }
.qcount-l small { display: block; font-weight: 400; color: var(--faint); font-size: .74rem; }
.qcount input { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.qcount-total { font-weight: 600; color: var(--text); font-size: .85rem; }

/* 音樂生成 */
.ml-lyrics { white-space: pre-wrap; line-height: 1.8; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; margin-top: 6px; }
.ml-sec { display: inline-block; font-size: .78rem; color: var(--brand-indigo); margin-top: 6px; }
.ml-new { outline: 3px solid var(--brand-sky); }

/* 閃卡小測 */
.fc-opt { width: 100%; text-align: left; cursor: pointer; margin-top: 6px; }
.fc-opt.ok { border-color: var(--green); background: rgba(47,158,107,.12); }
.fc-opt.bad { border-color: var(--danger); background: rgba(214,69,69,.1); }
.fc-edit { margin-top: 10px; }
/* 閃卡溫習評分（FSRS）：四個或兩個按鈕，手機上四個按鈕排成兩行 */
.fc-grade { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 8px; max-width: 560px; margin: 14px auto 0; }
.fc-grade .btn { justify-content: center; text-align: center; white-space: normal; padding: 10px 8px; border-radius: 14px; line-height: 1.35; display: block; }
.fc-grade .g1 { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.fc-grade .g2 { border-color: color-mix(in srgb, var(--amber) 55%, var(--border)); }
.fc-grade .g3 { border-color: color-mix(in srgb, var(--green) 50%, var(--border)); }
.fc-grade .g4 { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
@media (max-width: 520px) { .fc-grade { grid-template-columns: repeat(min(var(--n, 4), 2), minmax(0, 1fr)); } }

/* 心智圖 */
.mm-bar { flex-wrap: wrap; gap: 6px; margin: 10px 0; padding: 8px; background: var(--surface-2); border-radius: 10px; }
.mm-card { position: relative; }
.mm-host { height: min(68vh, 560px); min-height: 360px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-family: var(--sans); }
.mm-host .map-container { border-radius: 12px; font-family: var(--sans); touch-action: none; }
.mm-host .map-container me-root me-tpc { font-weight: 700; }
.mm-host .map-container me-main > me-wrapper > me-parent > me-tpc { font-weight: 600; }
.mm-host .context-menu .menu-list li#cm-summary { display: none; }
.mm-zoom { justify-content: flex-end; gap: 4px; margin-top: 6px; }
.mm-help { margin-top: 6px; }
@media (max-width: 600px) { .mm-host { height: 62vh; min-height: 320px; } .mm-bar .mm-sel { flex-basis: 100%; } .mm-help { font-size: .76rem; } }

.tool-doc { min-height: 75vh; width: 100%; border: 0; }

/* AI 助教：圖解、圖像、附件 */
.chat-svg { margin: 10px 0; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.chat-svg svg { width: 100%; height: auto; display: block; }
.chat-img { margin: 10px 0 0; max-width: 520px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.chat-img img { width: 100%; display: block; }
.chat-img figcaption { padding: 6px 10px; }
.att-link { color: inherit; text-decoration: underline; margin-right: 6px; }

/* Canvas：文件工具列 */
.cv-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.cv-color { position: relative; display: inline-grid; place-items: center; min-width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 8px; font-weight: 700; color: var(--brand-indigo); cursor: pointer; }
.cv-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.doc-page table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.doc-page td, .doc-page th { border: 1px solid var(--border); padding: 6px 8px; min-width: 40px; }
.doc-page th { background: var(--surface-2); }
.doc-page img { max-width: 100%; border-radius: 8px; }
/* Canvas：簡報主題、圖片、講稿 */
.slide { display: flex; flex-direction: row; align-items: center; gap: 4%; }
.slide-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.slide.has-img .slide-img { width: 40%; max-height: 80%; object-fit: contain; border-radius: 10px; }
.slide .sub:empty::before { content: attr(data-ph); opacity: .45; }
.slide.theme-light { background: #fff; color: #1e2a44; border: 1px solid var(--border); } .slide.theme-light h2 { color: #334669; } .slide.theme-light .sub { color: #402FFA; }
.slide.theme-sky { background: linear-gradient(135deg, #eaf6ff, #dbeeff); color: #1e2a44; } .slide.theme-sky h2 { color: #334669; } .slide.theme-sky .sub { color: #4382E9; }
.slide.theme-warm { background: linear-gradient(135deg, #fff7ec, #ffe9cf); color: #3b2a1a; } .slide.theme-warm h2 { color: #7a3e00; } .slide.theme-warm .sub { color: #b4561b; }
.slide.theme-light .slide-tools button, .slide.theme-sky .slide-tools button, .slide.theme-warm .slide-tools button { background: rgba(0,0,0,.08); color: #1e2a44; }
.slide-notes { display: block; width: 100%; max-width: 820px; margin: -10px auto 8px; font-size: .85rem; border: 1px dashed var(--border); border-radius: 8px; padding: 6px 10px; background: var(--surface); color: var(--muted); resize: vertical; }
.theme-dot { width: 26px; height: 18px; border-radius: 5px; border: 2px solid var(--border); padding: 0; }
.theme-dot.on { border-color: var(--brand-sky); box-shadow: 0 0 0 2px var(--brand-sky); }
.theme-dot.theme-vinci { background: linear-gradient(135deg, #0e1740, #1f2a6b); } .theme-dot.theme-light { background: #fff; } .theme-dot.theme-sky { background: #dbeeff; } .theme-dot.theme-warm { background: #ffe9cf; }
.sheet-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.link-card.is-locked { opacity: .6; }

/* 創作中心卡片預覽 */
.hp { height: 120px; margin: -2px 0 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); position: relative; }
.hp-app iframe { width: 400%; height: 400%; transform: scale(.25); transform-origin: 0 0; border: 0; pointer-events: none; background: #fff; }
.hp-doc { background: #fff; padding: 10px 12px; color: #1e2a44; font-size: .78rem; line-height: 1.5; }
.hp-doc b { display: block; font-size: .9rem; color: #334669; margin-bottom: 4px; }
.hp-doc p { margin: 0; opacity: .8; }
.hp-slide { display: flex; flex-direction: column; justify-content: center; padding: 12px 14px; background: linear-gradient(135deg, #0e1740, #1f2a6b); color: #fff; }
.hp-slide b { font-size: 1rem; } .hp-slide span { font-size: .78rem; opacity: .8; margin-top: 4px; } .hp-slide i { position: absolute; right: 8px; bottom: 6px; font-size: .7rem; opacity: .7; font-style: normal; }
.hp-slide.theme-light { background: #fff; color: #334669; } .hp-slide.theme-sky { background: #dbeeff; color: #334669; } .hp-slide.theme-warm { background: #ffe9cf; color: #7a3e00; }
.hp-sheet { background: #fff; padding: 6px; } .hp-sheet table { border-collapse: collapse; width: 100%; font-size: .72rem; color: #1e2a44; } .hp-sheet td, .hp-sheet th { border: 1px solid #dfe4f0; padding: 3px 5px; overflow: hidden; white-space: nowrap; max-width: 70px; text-overflow: ellipsis; } .hp-sheet th { background: #eef0fd; }
.hp-viz { background: #0b0f2e; } .hp-viz img { width: 100%; height: 100%; object-fit: cover; } .hp-viz i { position: absolute; left: 8px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: .72rem; padding: 2px 6px; border-radius: 6px; font-style: normal; }
.hp-agent { display: flex; gap: 10px; align-items: center; padding: 12px; } .hp-agent span { font-size: 2rem; } .hp-agent p { margin: 0; font-size: .8rem; color: var(--muted); }

.mk-queue { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 8%, var(--surface)); }

/* 學科平台 */
.sp-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.sp-topics { position: sticky; top: 10px; max-height: calc(100vh - 140px); overflow: auto; padding: 12px; }
.sp-topic { display: flex; justify-content: space-between; width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 8px; color: inherit; font: inherit; font-size: .9rem; cursor: pointer; }
.sp-topic span { color: var(--faint); font-size: .8rem; }
.sp-topic:hover { background: var(--surface-2); }
.sp-topic.on { background: color-mix(in srgb, var(--brand-indigo) 12%, var(--surface)); color: var(--brand-indigo); font-weight: 600; }
.sp-q { font-size: 1.05rem; white-space: pre-wrap; }
.sim-card { overflow: hidden; }
.sim-tile { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.sim-tile:hover, .sim-tile:focus-visible { border-color: var(--brand-indigo); transform: translateY(-1px); }
.sim-tile h4 { color: var(--heading); font-size: 1rem; }
@media (max-width: 860px) { .sp-grid { grid-template-columns: 1fr; } .sp-topics { position: static; max-height: 220px; } }

/* 編程平台 */
/* CodeMirror 6 的語法顏色（editor.js 的 HighlightStyle 用這些變數） */
:root { --code-kw: #402FFA; --code-str: #23794f; --code-num: #a8560c; --code-comment: #7b86a3; --code-fn: #2f6fd6; --code-type: #6b55f0; }
.code-editor { min-width: 0; }
.code-editor .cm-editor { max-width: 100%; }
.code-editor textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
/* 互動 input()：在輸出下面出現的輸入列 */
.py-ask { display: flex; gap: 8px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.py-ask label { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: var(--muted); max-width: 100%; overflow-wrap: anywhere; }
.py-ask input { flex: 1 1 180px; min-width: 0; min-height: 40px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sbx-term .py-ask label { color: var(--muted); }
/* 逐步執行視覺化 */
.viz { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; }
.viz-code { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: auto; max-height: 52vh; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; padding: 6px 0; }
.viz-line { display: grid; grid-template-columns: 26px 34px 1fr; white-space: pre; padding-right: 10px; }
.viz-line .ar { text-align: center; font-weight: 700; }
.viz-line .ln { color: var(--faint); text-align: right; padding-right: 10px; user-select: none; }
.viz-line.prev { background: color-mix(in srgb, var(--brand-sky) 12%, transparent); }
.viz-line.prev .ar { color: var(--brand-mist); }
.viz-line.cur { background: color-mix(in srgb, var(--brand-lavender) 45%, transparent); }
.viz-line.cur .ar { color: var(--accent); }
.viz-line.exc { background: rgba(214,69,69,.14); }
.viz-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.viz-desc { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--brand-lavender) 28%, var(--surface)); line-height: 1.55; }
.viz-frame { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.viz-frame > b { display: block; padding: 6px 10px; background: var(--surface-2); font-size: .85rem; color: var(--heading); }
.viz-frame.top { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.viz-frame table { width: 100%; border-collapse: collapse; font-size: 13px; }
.viz-frame td { padding: 4px 10px; border-top: 1px solid var(--border); vertical-align: top; }
.viz-frame td:first-child { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; width: 1%; }
.viz-frame td.v { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.viz-frame td.t { color: var(--faint); font-size: 12px; white-space: nowrap; width: 1%; }
.viz-frame tr.chg td { background: color-mix(in srgb, var(--amber) 16%, transparent); }
.viz-frames { display: flex; flex-direction: column; gap: 8px; max-height: 34vh; overflow: auto; }
.viz-ctrl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.viz-ctrl input[type=range] { flex: 1 1 160px; accent-color: var(--accent); min-height: 32px; }
.viz-ctrl .btn { min-width: 44px; min-height: 40px; }
@media (max-width: 760px) { .viz { grid-template-columns: 1fr; } .viz-code { max-height: 34vh; } }
.code-out { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 6px 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; }
.code-out.err { color: var(--danger); background: rgba(214,69,69,.06); }
.code-out.term { background: #11182b; color: #d8e2ff; border-color: #11182b; min-height: 120px; max-height: none; flex: 1; }
.lesson p, .lesson li { line-height: 1.7; }
.lesson pre { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; overflow: auto; }
.lesson code { background: var(--surface-2); border-radius: 4px; padding: 0 4px; font-size: .92em; }
.lesson pre code { background: none; padding: 0; }
.lesson .tip, .lesson .warn { border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.lesson .tip { background: color-mix(in srgb, var(--brand-sky) 18%, var(--surface)); }
.lesson .warn { background: rgba(216,154,29,.14); }
.lesson table { border-collapse: collapse; margin: 8px 0; } .lesson td, .lesson th { border: 1px solid var(--border); padding: 4px 10px; }
.code-split { display: grid; grid-template-columns: minmax(320px, 42%) 1fr; height: 100%; }
.code-left { overflow: auto; padding: 18px 22px; border-right: 1px solid var(--border); }
.code-right { display: flex; flex-direction: column; min-width: 0; overflow: auto; }
.code-bar { padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 2; flex-wrap: wrap; gap: 6px; }
.code-main { padding: 10px 12px; }
.code-bottom { padding: 10px 12px 18px; border-top: 1px solid var(--border); }
.code-case { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 6px 0; }
.code-case.ok { border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.code-case.bad { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: rgba(214,69,69,.04); }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
.sbx { display: grid; grid-template-columns: 240px 1fr; height: 100%; }
.sbx-side { padding: 14px; border-right: 1px solid var(--border); overflow: auto; background: var(--surface); }
.sbx-main { display: flex; flex-direction: column; min-width: 0; overflow: auto; }
.sbx-term { display: flex; flex-direction: column; padding: 10px 12px 14px; border-top: 1px solid var(--border); min-height: 220px; }
.sbx-file { display: flex; justify-content: space-between; align-items: center; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: .9rem; }
.sbx-file:hover, .sbx-file.on { background: var(--surface-2); }
.sbx-file.on { font-weight: 600; }
.sbx-acts { display: none; } .sbx-file:hover .sbx-acts, .sbx-file.on .sbx-acts { display: inline-flex; }
.sbx-acts .icon-btn { width: 24px; height: 24px; font-size: .8rem; }
@media (max-width: 860px) {
  .code-split, .sbx { grid-template-columns: 1fr; height: auto; }
  .content.flush:has(.code-split), .content.flush:has(.sbx) { overflow: auto; }
  .code-left, .sbx-side { border-right: 0; border-bottom: 1px solid var(--border); }
}
.sbx-task { margin-top: 12px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--brand-lavender) 30%, var(--surface)); }

/* 學生 AI 安全：關懷卡 */
.safety-card h3 { color: var(--heading); }
.safety-card p { line-height: 1.7; margin: 0 0 12px; }
.safety-help { list-style: none; padding: 12px 14px; margin: 0 0 16px; background: var(--surface-2); border-radius: 12px; display: grid; gap: 8px; }
.safety-help a { color: var(--accent); text-decoration: none; font-size: 1.1em; }
@media (max-width: 480px) { .safety-card .row.end { flex-direction: column-reverse; align-items: stretch; } }
/* 學生關懷提示（安全第三層）：頁首通知鈴和提示列表 */
.bell-btn { position: relative; height: 34px; min-width: 34px; font-size: 1rem; }
.menu.bell-menu { width: min(360px, calc(100vw - 16px)); }
.bell-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.care-note { border-color: var(--brand-mist); background: color-mix(in srgb, var(--brand-lavender) 22%, var(--surface)); }
.care-note ul { margin: 6px 0 0; padding-left: 1.2em; line-height: 1.7; }
.care-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.care-list { display: grid; gap: 10px; }
.care-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: start; }
.care-item .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.care-item .excerpt { grid-column: 1 / -1; margin: 0; padding: 8px 12px; border-left: 3px solid var(--brand-mist); background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.care-item .follow { grid-column: 1 / -1; font-size: .88rem; color: var(--muted); }
@media (max-width: 600px) { .care-item { grid-template-columns: 1fr; } .care-item .acts { justify-self: start; } }

/* Azure 發音分析（英文說話）：參考 Azure 示範頁的版面 */
.az-top { display:grid; grid-template-columns:180px minmax(0, 1fr); gap:20px; align-items:center; margin-top:8px; }
.az-total { display:grid; gap:8px; justify-items:center; }
.az-ring { --p:0; width:120px; height:120px; border-radius:50%; display:grid; place-items:center; background:conic-gradient(var(--accent) calc(var(--p) * 1%), var(--border) 0); }
.az-ring.hi { background:conic-gradient(var(--green) calc(var(--p) * 1%), var(--border) 0); }
.az-ring.mid { background:conic-gradient(var(--amber) calc(var(--p) * 1%), var(--border) 0); }
.az-ring.lo { background:conic-gradient(var(--danger) calc(var(--p) * 1%), var(--border) 0); }
.az-ring > div { width:94px; height:94px; border-radius:50%; background:var(--surface); display:grid; place-items:center; }
.az-ring b { font-size:1.9rem; color:var(--heading); }
.az-bands { display:flex; gap:10px; font-size:.78rem; color:var(--muted); }
.az-bands i { display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:4px; vertical-align:-1px; }
.az-bands i.hi, .az-track .hi { background:var(--green); } .az-bands i.mid, .az-track .mid { background:var(--amber); } .az-bands i.lo, .az-track .lo { background:var(--danger); }
.az-bars { display:grid; gap:12px; }
.az-bars .row { font-size:.9rem; gap:4px; }
.az-track { height:10px; border-radius:99px; background:var(--surface-2); border:1px solid var(--border); overflow:hidden; margin-top:4px; }
.az-track span { display:block; height:100%; }
.az-wrap { display:grid; grid-template-columns:minmax(0, 1fr) 200px; border:1px solid var(--border); border-radius:14px; overflow:hidden; margin-top:14px; }
.az-text { padding:14px 16px; line-height:2; }
.az-text p { margin:0 0 8px; }
.az-w { border-radius:4px; padding:1px 2px; position:relative; }
.az-w.bad { background:color-mix(in srgb, var(--danger) 16%, transparent); color:var(--danger); }
.az-w.weak { background:color-mix(in srgb, var(--amber) 20%, transparent); }
.az-wrap.hide-bad .az-w.bad, .az-wrap.hide-weak .az-w.weak { background:transparent; color:inherit; }
.az-w[data-tip] { cursor:help; }
.az-w[data-tip]:hover::after, .az-w[data-tip]:focus::after { content:attr(data-tip); position:absolute; bottom:calc(100% + 4px); left:50%; transform:translateX(-50%); background:var(--brand-navy); color:#fff; font-size:.75rem; padding:3px 8px; border-radius:6px; white-space:nowrap; z-index:5; pointer-events:none; line-height:1.4; }
.az-errors { border-left:1px solid var(--border); background:var(--surface-2); padding:14px 16px; display:grid; gap:10px; align-content:start; }
.az-err { display:grid; grid-template-columns:28px 1fr auto; gap:8px; align-items:center; font-size:.9rem; }
.az-count { border-radius:6px; text-align:center; font-weight:700; font-size:.8rem; color:#fff; }
.az-count.bad { background:var(--danger); } .az-count.weak { background:var(--amber); } .az-count.brk { background:var(--rose); } .az-count.mono { background:var(--violet); }
.az-toggle { width:18px; height:18px; accent-color:var(--accent); }
@media (max-width: 700px) { .az-top, .az-wrap { grid-template-columns:1fr; } .az-errors { border-left:none; border-top:1px solid var(--border); } }

/* ---------- 登入（public/js/login.js） ---------- */
.login-screen { position: fixed; inset: 0; z-index: 120; overflow-y: auto; display: grid; place-items: center; padding: 32px 16px;
  background: radial-gradient(60% 50% at 85% 10%, rgba(219,205,255,.75), transparent 70%), radial-gradient(55% 45% at 10% 90%, rgba(70,194,255,.28), transparent 70%), var(--hero-grad); }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 32px 28px 24px; box-shadow: 0 24px 60px rgba(51,70,105,.16); }
.login-logo { display: block; height: 64px; margin: 0 auto 18px; }
.login-card h1 { text-align: center; font-size: 1.6rem; margin: 0 0 16px; color: var(--heading); }
.login-note { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: .9rem; color: var(--muted); margin: 0 0 14px; }
.login-note.shared { border-color: var(--brand-mist); }
.login-pw { position: relative; display: block; }
.login-pw input { padding-right: 64px !important; }
.login-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent); font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.login-eye:focus-visible { outline: 2px solid var(--accent); }
.login-error { color: var(--danger); font-size: .9rem; margin: -4px 0 12px; }
.login-go { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; }
.login-help { text-align: center; margin: 14px 0 0; }
.login-demo { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--border); }
.login-demo h2 { font-size: 1rem; margin: 0 0 2px; color: var(--heading); }
.login-demo-list { display: grid; gap: 8px; margin-top: 10px; }
.login-demo-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; cursor: pointer; font: inherit; color: var(--text); }
.login-demo-btn:hover { border-color: var(--accent); }
.login-demo-btn > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.login-demo-btn .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-pw-bg { z-index: 130; }
.temp-pw { margin-top: 12px; padding: 12px; border: 1px solid var(--brand-lavender); border-radius: 12px; background: var(--surface-2); }
.temp-pw .row { margin-top: 8px; }
.temp-pw-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95rem; letter-spacing: .04em; user-select: all; }
/* Google 登入按鈕（Google 品牌指引：白底、細邊、原色 G 標誌） */
.login-google { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; padding: 0 16px; border: 1px solid var(--color-line); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text-strong); font-weight: 600; text-decoration: none; }
.login-google:hover { background: var(--color-surface-2); }
.login-google:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.login-google-note { margin: 8px 0 0; text-align: center; }
.login-sso-error { margin: 0 0 12px; }
.login-or { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--color-text-secondary); font-size: var(--text-caption-size); }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--color-line); }
@media (max-width: 480px) { .login-card { padding: 26px 18px 20px; border-radius: 20px; } .login-logo { height: 54px; } }

/* 編程平台：手機提示（目標裝置是電腦和 iPad） */
.code-phone { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; margin: 12px 16px 0; }
.code-phone .icon-btn { flex-shrink: 0; min-width: 40px; min-height: 40px; }

/* 文件類 AI 工具：表單提示、快速範本、單元瀏覽器、輸出卡片（views/tool.js、views/tool-output.js） */
.tool-fields .field-wide { grid-column: 1 / -1; }
.tpl-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.tpl-row select { width: auto; max-width: 100%; min-width: 0; flex: 0 1 320px; padding-top: 7px; padding-bottom: 7px; }
.tool-collapsed { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface-2); }
.mb-subjects, .mb-stages { margin-bottom: 10px; }
.mb-stages .chip { font-size: .82rem; }
.mod-list { display: grid; gap: 12px; }
.mod-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--surface); min-width: 0; }
.mod-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.mod-head h4 { margin: 6px 0 0; color: var(--heading); overflow-wrap: anywhere; }
.mod-head .btn { flex-shrink: 0; }
.mod-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0 0; font-size: .86rem; }
.mod-meta dt { color: var(--muted); font-weight: 600; }
.mod-meta dd { margin: 0; overflow-wrap: anywhere; }
.mod-plan { margin-top: 8px; font-size: .86rem; }
.mod-plan summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.mod-plan ol { margin: 6px 0 0; padding-left: 0; list-style: none; display: grid; gap: 4px; }
@media (max-width: 520px) { .mod-meta { grid-template-columns: 1fr; } .mod-meta dd { margin-bottom: 4px; } }
.tool-out-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-between; }
.tool-out-head h3 { margin: 2px 0 0; color: var(--heading); }
.tool-out-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tool-out-actions .icon-btn { height: 32px; min-width: 36px; }
.tool-out-tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-top: 12px; }
.tool-out-tabs .tabs { flex: 1 1 240px; max-width: 360px; }
.tool-review { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--brand-lavender) 45%, var(--surface)); color: var(--text); }
.tool-doc-body { margin-top: 14px; overflow-wrap: anywhere; min-width: 0; }
.tool-doc-body.editing { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: 6px; }
.tool-doc-body table { max-width: 100%; }
.tool-out-foot { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }

/* 第二批 AI 工具（編程助手、辯論準備、作文大綱、概念理解、智能筆記；views/tool.js、views/student-tools.js） */
.chips-desc .chip { display: inline-flex; flex-direction: column; align-items: flex-start; text-align: left; border-radius: 12px; padding: 6px 12px; }
.chips-desc .chip small { font-size: .74rem; color: var(--muted); font-weight: 400; }
.chips-desc .chip.active small { color: rgba(255,255,255,.88); }
.tool-src-tabs { max-width: 420px; margin-top: 12px; }
.tool-code { min-width: 0; }
.tool-count { text-align: right; }
.note-thumbs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
.note-thumb { position: relative; margin: 0; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.note-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.note-thumb-n { position: absolute; left: 4px; top: 4px; font-size: .7rem; padding: 0 6px; border-radius: 99px; background: rgba(30,42,68,.75); color: #fff; }
.note-thumb-x { position: absolute; right: 4px; top: 4px; width: 26px; height: 26px; border-radius: 99px; border: 0; background: rgba(30,42,68,.75); color: #fff; font-size: .8rem; display: grid; place-items: center; }
/* 程式碼塊（工具輸出）：海軍藍底、淺色字，右上角語言和複製 */
.tool-doc-body pre.code-block, .md pre.code-block { position: relative; background: #1e2a44; color: #e6ebf7; padding: 34px 14px 12px; border-radius: 12px; line-height: 1.5; font-size: .88rem; }
.tool-doc-body pre.code-block code { background: none; padding: 0; color: inherit; font-size: inherit; white-space: pre; }
.code-tools { position: absolute; top: 6px; right: 8px; left: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--sans); user-select: none; }
.code-lang { font-size: .72rem; letter-spacing: .06em; color: var(--brand-sky); text-transform: uppercase; font-weight: 600; }
.code-copy { margin-left: auto; font-size: .74rem; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #e6ebf7; border-radius: 6px; padding: 1px 8px; }
.code-copy:hover { background: rgba(255,255,255,.1); }
/* 辯論準備 */
.debate { display: grid; gap: 14px; min-width: 0; }
.db-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: space-between; }
.db-title { margin: 4px 0 0; color: var(--heading); overflow-wrap: anywhere; }
.db-label { font-size: .72rem; letter-spacing: .12em; font-weight: 700; text-transform: uppercase; }
.db-open, .db-close { border-radius: 16px; padding: 18px; min-width: 0; }
.db-open { background: var(--accent-grad); color: #fff; }
.db-open .db-label { color: rgba(255,255,255,.9); }
.db-open .icon-btn { color: #fff; border-color: rgba(255,255,255,.4); }
.db-open .icon-btn:hover { background: rgba(255,255,255,.12); }
.db-open .tag { background: rgba(255,255,255,.18); color: #fff; border-color: transparent; }
.db-open-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.db-icons { display: inline-flex; gap: 6px; }
.db-quote { font-size: 1.02rem; line-height: 1.7; margin: 10px 0 12px; }
.db-quote::before { content: "“"; font-size: 1.8rem; line-height: 0; vertical-align: -.35em; margin-right: 4px; opacity: .6; }
.db-close { background: color-mix(in srgb, var(--brand-lavender) 40%, var(--surface)); border: 1px solid var(--border); }
.db-close .db-label { color: var(--violet); }
.db-h { margin: 6px 0 0; color: var(--heading); font-size: 1.05rem; }
.db-args { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.db-arg { position: relative; border: 1px solid var(--border); border-top: 4px solid var(--teal); border-radius: 14px; padding: 16px; background: var(--surface); min-width: 0; }
.db-arg:nth-child(2) { border-top-color: var(--violet); }
.db-arg:nth-child(3) { border-top-color: var(--green); }
.db-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 99px; background: var(--surface-2); color: var(--heading); font-weight: 700; font-size: .85rem; }
.db-arg h4 { margin: 8px 0 6px; color: var(--heading); overflow-wrap: anywhere; }
.db-arg p { margin: 0; color: var(--text); line-height: 1.6; }
.db-ev-h { margin-top: 10px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.db-evs { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.db-ev { line-height: 1.55; }
.db-src { margin-top: 2px; }
.db-rebs { display: grid; gap: 10px; }
.db-reb { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 10px; }
.db-counter, .db-resp { border-radius: 12px; padding: 12px 14px; min-width: 0; }
.db-counter { background: rgba(217,85,124,.08); border: 1px solid rgba(217,85,124,.25); }
.db-counter .db-label { color: var(--rose); }
.db-resp { background: rgba(47,158,107,.08); border: 1px solid rgba(47,158,107,.25); }
.db-resp .db-label { color: var(--green); }
.db-counter p, .db-resp p { margin: 6px 0 0; line-height: 1.6; }
.db-tips { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.db-tip { border-radius: 12px; padding: 12px 14px; background: rgba(216,154,29,.1); border: 1px solid rgba(216,154,29,.28); line-height: 1.55; }
.db-export { padding-top: 12px; border-top: 1px solid var(--border); }
/* 作文大綱 */
.essay-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-between; }
.essay-title { margin: 2px 0 0; color: var(--heading); overflow-wrap: anywhere; }
.essay-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.essay-secs { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.essay-sec { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--surface); }
.essay-num { width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; background: var(--accent-grad); color: #fff; font-weight: 700; }
.essay-body { min-width: 0; }
.essay-body h4 { margin: 3px 0 4px; color: var(--heading); overflow-wrap: anywhere; }
.essay-body p { margin: 0; color: var(--muted); }
.essay-points { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
@media (max-width: 560px) { .essay-sec { grid-template-columns: auto 1fr; } .essay-sec > .btn { grid-column: 2; justify-self: start; } }
/* 概念理解 */
.concept { display: grid; gap: 14px; min-width: 0; }
.cu-hero { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: 16px; background: var(--hero-grad); border: 1px solid var(--border); }
.cu-emoji { font-size: 2.4rem; flex-shrink: 0; }
.cu-hero h2 { margin: 0; color: var(--heading); font-size: 1.3rem; overflow-wrap: anywhere; }
.cu-hero p { margin: 4px 0 0; color: var(--muted); }
.cu-sec { border: 1px solid var(--border); border-radius: 16px; padding: 16px; background: var(--surface); min-width: 0; }
.cu-sec h3 { margin: 0 0 10px; color: var(--heading); font-size: 1.05rem; }
.cu-sec p { line-height: 1.7; margin: 0 0 8px; }
.cu-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.cu-card { border-radius: 12px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.cu-ana { background: color-mix(in srgb, var(--brand-lavender) 30%, var(--surface)); }
.cu-card-emoji { font-size: 1.6rem; }
.cu-card h4 { margin: 4px 0; color: var(--heading); }
.cu-card p { margin: 0; font-size: .92rem; }
.cu-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cu-facts li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.6; }
.cu-steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; line-height: 1.6; }
.cu-memory { background: rgba(216,154,29,.1); border-color: rgba(216,154,29,.3); }
.cu-trick { font-size: 1.15rem; font-weight: 700; color: var(--heading); white-space: pre-line; }
.cu-quiz { background: color-mix(in srgb, var(--brand-sky) 10%, var(--surface)); }
.cu-q { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-top: 8px; }
.cu-q-btn { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; border: 0; background: none; padding: 10px 12px; color: var(--text); font: inherit; }
.cu-q-icon { flex-shrink: 0; width: 24px; height: 24px; border-radius: 99px; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: rgba(217,85,124,.14); color: var(--rose); }
.cu-q.open .cu-q-icon { background: rgba(47,158,107,.16); color: var(--green); }
.cu-a { padding: 0 12px 12px 46px; line-height: 1.6; }
.cu-links { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.cu-link { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.cu-link:hover { border-color: var(--accent); }
.cu-explore-list { display: grid; gap: 8px; }
.cu-ex { text-align: left; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; color: var(--accent); font: inherit; font-weight: 600; }
.cu-ex:hover { border-color: var(--accent); }
/* 智能筆記：富文本編輯器（A4 白紙） */
.rte-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.rte-bar select { width: auto; padding: 4px 8px; }
.rte-bar .icon-btn { height: 32px; min-width: 34px; background: var(--surface); }
.notes-paper { margin-top: 10px; padding: 14px; border-radius: 14px; background: var(--surface-2); overflow-x: auto; }
.notes-page { max-width: 794px; margin: 0 auto; background: #fff; color: #1e2a44; padding: 32px 36px; border-radius: 6px; box-shadow: var(--shadow); min-height: 320px; outline: none; overflow-wrap: anywhere; }
.notes-page:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-sky) 70%, transparent); }
.notes-page h1 { color: #334669; font-size: 1.5rem; margin-top: 0; }
.notes-page h2, .notes-page h3 { color: #334669; }
.notes-page table.cornell { width: 100%; border-collapse: collapse; table-layout: fixed; }
.notes-page table.cornell th, .notes-page table.cornell td { border: 1px solid #cfd5e6; padding: 8px 10px; vertical-align: top; }
.notes-page table.cornell th { background: #eef0fd; text-align: left; }
.notes-page table.cornell th:first-child { width: 34%; }
.notes-page table.cornell td.cue { width: 34%; font-weight: 600; color: #334669; background: #f6f8fd; }
.notes-page table.cornell ul { margin: 0; padding-left: 18px; }
@media (max-width: 560px) { .notes-paper { padding: 6px; } .notes-page { padding: 18px 14px; } .notes-page table.cornell td.cue { width: 38%; } }

/* 編程助手：程式碼塊的「▶ 執行」和結果 */
.code-run-btn { font-size: .74rem; border: 1px solid var(--brand-sky); background: rgba(70,194,255,.16); color: #e6ebf7; border-radius: 6px; padding: 1px 10px; margin-left: auto; min-height: 28px; }
.code-run-btn + .code-copy { margin-left: 0; }
.code-run-btn:hover:not(:disabled) { background: rgba(70,194,255,.3); }
.code-run-btn:disabled { opacity: .55; }
.tool-doc-body pre.code-block .code-run, .md pre.code-block .code-run { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.18); font-family: var(--sans); white-space: normal; user-select: text; }
.code-run label { display: block; font-size: .78rem; color: #c8d2ea; }
.code-run textarea { display: block; width: 100%; margin-top: 4px; box-sizing: border-box; background: #11182b; color: #d8e2ff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 8px; font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code-run-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; min-height: 28px; }
.code-run-status { font-size: .78rem; color: #c8d2ea; }
.code-run-stop { font-size: .74rem; border: 1px solid rgba(255,255,255,.35); background: transparent; color: #e6ebf7; border-radius: 6px; padding: 1px 10px; min-height: 28px; }
.tool-doc-body pre.code-block .code-out, .md pre.code-block .code-out { margin: 6px 0 0; padding: 8px 10px; background: #11182b; color: #d8e2ff; border-radius: 8px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }
.tool-doc-body pre.code-block .code-out.err, .md pre.code-block .code-out.err { color: #ffb4b4; }
@media (pointer: coarse) { .code-run-btn, .code-run-stop, .code-copy { min-height: 36px; } }

/* ---------- 元件示範頁 /dev/components ---------- */
.dc-section { padding: var(--space-32) 0; border-top: 1px solid var(--color-line); }
.dc-note { margin: 4px 0 var(--space-16); }
.dc-body { margin-top: var(--space-16); }
.dc-stack { display: flex; flex-direction: column; gap: var(--space-12); }
.dc-grid2 { display: grid; gap: var(--space-16); grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.dc-grid3 { display: grid; gap: var(--space-16); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.dc-date { width: 44px; flex-shrink: 0; text-align: center; border-radius: var(--radius-md); background: var(--color-surface-2); padding: 6px 0; }
.dc-icons { display: grid; gap: var(--space-8); grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.dc-icon { display: flex; align-items: center; gap: 8px; min-height: 36px; color: var(--color-text); }

/* ---------- 批改台 /grading（P0-1，設計憲法第 19 節） ---------- */
.gd { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.gd-head { background: var(--color-surface); border-bottom: 1px solid var(--color-line); padding: 16px 28px 0; display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.gd-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-16); flex-wrap: wrap; }
.gd-head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gd-crumb { display: flex; align-items: center; gap: 4px; }
.gd-crumb a { color: inherit; text-decoration: none; }
.gd-crumb a:hover { color: var(--color-accent-text); }
.gd-title-row { display: flex; align-items: center; gap: var(--space-12); flex-wrap: wrap; }
.gd-head-actions { display: flex; align-items: center; gap: var(--space-8); }
.gd-progress { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-right: 6px; }
.gd-progress .progress { width: 160px; }
.gd-tabs { display: flex; gap: 22px; }
.gd-tabs a { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 2px; color: var(--color-text-secondary); font-weight: 500; text-decoration: none; box-shadow: inset 0 -2px 0 transparent; }
.gd-tabs a:hover { color: var(--color-text-strong); }
.gd-tabs a.active { color: var(--color-text-strong); font-weight: 600; box-shadow: inset 0 -2px 0 var(--color-accent); }
.gd-paused { margin-bottom: 10px; align-items: center; }
.gd-paused .btn { margin-left: auto; }
.gd-body { flex: 1; min-height: 0; overflow: auto; }

/* AI 批改中 */
.gd-proc { display: flex; justify-content: center; align-items: flex-start; gap: var(--space-24); padding: 36px 28px; flex-wrap: wrap; }
.gd-proc-card { width: min(620px, 100%); }
.gd-proc-count { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gd-proc-bar { height: 8px; }
.gd-proc-bar > div { background: var(--color-ai-gradient); }
.gd-proc-list { border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); padding: 0 14px; max-height: 360px; overflow: auto; }
.gd-proc-row { gap: var(--space-12); min-height: 44px; }
.gd-proc-row.is-cur .gd-proc-name { font-weight: 600; color: var(--color-text-strong); }
.gd-proc-name { flex: 1; min-width: 0; color: var(--color-text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-score { font-weight: 600; color: var(--color-text-strong); }
.gd-ic-ok { color: var(--color-success-icon); }
.gd-ic-wait { color: var(--color-text-disabled); }
.gd-ic-warn { color: var(--color-warning-icon); }
.gd-ic-ai { color: var(--color-accent); }
.gd-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--color-accent-tint); border-top-color: var(--color-accent); animation: ui-spin .8s linear infinite; flex-shrink: 0; }
.gd-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.gd-dot.lv-full { background: var(--color-success-icon); } .gd-dot.lv-partial { background: var(--color-warning-icon); } .gd-dot.lv-none { background: var(--color-danger-icon); }
.gd-proc-side { width: 300px; max-width: 100%; display: flex; flex-direction: column; gap: var(--space-12); }

/* 覆核：左學生名單、中答卷、右逐題評分 */
.gd-review { display: grid; grid-template-columns: 240px minmax(0, 1fr) 380px; height: 100%; min-height: 0; }
.gd-students { border-right: 1px solid var(--color-line); background: var(--color-surface); padding: 16px 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: hidden; }
.gd-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.gd-filters .chip { min-height: 28px; padding: 2px 10px; font-size: var(--text-caption-size); }
.gd-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.gd-stu { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--color-text); text-decoration: none; }
.gd-stu:hover { background: var(--color-surface-2); }
.gd-stu.active { background: var(--color-accent-tint); color: var(--color-accent-text); font-weight: 600; }
.gd-stu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-stu .icon { width: 16px; height: 16px; stroke-width: 2.2; }
.gd-paper { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--color-bg); }
.gd-paper-bar { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--color-line); background: var(--color-surface); flex-wrap: wrap; }
.gd-tools { display: inline-flex; gap: 2px; padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--color-line); }
.gd-tools .is-on { background: var(--color-accent-tint); color: var(--color-accent-text); }
.gd-doc { flex: 1; min-height: 0; overflow: auto; padding: 20px; }
.gd-doc-inner { margin: 0 auto; min-width: 280px; }
.gd-score { border-left: 1px solid var(--color-line); background: var(--color-surface); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.gd-score-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--color-line); }
.gd-score-avg { text-align: right; line-height: 1.6; }
.gd-qs { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.gd-q { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border: 0; background: none; border-radius: var(--radius-sm); text-align: left; cursor: pointer; color: var(--color-text); }
.gd-q:hover { background: var(--color-surface-2); }
.gd-q-id { font-weight: 600; color: var(--color-text-strong); }
.gd-q-sc { font-weight: 600; }
.gd-q-open { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.gd-q-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gd-q-fb { margin: 0; }
.ai-tag { background: var(--color-accent-tint); }
.gd-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gd-step { min-width: 40px; min-height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--color-line-strong); background: var(--color-surface); font-weight: 600; font-feature-settings: "tnum" 1; color: var(--color-text-strong); cursor: pointer; }
.gd-step:hover { background: var(--color-surface-2); }
.gd-step.on { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.gd-comment, .gd-more { margin: 0 16px 12px; }
.gd-more summary { cursor: pointer; color: var(--color-text-secondary); padding: 4px 0 8px; }
.gd-score-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid var(--color-line); display: flex; flex-direction: column; gap: 10px; position: sticky; bottom: 0; background: var(--color-surface); }
.gd-keys { display: flex; flex-wrap: wrap; gap: 6px 14px; }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; background: var(--color-surface-2); border: 1px solid var(--color-line); font: 600 11px/1 var(--font-sans); color: var(--color-text); }

/* 全班分析 */
.gd-an { padding: 20px 28px 32px; display: flex; flex-direction: column; gap: var(--space-16); }
.gd-an-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-16); }
.gd-an-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 360px; gap: var(--space-16); align-items: start; }
.gd-an-qs { display: flex; flex-direction: column; gap: 8px; }
.gd-an-qs-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 4px; }
.gd-an-q { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--color-line); background: var(--color-surface); cursor: pointer; color: inherit; }
.gd-an-q:hover { border-color: var(--color-line-strong); }
.gd-an-q.active { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); }
.gd-an-q-top { display: flex; align-items: center; gap: 8px; }
.gd-an-q-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-stack { display: flex; height: 8px; border-radius: var(--radius-pill); overflow: hidden; background: var(--color-data-track); gap: 2px; }
.gd-stack .lv-full, .gd-legend .lv-full { background: var(--color-data); }
.gd-stack .lv-partial, .gd-legend .lv-partial { background: var(--color-data-compare); }
.gd-stack .lv-none, .gd-legend .lv-none { background: var(--color-data-strong); }
.gd-legend { display: flex; gap: 14px; padding: 4px; }
.gd-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gd-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.gd-an-main { display: flex; flex-direction: column; gap: var(--space-16); min-width: 0; }
.gd-an-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gd-key { margin-top: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--color-surface-2); }
.gd-dist { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.gd-dist-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: center; gap: 12px; }
.gd-dist-row > :last-child { text-align: right; }
.gd-dist-track { height: 14px; border-radius: var(--radius-xs); background: var(--color-data-track); overflow: hidden; }
.gd-dist-track > div { height: 100%; background: var(--color-data); border-radius: var(--radius-xs); }
.gd-mis { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--color-line); }
.gd-mis:first-of-type { border-top: 0; padding-top: 0; }
.gd-mis-top { display: flex; align-items: baseline; gap: 6px; }
.gd-project-q { font-size: 28px; line-height: 1.5; font-weight: 600; color: var(--color-text-strong); margin: 12px 0 24px; }
.gd-dist-big .gd-dist-row { grid-template-columns: 80px minmax(0, 1fr) 80px; font-size: 20px; }
.gd-dist-big .gd-dist-track { height: 28px; }
.gd-roster { padding: 24px 28px 32px; }
.gd-link-card { margin-bottom: var(--space-24); }
@media (max-width: 1279px) {
  .gd-review { grid-template-columns: 200px minmax(0, 1fr) 340px; }
  .gd-an-grid { grid-template-columns: 260px minmax(0, 1fr); }
  .gd-an-side { grid-column: 1 / -1; }
}
@media (max-width: 1023px) {
  .gd-head { padding: 12px 16px 0; }
  .gd-review { grid-template-columns: minmax(0, 1fr); height: auto; }
  .gd-students { border-right: 0; border-bottom: 1px solid var(--color-line); max-height: 260px; }
  .gd-doc { max-height: 70vh; }
  .gd-score { border-left: 0; }
  .gd-an-stats, .gd-an-grid { grid-template-columns: minmax(0, 1fr); }
  .gd-an { padding: 16px; }
}

/* ---------- 今天（首頁，P0-2） ---------- */
.home-notices { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--space-24); }
.home-notice { align-items: flex-start; }
.home-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--card-gap); margin-bottom: var(--space-24); }
.home-stats a[aria-disabled="true"] { cursor: default; }
.home-empty { margin-bottom: var(--space-24); }
.home-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--card-gap); align-items: start; }
.home-main > .home-week:only-child { grid-column: 1 / -1; }
.home-bars { display: flex; gap: 14px; align-items: flex-end; height: 150px; }
.home-bar { flex: 1; min-width: 0; max-width: 88px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; color: var(--color-text-secondary); }
.home-bar i { display: block; width: 100%; border-radius: 8px; background: var(--color-data); max-height: calc(100% - 44px); }
.home-bar.is-top i { background: var(--color-data-strong); }
.home-bar.is-top span { color: var(--color-text-strong); font-weight: 700; }
.home-due { color: inherit; text-decoration: none; align-items: flex-start; padding: 12px 0; }
.home-due-title { font-weight: 600; color: var(--color-text-strong); }
.home-due .progress { margin-top: 6px; }
.home-date { width: 44px; flex-shrink: 0; text-align: center; border-radius: var(--radius-md); background: var(--color-surface-2); padding: 6px 0; }
.home-date .num { font-weight: 600; font-size: 18px; color: var(--color-text-strong); }
@media (max-width: 1100px) { .home-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .home-stats { grid-template-columns: minmax(0, 1fr); } }

/* 學生 */
.home-student { max-width: 720px; }
.home-next { margin-bottom: var(--space-24); }
.home-sec { margin-bottom: var(--space-24); display: flex; flex-direction: column; gap: 10px; }
.home-sec-head { display: flex; justify-content: space-between; align-items: baseline; }
.home-list { padding: 0 16px; }
.home-row { color: inherit; text-decoration: none; padding: 12px 0; }
.home-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.home-row-title { font-weight: 600; color: var(--color-text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-urgent { color: var(--color-warning-text); display: inline-flex; align-items: center; gap: 6px; }
.home-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-warning-icon); }
.home-chev { color: var(--color-text-disabled); }
/* 分數圓環（學生的分數，第 13.10 節）：--p 為百分比 */
.score-ring { --size: 52px; width: var(--size); height: var(--size); border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: conic-gradient(var(--color-accent) calc(var(--p) * 1%), var(--color-surface-2) 0); }
.score-ring > span { width: calc(var(--size) - 10px); height: calc(var(--size) - 10px); border-radius: 50%; background: var(--color-surface); display: grid; place-items: center; font-weight: 700; color: var(--color-text-strong); }
.score-ring.lg { --size: 76px; }
.score-ring.lg > span { width: 62px; height: 62px; font-size: 22px; }

/* 小學 */
.home-primary { max-width: 1120px; }
.home-p-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: var(--space-24); }
.home-p-hello { display: flex; align-items: center; gap: 18px; }
.home-p-hello .home-p-avatar { width: 64px; height: 64px; border-radius: 22px; font-size: 26px; font-weight: 700; background: var(--color-surface); box-shadow: var(--shadow-1); }
.home-p-week { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 20px 6px 14px; border-radius: var(--radius-pill); background: var(--color-surface); box-shadow: var(--shadow-1); }
.home-p-leaf { width: 30px; height: 30px; color: var(--subject-english-icon); fill: var(--subject-english-bg); }
.home-p-days { font-weight: 700; font-size: 20px; color: var(--color-text-strong); line-height: 1.1; }
.home-p-tasks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--card-gap); margin: 14px 0 var(--space-24); }
.home-p-task { display: flex; flex-direction: column; gap: 16px; }
.home-p-task .btn { margin-top: auto; }
.home-p-task-top { display: flex; align-items: center; gap: 14px; }
.home-p-bottom { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--card-gap); }
.home-p-subj { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.home-p-subj a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0; font-weight: 600; color: var(--color-text-strong); text-decoration: none; border-radius: var(--radius-lg); }
.home-p-subj a:hover { background: var(--color-surface-2); }
.home-p-leaves { display: flex; flex-direction: column; gap: 14px; }
/* 葉子獎勵（葉形簽名，第 9.3 節）：靜止，不擺動 */
.leaf-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.leaf { aspect-ratio: 1; border-radius: 10% 45% 10% 45% / 10% 45% 10% 45%; border: 2px dashed var(--color-line); }
.leaf.is-on { border: 0; background: linear-gradient(135deg, var(--color-success-icon), var(--color-success-text)); } /* 漸變只代表 AI（第 11 節）：葉子用成功色，不用品牌漸變 */
@media (max-width: 900px) { .home-p-tasks, .home-p-bottom { grid-template-columns: minmax(0, 1fr); } .home-p-subj { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- 學生功課頁（P0-2）：做功課、已交、成績回饋 ---------- */
.sw-wrap { max-width: 720px; }
.sw { display: flex; flex-direction: column; gap: 14px; padding-bottom: 96px; }
.sw-head { display: flex; align-items: center; gap: 8px; }
.sw-back { flex-shrink: 0; }
.sw-head-text { min-width: 0; }
.sw-head-text .t-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-chips { gap: 8px; }
.sw-questions, .sw-submit { display: flex; flex-direction: column; gap: 12px; }
.sw-qlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sw-qlist li { display: flex; gap: 10px; font-size: var(--text-body-size); line-height: 1.6; color: var(--color-text-strong); }
.sw-qno { color: var(--color-text-secondary); min-width: 28px; }
.sw-qtxt { flex: 1; }
.sw-instr { margin: 0; }
.sw-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sw-mode { min-height: 96px; border-radius: var(--radius-lg); border: 1px solid var(--color-line-strong); background: var(--color-surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-weight: 600; color: var(--color-text-strong); cursor: pointer; }
.sw-mode .icon { width: 26px; height: 26px; }
.sw-mode.on { border: 2px solid var(--color-accent); background: var(--color-accent-tint); color: var(--color-accent-text); }
.sw-pages { display: flex; gap: 10px; flex-wrap: wrap; }
.sw-page { position: relative; width: 72px; height: 96px; border-radius: var(--radius-sm); background: var(--color-surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; overflow: hidden; color: var(--color-text-secondary); }
.sw-page img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sw-page .t-caption { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; background: var(--color-nav); color: var(--color-text-strong); }
.sw-page-rm { position: absolute; top: 2px; right: 2px; min-width: 24px; min-height: 24px; padding: 0; background: var(--color-surface); border-radius: 50%; }
.sw-page-add { border: 2px dashed var(--color-line); background: transparent; cursor: pointer; }
.sw-page-add .t-caption { position: static; background: none; color: var(--color-text-secondary); padding: 0 4px; text-align: center; }
.sw-saved { text-align: center; }
.sw-bar { position: sticky; bottom: 0; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--color-bg) 30%); }
.app.has-tabbar .sw-bar { bottom: calc(68px + 12px + env(safe-area-inset-bottom)); }
.sw-score { display: flex; align-items: center; gap: 16px; }
.sw-score-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sw-next { gap: 10px; }
.sw-qs { padding: 0 16px; }
.sw-q { align-items: flex-start; padding: 12px 0; }
.sw-q-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sw-q-top { display: flex; justify-content: space-between; gap: 8px; }
.sw-q-id, .sw-q-sc { font-weight: 600; color: var(--color-text-strong); }
.sw-lv { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.sw-lv .icon { width: 16px; height: 16px; stroke-width: 2.4; }
.sw-lv.ok { background: var(--color-success-tint); color: var(--color-success-icon); }
.sw-lv.warn { background: var(--color-warning-tint); color: var(--color-warning-icon); }
.sw-lv.bad { background: var(--color-danger-tint); color: var(--color-danger-icon); }
.sw-done { display: flex; flex-direction: column; gap: 10px; }
.sw-done-top { display: flex; align-items: center; gap: 12px; }
.sw-more summary { cursor: pointer; color: var(--color-text-secondary); }

/* ---------- 跟進練習（P0-2）：一次一題、找出錯誤、逐步提示 ---------- */
.fp-dots { display: flex; gap: 6px; padding: 0 4px; }
.fp-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--color-line); }
.fp-dot.ok { background: var(--color-success-icon); }
.fp-dot.done { background: var(--color-text-secondary); }
.fp-dot.cur { width: 22px; background: var(--color-accent); }
.fp-kind { font-weight: 600; }
.fp-q { font-size: calc(var(--text-body-size) + 1px); color: var(--color-text-strong); }
.fp-steps { display: flex; flex-direction: column; gap: 4px; font-size: 18px; color: var(--color-text-strong); }
.fp-step { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; line-height: 2; }
.fp-opts { display: flex; flex-direction: column; gap: 10px; }
.fp-opt { min-height: 52px; border-radius: var(--radius-md); border: 1px solid var(--color-line-strong); background: var(--color-surface); display: flex; align-items: center; gap: 12px; padding: 0 16px; font-size: var(--text-body-size); color: var(--color-text-strong); text-align: left; cursor: pointer; }
.fp-opt:hover:not(:disabled) { background: var(--color-surface-2); }
.fp-opt:disabled { cursor: default; }
.fp-letter { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--color-line-strong); display: grid; place-items: center; font-size: 13px; color: var(--color-text-secondary); flex-shrink: 0; }
.fp-text { flex: 1; }
.fp-mark { width: 18px; height: 18px; }
.fp-opt.is-bad { border: 2px solid var(--color-danger-icon); background: var(--color-danger-tint); color: var(--color-danger-text); }
.fp-opt.is-bad .fp-letter { background: var(--color-danger-icon); border-color: var(--color-danger-icon); color: var(--color-on-accent); }
.fp-opt.is-ok { border: 2px solid var(--color-success-icon); background: var(--color-success-tint); color: var(--color-success-text); }
.fp-opt.is-ok .fp-letter { background: var(--color-success-icon); border-color: var(--color-success-icon); color: var(--color-on-accent); }
.fp-good { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--color-success-tint); color: var(--color-success-text); }
.fp-help { gap: 8px; padding: 14px 16px; }
.fp-hint { padding-top: 6px; border-top: 1px solid var(--color-line); }
.fp-more { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; }
.fp-bar { display: flex; gap: 10px; }
.fp-bar #fpRetry { flex: 1; }
.fp-end { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.fp-end-icon { width: 56px; height: 56px; border-radius: 10% 45% 10% 45% / 10% 45% 10% 45%; background: var(--color-success-tint); color: var(--color-success-icon); display: grid; place-items: center; }
.fp-end-icon .icon { width: 28px; height: 28px; }

/* 班房的功課列表（P0-4 第 8 項） */
.rm-row { color: inherit; text-decoration: none; padding: 10px 0; }
.rm-kind { --icon-tile-size: 40px; --icon-tile-radius: 12px; }
.rm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rm-title { font-weight: 600; color: var(--color-text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-row .stat-action { margin: 0; white-space: nowrap; }
/* 測驗編輯器：有數學式的欄位只顯示渲染結果，按一下才編輯原碼（P0-4 第 5 項） */
.pv-hidden { display: none !important; }
.math-preview.pv-click { color: var(--color-text-strong); font-size: var(--text-body-size); border: 1px solid var(--color-line-strong); border-radius: var(--input-radius); padding: 8px 12px; background: var(--color-surface); cursor: text; margin-top: 8px; }
.math-preview.pv-click:hover { border-color: var(--color-accent); }

/* 派發成功課（P1-2，public/js/assign-to-room.js） */
.as-qs:empty { display: none; }
.as-qs { margin-bottom: var(--space-16); }
.as-preview { border-radius: var(--radius-md); background: var(--color-surface-2); padding: var(--space-12) var(--space-16); }
.as-preview summary { cursor: pointer; font-weight: 600; color: var(--color-text-strong); }
.as-preview ol { margin: var(--space-12) 0 0; padding-left: 1.4em; max-height: 240px; overflow: auto; }
.as-preview li { margin: var(--space-4) 0; }
.as-pace { border: 0; padding: 0; margin: 0 0 var(--space-16); }
.as-pace legend { padding: 0; margin-bottom: 6px; font-size: var(--text-small-size); font-weight: 600; color: var(--color-text-strong); }
.cu-hero .cu-assign { margin-left: auto; flex-shrink: 0; }

/* 班房與單元（P1-6，public/js/views/room-units.js；設計稿「班房：按單元」） */
.rm-head { margin-bottom: var(--space-20); }
.rm-back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.rm-title-row { display: flex; align-items: center; gap: var(--space-12); min-width: 0; }
.rm-title-row h1 { overflow-wrap: anywhere; }
.rm-tabs { margin-bottom: var(--space-20); }
.un-card { padding: var(--space-24) var(--space-24); margin-bottom: var(--space-20); }
.un-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-16); margin-bottom: var(--space-16); }
.un-head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.un-head-actions { display: flex; gap: var(--space-8); align-items: center; flex-shrink: 0; }
.un-eyebrow { font-weight: 600; color: var(--color-text-secondary); }
.un-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-24); }
@media (max-width: 900px) { .un-cols { grid-template-columns: minmax(0, 1fr); } }
.un-h { margin: 0 0 var(--space-8); }
.un-row { color: inherit; text-decoration: none; border-bottom: 1px solid var(--color-line); }
.un-row:last-child { border-bottom: 0; }
.un-kind { --icon-tile-size: 36px; --icon-tile-radius: 10px; }
.un-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.un-title { font-weight: 600; color: var(--color-text-strong); }
.un-row .stat-action { margin: 0; white-space: nowrap; }
.un-bar { width: 120px; height: 4px; border-radius: var(--radius-pill); background: var(--color-data-track); overflow: hidden; flex-shrink: 0; }
.un-bar i { display: block; height: 100%; background: var(--color-data); }
.un-add { margin-top: var(--space-8); }
.un-res { width: 100%; border: 0; background: none; font: inherit; color: var(--color-text); text-align: left; text-decoration: none; cursor: pointer; min-height: 40px; }
.un-res .icon { color: var(--color-text-secondary); }
.un-stat { margin-top: var(--space-12); padding-top: var(--space-12); border-top: 1px solid var(--color-line); }
.un-stat b { font-size: var(--text-title-size); color: var(--color-text-strong); }
.un-sec { margin-bottom: var(--space-20); }
.un-sec-h { margin: 0 0 var(--space-8); }
.un-folds { padding: 0; }
.un-fold + .un-fold { border-top: 1px solid var(--color-line); }
.un-fold summary { display: flex; align-items: center; gap: var(--space-12); padding: var(--space-12) var(--space-20); min-height: 52px; cursor: pointer; list-style: none; }
.un-fold summary::-webkit-details-marker { display: none; }
.un-fold-title { flex: 1; min-width: 0; font-weight: 600; color: var(--color-text-strong); }
.un-chev { color: var(--color-text-secondary); transition: transform var(--dur-fast, .15s) var(--ease-standard, ease); }
.un-fold[open] .un-chev { transform: rotate(90deg); }
.un-fold-body { padding: 0 var(--space-20) var(--space-20); }
.un-gen { border: 0; padding: 0; margin: 0 0 var(--space-16); }
.un-gen legend { padding: 0; margin-bottom: 8px; font-size: var(--text-small-size); font-weight: 600; color: var(--color-text-strong); }
.un-gen-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8); }
.un-gen-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid var(--color-line-strong); cursor: pointer; }
.un-gen-opt:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-tint); }
.un-gen-opt input { width: 18px; height: 18px; accent-color: var(--color-accent); }
.un-steps { list-style: none; padding: 0; margin: var(--space-12) 0 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--text-small-size); color: var(--color-text-secondary); }
.un-steps li { display: flex; gap: 8px; align-items: center; }
@media (prefers-reduced-motion: reduce) { .un-chev { transition: none; } }
/* 建立班房（P1-6，views/room-new.js） */
.rn-steps { list-style: none; margin: 0 0 var(--space-16); padding: 0; display: flex; align-items: center; gap: var(--space-12); font-size: var(--text-small-size); color: var(--color-text-secondary); }
.rn-steps li { display: flex; align-items: center; gap: 8px; }
.rn-steps li[aria-current="step"] { color: var(--color-text-strong); font-weight: 600; }
.rn-dot { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--color-line-strong); display: grid; place-items: center; font-size: var(--text-caption-size); }
.rn-steps li[aria-current="step"] .rn-dot { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.rn-line { width: 40px; height: 1px; background: var(--color-line-strong); }
.rn-card { padding: var(--space-24); }
.rn-subj { border: 0; padding: 0; margin: 0 0 var(--space-16); }
.rn-subj legend { padding: 0; margin-bottom: 10px; font-size: var(--text-small-size); font-weight: 600; color: var(--color-text-strong); }
.rn-chips { display: flex; flex-wrap: wrap; gap: var(--space-8); align-items: center; }
.rn-chips .chip[aria-pressed="true"] { border-color: var(--color-accent); background: var(--color-accent-tint); color: var(--color-accent-text); font-weight: 600; }
.rn-chips .rn-other { width: auto; min-width: 140px; height: 40px; }
.rn-hr { border: 0; border-top: 1px solid var(--color-line); margin: var(--space-8) 0 var(--space-16); }
.rn-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--space-12); flex-wrap: wrap; margin-top: var(--space-20); }
.rn-skip { font-weight: 600; }
.rn-chips .chip { min-height: 40px; padding: 0 16px; font-size: var(--text-body-size); }
.rm-tabs .num { margin-left: 6px; }
/* 學生功課按單元（P1-6，views/work.js） */
.wk-tabs { margin-bottom: var(--space-20); }
.wk-tabs .num { margin-left: 6px; }
.wk-sec { margin-bottom: var(--space-20); }
.wk-head { display: flex; align-items: center; gap: var(--space-12); margin-bottom: var(--space-8); }
.wk-head-text { display: flex; flex-direction: column; min-width: 0; }
.wk-head-text h2 { margin: 0; }
.wk-unit-link { display: inline-flex; align-items: center; gap: 8px; margin-top: var(--space-8); padding: 6px 4px; font-weight: 600; color: var(--color-accent-text); text-decoration: none; min-height: 44px; }
.wk-row { padding-left: var(--space-4); }

/* 批改台：網上作答的文字（P1-3） */
.gd-text { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-24); display: flex; flex-direction: column; gap: var(--space-8); }
.gd-text-body { white-space: pre-wrap; line-height: 1.8; color: var(--color-text-strong); }
