/* 全站友善閱讀與無障礙輔助工具列（語音朗讀、注音輔助、平板易讀模式、科學家徽章） */

.a11y-dock {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 950;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

.a11y-fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 16px;
  border: 2px solid #245e4a;
  border-radius: 999px;
  background: #ffffff;
  color: #1c4a3a;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(24, 62, 48, 0.18);
  transition: transform 0.16s ease, background 0.16s ease;
}

.a11y-fab:hover,
.a11y-fab:focus-visible {
  transform: translateY(-2px);
  background: #f2fbf6;
  outline: 3px solid rgba(36, 94, 74, 0.28);
  outline-offset: 2px;
}

.a11y-fab[aria-expanded="true"] {
  background: #245e4a;
  color: #ffffff;
}

.a11y-panel {
  width: min(320px, calc(100vw - 32px));
  padding: 14px;
  border-radius: 20px;
  border: 2px solid #cfe3d8;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(22, 54, 42, 0.22);
  display: grid;
  gap: 10px;
}

.a11y-panel[hidden] {
  display: none;
}

.a11y-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e3efe8;
}

.a11y-panel-head strong {
  font-size: 15px;
  color: #1c4a3a;
}

.a11y-close {
  min-width: 36px;
  min-height: 36px;
  border: none;
  border-radius: 10px;
  background: #eef6f1;
  color: #1c4a3a;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.a11y-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid #d2e4da;
  border-radius: 14px;
  background: #f9fcfa;
  color: #1d3a2f;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.a11y-btn:hover {
  background: #edf8f2;
  border-color: #2f7a4d;
}

.a11y-btn[aria-pressed="true"],
.a11y-btn.speaking {
  background: #245e4a;
  border-color: #245e4a;
  color: #ffffff;
}

.a11y-pill {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(36, 94, 74, 0.12);
  color: #1d513e;
  font-weight: 700;
}

.a11y-btn[aria-pressed="true"] .a11y-pill,
.a11y-btn.speaking .a11y-pill {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.a11y-speed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 2px;
  font-size: 13px;
  color: #466156;
}

.a11y-speed-row button {
  flex: 1;
  min-height: 34px;
  border: 1px solid #cfe2d7;
  border-radius: 10px;
  background: #fff;
  color: #1d4a39;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.a11y-speed-row button[aria-pressed="true"] {
  background: #2f7a4d;
  border-color: #2f7a4d;
  color: #fff;
}

.a11y-badge-summary {
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff8e6, #eef8f1);
  border: 1px solid #e6dbb8;
  font-size: 13px;
  color: #3a4a40;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.a11y-badge-summary b {
  color: #1e523f;
  font-size: 14px;
}

.a11y-badge-links {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.a11y-badge-links a {
  flex: 1;
  text-align: center;
  padding: 7px 8px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #cfe0d6;
  color: #1e523f;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.a11y-badge-links a:hover {
  background: #e6f5ec;
}

/* 內嵌單段語音朗讀按鈕 */
.speak-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid #2c745a;
  background: #eef9f3;
  color: #1b503d;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.speak-inline-btn:hover {
  background: #dcf3e7;
  transform: translateY(-1px);
}

.speak-inline-btn.speaking {
  background: #245e4a;
  color: #fff;
}

/* 注音標註樣式 */
ruby.sci-ruby {
  ruby-position: over;
  font-weight: inherit;
}

ruby.sci-ruby rt {
  font-size: 0.56em;
  color: #2b6f56;
  font-weight: 600;
  letter-spacing: 0.02em;
  user-select: none;
}

/* 平板易讀模式（放大字體、加寬行距、加大觸控熱區） */
html.a11y-easy-read {
  font-size: 118%;
}

html.a11y-easy-read body {
  line-height: 1.85;
  letter-spacing: 0.02em;
}

html.a11y-easy-read button,
html.a11y-easy-read a.btn,
html.a11y-easy-read a.gate-enter,
html.a11y-easy-read .choice,
html.a11y-easy-read .pair {
  min-height: 52px;
}

/* 生活中的為什麼？卡片 & 單元互動實驗入口卡（用於 lesson-ui.js） */
.life-hook-card {
  margin: 0 0 22px;
  padding: 20px 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, #fff9e6 0%, #eef9f1 100%);
  border: 2px solid #e6d59c;
  box-shadow: 0 8px 22px rgba(48, 72, 42, 0.08);
}

.life-hook-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.life-hook-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.domain-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  border: 1.5px solid currentColor;
}

.life-hook-card h3 {
  margin: 4px 0 10px;
  font-size: 20px;
  line-height: 1.5;
  color: #1e3f2d;
}

.life-hook-reveal {
  margin-top: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px dashed #c8b679;
}

.life-hook-reveal summary {
  cursor: pointer;
  font-weight: 800;
  color: #8a5a10;
  font-size: 15px;
  list-style: none;
}

.life-hook-reveal summary::before {
  content: "💡 ";
}

.life-hook-reveal p {
  margin: 8px 0 0;
  color: #2b4437;
  line-height: 1.7;
}

.unit-lab-banner {
  margin: 22px 0;
  padding: 20px 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, #e8f5ff 0%, #eaf9f0 100%);
  border: 2px solid #9cc8e6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.unit-lab-banner-copy {
  flex: 1 1 280px;
}

.unit-lab-banner-copy h3 {
  margin: 6px 0 6px;
  font-size: 19px;
  color: #164463;
}

.unit-lab-banner-copy p {
  margin: 0;
  font-size: 14px;
  color: #2d556b;
  line-height: 1.65;
}

.unit-lab-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media print {
  .a11y-dock,
  .speak-inline-btn {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .a11y-dock {
    right: 10px;
    bottom: 10px;
  }
  .a11y-fab {
    padding: 8px 14px;
    font-size: 14px;
  }
}


/* === 科學原理示意圖卡片與全螢幕放大檢視 === */
.sci-diagram-card {
  margin: 0 0 24px;
  padding: 20px 22px;
  border-radius: 22px;
  background: #ffffff;
  border: 2px solid #bed9ea;
  box-shadow: 0 10px 26px rgba(24, 62, 48, 0.08);
}

.sci-diagram-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sci-diagram-head h3 {
  margin: 6px 0 0;
  font-size: 22px;
  color: #163d5c;
}

.sci-diagram-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sci-3d-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1.5px solid #1d5945;
  background: #1d5945;
  color: #ffffff !important;
  font-size: 14.5px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.sci-3d-btn:hover {
  background: #144233;
}

.sci-zoom-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1.5px solid #2563a6;
  background: #eaf3ff;
  color: #16447a;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
}

.sci-zoom-btn:hover {
  background: #d9ebff;
}

.sci-diagram-stage {
  background: #f8fcff;
  border: 1.5px solid #dbeaf4;
  border-radius: 16px;
  padding: 10px;
  overflow: hidden;
}

.sci-diagram-stage svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
}

.sci-diagram-caption {
  margin: 16px 0 0;
  padding: 16px 20px;
  border-radius: 16px;
  background: #eef9f2;
  border-left: 6px solid #245e4a;
  color: #17382b;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.8;
}

.sci-diagram-caption strong {
  color: #164e39;
  font-weight: 800;
}

.sci-diagram-modal {
  width: min(1020px, 96vw);
  max-height: 92vh;
  padding: 20px 24px;
  border: none;
  border-radius: 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.sci-diagram-modal::backdrop {
  background: rgba(15, 32, 24, 0.72);
  backdrop-filter: blur(4px);
}

.sci-diagram-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sci-diagram-modal-head h2 {
  margin: 0;
  font-size: 20px;
  color: #183f35;
}

.sci-diagram-modal svg {
  display: block;
  width: 100%;
  height: auto;
}


/* 擬真圖解／實景照切換列與圖片排版 */
.sci-diagram-mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sci-mode-btn {
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid #c3dbce;
  background: #ffffff;
  color: #1c4a3a;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.sci-mode-btn.active {
  background: #245e4a;
  border-color: #245e4a;
  color: #ffffff;
}

.sci-photo-credit {
  margin-left: auto;
  font-size: 12.5px;
  color: #546e60;
  font-weight: 600;
}

.sci-photo-view {
  margin: 0;
}

.sci-photo-view img {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: 12px;
}

@media (max-width: 640px) {
  .a11y-fab {
    min-height: 40px;
    padding: 6px 12px;
    font-size: 13px;
    opacity: 0.92;
  }
}


/* === 單元真人感神經網路語音導讀卡片 === */
.unit-audio-card {
  margin: 0 0 20px;
  padding: 18px 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, #f0fbf5 0%, #eaf5ff 100%);
  border: 2px solid #9fd0ba;
  box-shadow: 0 8px 20px rgba(24, 62, 48, 0.08);
  display: grid;
  gap: 12px;
}

.unit-audio-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.unit-audio-head h3 {
  margin: 6px 0 0;
  font-size: 18px;
  color: #164433;
}

.unit-audio-speeds {
  display: flex;
  gap: 6px;
}

.audio-spd-btn {
  min-height: 36px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1.5px solid #b5d5c6;
  background: #ffffff;
  color: #194d39;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.audio-spd-btn.active {
  background: #1d5945;
  border-color: #1d5945;
  color: #ffffff;
}

.unit-audio-player {
  width: 100%;
  height: 44px;
  border-radius: 12px;
}

/* === 國小自然 HiDPI 科學動畫教學短片播放器 === */
.sci-vplayer { margin: 14px 0 18px; border-radius: 18px; overflow: hidden; border: 2px solid #1e4d3d; background: #0f241d; box-shadow: 0 10px 26px rgba(15,36,29,0.16); }
.sci-vstage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #132d24; cursor: pointer; user-select: none; }
.sci-vcanvas { display: block; width: 100%; height: 100%; }
.sci-vplay-overlay { position: absolute; inset: 0; display: grid; place-items: center; width: 100%; border: 0; background: rgba(12,30,24,0.34); cursor: pointer; transition: opacity 0.2s ease; }
.sci-vplay-overlay.hidden { opacity: 0; pointer-events: none; }
.sci-vplay-pill { display: inline-flex; align-items: center; gap: 10px; padding: 13px 24px; border-radius: 999px; background: #fef08a; color: #14362a; font-size: 16px; font-weight: 900; box-shadow: 0 10px 24px rgba(0,0,0,0.35); }
.sci-vbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; background: #0d1f19; color: #e2f5ec; }
.sci-vbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 32px; padding: 0 10px; border-radius: 9px; border: 1.5px solid rgba(158,240,192,0.32); background: rgba(255,255,255,0.08); color: #fff; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.sci-vbtn.active { background: #22c55e; border-color: #22c55e; color: #082419; }
.sci-vseek { flex: 1; min-width: 110px; height: 8px; accent-color: #fbbf24; cursor: pointer; }
.sci-vtime { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: #b7e4cc; white-space: nowrap; }
.sci-vspeeds { display: inline-flex; gap: 4px; }
.sci-vchapters { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 10px; background: #132821; border-top: 1px solid rgba(255,255,255,0.1); }
.sci-vchap { padding: 4px 11px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.06); color: #d6f1e4; font-size: 12px; font-weight: 800; cursor: pointer; }
.sci-vchap.active { background: #fbbf24; border-color: #fbbf24; color: #1a1610; }
