:root {
  --brand: #5b5fc7;
  --brand-dark: #4649a6;
  --bg: #f5f6fb;
  --card-bg: #ffffff;
  --text: #23233b;
  --muted: #6b6b85;
  --good: #1a9c5c;
  --good-bg: #e7f8ef;
  --bad: #d5372f;
  --bad-bg: #fdecea;
  --border: #e3e3f0;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft JhengHei", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--brand);
  color: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 24px;
}

.topbar a { color: #fff; text-decoration: none; font-weight: 600; }
.topbar-left { justify-self: start; min-width: 0; }
.topbar-right { justify-self: end; min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar .title { grid-column: 2; justify-self: center; text-align: center; font-size: 18px; font-weight: 700; }
.topbar .title small { display:block; font-weight:400; font-size:12px; opacity:.85; }

@media (max-width: 620px) {
  .topbar {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
    gap: 8px;
  }
  .topbar-left, .topbar-right { justify-self: center; }
  /* 修正：桌機版標題被固定在 grid 第 2 欄，手機版改成單欄後這條規則沒有跟著重置，
     導致瀏覽器多長出一個看不見的隱形欄位，把 topbar-right 的內容擠壓成一長串
     逐字換行、看起來像一大塊空白的跑版畫面。手機版這裡強制改回第 1 欄即可。 */
  .topbar .title { grid-column: 1; }
  .topbar-right {
    flex-wrap: wrap;
    justify-content: center;
  }
}

.lang-toggle {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.lang-toggle:hover { background: rgba(255,255,255,0.32); }

h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 0 0 12px; }
p.lead { color: var(--muted); margin-top: 0; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(20,20,50,.04);
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 620px) {
  .mode-grid { grid-template-columns: 1fr; }
}

.domain-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.domain-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.domain-head strong { font-size: 16px; }

.skill-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}
.skill-info { flex: 1; min-width: 0; }
.skill-info .skill-name { font-weight: 600; font-size: 14px; }
.skill-info .skill-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.skill-row .btn.secondary {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 13px;
  white-space: nowrap;
}

/* On narrow screens, stack the skill's text above its practice button
   instead of squeezing them side by side (which left an awkward blank gap). */
@media (max-width: 480px) {
  .skill-row {
    flex-direction: column;
    align-items: stretch;
  }
  .skill-row .btn.secondary {
    align-self: flex-start;
    margin-top: 10px;
  }
}

.mode-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
  background: #fbfbff;
}
.mode-card .emoji { font-size: 30px; }
.mode-card h3 { margin: 8px 0 6px; font-size: 17px; }
.mode-card p { color: var(--muted); font-size: 14px; min-height: 60px; }

select, button, input[type=text] {
  font-family: inherit;
  font-size: 15px;
}

select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  margin-bottom: 14px;
}

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary {
  background: #fff;
  color: var(--brand);
  border: 1.5px solid var(--brand);
}
.btn.secondary:hover { background: #eef0fb; }
.btn.block { width: 100%; text-align: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eef0fb;
  color: var(--brand-dark);
}

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #e9e9f5;
  overflow: hidden;
  margin: 10px 0 18px;
}
.progress-bar > div {
  height: 100%;
  background: var(--brand);
  transition: width .2s ease;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.lang-toggle-card {
  background: #eef0fb;
  border: 1px solid var(--border);
  color: var(--brand-dark);
}
.lang-toggle-card:hover { background: #e1e3f8; }

.q-image {
  margin: 4px 0 18px;
  text-align: center;
}
.q-image img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.q-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.q-text {
  font-size: 16px;
  font-weight: 600;
  margin: 6px 0 18px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.option:hover { border-color: var(--brand); background: #f8f8ff; }
.option input { margin-top: 3px; }
.option .letter {
  font-weight: 700;
  color: var(--brand-dark);
  min-width: 18px;
}
.option.correct { border-color: var(--good); background: var(--good-bg); }
.option.incorrect { border-color: var(--bad); background: var(--bad-bg); }
.option.disabled { cursor: default; }

.feedback {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
}
.feedback.correct { background: var(--good-bg); color: var(--good); border: 1px solid #b7ecd1; }
.feedback.incorrect { background: var(--bad-bg); color: var(--bad); border: 1px solid #f6c3bf; }
.feedback .explain { color: var(--text); margin-top: 8px; font-size: 14px; }

/* HOTSPOT 表格題型（判斷題 / 下拉選單題） */
.hotspot-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}
.hotspot-table th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1.5px solid var(--border);
}
.hotspot-table th.hs-choice { text-align: center; width: 70px; }
.hotspot-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}
.hotspot-table tr:last-child td { border-bottom: none; }
.hotspot-row-label { font-weight: 500; }
.hotspot-radio { text-align: center; }
.hotspot-radio input { width: 18px; height: 18px; cursor: pointer; }
.hotspot-select select {
  width: 100%;
  min-width: 180px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.hotspot-row.correct td { background: var(--good-bg); }
.hotspot-row.incorrect td { background: var(--bad-bg); }
.hotspot-row-mark { font-weight: 700; margin-left: 6px; }
.hotspot-row-mark.correct { color: var(--good); }
.hotspot-row-mark.incorrect { color: var(--bad); }
.hotspot-row-answer { font-size: 12px; color: var(--muted); margin-top: 2px; }

.actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  background: rgba(255,255,255,.18);
  padding: 6px 12px;
  border-radius: 999px;
}
.timer.warn { background: #ffdada; color: #b0231d; }

.jumpgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 6px;
  margin: 14px 0;
}
.jumpgrid button {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.jumpgrid button.current { border-color: var(--brand); background: var(--brand); color: #fff; }
.jumpgrid button.answered { border-color: var(--good); color: var(--good); }
.jumpgrid button.answered.current { color: #fff; background: var(--brand); }

/* ---- 正式模擬考：左側題目選單（可顯示/隱藏） ---- */
.sidebar-toggle-btn {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.32); }

.exam-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.exam-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.sidebar-backdrop {
  display: none;
}

.exam-sidebar {
  flex: 0 0 220px;
  width: 220px;
  box-sizing: border-box;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(20,20,50,.04);
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  transition: width .2s ease, flex-basis .2s ease, padding .2s ease, opacity .2s ease, border-width .2s ease;
}
.exam-sidebar.collapsed,
html.sb-init-collapsed .exam-sidebar {
  width: 0;
  flex-basis: 0;
  padding: 0;
  border-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.sidebar-close-btn {
  display: none;
  border: none;
  background: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 6px;
}

.exam-sidebar .jumpgrid {
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  margin: 0 0 12px;
}

.sidebar-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}
.sidebar-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
  border: 1.5px solid var(--border);
  background: #fff;
}
.sidebar-legend .dot-current { background: var(--brand); border-color: var(--brand); }
.sidebar-legend .dot-answered { border-color: var(--good); }

.exam-main {
  flex: 1;
  min-width: 0;
}

@media (max-width: 880px) {
  .exam-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    max-height: 100vh;
    width: 260px;
    flex-basis: 260px;
    padding: 16px;
    border-width: 1px;
    opacity: 1;
    overflow-y: auto;
    pointer-events: auto;
    border-radius: 0 var(--radius) var(--radius) 0;
    z-index: 101;
    /* 手機版預設一律先「收起（畫面外）」，就算 JS 還沒執行也不會蓋住頁面最上方；
       真正要顯示時才由 .sidebar-open（執行時）或 sb-init-open（畫面畫出來前）加上 translateX(0)。 */
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .exam-layout.sidebar-open .exam-sidebar,
  html.sb-init-open .exam-sidebar {
    transform: translateX(0);
  }
  .sidebar-close-btn { display: inline-block; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(20,20,50,.35);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .exam-layout.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
  margin-bottom: 20px;
}
.summary-grid .stat {
  background: #fbfbff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 8px;
}
.summary-grid .stat .num { font-size: 26px; font-weight: 800; color: var(--brand-dark); }
.summary-grid .stat .label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.pass { color: var(--good); }
.fail { color: var(--bad); }

.review-item { border-bottom: 1px dashed var(--border); padding: 16px 0; }
.review-item:last-child { border-bottom: none; }
.tag-correct { color: var(--good); font-weight: 700; }
.tag-incorrect { color: var(--bad); font-weight: 700; }

.filterbar { margin-bottom: 16px; }
.filterbar a {
  display: inline-block;
  margin-right: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.filterbar a.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.result-table-wrap {
  overflow-x: auto;
  margin-top: 10px;
}
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 560px;
}
.result-table th, .result-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.result-table th {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  border-bottom: 2px solid var(--border);
}
.result-table td.col-scope { white-space: normal; min-width: 140px; }
.result-table td.col-score { white-space: normal; }
.result-table tbody tr:last-child td { border-bottom: none; }
.result-table tbody tr:hover { background: #faf9ff; }
.result-table .score-line { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

@media (max-width: 620px) {
  .result-table th, .result-table td { padding: 10px; font-size: 13px; }
}

footer.note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 30px;
}

/* ---- 重點關鍵字標註（已移除黃底，維持純文字樣式） ---- */
mark {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-weight: inherit;
}

/* ---- 全部題目與答案：目錄 ---- */
.qa-toc {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.qa-toc-domain strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}
.qa-toc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.qa-toc-links a {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  background: #fff;
  transition: border-color .15s ease, color .15s ease;
}
.qa-toc-links a:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* =========================================================================
 * 教師資料設定頁：照片預覽 / LOGO 清單
 * ========================================================================= */
.teacher-photo-preview {
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.teacher-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.teacher-photo-placeholder { font-size: 12px; color: var(--muted); text-align: center; padding: 0 10px; }
.teacher-logo-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.teacher-logo-item {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  text-align: center; width: 140px;
}
.teacher-logo-item img { max-width: 100%; max-height: 70px; object-fit: contain; margin-bottom: 8px; }

/* =========================================================================
 * 教學簡報模式（PPT 風格全螢幕呈現）
 * ========================================================================= */
.present-body { background: #1c1d2b; }
.present-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: clamp(8px, 1.2vmin, 16px) clamp(12px, 1.8vmin, 24px); background: #14151f; color: #fff;
  flex-wrap: wrap;
}
.present-topbar a.present-exit { color: #fff; text-decoration: none; font-weight: 600; font-size: clamp(12px, 1.3vmin, 16px); opacity: .85; }
.present-topbar a.present-exit:hover { opacity: 1; }
.present-jump {
  flex: 1; min-width: 160px; max-width: 480px;
  padding: clamp(5px, .8vmin, 9px) clamp(8px, 1.2vmin, 14px); border-radius: 8px; border: 1px solid #3a3b52;
  background: #23243a; color: #fff; font-size: clamp(11px, 1.2vmin, 14px);
}
.present-counter { font-size: clamp(11px, 1.2vmin, 14px); opacity: .85; white-space: nowrap; }
.present-fullscreen {
  background: #3a3b52; color: #fff; border: none; border-radius: 8px;
  padding: clamp(5px, .8vmin, 9px) clamp(10px, 1.4vmin, 16px); font-size: clamp(11px, 1.2vmin, 14px); cursor: pointer;
}
.present-fullscreen:hover { background: #4a4b6a; }

.present-progress { height: 4px; background: #2a2b40; }
.present-progress-bar { height: 100%; background: var(--brand); transition: width .25s ease; }

.present-stage {
  min-height: calc(100vh - 130px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px 16px;
}
.present-slide {
  background: #fff; border-radius: var(--radius);
  max-width: min(1400px, 94vw); width: 100%;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  padding: clamp(20px, 3.4vmin, 52px) clamp(20px, 4.2vmin, 64px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
}
.present-breadcrumb { font-size: clamp(12px, 1.5vmin, 18px); color: var(--muted); font-weight: 600; }
.present-breadcrumb-pos { font-weight: 400; opacity: .8; }
.present-q-text { font-size: clamp(17px, 2.8vmin, 32px); font-weight: 600; margin: clamp(10px, 1.6vmin, 20px) 0 clamp(12px, 2vmin, 24px); }
.present-slide .card-head .badge { font-size: clamp(11px, 1.3vmin, 15px); }
.present-slide .q-image img { max-height: 38vh; }
.present-slide .teacher-options .option { font-size: clamp(14px, 1.9vmin, 20px); padding: clamp(10px, 1.4vmin, 16px) clamp(12px, 1.8vmin, 20px); }
.present-slide .feedback { font-size: clamp(13px, 1.7vmin, 18px); padding: clamp(12px, 1.8vmin, 20px); }
.present-slide .feedback strong { font-size: clamp(14px, 1.9vmin, 20px); }
.present-slide .hotspot-table { font-size: clamp(13px, 1.6vmin, 18px); }

.present-cover { text-align: center; padding: clamp(20px, 3vmin, 44px) clamp(24px, 5vmin, 64px); display: flex; flex-direction: column; }
.teacher-cover-photo {
  width: clamp(70px, 11vmin, 168px); height: clamp(70px, 11vmin, 168px); border-radius: 50%; object-fit: cover;
  margin: 0 auto clamp(8px, 1.2vmin, 16px); display: block; border: 3px solid var(--bg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15); flex-shrink: 0;
}
.teacher-cover-photo-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(28px, 4vmin, 56px); background: var(--bg); color: var(--muted);
}
.teacher-cover-name { margin: 0 0 2px; font-size: clamp(19px, 3.4vmin, 38px); flex-shrink: 0; }
.teacher-cover-title { color: var(--brand-dark); font-weight: 600; margin-bottom: clamp(8px, 1.4vmin, 16px); font-size: clamp(13px, 1.8vmin, 20px); flex-shrink: 0; }
.teacher-cover-email { color: var(--muted); font-size: clamp(11px, 1.4vmin, 16px); margin-bottom: clamp(10px, 1.6vmin, 18px); flex-shrink: 0; }
.teacher-cover-email a { color: inherit; text-decoration: none; }
.teacher-cover-email a:hover { text-decoration: underline; }
.teacher-cover-experience {
  text-align: left; max-width: 900px; margin: 0 auto clamp(12px, 1.8vmin, 20px);
  color: var(--text); font-size: clamp(12px, 1.6vmin, 18px); line-height: 1.5;
  list-style: none; padding: 0;
  columns: 2 300px; column-gap: clamp(18px, 2.6vmin, 34px);
}
.teacher-cover-experience li {
  break-inside: avoid; margin-bottom: clamp(4px, .7vmin, 8px); padding-left: 14px; position: relative;
}
.teacher-cover-experience li::before {
  content: "•"; position: absolute; left: 0; color: var(--brand);
}
.teacher-cover-experience.is-dense-2 { font-size: clamp(11px, 1.4vmin, 16px); line-height: 1.4; }
.teacher-cover-experience.is-dense-2 li { margin-bottom: clamp(3px, .5vmin, 6px); }
.teacher-cover-experience.is-dense-3 { font-size: clamp(10px, 1.25vmin, 14px); line-height: 1.32; columns: 2 250px; column-gap: clamp(14px, 2vmin, 24px); }
.teacher-cover-experience.is-dense-3 li { margin-bottom: clamp(2px, .35vmin, 4px); padding-left: 11px; }
.teacher-cover-logos {
  display: flex; flex-wrap: wrap; gap: clamp(14px, 2.2vmin, 28px); justify-content: center; align-items: center;
  padding-top: clamp(10px, 1.6vmin, 18px); border-top: 1px dashed var(--border); flex-shrink: 0;
}
.teacher-cover-logos img { max-height: clamp(44px, 7.5vmin, 110px); max-width: clamp(110px, 17vmin, 260px); object-fit: contain; }
.teacher-cover-hint { color: var(--muted); font-size: clamp(12px, 1.5vmin, 16px); }

.teacher-options .option { position: relative; }
.present-plain-list { padding-left: 20px; margin: 0; }
.present-plain-list li { margin-bottom: 8px; }

.manual-only { display: none; }
.present-slide.manual-reveal:not(.revealed) .manual-only { display: block; }
.present-slide.manual-reveal:not(.revealed) .answer-block { display: none; }
.present-slide.manual-reveal:not(.revealed) .option.answer-correct { border-color: var(--border); background: transparent; }
.present-slide.manual-reveal:not(.revealed) .ans-mark { display: none; }
.present-reveal-btn { font-weight: 700; }

.present-slide .option.answer-correct { border-color: var(--good); background: var(--good-bg); }
.present-slide .option .ans-mark { float: right; }

.present-controls {
  position: sticky; bottom: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: clamp(10px, 1.6vmin, 20px); background: #14151f;
  flex-wrap: wrap;
}
.present-nav-btns { display: flex; gap: 10px; margin-left: auto; width: 100%; justify-content: center; }
.present-nav-btns .btn { font-size: clamp(13px, 1.6vmin, 18px); padding: clamp(9px, 1.4vmin, 16px) clamp(16px, 2.4vmin, 28px); }
@media (max-width: 620px) {
  .present-slide { padding: 22px 18px; max-height: calc(100vh - 150px); }
  .present-controls { justify-content: center; }
  .present-nav-btns { margin-left: 0; }
  .teacher-cover-experience,
  .teacher-cover-experience.is-dense-2,
  .teacher-cover-experience.is-dense-3 { columns: 1; }
}

/* ================================================================
   學習指南 / 重點整理 — guide.php 頁面 與 practice.php 側欄共用樣式
   ================================================================ */

/* ---- guide.php：頁首單元目錄 ---- */
.guide-toc {
  display: flex; flex-wrap: wrap; gap: 14px 22px;
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border);
}
.guide-toc-group { font-size: 13px; }
.guide-toc-group > strong { display: block; margin-bottom: 6px; }
.guide-toc-links { display: flex; flex-wrap: wrap; gap: 6px; }
.guide-toc-links a {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--brand-dark); text-decoration: none; font-size: 12px; font-weight: 600;
}
.guide-toc-links a:hover { background: #eef0fb; }

/* ---- guide.php：每個單元的區塊 ---- */
.guide-unit {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
  scroll-margin-top: 16px;
}
.guide-unit-highlight {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(91, 95, 199, .15);
}
.guide-unit-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}

/* 章節迷你目錄：單元內各章節的跳轉連結 */
.guide-mini-toc {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin: 4px 0 14px; padding: 10px 12px; background: #f7f8fd;
  border: 1px solid var(--border); border-radius: 10px; font-size: 13px;
}
.guide-mini-toc-label { color: var(--muted); font-weight: 600; margin-right: 2px; }
.guide-mini-toc-link {
  color: var(--brand-dark); text-decoration: none; padding: 2px 8px;
  border: 1px solid var(--border); border-radius: 999px; background: #fff;
  white-space: nowrap;
}
.guide-mini-toc-link:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 完整筆記內容：以可展開/收合的章節（details/summary）呈現，避免長文一次全部展開 */
.guide-sections { margin-top: 6px; }
.guide-section {
  margin-bottom: 10px; border: 1px solid var(--border); border-radius: 10px;
  padding: 0; overflow: hidden; scroll-margin-top: 12px;
}
.guide-section:last-child { margin-bottom: 0; }
.guide-section-h {
  margin: 0; padding: 10px 14px; font-size: 15px; font-weight: 600;
  color: var(--brand-dark); background: #f7f8fd; cursor: pointer;
  list-style: none;
}
.guide-section-h::-webkit-details-marker { display: none; }
.guide-section-h::before {
  content: '▸'; display: inline-block; margin-right: 8px; color: var(--brand);
  transition: transform .15s ease;
}
.guide-section[open] > .guide-section-h::before { transform: rotate(90deg); }
.guide-section-body { padding: 12px 14px 14px; }
.guide-section-p { margin: 0 0 10px; font-size: 14px; line-height: 1.75; }
.guide-section-ul { margin: 0 0 10px; padding-left: 20px; }
.guide-section-ul li { margin-bottom: 6px; font-size: 14px; line-height: 1.65; }
.guide-table-wrap { overflow-x: auto; margin: 0 0 14px; }
.guide-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.guide-table th, .guide-table td {
  border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top;
}
.guide-table th { background: #f5f6fb; color: var(--brand-dark); }

.guide-points h4,
.guide-mnemonics h4 { margin: 10px 0 6px; font-size: 14px; }
.guide-points ul { margin: 0; padding-left: 20px; }
.guide-points li { margin-bottom: 6px; font-size: 14px; line-height: 1.6; }
.guide-mnemonics { margin-top: 10px; }
.guide-pitfall {
  margin-top: 10px; padding: 8px 12px; border-radius: 8px;
  background: #fff7e6; border: 1px solid #ffe1a8; color: #7a5a00;
  font-size: 13px; line-height: 1.6;
}

/* 記憶口訣：小圓角標籤 */
.mnemonic-chip {
  display: inline-block; margin: 0 6px 6px 0; padding: 5px 11px;
  border-radius: 8px; background: #eef0fb; color: var(--brand-dark);
  font-size: 13px; font-weight: 600; line-height: 1.5;
}
.mnemonic-chip.small { font-size: 12px; padding: 4px 9px; }

/* ---- guide.php：左側章節選單（可顯示/隱藏，記住使用者偏好）與已讀進度 ---- */
.guide-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}
.guide-main { flex: 1; min-width: 0; }

.guide-sidebar {
  flex: 0 0 250px;
  width: 250px;
  box-sizing: border-box;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(20,20,50,.04);
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  transition: width .2s ease, flex-basis .2s ease, padding .2s ease, opacity .2s ease, border-width .2s ease;
}
.guide-sidebar.collapsed,
html.gsb-init-collapsed .guide-sidebar {
  width: 0;
  flex-basis: 0;
  padding: 0;
  border-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.guide-sidebar-home {
  display: block;
  padding: 8px 10px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: #f7f8fd;
  color: var(--brand-dark);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid var(--border);
}
.guide-sidebar-home:hover { background: #eef0fb; }
.guide-sidebar-home.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.guide-nav-group { margin-bottom: 16px; }
.guide-nav-group:last-child { margin-bottom: 0; }
.guide-nav-group-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px;
}
.guide-nav-group .progress-bar { height: 5px; margin: 0 0 8px; }
.guide-nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: 8px;
  font-size: 13px; line-height: 1.4; color: var(--text);
  text-decoration: none; margin-bottom: 2px;
}
.guide-nav-link:hover { background: #f2f3fb; }
.guide-nav-link.active { background: var(--brand); color: #fff; font-weight: 700; }
.guide-nav-link.read:not(.active) { color: var(--good); }
.guide-nav-check { flex-shrink: 0; font-size: 12px; }

/* 側欄單元底下的小節（章節）子選單 */
.guide-nav-unit { margin-bottom: 2px; }
.guide-nav-link-row { display: flex; align-items: center; gap: 2px; }
.guide-nav-link-row .guide-nav-link { flex: 1; min-width: 0; }
.guide-nav-expand-btn {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 12px; line-height: 1;
  border-radius: 6px;
}
.guide-nav-expand-btn:hover { background: #f2f3fb; color: var(--text); }
.guide-nav-subsections {
  display: none;
  margin: 2px 0 6px 14px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
}
.guide-nav-unit.expanded .guide-nav-subsections { display: block; }
.guide-nav-subhead { font-size: 11px; color: var(--muted); margin: 2px 0 4px; }
.guide-nav-sublink {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px; border-radius: 6px;
  font-size: 12px; line-height: 1.35; color: var(--text);
  text-decoration: none; margin-bottom: 1px;
}
.guide-nav-sublink:hover { background: #f2f3fb; }
.guide-nav-sublink.read { color: var(--good); }

/* 單元頁內：每個小節的已讀標記按鈕 / 練習連結 */
.guide-section-foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.guide-section-mark-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; color: var(--muted);
}
.guide-section-mark-btn.is-read { color: var(--good); border-color: var(--good); background: var(--good-bg); }
.guide-section-practice-link {
  font-size: 12px; font-weight: 700; color: var(--brand-dark); text-decoration: none;
  border: 1px solid var(--brand); border-radius: 8px; padding: 5px 10px;
}
.guide-section-practice-link:hover { background: var(--brand); color: #fff; }
.guide-mini-toc-link.read { color: var(--good); border-color: var(--good); }

@media (max-width: 880px) {
  .guide-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    max-height: 100vh;
    width: 280px;
    flex-basis: 280px;
    padding: 16px;
    border-width: 1px;
    opacity: 1;
    overflow-y: auto;
    pointer-events: auto;
    border-radius: 0 var(--radius) var(--radius) 0;
    z-index: 101;
    /* 手機版預設先「收起（畫面外）」，即使 JS 還沒執行也不會蓋住畫面最上方。 */
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .guide-layout.sidebar-open .guide-sidebar,
  html.gsb-init-open .guide-sidebar {
    transform: translateX(0);
  }
  .guide-layout .sidebar-backdrop { display: block; }
  .guide-layout.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

/* 首頁學習狀況：單元卡片格狀列表 */
.guide-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 6px;
}
.guide-unit-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.guide-unit-card:hover { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,95,199,.12); }
.guide-unit-card.read { border-color: var(--good); background: var(--good-bg); }
.guide-unit-card-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 6px;
}
.guide-unit-card .skill-name { font-size: 13px; font-weight: 700; }
.guide-unit-card .skill-desc { font-size: 12px; color: var(--muted); }
.guide-unit-status { font-size: 11px; font-weight: 700; white-space: nowrap; color: var(--muted); }
.guide-unit-card.read .guide-unit-status { color: var(--good); }

/* 單元頁：已讀完徽章與上一/下一單元導覽列 */
.guide-read-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--good-bg);
  color: var(--good);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.guide-prevnext {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.guide-prevnext > a:only-child { margin-left: auto; }

/* 單元末尾：標記已讀 + 單元練習（考古題／擴充題）按鈕區 */
.guide-unit-practice {
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border);
}
.guide-unit-practice-label { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.guide-unit-practice-btns {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
}
.guide-unit-practice-btns .btn { white-space: nowrap; }
.guide-unit-practice-btns .btn.is-disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}
@media (max-width: 480px) {
  .guide-unit-practice-btns .btn { width: 100%; text-align: center; }
}

/* ---- practice.php：兩欄版面（主要作答區 + 旁邊重點整理側欄） ---- */
.practice-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}
.practice-main { flex: 1 1 0; min-width: 0; }
.practice-side {
  flex: 0 0 300px;
  position: sticky;
  top: 16px;
}
.wrap.wrap-with-side { max-width: 1180px; }

.guide-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(20, 20, 40, .06);
}
.guide-box-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px dashed var(--border);
}
.guide-box-link { font-size: 12px; font-weight: 600; color: var(--brand); text-decoration: none; white-space: nowrap; }
.guide-box-link:hover { text-decoration: underline; }
.guide-box-points { margin: 0; padding-left: 18px; }
.guide-box-points li { margin-bottom: 8px; font-size: 13px; line-height: 1.55; }
.guide-box-subhead { font-size: 12px; font-weight: 700; color: var(--muted); margin: 10px 0 6px; }
.guide-box-mnemonics { margin-top: 4px; }
.guide-box-pitfall {
  margin-top: 10px; padding: 7px 10px; border-radius: 8px;
  background: #fff7e6; border: 1px solid #ffe1a8; color: #7a5a00;
  font-size: 12px; line-height: 1.55;
}

/* 手機／窄螢幕：側欄改成堆疊在作答卡片「下方」，而不是消失或硬擠成兩欄 */
@media (max-width: 880px) {
  .practice-layout { flex-direction: column; }
  .practice-side { position: static; flex-basis: auto; width: 100%; }
  .wrap.wrap-with-side { max-width: 860px; }
}

/* ---- guide.php：📌 補充重點（可收合區塊） ---- */
.guide-supplement {
  margin-top: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  background: #fafaff;
}
.guide-supplement summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: var(--brand-dark);
  list-style: revert;
}
.guide-supplement summary:hover { opacity: .85; }
.guide-supplement-note {
  font-size: 12px; color: var(--muted);
  margin: 10px 0 8px;
}
.guide-supplement-list { margin: 0; padding-left: 20px; }
.guide-supplement-list li { margin-bottom: 10px; font-size: 13px; line-height: 1.65; }
.guide-supplement-list li strong { color: var(--brand-dark); }

/* ---- practice.php 側欄：補充重點提示連結 ---- */
.guide-box-supp-link {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
  font-size: 12px;
}
.guide-box-supp-link a { color: var(--brand-dark); font-weight: 600; text-decoration: none; }
.guide-box-supp-link a:hover { text-decoration: underline; }

/* ---- 名詞閃卡（flashcard.php）：翻卡動畫與版面 ---- */
.flashcard-scene {
  max-width: 560px;
  margin: 18px auto;
  perspective: 1400px;
}
.flashcard {
  position: relative;
  width: 100%;
  min-height: 260px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.4,.2,.2,1);
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 24px;
  box-shadow: 0 4px 16px rgba(30,30,60,.08);
}
.flashcard-front { background: linear-gradient(160deg, #fff, #f2f2ff); }
.flashcard-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #f2f2ff, #eef0fb);
}
.flashcard-badge {
  position: absolute;
  top: 14px; left: 14px;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
}
.flashcard-term {
  font-size: 24px;
  font-weight: 800;
  color: var(--brand-dark);
  line-height: 1.5;
}
.flashcard-def {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  max-height: 100%;
  overflow-y: auto;
}
.flashcard-example {
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
  background: rgba(255,255,255,.6);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  max-width: 100%;
}
.flashcard-hint {
  position: absolute;
  bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}
.flashcard-actions {
  display: flex;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto 18px;
}
.flashcard-actions button { flex: 1; font-size: 16px; padding: 14px; }
.flashcard-btn-unfamiliar:hover { border-color: var(--bad); color: var(--bad); }
.flashcard-btn-familiar:hover { background: var(--good); }
@media (max-width: 620px) {
  .flashcard { min-height: 220px; }
  .flashcard-term { font-size: 20px; }
  .flashcard-def { font-size: 15px; }
}

/* =========================================================================
 * 教學 PPT 線上展示（teacher_slides_view.php）
 * ========================================================================= */
.ppt-body { min-height: 100vh; display: flex; flex-direction: column; }
.ppt-stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: clamp(8px, 1.5vmin, 20px); min-height: 0;
}
.ppt-stage img {
  max-width: 100%; max-height: calc(100vh - 150px); width: auto; height: auto;
  border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.45); background: #fff;
}
a.ppt-dl { text-decoration: none; display: inline-block; }


/* ========================================================================
 * UI / RWD Refresh
 * 目的：維持既有功能與品牌色，統一桌機、平板、手機的視覺節奏與觸控體驗。
 * ======================================================================== */
:root {
  --shadow-sm: 0 2px 8px rgba(35,35,59,.06);
  --shadow-md: 0 8px 24px rgba(35,35,59,.08);
  --focus-ring: 0 0 0 3px rgba(91,95,199,.16);
}

html { scroll-behavior: smooth; }
body { -webkit-text-size-adjust: 100%; }
img, svg, video { max-width: 100%; }
button, input, select, textarea { max-width: 100%; }

/* 桌機：稍微增加閱讀寬度，但避免長行文字降低可讀性 */
.wrap { max-width: 1120px; }
.wrap:not(.wrap-with-side) > .card,
.wrap:not(.wrap-with-side) > .fx-hero { max-width: 100%; }

.card {
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, border-color .18s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

.mode-card {
  box-shadow: 0 1px 4px rgba(35,35,59,.04);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.mode-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #cfd1ef; }

.btn, .sidebar-toggle-btn, .lang-toggle, .jumpgrid button,
.fx-iconbtn, .fx-submit, .fx-cell, .fx-opt {
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible, a:focus-visible, button:focus-visible,
select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn { min-height: 44px; }
select, input[type=text], input[type=password], input[type=email], input[type=number], textarea {
  min-height: 44px;
}

/* 首頁主要導覽：桌機橫向，手機自動分成可點擊的功能膠囊 */
.main-topbar-nav { align-items: flex-end; flex-direction: column; gap: 7px; }
.user-nav-label { font-size: 12px; opacity: .88; white-space: nowrap; }
.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}
.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(255,255,255,.08);
}
.main-nav a:hover { background: rgba(255,255,255,.2); }
.main-topbar-nav .lang-toggle { min-height: 34px; }

/* 寬螢幕讓首頁內容更有呼吸感 */
@media (min-width: 1100px) {
  .topbar { padding-left: 24px; padding-right: 24px; }
  .card { padding: 26px; }
  .mode-grid { gap: 20px; }
}

/* 平板：避免兩欄卡片過窄 */
@media (max-width: 900px) {
  .wrap { max-width: 100%; padding-left: 14px; padding-right: 14px; }
  .exam-wrap { padding-left: 14px; padding-right: 14px; }
  .mode-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .practice-layout { gap: 14px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 手機：以「單欄、滿寬、容易點」為優先 */
@media (max-width: 620px) {
  .wrap, .exam-wrap { padding: 14px 10px 36px; }
  .topbar {
    margin-bottom: 14px;
    padding: 12px 10px;
    border-radius: 0 0 12px 12px;
  }
  .topbar .title { font-size: 16px; line-height: 1.35; max-width: 100%; }
  .topbar .title small { font-size: 11px; margin-top: 2px; }
  .topbar-right { width: 100%; max-width: 100%; }
  .main-topbar-nav { align-items: center; }
  .main-nav { width: 100%; justify-content: center; gap: 5px; }
  .main-nav a { flex: 0 0 auto; padding: 6px 8px; min-height: 36px; font-size: 12px; }
  .main-nav a span { display: inline; }
  .user-nav-label { width: 100%; text-align: center; }

  h1 { font-size: 21px; }
  h2 { font-size: 18px; }
  .card { padding: 16px 14px; margin-bottom: 14px; border-radius: 12px; }
  .card-head { gap: 8px; flex-wrap: wrap; }
  p.lead { font-size: 14px; }

  .mode-grid { grid-template-columns: 1fr; gap: 12px; }
  .mode-card { padding: 16px; }
  .mode-card:hover { transform: none; }
  .mode-card p { min-height: 0; }

  .domain-box { padding: 13px; }
  .skill-row { padding: 10px 0; }
  .skill-row .btn.secondary { width: 100%; text-align: center; }

  .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .summary-grid .stat { padding: 12px 6px; }
  .summary-grid .stat .num { font-size: 23px; }
  .summary-grid .stat .label { line-height: 1.4; }

  .actions { gap: 8px; }
  .actions .btn { flex: 1 1 calc(50% - 8px); text-align: center; padding-left: 10px; padding-right: 10px; }

  .filterbar { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: thin; }
  .filterbar a { flex: 0 0 auto; margin-right: 0; min-height: 40px; display: inline-flex; align-items: center; }

  .q-meta { gap: 8px; flex-wrap: wrap; }
  .q-text { font-size: 16px; line-height: 1.75; }
  .option { padding: 13px 12px; gap: 9px; margin-bottom: 8px; }
  .option input { width: 18px; height: 18px; flex: 0 0 auto; }
  .option .letter { min-width: 20px; }

  .hotspot-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hotspot-table table { min-width: 520px; }
  .hotspot-table td, .hotspot-table th { padding: 9px 7px; }

  .result-table-wrap { margin-left: -2px; margin-right: -2px; }
  .result-table { min-width: 620px; }

  .fx-hero { padding: 17px 15px; border-radius: 12px; }
  .fx-hero h2 { font-size: 18px; }
  .fx-hero-item { padding: 12px; }
  .fx-hero-item > div { width: 100%; }
  .fx-hero-item .btn { width: 100%; text-align: center; }

  .fx-window { align-items: flex-start; padding: 11px 12px; font-size: 13px; }
  .fx-rules { padding-left: 19px; font-size: 14px; }
  .fx-cta .btn { width: 100%; }

  .fx-paper-grid { grid-template-columns: 1fr; }
  .fx-round-head { align-items: flex-start; flex-direction: column; gap: 5px; }
  .fx-round-tag { font-size: 14px; padding: 4px 14px; }
}

/* 極窄手機（例如 320px） */
@media (max-width: 380px) {
  .wrap, .exam-wrap { padding-left: 8px; padding-right: 8px; }
  .topbar { padding-left: 7px; padding-right: 7px; }
  .main-nav a { padding-left: 6px; padding-right: 6px; font-size: 11.5px; }
  .card { padding: 14px 11px; }
  .actions .btn { flex-basis: 100%; }
}

/* 桌面表格在小螢幕上不要把整頁撐寬 */
.result-table-wrap, .admin-table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 學習指南 / 作答側欄：平板以下維持單欄，避免內容被壓縮 */
@media (max-width: 880px) {
  .guide-layout, .practice-layout, .exam-layout { width: 100%; }
  .practice-side { width: 100%; }
}

/* 無障礙：使用鍵盤操作時保持明顯焦點 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}


/* ===== 我的紀錄：學習分數 ===== */
.score-hero { display: flex; gap: 22px; align-items: center; margin: 6px 0 18px; flex-wrap: wrap; }
.score-hero-num { display: flex; align-items: baseline; gap: 6px; min-width: 150px; }
.score-hero-num span { font-size: 56px; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.score-hero-num small { font-size: 14px; color: var(--muted); }
.score-hero-side { flex: 1; min-width: 240px; }
.score-stack { display: flex; height: 16px; background: #eceef8; border-radius: 999px; overflow: hidden; }
.score-stack span { display: block; height: 100%; }
.score-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.score-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.score-table { min-width: 640px; }
.score-table td { white-space: normal; }
.score-table tfoot td { border-top: 2px solid var(--border); border-bottom: none; }
.score-hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 3px; max-width: 260px; }
.score-bar { height: 8px; min-width: 110px; background: #eceef8; border-radius: 999px; overflow: hidden; }
.score-bar span { display: block; height: 100%; border-radius: 999px; }
.score-bar-label { font-size: 12px; color: var(--muted); margin-top: 3px; }
@media (max-width: 620px) {
  .score-hero-num span { font-size: 44px; }
}
