@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&display=swap');

:root {
  --ink: #172033;
  --muted: #657187;
  --faint: #96a0b3;
  --line: #dce3ee;
  --paper: #eef2f8;
  --panel: #ffffff;
  --blue: #2563eb;
  --green: #059669;
  --amber: #d97706;
  --rose: #e11d48;
  --violet: #7c3aed;
  --teal: #0891b2;
  --shadow-sm: 0 6px 18px rgba(30, 42, 68, 0.08);
  --shadow: 0 18px 50px rgba(30, 42, 68, 0.14);
  --r: 18px;
  /* 各章主題色 */
  --c1: #2563eb;
  --c2: #7c3aed;
  --c3: #059669;
  --c4: #d97706;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans TC", system-ui, sans-serif;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(37, 99, 235, 0.10), transparent 60%),
    radial-gradient(1000px 700px at 100% 0%, rgba(124, 58, 237, 0.10), transparent 55%),
    radial-gradient(900px 700px at 90% 110%, rgba(5, 150, 105, 0.10), transparent 55%),
    var(--paper);
  min-height: 100vh;
}

button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ===================== 封面 ===================== */
.cover {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 24px;
}
.cover-inner {
  max-width: 960px;
  width: 100%;
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 48px 46px 42px;
}
.cover-eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-weight: 900;
  letter-spacing: 0.22em;
  font-size: 14px;
}
.cover-title {
  margin: 0;
  font-size: clamp(28px, 5.2vw, 70px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: linear-gradient(120deg, var(--blue), var(--violet) 45%, var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cover-sub {
  margin: 18px 0 30px;
  color: var(--muted);
  font-size: clamp(14px, 1.8vw, 18px);
  font-weight: 500;
  line-height: 1.7;
  word-break: keep-all;
}
.cover-sub span {
  display: inline-block;
  white-space: nowrap;
}
.cover-chapters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 34px;
  text-align: left;
}
.cover-card {
  border-radius: 16px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--ct);
}
.cover-card .cc-num {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--ct);
}
.cover-card .cc-title { font-size: 19px; font-weight: 900; margin: 4px 0 6px; }
.cover-card .cc-list { font-size: 13px; color: var(--muted); line-height: 1.7; }
.cover-start {
  border: none;
  color: #fff;
  background: linear-gradient(120deg, var(--blue), var(--violet));
  padding: 16px 40px;
  font-size: 19px;
  font-weight: 900;
  border-radius: 999px;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.34);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cover-start:hover { transform: translateY(-2px); box-shadow: 0 22px 40px rgba(37, 99, 235, 0.42); }
.cover-hint { margin: 22px 0 0; color: var(--faint); font-size: 13px; }

/* ===================== 主體版面 ===================== */
.app { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.topbar {
  height: 62px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.home-btn {
  border: none;
  background: none;
  font-weight: 900;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.crumb {
  flex: 1;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumb b { color: var(--ink); }
.ghost-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}

.body { flex: 1; display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 0; }

/* ------- 目錄 ------- */
.toc {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  overflow-y: auto;
  padding: 14px 12px 40px;
}
.toc-chapter { margin-bottom: 6px; }
.toc-chead {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  font-weight: 900;
  font-size: 14px;
  color: var(--ct);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
}
.toc-chead:hover { background: rgba(37, 99, 235, 0.06); }
.toc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ct); flex: none; }
.toc-items { display: none; padding-left: 8px; }
.toc-chapter.open .toc-items { display: block; }
.toc-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  border-left: 2px solid var(--line);
  padding: 7px 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}
.toc-item:hover { color: var(--ink); background: rgba(37, 99, 235, 0.05); }
.toc-item.active {
  color: var(--ct);
  font-weight: 800;
  border-left: 2px solid var(--ct);
  background: rgba(37, 99, 235, 0.08);
}
.toc-item .ti-sec { font-size: 11px; color: var(--faint); font-weight: 700; margin-right: 6px; }
.toc-item mjx-container {
  font-size: 100% !important;
  line-height: 0;
  vertical-align: -0.1em;
}

/* ------- 舞台 ------- */
.stage { display: flex; flex-direction: column; min-height: 0; padding: 14px 24px 0; }

.slide {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 22px 30px;
  overflow: hidden;
  animation: slidein 0.32s ease;
}
@keyframes slidein {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* 章節分隔頁 */
.slide.divider {
  grid-template-columns: 1fr;
  place-items: center;
  text-align: center;
  background: linear-gradient(135deg, var(--ct), color-mix(in srgb, var(--ct) 62%, #111));
  color: #fff;
  border: none;
}
.divider .dv-num { font-size: 15px; font-weight: 900; letter-spacing: 0.3em; opacity: 0.85; }
.divider .dv-title { font-size: clamp(38px, 6vw, 66px); font-weight: 900; margin: 12px 0 18px; }
.divider .dv-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 720px; }
.divider .dv-chip { background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.35); padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 15px; }

/* 左：概念欄（改為不捲動，內容過高時由 JS 自動縮放） */
.slide-info { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding-right: 6px; }
.col-fit { display: flex; flex-direction: column; min-height: 100%; transform-origin: top center; }
.slide-info::-webkit-scrollbar, .toc::-webkit-scrollbar, .slide-visual::-webkit-scrollbar { width: 8px; }
.slide-info::-webkit-scrollbar-thumb, .toc::-webkit-scrollbar-thumb, .slide-visual::-webkit-scrollbar-thumb { background: #cfd7e6; border-radius: 8px; }

.badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--ct);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.slide-title { font-size: clamp(23px, 2.6vw, 32px); font-weight: 900; line-height: 1.18; margin: 0 0 10px; }

.formula {
  flex-shrink: 0;
  background: color-mix(in srgb, var(--ct) 8%, #fff);
  border: 1px solid color-mix(in srgb, var(--ct) 24%, #fff);
  border-radius: 12px;
  padding: 8px 14px;
  margin-bottom: 12px;
  overflow-x: auto;
  overflow-y: hidden;
}
.formula .formula-label { font-size: 12px; font-weight: 900; color: var(--ct); letter-spacing: 0.06em; margin-bottom: 4px; }
.formula mjx-container[display="true"],
.formula mjx-container {
  margin: 4px 0 !important;
  display: block;
  text-align: center;
}

.points { list-style: none; margin: 0 0 16px; padding: 0; }
.points li {
  position: relative;
  padding: 4px 0 4px 26px;
  font-size: 15.5px;
  line-height: 1.55;
  color: #29344a;
}
.points li::before {
  content: "";
  position: absolute;
  left: 4px; top: 13px;
  width: 9px; height: 9px;
  border-radius: 3px;
  background: var(--ct);
  transform: rotate(45deg);
}
.points li b { color: var(--ct); }
.points .k { font-weight: 900; color: var(--ct); }

/* 範例 */
.example {
  margin-top: auto;
  border: 1px dashed color-mix(in srgb, var(--ct) 40%, var(--line));
  border-radius: 14px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--ct) 5%, #fff);
}
.ex-head { display: flex; align-items: center; gap: 8px; font-weight: 900; color: var(--ct); font-size: 14px; margin-bottom: 8px; }
.ex-head::before { content: "✎"; }
.ex-q { font-size: 15px; line-height: 1.6; color: var(--ink); }
.ex-toggle {
  margin-top: 12px;
  border: 1px solid var(--ct);
  color: var(--ct);
  background: #fff;
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 800;
  font-size: 13px;
}
.ex-toggle:hover { background: var(--ct); color: #fff; }
.ex-sol { margin-top: 12px; display: none; }
.ex-sol.show { display: block; animation: slidein 0.25s ease; }
.ex-sol ol { margin: 0; padding-left: 20px; }
.ex-sol li { font-size: 14.5px; line-height: 1.7; margin-bottom: 4px; }
.ex-ans {
  margin-top: 10px;
  font-weight: 900;
  color: #fff;
  background: var(--ct);
  display: inline-block;
  padding: 6px 16px;
  border-radius: 10px;
  font-size: 15px;
}

/* 右：視覺欄 */
.slide-visual {
  position: relative; /* 浮動互動面板（.ictrl）的定位基準 */
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #fbfcfe, #f3f6fb);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.visual-host { flex: 1; display: flex; flex-direction: column; min-height: 0; width: 100%; overflow: hidden; transform-origin: center center; }
.visual-host > * { margin: auto; max-width: 100%; }
/* 繪圖用 SVG 撐滿欄寬並限高 */
.visual-host svg { width: 100%; height: auto; max-height: 100%; display: block; }
/* 但 MathJax 內嵌數學的 SVG 要保留原始尺寸，否則分數會被拉成滿寬而暴大 */
.visual-host mjx-container svg { width: auto !important; height: auto !important; max-height: none !important; display: inline-block; }
.visual-caption { margin-top: 12px; text-align: center; font-size: 13px; color: var(--muted); line-height: 1.55; }

/* 互動控制元件（通用） */
.ictrl { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin-top: 14px; }
.ictrl label { font-size: 13px; font-weight: 800; color: var(--muted); }
.ictrl input[type="range"] { width: 180px; accent-color: var(--ct); }
/* 寬螢幕：滑桿改為「圖下方一列」，不再浮動蓋住圖形 */
@media (min-width: 641px) {
  .ictrl {
    margin: 10px auto 0; max-width: 100%;
    flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 18px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid var(--ct); border-radius: 14px;
    box-shadow: 0 4px 14px rgba(23, 32, 51, 0.10);
  }
  .ictrl label { display: flex; align-items: baseline; gap: 8px; }
  .ictrl input[type="range"] { width: 160px; }
  .ictrl .step-txt { max-width: 300px; }
  /* 有滑桿的視覺欄：圖形頂端對齊，讓「圖＋滑桿」由 JS(fitSlide) 當一整組等比縮放，
     不再用固定保留高度硬切 SVG（步驟說明會換行、控制列高度不固定，硬切會裁掉滑桿） */
  .slide-visual:has(.ictrl) .visual-host { justify-content: flex-start; }
  .slide-visual:has(.ictrl) .visual-host > * { margin-top: 0; }
  .slide-visual:has(.ictrl) .visual-host svg { max-height: none; }
}
/* 步驟講解器文字 */
.step-txt { font-size: 12.5px; font-weight: 700; color: var(--ink, #172033); text-align: left; line-height: 1.55; min-height: 1em; }
.step-txt b { color: var(--ct); }
.step-hint { font-weight: 700; color: var(--ct); font-size: 11px; }
.ibtn {
  border: 1px solid var(--ct);
  color: var(--ct);
  background: #fff;
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 800;
  font-size: 13px;
}
.ibtn:hover { background: var(--ct); color: #fff; }
.ibtn.active { background: var(--ct); color: #fff; }
.ival { font-weight: 900; color: var(--ct); font-size: 15px; min-width: 26px; text-align: center; }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }

/* SVG 共用樣式 */
svg .lbl { font-family: "Noto Sans TC", sans-serif; font-weight: 800; }
svg .mth { font-family: "Cambria Math", "Times New Roman", serif; font-style: italic; }
svg .dim { fill: var(--muted); }

/* 控制列 */
.controlbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 4px 12px;
}
.nav-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 11px 22px;
  font-weight: 800;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
.nav-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.progress { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 14px; }
.progress-track { flex: 1; height: 8px; background: #dbe2ee; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--violet)); border-radius: 999px; transition: width 0.3s ease; }
.progress-text { font-weight: 800; font-size: 13px; color: var(--muted); min-width: 62px; text-align: right; }

/* ===================== 授課教具 ===================== */
/* 側欄收合 → 投影滿版 */
.app.toc-collapsed .toc { display: none; }
.app.toc-collapsed .body { grid-template-columns: 1fr; }

/* 畫筆畫布 */
.pen-canvas { position: fixed; inset: 0; z-index: 800; pointer-events: none; touch-action: none; }
.laser-canvas { position: fixed; inset: 0; z-index: 1150; pointer-events: none; }
.app.pen-on .body { cursor: crosshair; }
.app.laser-on .body { cursor: none; }

/* 雷射點 */
.laser-dot {
  position: fixed; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%; pointer-events: none; z-index: 1200;
  background: radial-gradient(circle, rgba(255,60,60,0.98), rgba(255,0,0,0.55) 55%, rgba(255,0,0,0) 72%);
  box-shadow: 0 0 14px 5px rgba(255,0,0,0.55);
}

/* 浮動工具列 */
.dock {
  position: fixed; right: 14px; top: 50%; transform: translateY(-50%);
  z-index: 1000; display: flex; flex-direction: column; gap: 7px;
  padding: 10px 8px; background: rgba(255,255,255,0.9); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.dbtn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--ink); display: grid; place-items: center; transition: background 0.15s, color 0.15s;
}
.dbtn svg { width: 22px; height: 22px; }
.dbtn:hover { background: rgba(37,99,235,0.10); color: var(--blue); }
.dbtn.active { background: var(--blue); color: #fff; }
#dkLaser.active { background: var(--rose); color: #fff; }
#dkPen.active { background: var(--green); color: #fff; }
.dsep { height: 1px; background: var(--line); margin: 2px 5px; }
.dcolors { display: flex; flex-direction: column; gap: 6px; align-items: center; padding: 4px 0; }
.dcolor {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line); background: var(--sc); cursor: pointer; padding: 0;
}
.dcolor.active { box-shadow: 0 0 0 3px var(--sc); transform: scale(1.1); }
.derase { width: 34px; height: 34px; }
.derase.active { background: var(--amber); color: #fff; }

/* ===================== 範例／圖解「放大成整頁」 ===================== */
/* 範例框內的放大鈕 */
.ex-zoom {
  margin-left: auto; border: 1px solid var(--ct); color: var(--ct); background: #fff;
  border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 800; line-height: 1.4;
}
.ex-zoom:hover { background: var(--ct); color: #fff; }
/* 視覺欄右上角的放大鈕 */
.vis-zoom {
  position: absolute; top: 10px; right: 12px; z-index: 6;
  border: 1.5px solid var(--ct); color: var(--ct); background: rgba(255, 255, 255, 0.9);
  border-radius: 999px; padding: 5px 13px; font-size: 12.5px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(23, 32, 51, 0.12);
}
.vis-zoom:hover { background: var(--ct); color: #fff; }

/* 放大內容層：z-index 700 < 畫筆畫布(800)，才能用畫筆寫在放大內容上面 */
.zoom-modal {
  position: fixed; inset: 0; z-index: 700; background: #fff;
  overflow: auto; padding: 82px clamp(20px, 5vw, 80px) 56px;
}
.zoom-modal.hidden, .zoom-bar.hidden { display: none !important; }
.zoom-body { position: relative; min-height: 100%; display: flex; flex-direction: column; }
.zoom-q { font-size: clamp(23px, 3.3vw, 42px); line-height: 1.7; color: var(--ink); font-weight: 500; }
.zoom-sol { display: none; margin-top: 28px; padding-top: 20px; border-top: 2px dashed #cdd6e2; }
.zoom-sol.show { display: block; }
.zoom-sol ol { font-size: clamp(19px, 2.7vw, 33px); line-height: 1.9; padding-left: 1.3em; margin: 0; }
.zoom-sol li { margin-bottom: 10px; }
.zoom-ans { margin-top: 20px; font-size: clamp(21px, 2.9vw, 35px); font-weight: 900; color: #fff; background: var(--ct); display: inline-block; padding: 9px 26px; border-radius: 14px; }
/* 圖解模式：放大的視覺 host 撐滿 */
.zoom-body > .visual-host { flex: 1; min-height: 0; }
.zoom-body > .visual-host svg { max-height: 80vh; }

/* 放大控制列：z-index 1300 > 畫筆畫布，按鈕隨時可點 */
.zoom-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1300;
  display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--ct, #2563eb);
}
.zoom-badge { flex: 1; font-weight: 900; color: var(--ct, #2563eb); font-size: clamp(14px, 2vw, 18px); }
.zoom-btn { border: 1.5px solid var(--ct, #2563eb); color: var(--ct, #2563eb); background: #fff; border-radius: 999px; padding: 8px 20px; font-weight: 800; font-size: 15px; }
.zoom-btn:hover { background: var(--ct, #2563eb); color: #fff; }
.zoom-x { border-color: #e11d48; color: #e11d48; }
.zoom-x:hover { background: #e11d48; color: #fff; }

/* 右側浮動教具列（.dock）是 fixed 且垂直置中，會壓在投影片右緣上方；
   視窗一矮，教具列就升到「🔍 放大」鈕的高度並蓋住它（dock z-index 1000 > 放大鈕 6）。
   寬螢幕（兩欄不捲動版面）預留一條「教具列車道」，讓投影片內容永遠不進入該區。 */
@media (min-width: 1081px) {
  .stage { padding-right: 86px; }
}

/* 響應式 */
@media (max-width: 1080px) {
  .body { grid-template-columns: 1fr; }
  .toc { position: fixed; inset: 62px 0 0 0; z-index: 30; width: min(320px, 86vw); border-right: 1px solid var(--line); transform: translateX(-105%); transition: transform 0.25s ease; background: #fff; }
  .toc.open { transform: none; box-shadow: var(--shadow); }
  .slide { grid-template-columns: 1fr; overflow-y: auto; }
  .slide-info { overflow: visible; }
  .slide-visual { overflow: visible; }
}
@media (max-width: 640px) {
  .stage { padding: 12px 12px 0; }
  .slide { padding: 20px; gap: 18px; }
  .nav-btn { padding: 10px 14px; font-size: 14px; }
}

/* ===================== 澳門四校聯考（JAE）專屬排版 ===================== */
.jae-slide {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 22px;
}

/* 左欄：試題與正下方核心知識點 */
.jae-problem-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.jae-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.jae-badge {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--ct);
  padding: 4px 12px;
  border-radius: 999px;
}
.jae-topic-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--ct);
  background: color-mix(in srgb, var(--ct) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--ct) 25%, #fff);
  padding: 3px 10px;
  border-radius: 999px;
}
.jae-score-tag {
  font-size: 12px;
  font-weight: 800;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  border-radius: 6px;
}
.jae-q-zoom {
  margin-left: auto;
  border: 1px solid var(--ct);
  color: var(--ct);
  background: #fff;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  cursor: pointer;
}
.jae-q-zoom:hover { background: var(--ct); color: #fff; }

.jae-q-card {
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}
.jae-q-text {
  font-size: 16px;
  line-height: 1.68;
  color: var(--ink);
  font-weight: 500;
}
.jae-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.jae-opt-item {
  font-size: 14.5px;
  line-height: 1.5;
  color: #1e293b;
  font-weight: 500;
}

/* 頂部三部曲動線步驟列 */
.jae-flow-steps {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
}
.flow-step-btn {
  background: transparent;
  border: none;
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.flow-step-btn:hover {
  color: var(--ct);
  background: rgba(255, 255, 255, 0.8);
}
.flow-step-btn.active {
  background: var(--ct);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.flow-arrow {
  color: #94a3b8;
  font-size: 11px;
}

/* 核心知識點 & 必背公式卡片（獨立區域） */
.jae-kp-card {
  margin-top: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--ct) 6%, #fff), #ffffff);
  border: 1.5px solid color-mix(in srgb, var(--ct) 28%, var(--line));
  border-left: 5px solid var(--ct);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.jae-kp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: none;
}
.jae-kp-title {
  font-weight: 900;
  font-size: 13.5px;
  color: var(--ct);
  display: flex;
  align-items: center;
  gap: 6px;
}
.jae-kp-icon { font-size: 15px; }
.jae-kp-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.jae-kp-zoom {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.jae-kp-zoom:hover {
  background: var(--ct);
  color: #fff;
  border-color: var(--ct);
  transform: translateY(-1px);
}
.jae-kp-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: color-mix(in srgb, var(--ct) 15%, #fff);
  color: var(--ct);
  border: 1px solid color-mix(in srgb, var(--ct) 35%, #cbd5e1);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}
.jae-kp-toggle-btn:hover {
  background: var(--ct);
  color: #fff;
  transform: translateY(-1px);
}
.jae-kp-toggle-btn .btn-key {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: monospace;
}
.jae-kp-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 12px 14px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed color-mix(in srgb, var(--ct) 30%, #cbd5e1);
  border-radius: 10px;
  font-size: 12.5px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}
.jae-kp-prompt:hover {
  background: #ffffff;
  color: var(--ct);
  border-color: var(--ct);
}
.jae-kp-content {
  display: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed color-mix(in srgb, var(--ct) 20%, var(--line));
}
.jae-kp-content.show {
  display: block;
  animation: slidein 0.22s ease;
}
.jae-kn-formulas {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.jae-formula-item {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid color-mix(in srgb, var(--ct) 20%, #e2e8f0);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 14px;
  overflow-x: auto;
}
.jae-kn-points {
  margin: 0 0 6px;
  padding-left: 18px;
}
.jae-kn-points li {
  font-size: 13.5px;
  line-height: 1.55;
  color: #334155;
  margin-bottom: 4px;
}
.jae-kn-pitfall {
  margin-top: 6px;
  padding: 6px 10px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  font-size: 12.5px;
  color: #be123c;
  line-height: 1.5;
}
.pitfall-badge { font-weight: 800; margin-right: 4px; }

/* 右欄：動態圖解與規範解答 */
.jae-sol-col {
  padding: 16px 18px;
  background: linear-gradient(180deg, #fbfcfe, #f3f6fb);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.jae-sol-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  gap: 12px;
  transform-origin: top center;
}
.jae-vis-container {
  position: relative;
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.jae-vis-host {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.jae-vis-host svg {
  max-height: 240px;
  width: 100%;
  height: auto;
  display: block;
}
.jae-vis-container .vis-zoom {
  top: 8px;
  right: 8px;
}

/* 解答卡片 */
.jae-sol-card {
  flex: 1 1 auto;
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.jae-sol-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: none;
}
.jae-sol-title {
  font-weight: 900;
  font-size: 14px;
  color: var(--ink);
}
.jae-sol-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.jae-sol-zoom {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.jae-sol-zoom:hover {
  background: var(--ct);
  color: #fff;
  border-color: var(--ct);
  transform: translateY(-1px);
}
.jae-sol-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ct);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}
.jae-sol-toggle-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.jae-sol-toggle-btn .btn-key {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  font-family: monospace;
}

/* 預設隱藏時顯示的課堂提問思考提示卡 */
.jae-sol-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px 16px;
  margin-top: 10px;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border: 1.5px dashed color-mix(in srgb, var(--ct) 40%, #cbd5e1);
  border-radius: 12px;
  user-select: none;
}
.prompt-icon {
  font-size: 24px;
  margin-bottom: 6px;
}
.prompt-title {
  font-weight: 900;
  font-size: 14.5px;
  color: var(--ct);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.prompt-sub {
  font-size: 13px;
  line-height: 1.6;
  color: #475569;
}
.prompt-sub kbd {
  display: inline-block;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 5px;
  box-shadow: 0 2px 0 #cbd5e1;
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ct);
  font-family: monospace;
}

.jae-sol-content {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.jae-sol-content.show {
  display: block;
  animation: slidein 0.25s ease;
}
.jae-sol-thinking {
  background: #f8fafc;
  border-left: 3px solid #64748b;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: #475569;
  line-height: 1.55;
  margin-bottom: 10px;
}
.thinking-label {
  font-weight: 800;
  font-size: 12px;
  color: #334155;
  margin-bottom: 3px;
}
.jae-sol-steps {
  margin-bottom: 10px;
}
.jae-sol-steps ol {
  margin: 0;
  padding-left: 20px;
}
.jae-sol-steps li {
  font-size: 14px;
  line-height: 1.65;
  color: #1e293b;
  margin-bottom: 6px;
}
.jae-ans-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--ct) 8%, #fff);
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--ct) 24%, #fff);
}
.jae-ans-badge {
  font-size: 12px;
  font-weight: 900;
  color: #fff;
  background: var(--ct);
  padding: 3px 8px;
  border-radius: 6px;
}
.jae-ans-value {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
}
.jae-quick-tip {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 8px;
  font-size: 13px;
  color: #854d0e;
  line-height: 1.5;
}
.tip-badge {
  font-weight: 800;
  color: #b45309;
  margin-right: 4px;
}

/* 放大講解 Modal 中的專用樣式 */
.zoom-q-badge {
  font-size: clamp(16px, 2.2vw, 24px);
  font-weight: 900;
  color: var(--ct);
  margin-bottom: 12px;
}
.zoom-q-text {
  font-size: clamp(22px, 3.2vw, 38px);
  line-height: 1.7;
  font-weight: 500;
}
.zoom-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 24px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px dashed #cdd6e2;
}
.zoom-opt-item {
  font-size: clamp(18px, 2.5vw, 30px);
  font-weight: 500;
}
.zoom-knowledge {
  margin-top: 22px;
  padding: 18px 24px;
  background: #f8fafc;
  border-left: 6px solid var(--ct);
  border-radius: 14px;
}
.zoom-kn-title {
  font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 900;
  color: var(--ct);
  margin-bottom: 10px;
}
.zoom-kn-formulas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: clamp(18px, 2.5vw, 28px);
}
.zoom-knowledge ul {
  margin: 10px 0;
  padding-left: 28px;
  font-size: clamp(16px, 2.2vw, 24px);
  line-height: 1.6;
}
.zoom-kn-pitfall {
  margin-top: 10px;
  padding: 10px 14px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  font-size: clamp(15px, 2vw, 22px);
  color: #be123c;
}
.zoom-thinking {
  font-size: clamp(16px, 2.2vw, 26px);
  line-height: 1.7;
  margin-bottom: 16px;
  color: #475569;
}
.zoom-quick-tip {
  margin-top: 16px;
  padding: 12px 18px;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 12px;
  font-size: clamp(16px, 2.2vw, 26px);
  color: #854d0e;
}
.zoom-sol-full {
  width: 100%;
}
.zoom-sol-badge {
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 900;
  color: var(--ct);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}
.zoom-steps {
  margin: 16px 0;
  padding-left: 28px;
}
.zoom-steps li {
  font-size: clamp(16px, 2.2vw, 26px);
  line-height: 1.7;
  color: #1e293b;
  margin-bottom: 12px;
}

/* 核心知識點 & 必背公式 全螢幕放大視窗樣式 */
.zoom-kp-full {
  width: 100%;
}
.zoom-kp-badge {
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 900;
  color: var(--ct);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
.zoom-kp-topic {
  font-size: clamp(16px, 2vw, 24px);
  color: #475569;
  margin-bottom: 18px;
}
.zoom-kn-box {
  margin-bottom: 20px;
  padding: 16px 22px;
  background: #f8fafc;
  border-left: 6px solid var(--ct);
  border-radius: 14px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.zoom-kn-subtitle {
  font-size: clamp(17px, 2.3vw, 26px);
  font-weight: 900;
  color: var(--ct);
  margin-bottom: 12px;
}
.zoom-formula-card {
  background: #ffffff;
  border: 1.5px solid color-mix(in srgb, var(--ct) 30%, #cbd5e1);
  border-radius: 10px;
  padding: 10px 18px;
  margin-bottom: 10px;
  font-size: clamp(18px, 2.5vw, 32px);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.zoom-kn-list {
  margin: 0;
  padding-left: 28px;
}
.zoom-kn-list li {
  font-size: clamp(16px, 2.1vw, 25px);
  line-height: 1.7;
  color: #1e293b;
  margin-bottom: 10px;
}
.zoom-kn-pitfall-box {
  margin-top: 18px;
  padding: 14px 20px;
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
  border-radius: 14px;
}
.zoom-pit-head {
  font-size: clamp(17px, 2.2vw, 25px);
  font-weight: 900;
  color: #be123c;
  margin-bottom: 6px;
}
.zoom-pit-body {
  font-size: clamp(15px, 2vw, 23px);
  line-height: 1.65;
  color: #9f1239;
}

/* ============================================================
   教師面板、PIN碼驗證、大螢幕 QR 碼與課堂進度控制樣式
   ============================================================ */

/* 封面頂部列與教師控制按鈕 */
.cover-top-bar {
  position: absolute;
  top: 18px;
  right: 24px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.cover-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cover-teacher-btn {
  background: rgba(255, 255, 255, 0.95);
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  text-decoration: none;
}
.cover-teacher-btn:hover {
  background: #f8fafc;
  border-color: #3b82f6;
  color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
}

/* 手機版速查二維碼卡片（置於手機速查版按鈕正下方） */
.cover-qr-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1.5px solid #cbd5e1;
  border-radius: 18px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(8px);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}
.cover-qr-card:hover {
  transform: translateY(-2px);
  border-color: #3b82f6;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.2);
}
.cover-qr-box {
  width: 108px;
  height: 108px;
  background: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.cover-qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}
.cover-qr-label {
  font-size: 12px;
  font-weight: 800;
  color: #2563eb;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cover-qr-card:hover .cover-qr-label {
  color: #1d4ed8;
}

/* 舞台頂部列手機版懸浮二維碼 */
.top-mobile-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.top-qr-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.top-mobile-wrapper:hover .top-qr-popover {
  display: flex;
}
.top-qr-svg {
  width: 100px;
  height: 100px;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.top-qr-svg svg {
  width: 100%;
  height: 100%;
  display: block;
}
.top-qr-tip {
  font-size: 11px;
  font-weight: 800;
  color: #2563eb;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .cover-qr-card {
    display: none;
  }
}

/* 舞台頂部列教師按鈕 */
.teacher-ctrl-btn {
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-weight: 800;
  font-size: 12px;
  border-radius: 999px;
  padding: 5px 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s ease;
}
.teacher-ctrl-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #2563eb;
  transform: translateY(-1px);
}

/* 通用彈窗遮罩 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden {
  display: none !important;
}

/* 彈窗卡片本體 */
.modal-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalPop {
  0% { opacity: 0; transform: scale(0.94) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1.5px solid #e2e8f0;
  background: #f8fafc;
}
.modal-title {
  font-size: 17px;
  font-weight: 900;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.15s ease;
}
.modal-close:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* 1. PIN 碼卡片 */
.pin-card {
  width: 440px;
}
.pin-body {
  padding: 24px;
}
.pin-desc {
  font-size: 14px;
  color: #475569;
  margin-bottom: 18px;
  line-height: 1.6;
}
.pin-input-row {
  display: flex;
  gap: 10px;
}
.pin-input-row input {
  flex: 1;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 4px;
  text-align: center;
  color: #0f172a;
  outline: none;
  transition: all 0.2s ease;
}
.pin-input-row input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.btn-primary {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}
.pin-err {
  margin-top: 14px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  color: #dc2626;
  font-size: 13px;
  font-weight: 700;
}
.pin-err.hidden {
  display: none !important;
}

/* 2. 教師進度控制面板本體 */
.teacher-card {
  width: 840px;
  max-height: 90vh;
}
.teacher-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.teacher-tip {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: #1e40af;
  line-height: 1.6;
}

/* 快速進度按鈕 */
.preset-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.section-label {
  font-size: 13.5px;
  font-weight: 900;
  color: #334155;
}
.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.preset-btn {
  background: #f8fafc;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  transform: translateY(-1px);
}
.preset-btn.preset-secondary {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #334155;
}
.preset-btn.preset-secondary:hover {
  background: #e2e8f0;
}
.preset-btn.preset-all {
  background: #ecfdf5;
  border-color: #10b981;
  color: #047857;
}
.preset-btn.preset-all:hover {
  background: #10b981;
  color: #fff;
}
.preset-btn.preset-clear {
  background: #fff1f2;
  border-color: #f43f5e;
  color: #be123c;
}
.preset-btn.preset-clear:hover {
  background: #e11d48;
  color: #fff;
}

/* 試卷自由勾選清單 */
.papers-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.papers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.selected-count {
  font-size: 12.5px;
  font-weight: 900;
  color: #2563eb;
  background: #dbeafe;
  padding: 3px 10px;
  border-radius: 999px;
}
.paper-year-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 290px;
  overflow-y: auto;
  padding-right: 6px;
}
.year-row {
  display: grid;
  grid-template-columns: 85px 1fr 1fr;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 12px;
}
.year-label {
  font-weight: 900;
  font-size: 13.5px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 5px;
}
.paper-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.paper-box:hover {
  border-color: var(--paper-color, #2563eb);
  background: #fdfdfd;
}
.paper-box.checked {
  border-color: var(--paper-color, #2563eb);
  background: color-mix(in srgb, var(--paper-color, #2563eb) 8%, #ffffff);
}
.paper-box input[type="checkbox"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: var(--paper-color, #2563eb);
}
.paper-info-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.paper-name {
  font-size: 12.5px;
  font-weight: 800;
  color: #0f172a;
}
.paper-meta {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

/* 操作按鈕列 */
.teacher-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 12px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1.5px solid #e2e8f0;
}
.btn-action {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn-qr {
  background: #f1f5f9;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
}
.btn-qr:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-1px);
}
.btn-copy {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1.5px solid #bfdbfe;
}
.btn-copy:hover {
  background: #dbeafe;
  border-color: #3b82f6;
  transform: translateY(-1px);
}
.btn-save {
  background: #16a34a;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.25);
}
.btn-save:hover {
  background: #15803d;
  transform: translateY(-1px);
}

/* 3. 大螢幕 QR 碼彈窗 */
.qr-card {
  width: 520px;
  text-align: center;
}
.qr-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.qr-sub {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
}
.qr-code-box {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}
.qr-code-box svg {
  display: block;
  max-width: 260px;
  max-height: 260px;
  width: 100%;
  height: auto;
}
.qr-info-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qr-info-papers {
  font-size: 13px;
  font-weight: 800;
  color: #2563eb;
  background: #eff6ff;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
}
.qr-url-row {
  display: flex;
  gap: 8px;
}
.qr-url-row input {
  flex: 1;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #475569;
  background: #f8fafc;
  outline: none;
}
.btn-sm {
  background: #0f172a;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn-sm:hover {
  background: #334155;
}

/* Toast 輕量通知訊息 */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 800;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.25s ease 2.5s forwards;
  pointer-events: auto;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}




/* ===== OMML 複製按鈕專用樣式 ===== */
.jae-copy-omml-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  vertical-align: middle;
  white-space: nowrap;
}
.jae-copy-omml-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}
.jae-copy-omml-btn.copied {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
}
