/* ═══════════════════════════════════════════════════
   廉政報 互動式閱讀引擎 — 三套風格主題
   ═══════════════════════════════════════════════════ */

/* ─── 共用基礎（所有非標準風格共用） ─── */
.ir-active {
  position: relative;
}

/* 閱讀進度條 */
#ir-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 9999;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* 預估閱讀時間標籤 */
.ir-reading-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: #888;
  margin-bottom: 1rem;
}

/* 目錄容器（桌機側欄，手機隱藏） */
#ir-toc {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  font-size: 0.85rem;
  border-left: 3px solid var(--ir-accent, #1a73e8);
  padding-left: 12px;
  display: none;
}
@media (min-width: 992px) {
  #ir-toc { display: block; }
}
#ir-toc h6 {
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ir-accent, #1a73e8);
  margin-bottom: 10px;
}
#ir-toc a {
  display: block;
  color: #555;
  text-decoration: none;
  padding: 3px 0;
  line-height: 1.4;
  transition: color .2s, padding-left .2s;
}
#ir-toc a:hover,
#ir-toc a.active {
  color: var(--ir-accent, #1a73e8);
  padding-left: 5px;
}
#ir-toc .toc-h3 {
  padding-left: 12px;
  font-size: 0.8rem;
  color: #888;
}

/* ═══════════════════════════════════════════════════
   THEME: depth（深度報導風）
   ─ 閱讀進度條、目錄側欄、引言框、節次強調
   ═══════════════════════════════════════════════════ */
[data-reading-style="depth"] {
  --ir-accent: #1a73e8;
  --ir-section-border: #1a73e8;
  --ir-quote-bg: #f0f6ff;
  --ir-quote-border: #1a73e8;
}

[data-reading-style="depth"] #ir-progress-bar {
  background: linear-gradient(90deg, #1a73e8, #34a853);
}

[data-reading-style="depth"] .article-content h2 {
  border-left: 4px solid var(--ir-section-border);
  padding-left: 14px;
  margin-top: 2rem;
  color: #1a2c4e;
  font-size: 1.25rem;
}

[data-reading-style="depth"] .article-content h3 {
  color: #2c5282;
  font-size: 1.05rem;
  margin-top: 1.5rem;
}

[data-reading-style="depth"] .article-content blockquote {
  background: var(--ir-quote-bg);
  border-left: 5px solid var(--ir-quote-border);
  border-radius: 0 8px 8px 0;
  padding: 18px 22px;
  margin: 1.8rem 0;
  font-size: 1.05rem;
  color: #2c3e50;
  position: relative;
}
[data-reading-style="depth"] .article-content blockquote::before {
  content: '"';
  font-size: 3.5rem;
  color: var(--ir-quote-border);
  opacity: .25;
  position: absolute;
  top: -8px;
  left: 14px;
  line-height: 1;
  font-family: Georgia, serif;
}

[data-reading-style="depth"] .article-content p:first-of-type::first-letter {
  font-size: 3.2rem;
  float: left;
  line-height: 0.85;
  padding-right: 8px;
  padding-top: 5px;
  color: var(--ir-accent);
  font-weight: 700;
}

[data-reading-style="depth"] .ir-section-num {
  display: inline-block;
  background: var(--ir-accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 3px;
  padding: 1px 6px;
  margin-right: 8px;
  vertical-align: middle;
}

[data-reading-style="depth"] .article-content ul li {
  padding: 3px 0;
}
[data-reading-style="depth"] .article-content ul li::marker {
  color: var(--ir-accent);
}

/* ════════════════════════════════════════════════════════
   THEME: magazine（現代編輯雜誌風）
   靈感：雜誌版面設計師 — 封面感、雙欄排版、金色裝飾
   ════════════════════════════════════════════════════════ */

/* 整頁背景：溫暖亞麻色 */
body[data-style-env="magazine"] {
  background: #ddd6c8 !important;
}
body[data-style-env="magazine"] .col-lg-8 {
  flex: 0 0 100% !important;
  max-width: 100% !important;
  width: 100% !important;
}
body[data-style-env="magazine"] .col-lg-4 {
  display: none !important;
}
body[data-style-env="magazine"] .breadcrumb-item,
body[data-style-env="magazine"] .breadcrumb-item a {
  color: rgba(58,80,104,0.7) !important;
  text-decoration: none;
}

/* 文章容器：移除原本白底卡片感 */
[data-reading-style="magazine"].news-article {
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  max-width: 1180px;
  margin: 0 auto;
}

/* 封面標題區：深鋼藍底 */
[data-reading-style="magazine"] .article-header {
  background: #3a5068 !important;
  padding: 3.5rem 4rem 2.5rem !important;
  margin-bottom: 0 !important;
  border: none !important;
  position: relative;
  overflow: hidden;
}
/* 金色頂部條紋 */
[data-reading-style="magazine"] .article-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, #b8902a 0%, #e8c45a 40%, #c8a84b 70%, #b8902a 100%);
}
/* 右下角圓形幾何裝飾 */
[data-reading-style="magazine"] .article-header::after {
  content: '';
  position: absolute;
  bottom: -50px; right: -50px;
  width: 180px; height: 180px;
  border: 2px solid rgba(200,168,75,0.2);
  border-radius: 50%;
  pointer-events: none;
}
/* 分類標籤 → 金色雜誌欄目 */
[data-reading-style="magazine"] .article-header .list-category {
  background: rgba(200,168,75,0.2) !important;
  color: #e8c45a !important;
  border: 1px solid rgba(200,168,75,0.45) !important;
  border-radius: 1px !important;
  font-size: 0.62rem;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 10px !important;
}
[data-reading-style="magazine"] .article-header .badge {
  background: rgba(255,255,255,0.12) !important;
  color: rgba(255,255,255,0.85) !important;
}
/* 大標題：白色衝擊感 */
[data-reading-style="magazine"] h1.article-title {
  font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif !important;
  font-size: clamp(1.9rem, 5vw, 3.8rem) !important;
  font-weight: 900 !important;
  color: #fff !important;
  line-height: 1.08 !important;
  letter-spacing: -1px !important;
  margin: 1.2rem 0 0.6rem !important;
  text-shadow: 0 2px 24px rgba(0,0,0,0.25) !important;
}
/* Meta 欄：白色半透明 */
[data-reading-style="magazine"] .article-meta {
  color: rgba(255,255,255,0.6) !important;
  font-size: 0.75rem !important;
  border-bottom: 1px solid rgba(255,255,255,0.12) !important;
  padding-bottom: 0.6rem !important;
  font-family: -apple-system, sans-serif;
  margin-top: 0.5rem !important;
}
[data-reading-style="magazine"] .article-meta * { color: rgba(255,255,255,0.6) !important; }

/* 封面圖：全出血設計，無邊距 */
[data-reading-style="magazine"] .article-cover {
  margin: 0 !important;
  background: #1a2535;
}
[data-reading-style="magazine"] .article-cover img {
  width: 100% !important;
  max-height: 500px;
  object-fit: cover;
  display: block;
  border-radius: 0 !important;
  filter: brightness(0.92) contrast(1.05) saturate(0.95) !important;
}

/* 正文包裹卡片（JS 插入的 .mg-body） */
[data-reading-style="magazine"] .mg-body {
  background: #faf7f0;
  padding: 2.8rem 4rem 3.5rem;
  box-shadow: 0 6px 40px rgba(0,0,0,0.15);
}
@media (max-width: 768px) {
  [data-reading-style="magazine"] .article-header { padding: 2rem 1.5rem !important; }
  [data-reading-style="magazine"] .mg-body { padding: 1.5rem 1.2rem 2rem; }
  [data-reading-style="magazine"] h1.article-title { font-size: clamp(1.6rem, 7vw, 2.5rem) !important; }
}

/* 摘要 → 雜誌副標 */
[data-reading-style="magazine"] .article-summary {
  background: #f3ede1 !important;
  border: none !important;
  border-left: 5px solid #c8a84b !important;
  border-radius: 0 !important;
  font-size: 1.08rem !important;
  font-style: italic;
  color: #3a2e1c !important;
  font-family: Georgia, 'Times New Roman', serif;
  margin: 0 0 2rem 0 !important;
  padding: 1.2rem 1.8rem !important;
}

/* 進度條：鋼藍→金 */
[data-reading-style="magazine"] #ir-progress-bar {
  background: linear-gradient(90deg, #3a5068 0%, #c8a84b 100%);
  height: 3px;
}

/* ★ 正文：雙欄排版 */
[data-reading-style="magazine"] .article-content {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.0rem;
  line-height: 1.88;
  color: #2a2218;
  column-count: 2;
  column-gap: 3.2em;
  column-rule: 1px solid #d4c8b0;
  text-align: justify;
  hyphens: auto;
  margin-top: 0;
}
@media (max-width: 700px) {
  [data-reading-style="magazine"] .article-content { column-count: 1; }
}
[data-reading-style="magazine"] .article-content p {
  margin-bottom: 0.65em;
  break-inside: avoid-column;
}
/* 首字下沉：鋼藍大字 */
[data-reading-style="magazine"] .article-content > p:first-of-type::first-letter {
  float: left;
  font-size: 5.2rem;
  line-height: 0.72;
  font-weight: 900;
  margin: 0.04em 0.09em 0 0;
  color: #3a5068;
  font-family: Georgia, serif;
}

/* 章節標題：跨欄，金色底線 */
[data-reading-style="magazine"] .article-content h2 {
  column-span: all;
  font-family: -apple-system, 'Segoe UI', sans-serif !important;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 4.5px;
  color: #3a5068;
  border-top: 3px solid #3a5068;
  border-bottom: 2px solid #c8a84b;
  padding: 0.7em 0;
  margin: 2.5em 0 1.3em;
  text-align: center;
}
[data-reading-style="magazine"] .article-content h3 {
  column-span: all;
  font-family: Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #3a5068;
  margin: 1.8em 0 0.8em;
}

/* 拉引文：跨欄，金色引號 */
[data-reading-style="magazine"] .mg-pullquote {
  column-span: all;
  text-align: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.35rem;
  font-style: italic;
  color: #3a5068;
  line-height: 1.55;
  padding: 1.6em 3.5em;
  margin: 1.5em 0;
  border-top: 2px solid #c8a84b;
  border-bottom: 2px solid #c8a84b;
  position: relative;
}
[data-reading-style="magazine"] .mg-pullquote::before {
  content: '\201C';
  font-size: 7rem;
  color: #c8a84b;
  opacity: 0.35;
  position: absolute;
  top: -0.15em; left: 0.1em;
  line-height: 1;
  font-style: normal;
  font-family: Georgia, serif;
}
@media (max-width: 700px) {
  [data-reading-style="magazine"] .mg-pullquote { padding: 1.2em 1.5em; font-size: 1.1rem; }
}

/* 章節分隔裝飾 */
[data-reading-style="magazine"] .mg-divider {
  column-span: all;
  text-align: center;
  margin: 2em 0;
  color: #c8a84b;
  letter-spacing: 10px;
  font-size: 0.9rem;
  opacity: 0.65;
}
[data-reading-style="magazine"] .mg-divider::before {
  content: '◆ ◆ ◆';
}

/* 深色強調塊（JS 插入） */
[data-reading-style="magazine"] .mg-dark-panel {
  column-span: all;
  background: #2c3444;
  color: rgba(255,255,255,0.88);
  padding: 1.4em 2.5em;
  margin: 2.2em 0;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.92rem;
  line-height: 1.65;
  position: relative;
  border-left: 5px solid #c8a84b;
}
[data-reading-style="magazine"] .mg-dark-panel strong {
  color: #e8c45a;
}

/* blockquote → 雜誌引言 */
[data-reading-style="magazine"] .article-content blockquote {
  column-span: all;
  border: none;
  border-top: 2px solid #3a5068;
  border-bottom: 2px solid #3a5068;
  padding: 1.2rem 0;
  margin: 1.8rem 2rem;
  font-size: 1.12rem;
  font-style: italic;
  text-align: center;
  color: #3a3025;
}

/* 列表 */
[data-reading-style="magazine"] .article-content ul {
  list-style: none;
  padding-left: 0;
}
[data-reading-style="magazine"] .article-content ul li {
  padding: 5px 0 5px 1.5rem;
  position: relative;
  border-bottom: 1px dotted #c8a84b;
  break-inside: avoid-column;
}
[data-reading-style="magazine"] .article-content ul li::before {
  content: '◆';
  position: absolute;
  left: 0;
  color: #c8a84b;
  font-size: 0.65rem;
  top: 0.6em;
}

/* 圖片 */
[data-reading-style="magazine"] .article-content img {
  width: 100%;
  break-inside: avoid-column;
  column-span: all;
  margin: 1.5em 0;
}

/* 雜誌結尾花 */
[data-reading-style="magazine"] .mg-end-mark {
  column-span: all;
  text-align: center;
  color: #c8a84b;
  font-size: 1.2rem;
  margin-top: 2.5em;
  letter-spacing: 6px;
  opacity: 0.6;
}

/* ═══════════════════════════════════════════════════
   THEME: brief（簡報風）
   ─ 卡片式、彩色重點框、視覺清單
   ═══════════════════════════════════════════════════ */
[data-reading-style="brief"] {
  --ir-accent: #6c3483;
  --ir-card-border: #e8d5f5;
  --ir-highlight-bg: #fdf9ff;
}

[data-reading-style="brief"] #ir-progress-bar {
  background: linear-gradient(90deg, #6c3483, #a569bd);
}

[data-reading-style="brief"] .article-content h2 {
  background: linear-gradient(135deg, #6c3483 0%, #8e44ad 100%);
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  margin-top: 2rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .02em;
}

[data-reading-style="brief"] .article-content h3 {
  color: #6c3483;
  border-bottom: 2px dashed var(--ir-card-border);
  padding-bottom: 5px;
  margin-top: 1.5rem;
}

[data-reading-style="brief"] .ir-section-card {
  background: var(--ir-highlight-bg);
  border: 1px solid var(--ir-card-border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(108,52,131,.07);
}

[data-reading-style="brief"] .article-content blockquote {
  background: linear-gradient(135deg, #f5eefa 0%, #fdf9ff 100%);
  border-left: 4px solid #a569bd;
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  margin: 1.5rem 0;
  color: #4a235a;
  font-weight: 500;
}

[data-reading-style="brief"] .article-content ul {
  list-style: none;
  padding-left: 0;
}
[data-reading-style="brief"] .article-content ul li {
  background: white;
  border: 1px solid var(--ir-card-border);
  border-radius: 8px;
  padding: 10px 14px 10px 40px;
  margin-bottom: 8px;
  position: relative;
  font-size: .95rem;
}
[data-reading-style="brief"] .article-content ul li::before {
  content: '✦';
  position: absolute;
  left: 14px;
  color: #a569bd;
  font-size: 0.9rem;
}

[data-reading-style="brief"] .article-content p:first-of-type {
  font-size: 1.08rem;
  font-weight: 500;
  color: #2d1b3d;
  background: linear-gradient(135deg, #f5eefa, #fdf9ff);
  border-radius: 8px;
  padding: 14px 18px;
  border-left: 4px solid #6c3483;
}

/* ════════════════════════════════════════════════════════
   MAGAZINE FLIP READER — 雜誌翻頁閱讀器
   ════════════════════════════════════════════════════════ */

/* 防止背景滾動 */
body.mg-no-scroll { overflow: hidden; }

/* ── 開啟按鈕 ────────────────────────────────────────── */
.mg-open-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: linear-gradient(135deg, #3a5068 0%, #2c3e52 100%);
  color: #fff;
  border: none;
  border-top: 3px solid #c8a84b;
  padding: 0.85rem 1.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  border-radius: 50px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.mg-open-btn:hover {
  background: linear-gradient(135deg, #4a6278 0%, #3a4f62 100%);
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0,0,0,0.45);
}
.mg-open-btn span { font-size: 1.1rem; }
/* 開啟閱讀器時隱藏浮動按鈕 */
body.mg-no-scroll .mg-open-btn { opacity: 0; pointer-events: none; transition: opacity 0.2s; }

/* 無過渡（自動開啟使用）*/
.mg-reader-overlay.mg-no-transition { transition: none !important; }

/* ── Overlay 全屏蓋板 ────────────────────────────────── */
.mg-reader-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #1a1f2e 0%, #0d1018 100%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.mg-reader-overlay.mg-open {
  opacity: 1;
  visibility: visible;
}

/* ── 關閉按鈕 ────────────────────────────────────────── */
.mg-close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}
.mg-close-btn:hover { background: rgba(255,255,255,0.18); }

/* ── 書本舞台（3D 視角） ─────────────────────────────── */
.mg-stage {
  perspective: 2400px;
  width: 100%;
  max-width: 1020px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

/* ── 書本容器 ────────────────────────────────────────── */
.mg-book {
  position: relative;
  width: 880px;
  max-width: 100%;
  height: 600px;
  /* box-shadow 不產生新合成層，避免子元素背景渲染異常 */
  box-shadow: 0 40px 80px rgba(0,0,0,0.9), 0 8px 20px rgba(0,0,0,0.6);
}
@media (max-width: 960px) {
  .mg-book { width: 700px; height: 520px; }
}
@media (max-width: 740px) {
  .mg-book { width: 360px; height: 560px; }
  .mg-page-left { display: none; } /* 手機只顯示右頁 */
  .mg-page-right { width: 100% !important; }
  .mg-spine { display: none; }
  .mg-flip { display: none; }
}

/* ── 圖層（底層/前層） ───────────────────────────────── */
.mg-layer {
  position: absolute;
  inset: 0;
  display: flex;
}
.mg-layer-back { z-index: 1; }
.mg-layer-front { z-index: 2; }

/* ── 單頁（必須 position:relative，才能讓 absolute 子元素定位於此） */
.mg-page {
  width: 50%;
  height: 100%;
  overflow: hidden;
  position: relative !important;
}
.mg-page-left {
  border-radius: 2px 0 0 2px;
  background: linear-gradient(to right, #ebe4d6 0%, #f5f0e8 100%);
  box-shadow:
    inset -12px 0 18px rgba(0,0,0,0.12),
    inset -2px 0 4px rgba(0,0,0,0.08);
}
.mg-page-right {
  border-radius: 0 2px 2px 0;
  background: linear-gradient(to left, #ebe4d6 0%, #f5f0e8 100%);
  box-shadow:
    inset 12px 0 18px rgba(0,0,0,0.12),
    inset 2px 0 4px rgba(0,0,0,0.08);
}
/* 頁底卷角陰影 */
.mg-page-left::before, .mg-page-right::before {
  content: '';
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(to top, rgba(0,0,0,0.15), transparent);
  z-index: 5;
}

/* ── 翻頁元素（3D CSS） ──────────────────────────────── */
.mg-flip {
  position: absolute;
  top: 0;
  /* 初始放在左側螢幕外，避免覆蓋左頁 */
  left: -110%;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  z-index: 20;
  pointer-events: none;
}
.mg-flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.mg-flip-front-face {
  background: linear-gradient(to left, #ebe4d6 0%, #f5f0e8 100%);
  box-shadow: inset 12px 0 18px rgba(0,0,0,0.10), inset 2px 0 4px rgba(0,0,0,0.06);
}
/* 翻轉後的背面（對稱） */
.mg-flip-back-face {
  background: linear-gradient(to right, #ebe4d6 0%, #f5f0e8 100%);
  box-shadow: inset -12px 0 18px rgba(0,0,0,0.10), inset -2px 0 4px rgba(0,0,0,0.06);
}
/* 翻頁時的 fold 陰影 */
.mg-flip::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 20px;
  background: linear-gradient(to right, rgba(0,0,0,0.18), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.mg-flip.flipping::after { opacity: 1; }

/* ── 書脊 ────────────────────────────────────────────── */
.mg-spine {
  position: absolute;
  left: 50%;
  top: 0;
  width: 10px;
  height: 100%;
  transform: translateX(-50%);
  background: linear-gradient(to right,
    #8a6520 0%,
    #c8a84b 25%,
    #e0c060 50%,
    #c8a84b 75%,
    #8a6520 100%
  );
  z-index: 25;
  box-shadow: 0 0 12px rgba(0,0,0,0.4);
}

/* 翻頁時的半頁陰影 */
.mg-page-shadow {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  background: linear-gradient(to left, rgba(0,0,0,0.3) 0%, transparent 100%);
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

/* ── 頁面內容樣式 ────────────────────────────────────── */
.mg-page-inner {
  position: absolute !important;
  inset: 0 !important;
  padding: 2rem 1.8rem;
  overflow: hidden;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.82rem;
  line-height: 1.72;
  color: #2a2218;
  box-sizing: border-box;
  background: transparent;
}

/* 品牌（Logo）頁 */
.mg-logo-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: linear-gradient(160deg, #2c3e52 0%, #3a5068 50%, #2c3e52 100%) !important;
  color: #fff !important;
}
.mg-logo-badge {
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -1px;
  color: #fff;
  border-top: 3px solid #c8a84b;
  border-bottom: 3px solid #c8a84b;
  padding: 0.4rem 1rem;
  margin-bottom: 1rem;
}
.mg-logo-badge span { font-weight: 300; letter-spacing: 3px; font-size: 0.55em; display: block; margin-top: 0.2em; }
.mg-logo-sub {
  font-size: 0.62rem;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  line-height: 1.8;
}
.mg-logo-line {
  width: 40px;
  height: 1px;
  background: #c8a84b;
  margin: 1.2rem auto;
}
.mg-logo-date {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.5px;
}

/* 封面（Cover）頁 */
.mg-cover-page {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem !important;
  background: #3a5068;
  background-size: cover !important;
  background-position: center !important;
  color: #fff;
}
.mg-cover-page::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #b8902a, #e8c45a, #b8902a);
}
.mg-cover-cat {
  font-size: 0.6rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #e8c45a;
  border: 1px solid rgba(232,196,90,0.4);
  display: inline-block;
  padding: 2px 8px;
  margin-bottom: 0.8rem;
  font-family: -apple-system, sans-serif;
  font-weight: 700;
}
.mg-cover-cat i { margin-right: 4px; }
.mg-cover-title {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
  margin-bottom: 0.8rem;
  letter-spacing: -0.3px;
  font-family: -apple-system, 'Segoe UI', sans-serif !important;
}
.mg-cover-meta {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.5px;
  font-family: -apple-system, sans-serif;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 0.6rem;
}

/* 摘要頁 */
.mg-section-label {
  font-family: -apple-system, sans-serif;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: #3a5068;
  border-bottom: 2px solid #c8a84b;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}
.mg-summary-text {
  font-style: italic;
  color: #3a3020;
  font-size: 0.85rem;
  line-height: 1.7;
  border: none;
  background: transparent;
}
.mg-summary-text strong { color: #3a5068; }

/* 正文頁 */
.mg-content-page {
  overflow: hidden;
}
/* 隱藏量測容器：繼承 mg-content-page 所有樣式，僅覆蓋定位 */
.mg-measure-container {
  position: fixed !important;
  top: -9999px !important;
  left: -9999px !important;
  inset: auto !important;
  visibility: hidden !important;
  pointer-events: none !important;
  /* width 由 JS 根據視窗寬度動態設定 */
  height: auto !important;
  overflow: visible !important;
  max-height: none !important;
  padding: 0 !important;
}
.mg-content-page h2 {
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #3a5068;
  border-top: 2px solid #3a5068;
  border-bottom: 1px solid #c8a84b;
  padding: 0.4rem 0;
  margin: 1rem 0 0.8rem;
}
.mg-content-page h3 {
  font-family: Georgia, serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #3a5068;
  margin: 0.8rem 0 0.4rem;
}
.mg-content-page p {
  font-size: 0.82rem;
  margin-bottom: 0.55em;
  line-height: 1.72;
  color: #2a2218;
  text-align: justify;
}
/* 首字下沉（第一頁第一段） */
.mg-content-page > p:first-of-type::first-letter {
  float: left;
  font-size: 3.2rem;
  line-height: 0.72;
  font-weight: 900;
  margin: 0.04em 0.08em 0 0;
  color: #3a5068;
}
.mg-content-page ul {
  padding-left: 1rem;
  font-size: 0.8rem;
}
.mg-content-page blockquote {
  border-left: 3px solid #c8a84b;
  margin: 0.8rem 0;
  padding: 0.5rem 0.8rem;
  font-style: italic;
  color: #4a3a20;
  font-size: 0.82rem;
}
/* 文字頁內的圖片：受限尺寸顯示 */
.mg-content-page img {
  display: block;
  max-width: 100%;
  max-height: 160px;
  width: auto;
  height: auto;
  object-fit: cover;
  margin: 0.4rem auto;
  border-radius: 3px;
}
.mg-content-page figure {
  margin: 0.5rem 0;
  text-align: center;
}
.mg-content-page figcaption {
  font-size: 0.68rem;
  color: #888;
  margin-top: 0.2rem;
}

/* 圖片專頁：全頁置中，圖片盡量填滿 */
.mg-image-page {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.8rem !important;
  background: #1a2535;
}
.mg-image-page figure {
  margin: 0;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.mg-image-page img {
  display: block !important;
  max-width: 100% !important;
  max-height: 88% !important;
  width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 4px;
}
.mg-image-page figcaption {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.6);
  margin-top: 0.4rem;
  text-align: center;
  font-style: italic;
}

/* 頁碼 */
.mg-page-inner::after {
  content: attr(data-page-num);
  position: absolute;
  bottom: 0.8rem;
  font-size: 0.62rem;
  color: rgba(80,60,20,0.4);
  font-family: -apple-system, sans-serif;
  letter-spacing: 1px;
}
.mg-page-left .mg-page-inner::after { left: 1.8rem; }
.mg-page-right .mg-page-inner::after { right: 1.8rem; }

/* 結尾頁 */
.mg-end-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.8rem;
}
.mg-end-ornament { color: #c8a84b; font-size: 1rem; letter-spacing: 8px; }
.mg-end-brand { font-family: -apple-system, sans-serif; font-weight: 900; font-size: 1.2rem; color: #3a5068; letter-spacing: 2px; }
.mg-end-tagline { font-size: 0.7rem; letter-spacing: 3px; color: #888; text-transform: uppercase; }

/* ── 導航控制欄 ─────────────────────────────────────── */
.mg-controls {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  padding: 0.8rem 0 0;
}
.mg-nav-btn {
  background: rgba(200,168,75,0.12);
  border: 1px solid rgba(200,168,75,0.35);
  color: rgba(200,168,75,0.9);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.mg-nav-btn:hover:not(:disabled) { background: rgba(200,168,75,0.25); color: #e8c45a; }
.mg-nav-btn:disabled { opacity: 0.2; cursor: not-allowed; }
.mg-spread-num {
  font-family: -apple-system, sans-serif;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  min-width: 60px;
  text-align: center;
  letter-spacing: 1px;
}
.mg-hint {
  font-family: -apple-system, sans-serif;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.5px;
  margin-top: 0.4rem;
}
