   PRACTICE VIEW
═══════════════════════════════════ */
.prac-topbar {
  position: sticky; top: var(--hdr-h); z-index: 40;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  padding: 6px 16px 0;
}

/* Back + title on one line */
.back-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 0;
}
.back-btn {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .8rem; color: var(--c-muted); font-weight: 500;
  padding: 10px 0; min-height: 44px; flex-shrink: 0;
}
.back-btn:hover { color: var(--c-text); }
.back-btn svg { width: 14px; height: 14px; }
.bc-sep { color: var(--c-border); }
.bc-item { font-size: .79rem; color: var(--c-muted); }

.prac-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 2px 0 5px;
}
.prac-title-row .title { font-size: 1rem; font-weight: 700; }
#prac-prog { font-size: .76rem; color: var(--c-muted); font-weight: 600; flex-shrink: 0; }

/* Year bar — compact */
.year-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 1px; }
.year-scroll::-webkit-scrollbar { display: none; }
.year-row { display: flex; gap: 4px; width: max-content; padding: 2px 0; }
.yr-btn {
  padding: 5px 12px; border-radius: 20px;
  font-size: .78rem; font-weight: 600;
  background: var(--c-surface2); border: 1.5px solid var(--c-border); color: var(--c-muted);
  transition: all .15s; white-space: nowrap; min-height: 36px;
  display: inline-flex; align-items: center; gap: 4px;
}
.yr-btn:hover  { border-color: var(--c-primary); color: var(--c-primary); }
.yr-btn.active { background: var(--c-primary); border-color: var(--c-primary); color: white; }
.yr-btn.empty,
.yr-btn[disabled] {
  opacity: .4; cursor: not-allowed; background: var(--c-surface2);
  border-style: dashed; color: var(--c-muted);
}
.yr-btn.empty:hover,
.yr-btn[disabled]:hover { border-color: var(--c-border); color: var(--c-muted); }

/* Mode toggle — pill tabs */
.mode-row {
  display: flex; gap: 0; margin: 4px 0 0;
  background: var(--c-surface2); border-radius: var(--r-sm); padding: 2px;
}
.mode-btn {
  flex: 1; padding: 5px 8px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border-radius: 6px; font-size: .8rem; font-weight: 600;
  background: transparent; border: none; color: var(--c-muted);
  transition: all .15s; min-height: 44px; cursor: pointer;
  padding: 8px 12px;
}
.mode-btn svg { width: 14px; height: 14px; }
.mode-btn.active {
  background: var(--c-surface); color: var(--c-primary);
  box-shadow: var(--shadow-sm);
}

/* Progress bar */
.prog-track { height: 4px; background: var(--c-surface2); margin-top: 6px; border-radius: 2px; overflow: hidden; }
.prog-fill  { height: 100%; background: var(--c-primary); transition: width .3s; border-radius: 2px; }

/* Exam bar */
#exam-bar {
  display: none;
  background: var(--c-surface2); border-bottom: 1px solid var(--c-border);
  padding: 6px 16px; font-size: .79rem; color: var(--c-muted);
  align-items: center; gap: 14px;
}
#exam-bar.show { display: flex; }
#exam-bar strong { color: var(--c-text); }

/* Jump to question button in exam bar */
.jump-q-btn {
  margin-left: auto; padding: 4px 12px; border-radius: var(--r-sm);
  font-size: .78rem; font-weight: 700; color: var(--c-primary);
  background: var(--c-primary-10); border: 1px solid var(--c-primary-20);
  transition: all .15s; white-space: nowrap;
}
.jump-q-btn:hover { background: var(--c-primary-20); }

/* Full exam simulation bar in practice-select view */
.full-exam-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px;
  background: var(--c-surface); border: 1.5px solid var(--c-border);
  border-radius: var(--r-lg); margin: 0 0 16px 0;
  box-shadow: var(--shadow-sm);
}
.full-exam-info { font-size: .84rem; color: var(--c-muted); line-height: 1.5; }
.full-exam-info strong { color: var(--c-text); display: block; font-size: .9rem; margin-bottom: 2px; }
.full-exam-btns { display: flex; gap: 8px; flex-shrink: 0; }
.full-exam-btn {
  padding: 8px 16px; border-radius: var(--r-md);
  font-size: .84rem; font-weight: 700; color: #fff; border: none;
  transition: all .15s; cursor: pointer;
}
.full-exam-btn.broker { background: var(--c-broker); }
.full-exam-btn.broker:hover { background: var(--c-primary-h); }
.full-exam-btn.agent  { background: var(--c-agent); }
.full-exam-btn.agent:hover  { filter: brightness(1.1); }

/* Question area — full-width feel on mobile */
.q-area { padding: 12px 12px 8px; max-width: 720px; margin: 0 auto; }
@media (min-width: 480px) { .q-area { padding: 16px 16px 8px; } }

/* Question card — larger, more breathable */
.q-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-md); margin-bottom: 12px;
}
.q-card-hdr {
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
}
.q-num {
  font-size: .75rem; font-weight: 700; color: var(--c-muted);
  background: var(--c-surface2); padding: 3px 10px; border-radius: 20px;
}
.q-flag {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-muted); transition: all .15s;
}
.q-flag:hover  { background: rgba(217,119,6,.1); color: var(--c-warning); }
.q-flag.flagged { color: var(--c-warning); background: rgba(217,119,6,.1); }
.q-flag svg { width: 20px; height: 20px; }
.q-body { padding: 18px 16px 14px; }
.q-text {
  /* 2026 editorial typography — Stripe Press 骨 + New Yorker 肌 + 六法全書紙
     30-50 歲法律考生疲倦狀態下長句 200-400 字閱讀，serif + measure 38em + 行高 1.85 */
  font-family: var(--ff-serif-cn);
  font-size: clamp(17px, 0.95rem + 0.4vw, 20px);
  line-height: 1.85;
  letter-spacing: -.005em;
  color: var(--c-text);
  margin-bottom: 16px;
  font-weight: 450;                               /* 不要 500 太重 */
  max-width: 38em;                                /* 中文約 38 字/行 measure */
  text-wrap: pretty;                              /* 避免孤字斷行（Chrome 117+/Safari 17.5+） */
  hanging-punctuation: allow-end;                 /* 句末標點懸掛 measure 外 */
  font-feature-settings: 'tnum' 1, 'kern' 1, 'liga' 1;  /* §767 數字等寬 */
  font-variant-numeric: tabular-nums lining-nums;
  line-break: strict;                             /* 中文行首禁則 */
  overflow-wrap: anywhere;                        /* 長英文 fallback */
}
/* 法條編號（民法 §767、土地法 §43）等寬數字對齊 */
.q-text .law-cite {
  font-family: var(--ff-mono);
  font-feature-settings: 'tnum' 1, 'zero' 1;
  font-size: 0.92em;
  letter-spacing: 0;
}

/* Options — large touch targets, 2026 editorial 單色系統
   砍 transition:all（all 會 transition CSS variable / width 等預期外屬性 → 抖動）
   改分屬性 timing — 顏色快、transform 帶微 overshoot、shadow 中速 */
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; text-align: left; padding: 14px 16px;
  margin-bottom: 9px;
  background: var(--c-surface); border: 2px solid var(--c-border);
  border-radius: var(--r-md); font-size: 1rem; color: var(--c-text);
  cursor: pointer; min-height: 54px;
  line-height: 1.55;
  transition:
    background-color 120ms cubic-bezier(.4,0,.2,1),
    border-color     120ms cubic-bezier(.4,0,.2,1),
    transform        180ms cubic-bezier(.34,1.56,.64,1),
    box-shadow       200ms cubic-bezier(.4,0,.2,1),
    opacity          240ms cubic-bezier(.4,0,.2,1),
    filter           240ms cubic-bezier(.4,0,.2,1);
}
.opt:last-of-type { margin-bottom: 0; }
/* Hover only on hover-capable pointers — iOS sticky hover used to leave a
   2px X-shift on tapped options after release. */
@media (hover: hover) and (pointer: fine) {
  .opt:hover:not(:disabled) {
    border-color: var(--c-primary);
    background: var(--c-primary-10);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
  }
}
.opt:active:not(:disabled) { transform: translateY(0) scale(.985); transition-duration: 60ms; }
.opt:disabled { cursor: default; }
.opt-letter {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--c-surface2); border: 2px solid var(--c-border);
  color: var(--c-text);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 800; margin-top: 1px;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 180ms cubic-bezier(.34,1.56,.64,1);
  position: relative;
}
.opt.selected { border-color: var(--c-primary); background: var(--c-primary-10); transform: translateX(4px); }
.opt.selected .opt-letter { background: var(--c-primary); border-color: var(--c-primary); color: white; transform: scale(.92); }

/* Light mode：editorial vermilion 單色系統（不用綠 / 紅雙色 — 紙本邏輯：正＝朱印，
   誤＝退色 + 線刪。錯題不該紅色閃，會刺激疲勞用戶；應該淡出讓注意力回到正解） */
.opt.correct {
  border-color: var(--c-vermilion);
  background: var(--c-vermilion-10, rgba(178,58,43,.08));
  animation: opt-pulse 360ms cubic-bezier(.16,1,.3,1) both;
}
@keyframes opt-pulse {
  0%   { box-shadow: 0 0 0 0   color-mix(in oklch, var(--c-vermilion) 22%, transparent); }
  40%  { box-shadow: 0 0 0 8px color-mix(in oklch, var(--c-vermilion) 14%, transparent); transform: scale(1.005); }
  100% { box-shadow: 0 0 0 0   transparent; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .opt.correct { animation: none; }
}
/* 答錯：用戶選的那個選項 single shake — 不要連續抖（連續是 error dialog，傷學習） */
.opt.wrong[data-user-chose="true"] {
  animation: opt-shake-once 220ms ease-out both;
}
@keyframes opt-shake-once {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .opt.wrong[data-user-chose="true"] { animation: none; }
}

/* Confidence rating + Hypercorrection 盲點集 — 已移除（用戶反饋雞肋） */

/* 鍵盤快捷視覺：按下 A/B/C/D 後 3 秒內顯示 kbd 角標
   （桌機族提升 hint，等於「不告訴你也能用，告訴你後更快」） */
body[data-kbd-active] .opt:not(:disabled) {
  position: relative;
}
body[data-kbd-active] .opt:not(:disabled)::after {
  content: attr(data-letter);
  position: absolute;
  top: 6px; right: 8px;
  font-family: var(--ff-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--c-muted);
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  padding: 2px 5px;
  pointer-events: none;
  opacity: 0;
  animation: kbd-hint-fade 220ms ease forwards;
}
@keyframes kbd-hint-fade { to { opacity: 1; } }
.opt.correct .opt-letter {
  background: var(--c-vermilion);
  border-color: var(--c-vermilion);
  color: white;
}
.opt.wrong {
  border-color: var(--c-border);
  background: transparent;
  opacity: .55;
  filter: grayscale(.4);
}
.opt.wrong .opt-letter {
  background: var(--c-surface2);
  border-color: var(--c-border);
  color: var(--c-muted);
}
/* 用戶選錯時，強調該選項的「錯誤」識別 + 線刪文字 */
.opt.wrong[data-user-chose="true"] {
  opacity: .75;
  filter: none;
  border-color: var(--c-border-2, var(--c-rule));
}
.opt.wrong[data-user-chose="true"] .opt-letter {
  background: var(--c-muted);
  border-color: var(--c-muted);
  color: white;
}
/* 錯誤選項橫線刪除動畫（reveal 時觸發） */
.opt.wrong:not([data-user-chose="true"])::after {
  content: ''; position: absolute; left: 14px; right: 14px; top: 50%;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left;
  animation: opt-strike 360ms cubic-bezier(.65,0,.35,1) 200ms forwards;
}
.opt { position: relative; }   /* 需要 relative 才能讓 ::after 定位 */
@keyframes opt-strike { to { transform: scaleX(1); } }

/* Feedback — 2026 editorial 重設計：rule line + pull-quote + details 折疊
   砍掉舊版 4px 左色條 + 7% bg block（2018 SaaS 殘留），改紙本期刊「Discussion」風格 */
.feedback {
  margin-top: 24px; padding: 0;
  background: transparent !important;
  border: none !important;
  border-top: 1px solid var(--c-rule) !important;
  border-radius: 0 !important;
  border-left: none !important;
  padding-top: 24px;
  font-size: .9rem;
  /* Grid template rows for smooth unfold animation (P1-D 揭示節奏) */
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 280ms cubic-bezier(.4,0,.2,1);
}
.feedback.correct, .feedback.wrong {
  background: transparent !important;
  border-color: var(--c-rule) !important;
}
/* mono caps + 中文 是 anti-pattern（letter-spacing 0.15em 撐爆中文 + JetBrains Mono
   無 CJK glyph fallback 醜）。改 sans-cn + 砍 letter-spacing/uppercase；
   ANS · 前綴用 mono 但中文本體用 sans。 */
.feedback-title {
  font-family: var(--ff-sans-cn);
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: .04em;
  text-transform: none;
  color: var(--c-vermilion);
  margin-bottom: 14px !important;
}
.feedback-title::before {
  content: 'ANS · ';
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: .15em;
  font-weight: 600;
}
.feedback.correct .feedback-title { color: var(--c-vermilion); }
.feedback.wrong   .feedback-title { color: var(--c-muted); }
.feedback.wrong .feedback-title::before { content: 'ANS · '; }

.feedback-answer {
  font-family: var(--ff-mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .04em;
  margin-bottom: 14px;
  color: var(--c-vermilion);
}

.feedback-exp {
  font-family: var(--ff-serif-cn);
  font-size: 16px;
  line-height: 1.78;
  color: var(--c-text);
  max-width: 38em;
  text-wrap: pretty;
}

/* ─────────────────────────────────────────────────────────
   LoginGate — 訪客只看前段、登入後解鎖完整解答
   用 CSS max-height 做視覺遮罩；HTML 內容仍完整存在 DOM（SEO/AI 友善）
   ───────────────────────────────────────────────────────── */
.login-gate { position: relative; }
.login-gate[data-lock="locked"] .login-gate-content {
  max-height: 200px;
  overflow: hidden;
  /* mask 讓底部漸層淡出 — 比硬切順眼 */
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
}
@media (max-width: 540px) {
  .login-gate[data-lock="locked"] .login-gate-content { max-height: 140px; }
}
.login-gate[data-lock="unlocked"] .login-gate-overlay { display: none; }
.login-gate-overlay {
  position: relative;
  margin-top: -60px;            /* 蓋住 mask fade 區域 */
  padding: 20px 16px 8px;
  text-align: center;
  z-index: 2;
}
.login-gate-card {
  max-width: 480px;
  margin: 0 auto;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 24px 22px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
[data-theme="dark"] .login-gate-card {
  background: var(--c-surface);
  border-color: var(--c-border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.32);
}
.login-gate-icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.login-gate-title {
  font-family: var(--ff-serif-cn);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 6px;
}
.login-gate-sub {
  font-size: .82rem;
  color: var(--c-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}
.login-gate-free {
  display: inline-block;
  margin-top: 4px;
  font-size: .72rem;
  color: var(--c-success);
  letter-spacing: .04em;
  font-weight: 700;
}
.login-gate-cta {
  display: inline-block;
  background: var(--c-vermilion);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: filter .15s, transform .15s;
  min-height: 44px;
  touch-action: manipulation;
}
[data-theme="dark"] .login-gate-cta { color: var(--c-primary-fg); }
.login-gate-cta:hover { filter: brightness(1.08); }
.login-gate-cta:active { transform: scale(.98); }
.login-gate-link {
  display: block;
  margin: 10px auto 0;
  background: none;
  border: none;
  color: var(--c-muted);
  font-size: .8rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px 12px;
  touch-action: manipulation;
}
.login-gate-link:hover { color: var(--c-vermilion); }

/* 法條引用 = pull-quote（紙本引文塊），不是 card */
.exp-law-quote {
  margin: 18px 0 18px 8px;
  padding: 4px 0 4px 16px;
  border-left: 2px solid var(--c-vermilion);
  font-family: var(--ff-serif-cn);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--c-text);
  font-style: normal;
}
.exp-law-quote cite {
  display: block;
  margin-top: 8px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--c-muted);
  font-style: normal;
}
.exp-law-quote cite::before { content: '— '; }

/* 各選項分析：所有斷點都左右雙欄（不上下堆疊，避免破壞桌機閱讀流）。
   修法重點：左欄寬度由內容決定（flex: 0 0 auto）+ min-width 72px 保底 +
   max-width 120px 上限，配合 white-space: nowrap + word-break: keep-all
   讓「第 1234-1 條」「正確答案 ABCD」等任何長度都絕不斷字。 */
.exp-correct-block, .exp-wrong-block {
  background: transparent !important;

  border-left: none !important;
  border-radius: 0 !important;
  border-bottom: 1px dotted var(--c-rule);
  padding: 12px 0 !important;
  margin: 0 !important;
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: flex-start;
  font-family: var(--ff-serif-cn);
  font-size: 15px;
  line-height: 1.7;
  color: var(--c-text);
}
.exp-correct-block:last-child, .exp-wrong-block:last-child { border-bottom: none; }
.exp-correct-label, .exp-wrong-label {
  flex: 0 0 auto;                /* 寬度由內容決定 */
  min-width: 72px;               /* 最小保證寬度，避免太擠 */
  max-width: 120px;              /* 上限，避免吃太多右欄 */
  font-family: var(--ff-sans-cn);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;           /* 關鍵：整串不換行 */
  word-break: keep-all;          /* 中文視為單字不斷行 */
  text-align: center;
  margin-bottom: 0 !important;
  align-self: flex-start;
}
/* 正確答案 — vermilion accent badge */
.exp-correct-label {
  color: var(--c-vermilion);
  background: var(--c-vermilion-10, rgba(178,58,43,.10));
  border-left: 3px solid var(--c-vermilion);
}
/* 錯誤選項分析 — 灰色 muted badge */
.exp-wrong-label {
  color: var(--c-muted);
  background: var(--c-surface2);
  border-left: 3px solid var(--c-rule);
}
/* 右欄（解析內容）— flex: 1 + min-width: 0 讓內容能正常換行（不溢出邊界） */
.exp-body {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  line-height: 1.7;
}

/* 套用地政士 essay 編輯樣式到經紀人 MC 解析（_formatEssayAnswer 解析 body）：
   .essay-ans-text 在獨立 essay 中是 max-width 64ch / 16px font；
   嵌入 .exp-body 時要瘦身以配合 MC 解析的 inline 場景 */
.exp-body.essay-ans-text {
  max-width: none;
  font-size: 15px;
  line-height: 1.72;
}
.exp-body.essay-ans-text .ans-h1 {
  font-size: 15.5px; margin: 1.3em 0 .55em;
  padding-left: 12px;
}
.exp-body.essay-ans-text .ans-h1:first-child { margin-top: 0; }
.exp-body.essay-ans-text .ans-h2 { font-size: 14.5px; margin: 1em 0 .4em; }
.exp-body.essay-ans-text .ans-h3 { font-size: 14px; margin: .85em 0 .3em; }
.exp-body.essay-ans-text .ans-p { font-size: 15px; line-height: 1.72; }
.exp-body.essay-ans-text .ans-p:not(:first-child) { margin-top: .9em; }
.exp-body.essay-ans-text .ans-quote {
  font-size: 14px; line-height: 1.72;
  margin: .9em 0 .9em .4em; padding-left: 14px;
}
.exp-body.essay-ans-text .ans-conclusion {
  font-size: 15px; line-height: 1.65;
  margin: 1.3em 0 .3em; padding: 12px 0;
}
.exp-body.essay-ans-text > * + * { margin-top: .9em; }

/* details 折疊「各選項分析」— 70% 答對的人不必看，可主動展開
   中文 summary：sans-cn + 砍 letter-spacing/uppercase（mono caps anti-pattern） */
details.exp-opts > summary {
  font-family: var(--ff-sans-cn);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: none;
  color: var(--c-muted);
  cursor: pointer;
  padding: 14px 0;
  list-style: none;
  border-top: 1px dotted var(--c-rule);
  margin-top: 12px;
  user-select: none;
}
details.exp-opts > summary::-webkit-details-marker { display: none; }
details.exp-opts > summary::after { content: ' →'; transition: transform 200ms ease; display: inline-block; }
details.exp-opts[open] > summary::after { content: ' ↓'; }
details.exp-opts > summary:hover { color: var(--c-vermilion); }
.exp-wrong-label  { font-weight: 800; color: var(--c-danger); font-size: .8rem; display: block; margin-bottom: 3px; }
.yr-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--c-success); flex-shrink: 0; }
.yr-btn.active .yr-dot { background: rgba(255,255,255,.8); }

/* Essay */
.essay-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); margin-bottom: 10px;
}
.essay-q   { padding: 18px 16px; }
.essay-tag { display: inline-flex; padding: 3px 10px; border-radius: 20px; background: var(--c-primary-10); color: var(--c-primary); font-size: .75rem; font-weight: 700; margin-bottom: 12px; }
.essay-text { font-size: .95rem; line-height: 1.9; }
.essay-divider {
  padding: 0 16px 14px;
}
.essay-reveal-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 16px; border-radius: var(--r-md);
  background: var(--c-primary); color: white;
  font-size: .9rem; font-weight: 600; border: none; cursor: pointer;
  transition: background .15s;
}
.essay-reveal-btn:hover { background: var(--c-primary-h); }
.essay-ans {
  padding: 28px 24px;
  border-top: 1px solid var(--c-rule, var(--c-border));
  background: var(--c-paper, transparent);
}
.essay-ans-tag {
  font-family: var(--ff-mono); font-size: 11px; font-weight: 600;
  color: var(--c-vermilion); text-transform: uppercase; letter-spacing: .15em;
  margin-bottom: 24px; padding-bottom: 12px;
  border-bottom: 1px solid var(--c-rule);
}
.essay-ans-text {
  font-family: var(--ff-sans-cn);
  font-size: 16px; line-height: 1.85;
  color: var(--c-ink, var(--c-text));
  max-width: 64ch;
  font-feature-settings: 'palt' 1;
}
.essay-ans-text > * + * { margin-top: 1.2em; }   /* 段距派 */
/* ⚠ pre-wrap 保留原文換行 + 空白（修「換行被吃」「縮排消失」bug）
   word-break: break-word 避免長英文/數字撐爆容器 */
.essay-ans-text .ans-p,
.essay-ans-text .ans-quote,
.essay-ans-text .ans-conclusion {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.essay-ans-text .ans-p { margin: 0; }
.essay-ans-text .ans-p:not(:first-child) { margin-top: 1.2em; }

/* L1 大標 「一、」「二、」 — editorial: 思源宋 600 + 朱紅 2px 左 hairline */
.essay-ans-text .ans-h1 {
  font-family: var(--ff-serif-cn);
  font-size: 17px; font-weight: 600;
  letter-spacing: .05em;
  color: var(--c-ink, var(--c-text));
  margin: 2.4em 0 .9em;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--c-vermilion, var(--c-primary));
  line-height: 1.45;
}
.essay-ans-text .ans-h1:first-child { margin-top: 0; }
.essay-ans-text .ans-h1-num {
  font-family: var(--ff-serif-cn);
  color: var(--c-vermilion, var(--c-primary));
  margin-right: 4px;
}

/* L2 子標 「(一)」「（一）」 — 不加底色，靠字重 + 間距 */
.essay-ans-text .ans-h2 {
  font-family: var(--ff-serif-cn);
  font-size: 15.5px; font-weight: 600;
  color: var(--c-ink, var(--c-text));
  margin: 1.6em 0 .5em;
  line-height: 1.5;
}
.essay-ans-text .ans-h2-num { color: var(--c-muted); margin-right: 2px; }

/* L3 「1.」「2.」— 行內粗體，間距小 */
.essay-ans-text .ans-h3 {
  font-size: 15px; font-weight: 600;
  color: var(--c-ink, var(--c-text));
  margin: 1.1em 0 .35em;
  line-height: 1.55;
}
.essay-ans-text .ans-h3-num {
  font-family: var(--ff-mono);
  color: var(--c-muted); font-weight: 500;
  margin-right: 4px;
}

/* 法條引文 blockquote — 思源宋 + § 開頭 + 左 hairline */
.essay-ans-text .ans-quote {
  font-family: var(--ff-serif-cn);
  font-size: 15px; line-height: 1.85;
  color: #2A2520;
  margin: 1.4em 0 1.4em 1em;
  padding: 4px 0 4px 18px;
  border-left: 1px solid rgba(20,17,13,.22);
  font-feature-settings: 'palt' 1;
}
.essay-ans-text .ans-quote::before {
  content: '§ ';
  color: var(--c-vermilion, var(--c-primary));
  font-family: var(--ff-mono);
  font-weight: 700;
}
[data-theme="dark"] .essay-ans-text .ans-quote { color: #C9C0AE; border-left-color: rgba(242,238,229,.22); }

/* 結論段 — 上下 hairline 夾擊 (editorial「主文」氣質) */
.essay-ans-text .ans-conclusion {
  font-family: var(--ff-serif-cn);
  font-size: 16px; line-height: 1.72;
  color: var(--c-ink, var(--c-text));
  margin: 2em 0 .5em;
  padding: 18px 0;
  border-top: 1px solid var(--c-ink, var(--c-text));
  border-bottom: 1px solid rgba(20,17,13,.22);
}
[data-theme="dark"] .essay-ans-text .ans-conclusion { border-bottom-color: rgba(242,238,229,.22); }

/* 法條條號 inline highlight — 淡黃底（最克制） */
.essay-ans-text .ans-art {
  background: linear-gradient(transparent 60%, rgba(184,137,58,.22) 60%);
  font-family: var(--ff-mono);
  font-feature-settings: 'tnum' 1;
  padding: 0 2px; color: inherit;
}
[data-theme="dark"] .essay-ans-text .ans-art { background: linear-gradient(transparent 60%, rgba(214,166,83,.3) 60%); }

/* Numbered list & bullet inside answer */
.essay-ans-text ol, .essay-ans-text ul { padding-left: 1.6em; margin: .8em 0; }
.essay-ans-text li { margin-bottom: .45em; }

/* 「複製整段答案」 button (A2 必加) */
.essay-ans-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 18px; padding-top: 12px;
  border-top: 1px dashed var(--c-rule);
}
.essay-ans-copy-btn {
  font-family: var(--ff-mono); font-size: 11.5px; font-weight: 500;
  padding: 5px 12px; border-radius: 999px;
  background: transparent; color: var(--c-muted);
  border: 1px solid var(--c-rule); cursor: pointer;
  letter-spacing: .04em; transition: all .15s;
}
@media (hover: hover) {
  .essay-ans-copy-btn:hover { background: var(--c-vermilion); color: #FFFAF2; border-color: var(--c-vermilion); }
}
.essay-ans-copy-btn.copied { background: var(--c-success); color: #FFFAF2; border-color: var(--c-success); }

/* Mobile：稍微縮小、放寬內距 — 統一斷點 768 (md) */
@media (max-width: 767.98px) {
  .essay-ans { padding: 20px 16px; }
  .essay-ans-text { font-size: 15.5px; line-height: 1.78; }
  .essay-ans-text .ans-h1 { font-size: 16.5px; padding-left: 12px; }
  .essay-ans-text .ans-quote { margin-left: .5em; padding-left: 14px; }
}

/* Essay write + AI grade area */
.essay-write-area {
  padding: 0 16px 14px; border-top: 1px solid var(--c-border);
}
.essay-write-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 8px;
}
.essay-write-label { font-size: .78rem; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: .06em; }
.essay-write-hint  { font-size: .72rem; color: var(--c-muted); font-style: italic; }
.essay-textarea {
  width: 100%; padding: 12px; border-radius: var(--r-md);
  border: 1.5px solid var(--c-border); background: var(--c-bg); color: var(--c-text);
  font-family: inherit; font-size: .9rem; line-height: 1.8;
  resize: vertical; transition: border-color .15s; box-sizing: border-box;
}
.essay-textarea:focus { outline: none; border-color: var(--c-primary); }
.essay-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 8px; }
.essay-quota-pill {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--c-surface2); color: var(--c-muted); font-weight: 500;
}
.essay-quota-pill.q-ok    { background: rgba(5,150,105,.1); color: var(--c-success); }
.essay-quota-pill.q-low   { background: rgba(217,119,6,.1); color: var(--c-warning); }
.essay-quota-pill.q-empty { background: var(--c-danger); color: #fff; font-weight: 600; padding: 4px 12px; }
.essay-quota-pill.q-empty a { color: #fff; }
.essay-quota-pill.q-blocked { background: rgba(220,38,38,.15); color: var(--c-danger); font-weight: 600; }
.essay-quota-pill.q-paid {
  background: linear-gradient(135deg, rgba(178,58,43,.12), rgba(178,58,43,.06));
  color: var(--c-vermilion, #B23A2B); font-weight: 600;
  border: 1px solid rgba(178,58,43,.25);
}
/* Deep mode toggle (only shown for paid_seasonal users) */
.essay-deep-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(178,58,43,.08);
  border: 1px solid rgba(178,58,43,.25);
  cursor: pointer; user-select: none;
  font-size: 12px; transition: background .15s;
}
.essay-deep-toggle:hover { background: rgba(178,58,43,.14); }
.essay-deep-toggle input[type="checkbox"] {
  margin: 0; width: 14px; height: 14px;
  accent-color: var(--c-vermilion, #B23A2B);
  cursor: pointer;
}
.essay-deep-toggle.disabled { opacity: .45; cursor: not-allowed; }
.essay-deep-toggle.disabled input { cursor: not-allowed; }
.essay-deep-lbl {
  color: var(--c-vermilion, #B23A2B); font-weight: 600;
  white-space: nowrap;
}
.essay-deep-lbl em {
  font-style: normal; font-size: 10px;
  background: var(--c-vermilion, #B23A2B); color: #fff;
  padding: 1px 5px; border-radius: 999px;
  margin-left: 2px; font-weight: 700;
}

/* AI grading personal stats panel */
.ai-quota-card { background: var(--c-surface2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.ai-quota-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.ai-quota-tier { font-size: .82rem; color: var(--c-text); font-weight: 500; }
.ai-quota-num { font-size: .92rem; font-weight: 600; color: var(--c-text); }
.ai-quota-bar { height: 6px; background: var(--c-border); border-radius: 3px; overflow: hidden; }
.ai-quota-fill { height: 100%; transition: width .3s; border-radius: 3px; }
.ai-quota-hint { font-size: .72rem; color: var(--c-muted); margin-top: 6px; }
.ai-stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 12px; }
.ai-stat-item { background: var(--c-surface2); padding: 10px; border-radius: 8px; text-align: center; }
.ai-stat-val { font-size: 1.4rem; font-weight: 700; color: var(--c-primary); line-height: 1.1; }
.ai-stat-lbl { font-size: .68rem; color: var(--c-muted); margin-top: 2px; }
.ai-hist-title { font-size: .76rem; color: var(--c-muted); margin: 6px 0 4px; font-weight: 500; }
.ai-hist-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--c-border); }
.ai-hist-item:last-child { border-bottom: none; }
.ai-hist-score { font-size: 1.3rem; font-weight: 700; min-width: 50px; text-align: center; line-height: 1; }
.ai-hist-max { font-size: .65rem; color: var(--c-muted); font-weight: 400; }
.ai-hist-mid { flex: 1; min-width: 0; }
.ai-hist-meta { font-size: .68rem; color: var(--c-muted); }
.ai-hist-q { font-size: .76rem; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ai-hist-grade { font-size: .68rem; padding: 2px 8px; border-radius: 8px; font-weight: 600; flex-shrink: 0; }

/* Admin AI usage section */
.admin-ai-section { margin-top: 16px; padding: 14px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 10px; }
.admin-ai-cost-card { background: linear-gradient(135deg, rgba(178,58,43,.08), rgba(178,58,43,.02)); border: 1px solid rgba(178,58,43,.2); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.admin-ai-cost-val { font-size: 1.8rem; font-weight: 700; color: var(--c-primary); }
.admin-ai-cost-lbl { font-size: .72rem; color: var(--c-muted); margin-top: 2px; }
.admin-ai-cost-note { font-size: .68rem; color: var(--c-muted); margin-top: 8px; line-height: 1.4; }
.admin-ai-trend { display: flex; align-items: flex-end; gap: 2px; height: 100px; padding: 8px 0; overflow-x: auto; }
.admin-ai-bar { flex: 1; min-width: 8px; background: var(--c-primary); border-radius: 2px 2px 0 0; opacity: .8; transition: opacity .15s; }
.admin-ai-bar:hover { opacity: 1; }
.admin-ai-bar-empty { background: var(--c-border); }
.admin-ai-toplist { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.admin-ai-toplist-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; background: var(--c-surface2); border-radius: 6px; font-size: .76rem; }
.admin-ai-toplist-email { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--c-text); }
.admin-ai-toplist-count { font-weight: 600; color: var(--c-primary); margin-left: 8px; }
.admin-ai-blocks { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.admin-ai-block-card { background: var(--c-surface2); padding: 10px; border-radius: 8px; text-align: center; }
.admin-ai-block-val { font-size: 1.2rem; font-weight: 700; color: var(--c-warning); }
.admin-ai-block-lbl { font-size: .65rem; color: var(--c-muted); }
.essay-grade-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--r-md);
  background: var(--c-primary); color: white;
  font-size: .88rem; font-weight: 700; border: none; cursor: pointer;
  transition: background .15s;
}
.essay-grade-btn:hover:not(:disabled) { background: var(--c-primary-h); }
.essay-grade-btn:disabled { opacity: .45; cursor: default; }
.essay-grade-spinner {
  width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.3);
  border-top-color: white; border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.essay-grade-result { margin-top: 12px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--c-border); }
.essay-grade-loading { padding: 20px; text-align: center; color: var(--c-muted); font-size: .88rem; }
.grade-error { padding: 14px 16px; color: var(--c-danger); font-size: .85rem; }
.grade-header {
  padding: 16px; background: var(--c-surface2);
  border-bottom: 1px solid var(--c-border);
}
.grade-score-wrap { display: flex; align-items: baseline; gap: 2px; margin-bottom: 6px; }
.grade-score { font-size: 2.4rem; font-weight: 900; line-height: 1; }
.grade-score-denom { font-size: 1rem; color: var(--c-muted); font-weight: 600; }
.grade-meta { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.grade-badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: .78rem; font-weight: 700;
}
.grade-law-badge {
  font-size: .73rem; padding: 2px 8px; border-radius: 10px;
  background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-muted);
}
.grade-law-badge.seo-ok { color: var(--c-success); border-color: rgba(5,150,105,.3); background: rgba(5,150,105,.08); }
.grade-law-badge.seo-warn { color: var(--c-warning); border-color: rgba(217,119,6,.3); background: rgba(217,119,6,.08); }
.grade-summary { font-size: .88rem; color: var(--c-text); margin-bottom: 8px; font-weight: 500; }
.grade-bar-track { height: 6px; background: var(--c-border); border-radius: 3px; overflow: hidden; }
.grade-bar-fill  { height: 100%; border-radius: 3px; transition: width .6s; }
.grade-section { padding: 10px 16px; border-bottom: 1px solid var(--c-border); }
.grade-section:last-child { border-bottom: none; }
.grade-section-hdr { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.grade-ok   { color: var(--c-success); }
.grade-miss { color: var(--c-danger); }
.grade-tip  { color: var(--c-primary); }
.grade-item { font-size: .86rem; line-height: 1.6; padding: 2px 0; }
.grade-item-ok   { color: var(--c-success); }
.grade-item-miss { color: var(--c-danger); }
.grade-item-tip  { color: var(--c-text); }
[data-theme="dark"] .essay-write-area { border-color: var(--c-border); }
[data-theme="dark"] .essay-textarea { background: var(--c-bg); border-color: var(--c-border); color: var(--c-text); }
[data-theme="dark"] .essay-grade-result { border-color: var(--c-border); }

/* Wrong option explanation */
.explain-opts-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 10px; padding: 6px 14px; border-radius: var(--r-sm);
  font-size: .8rem; font-weight: 700;
  color: var(--c-primary); background: var(--c-primary-10);
  border: 1px solid var(--c-primary-20); transition: all .15s; cursor: pointer;
}
.explain-opts-btn:hover:not(:disabled) { background: var(--c-primary-20); }
.explain-opts-btn:disabled { opacity: .5; cursor: default; }
.explain-opts-box {
  margin-top: 10px; border-radius: var(--r-md);
  border: 1px solid var(--c-border); overflow: hidden;
  background: var(--c-surface);
}
.explain-loading, .explain-error {
  padding: 14px 16px; font-size: .84rem; color: var(--c-muted); text-align: center;
}
.explain-error { color: var(--c-danger); }
.explain-keypoint {
  padding: 10px 14px; font-size: .84rem; font-weight: 600;
  background: var(--c-primary-10); color: var(--c-primary);
  border-bottom: 1px solid var(--c-primary-20);
}
.explain-opts-hdr {
  padding: 8px 14px; font-size: .72rem; font-weight: 700;
  color: var(--c-muted); text-transform: uppercase; letter-spacing: .06em;
  background: var(--c-surface2); border-bottom: 1px solid var(--c-border);
}
/* Per-option breakdown body (revealed by 為什麼其他選項是錯的 button). */
.woa-body {
  padding: 14px 16px; font-size: .88rem; line-height: 1.85; color: var(--c-text);
}
.woa-body .woa-marker {
  display: inline-block; margin: 8px 0 2px;
  font-weight: 700; color: var(--c-primary);
}
.woa-body .woa-marker:first-child { margin-top: 0; }
/* WOA panel 改用 .exp-wrong-block 結構化排版時的微調：
   外層已有 box border + padding，內層 block dotted divider 拿掉首尾 padding
   避免上下空白堆疊。 */
.woa-body-blocks { padding: 4px 16px 12px !important; }
.woa-body-blocks .exp-correct-block,
.woa-body-blocks .exp-wrong-block {
  padding: 10px 0 !important;
}
.woa-body-blocks .exp-correct-block:first-child,
.woa-body-blocks .exp-wrong-block:first-child {
  border-top: none !important;
  padding-top: 8px !important;
}
.woa-body-blocks .exp-correct-block:last-child,
.woa-body-blocks .exp-wrong-block:last-child {
  border-bottom: none !important;
  padding-bottom: 4px !important;
}
.woa-body-blocks .woa-fallback {
  font-size: .92rem; line-height: 1.78;
}
.woa-body-blocks .woa-fallback .woa-marker {
  display: inline-block; margin: 8px 0 2px;
  font-weight: 700; color: var(--c-primary);
}
.woa-trial-end {
  margin-top: 12px; padding: 10px 14px;
  background: var(--c-surface2); border-radius: 8px;
  font-size: .82rem; color: var(--c-text-2);
  text-align: center;
}
.woa-trial-end .link-btn {
  background: none; border: none; color: var(--c-primary);
  font-weight: 700; cursor: pointer; padding: 0; font-size: inherit;
  text-decoration: underline;
}
.explain-opt-row {
  display: flex; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
}
.explain-opt-row:last-child { border-bottom: none; }
.explain-opt-letter {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(220,38,38,.1); color: var(--c-danger);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 800; margin-top: 1px;
}
.explain-opt-body { flex: 1; min-width: 0; }
.explain-opt-text { font-size: .83rem; color: var(--c-muted); margin-bottom: 4px; line-height: 1.5; }
.explain-opt-reason { font-size: .86rem; line-height: 1.6; color: var(--c-text); margin-bottom: 4px; }
.explain-opt-law {
  font-size: .76rem; color: var(--c-primary); font-weight: 600;
  background: var(--c-primary-10); padding: 2px 8px; border-radius: 8px;
  display: inline-block; margin-top: 2px;
}
[data-theme="dark"] .explain-opts-box { border-color: var(--c-border); background: var(--c-surface); }
[data-theme="dark"] .explain-opts-hdr { background: var(--c-surface2); border-color: var(--c-border); }
[data-theme="dark"] .explain-opt-row { border-color: var(--c-border); }

[data-theme="dark"] .grade-header { background: var(--c-surface2); border-color: var(--c-border); }
[data-theme="dark"] .grade-section { border-color: var(--c-border); }
[data-theme="dark"] .grade-law-badge { background: var(--c-surface2); border-color: var(--c-border); }

/* Action bar — fixed above bottom nav */
#action-bar {
  display: none;
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0; z-index: 40;
  background: var(--c-surface); border-top: 1.5px solid var(--c-border);
  padding: 10px 12px; flex-direction: row; gap: 8px;
  box-shadow: 0 -4px 12px rgba(0,0,0,.07);
}
#action-bar > * { flex: 1; }
#action-bar .btn { font-size: .88rem; min-height: 46px; }
/* Question area needs padding so content doesn't hide behind fixed action bar */
.q-area { padding-bottom: calc(var(--action-h) + 8px) !important; }

/* ═══════════════════════════════════
