/* =========================================================
   字字珠璣 — 畫卷式版面
   酒精潑墨 × Q版國風｜宣紙 #f0e9d8｜青碧/黛藍/胭脂紅/鎏金
   手機直向優先（390px）；零外部資源
   ========================================================= */

:root {
  /* 依素材實際紙色微調（略暖於原稿 #f2ecdc） */
  --paper:      #f0e9d8;
  --paper-hi:   #f8f3e6;
  --paper-dim:  #e7ddc6;
  --ink:        #2b3a4a;   /* 黛藍墨 */
  --ink-soft:   #55636f;
  --teal:       #2e8f8a;   /* 青碧 */
  --teal-deep:  #1f6f74;
  --navy:       #274b63;
  --rouge:      #c14b4b;   /* 胭脂紅 */
  --rouge-deep: #9d3232;
  --gold:       #c9a227;   /* 鎏金（裝飾用：邊框／漸層背景） */
  --gold-hi:    #e6c96a;
  --gold-text:  #7d5c0f;   /* 鎏金字：對宣紙背景達 4.5:1 對比，供文字使用 */
  --serif: "Songti TC", "Noto Serif TC", "LiSong Pro", "PMingLiU", serif;
  --kai:   "Kaiti TC", "BiauKai", "DFKai-SB", "TW-Kai", "Songti TC", "Noto Serif TC", serif;
  --sans:  -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

/* HTML hidden 屬性必須勝過元件本身的 display，避免「下一題」等鎖定按鈕提前出現。 */
[hidden] { display: none !important; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--teal-deep);
  outline-offset: 2px;
}

/* 選項按鈕作答前不能用跟「答對」同色系的外框，否則手機點按/滾動時的殘留
   focus 外框會被誤認成洩題（灰色虛線，跟 .correct 的青色實體外框明顯不同） */
#options button:focus-visible {
  outline: 2px dashed #8a94a3;
  outline-offset: 2px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ---------- 遠景潑墨山水 ---------- */
/* 用 mask 往下淡出（而非蓋色塊），消除素材紙色與 CSS 底色的微差色帶 */
.ink-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("../assets/web/bg-ink.jpg") no-repeat center top / cover;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 42%, rgba(0,0,0,.45) 70%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, #000 42%, rgba(0,0,0,.45) 70%, transparent 100%);
}

/* ---------- 桌機答題兩側立繪（裝飾） ---------- */
.side-fig { display: none; }

/* ---------- 掛軸骨架 ---------- */
.scroll-frame {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 10px 40px;
}

/* 卷軸桿：黑漆桿身 + 鎏金軸頭 */
.scroll-rod {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  position: relative;
  z-index: 2;
}
.rod-bar {
  flex: 1;
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(180deg, #4a4139 0%, #241f1a 45%, #45392c 100%);
  box-shadow: 0 3px 8px rgba(36,31,26,.45),
              inset 0 1px 0 rgba(230,201,106,.35);
}
.rod-cap {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
  margin: 0 -4px;
  background: radial-gradient(circle at 34% 30%, var(--gold-hi), var(--gold) 55%, #8a6d14 100%);
  box-shadow: 0 2px 5px rgba(36,31,26,.5);
  z-index: 1;
}
.scroll-rod--top    { margin-bottom: -8px; }
.scroll-rod--bottom { margin-top: -8px; }

/* 宣紙卷面 */
.scroll-paper {
  position: relative;
  padding: 26px 16px 30px;
  background:
    /* 宣紙纖維微紋 */
    repeating-linear-gradient(0deg,
      rgba(43,58,74,.016) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, var(--paper-hi) 0%, var(--paper) 38%, var(--paper) 82%, var(--paper-dim) 100%);
  border-left:  1px solid rgba(201,162,39,.45);
  border-right: 1px solid rgba(201,162,39,.45);
  box-shadow: 0 10px 34px rgba(39,75,99,.28);
}
/* 卷面左右內側淡淡的捲曲陰影 */
.scroll-paper::before,
.scroll-paper::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 14px;
  pointer-events: none;
}
.scroll-paper::before { left: 0;  background: linear-gradient(90deg,  rgba(43,58,74,.08), transparent); }
.scroll-paper::after  { right: 0; background: linear-gradient(-90deg, rgba(43,58,74,.08), transparent); }

/* ---------- 題名 ---------- */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
/* 滿版素材圖：inset box-shadow 蓋不到 <img> 內容，一律改用 radial mask 柔邊 */
.brand-emblem {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  -webkit-mask-image: radial-gradient(circle, #000 58%, transparent 97%);
          mask-image: radial-gradient(circle, #000 58%, transparent 97%);
}
.brand-titlebox {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-title {
  margin: 0;
  display: flex;
  gap: 6px;
  font-family: var(--serif);
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: .04em;
  color: var(--ink);
  text-shadow: 0 2px 0 rgba(240,233,216,.9),
               2px 3px 6px rgba(39,75,99,.35);
}
/* 四字微錯位，做手寫落款感 */
.brand-title span:nth-child(1) { transform: rotate(-3deg) translateY(2px); }
.brand-title span:nth-child(2) { transform: rotate(2deg)  translateY(-2px); color: var(--teal-deep); }
.brand-title span:nth-child(3) { transform: rotate(-2deg) translateY(1px); }
.brand-title span:nth-child(4) { transform: rotate(3deg)  translateY(-1px); color: var(--rouge); }
/* 直排胭脂印章 */
.brand-seal {
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .3em;
  color: var(--paper-hi);
  background: linear-gradient(160deg, var(--rouge) 0%, var(--rouge-deep) 100%);
  border: 1px solid rgba(248,243,230,.55);
  outline: 2px solid var(--rouge-deep);
  border-radius: 4px;
  padding: 8px 4px 5px;
  transform: rotate(4deg);
  box-shadow: 1px 2px 4px rgba(157,50,50,.4);
}
.brand-sub {
  margin: 0;
  font-size: .85rem;
  letter-spacing: .35em;
  text-indent: .35em;
  color: var(--ink-soft);
}
.brand-grade {
  margin: 2px 0 0;
  font-size: .72rem;
  letter-spacing: .05em;
  color: var(--teal-deep);
}
.brand-trust {
  margin: 4px 0 0;
  font-size: .68rem;
  letter-spacing: .05em;
  color: var(--ink-soft);
  opacity: .7;
}
.parent-cta {
  margin-top: 6px;
  padding: 6px 16px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: rgba(201,162,39,.10);
  color: var(--gold-text);
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
}

/* 首屏主 CTA：新手一眼就看到的「立刻開始」，直接用預設值開練 */
.quickstart-cta {
  margin-top: 14px;
  padding: 14px 40px;
  border: none;
  border-radius: 999px;
  background: radial-gradient(circle at 34% 30%, var(--gold-hi), var(--gold) 62%);
  color: #3a2a00;
  font-family: var(--sans);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(201,162,39,.38);
  animation: qs-pulse 2.4s ease-in-out infinite;
}
.quickstart-cta:hover { filter: brightness(1.05); }
.quickstart-cta:active { transform: translateY(1px); }
@keyframes qs-pulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(201,162,39,.32); }
  50%      { box-shadow: 0 8px 26px rgba(201,162,39,.55); }
}
@media (prefers-reduced-motion: reduce) { .quickstart-cta { animation: none; } }

/* 未立誓時的邀請樣式 */
.oath-line--cta {
  border: 1px dashed var(--gold);
  background: rgba(201,162,39,.08);
  color: var(--gold-text);
  font-weight: 700;
}

/* 進入答題後：收起首頁、題名縮小 */
body.in-quiz #screen-home { display: none; }
body.in-quiz .brand { flex-direction: row; flex-wrap: wrap; justify-content: center; margin-bottom: 12px; }
body.in-quiz .brand-emblem { width: 40px; height: 40px; }
body.in-quiz .brand-title { font-size: 1.5rem; }
body.in-quiz .brand-seal,
body.in-quiz .brand-sub,
body.in-quiz .brand-grade,
body.in-quiz .parent-cta,
body.in-quiz .quickstart-cta,
body.in-quiz .nodamage-toggle { display: none; }
body.in-quiz .brand-trust { flex-basis: 100%; margin: 0; font-size: .6rem; text-align: center; }

/* ---------- 角色對峙 VS ---------- */
.vs-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 20px;
}
.fighter {
  margin: 0;
  flex: 1;
  max-width: 158px;
  text-align: center;
}
.fighter img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 42% 42% 30% 30% / 30% 30% 22% 22%;
  /* 滿版圖用 radial mask 柔進卷面（inset shadow 蓋不到 img 內容） */
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 60%, transparent 98%);
          mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 60%, transparent 98%);
}
.fighter--rival img { transform: scaleX(-1); }
/* 舞台地板橢圓光影 */
.fighter::after {
  content: "";
  display: block;
  height: 12px;
  width: 68%;
  margin: -8px auto 0;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(43,58,74,.18), transparent 68%);
}
.fighter figcaption {
  margin-top: 4px;
  font-family: var(--serif);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--ink-soft);
}
.fighter--player figcaption { color: var(--teal-deep); }
.fighter--rival  figcaption { color: var(--navy); }

.vs-badge {
  flex: none;
  width: 62px;
  height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--paper-hi);
  background: radial-gradient(circle at 32% 28%, #d96a5f, var(--rouge) 55%, var(--rouge-deep) 100%);
  border-radius: 50%;
  transform: rotate(-6deg);
  box-shadow: 0 3px 10px rgba(157,50,50,.4);
  position: relative;
}
.vs-badge::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px dashed var(--gold);
  opacity: .8;
}

/* ---------- 小節標題 ---------- */
.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px 0 12px;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--ink);
}
.section-title i {
  flex: 1;
  max-width: 90px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 45%, var(--rouge) 100%);
}
.section-title i:last-child {
  background: linear-gradient(-90deg, transparent, var(--gold) 45%, var(--rouge) 100%);
}
.more-section { margin-top: 4px; }
.more-section > summary { cursor: pointer; list-style: none; min-height: 44px; }
.more-section > summary::-webkit-details-marker { display: none; }
.section-title--toggle .toggle-label::after { content: ' ▸'; display: inline-block; transition: transform .2s ease; }
.more-section[open] .section-title--toggle .toggle-label::after { transform: rotate(90deg); }
.mode-hint {
  margin: 6px 0 0;
  font-size: .72rem;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- 題庫卡 ---------- */
.bank-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.bank-card {
  appearance: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px 10px;
  font-family: var(--sans);
  background: linear-gradient(180deg, var(--paper-hi), var(--paper));
  border: 1px solid rgba(43,58,74,.18);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(39,75,99,.1);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
}
/* 圓形裁切 + mask 柔邊；內層 img 放大 1.18 裁掉素材外圈留白聚焦主體 */
.bank-icon {
  display: block;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  overflow: hidden;
  -webkit-mask-image: radial-gradient(circle, #000 58%, transparent 97%);
          mask-image: radial-gradient(circle, #000 58%, transparent 97%);
}
.bank-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.18);
}
.bank-name {
  font-weight: 700;
  font-size: .92rem;
  color: var(--ink);
  letter-spacing: .08em;
}
.bank-count {
  font-size: .74rem;
  color: var(--ink-soft);
}
.bank-card:hover { transform: translateY(-2px); }
.bank-card.is-active {
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 1px rgba(201,162,39,.3),
              0 4px 12px rgba(201,162,39,.28);
}
/* 選中卡右上角落一枚小紅印 */
.bank-card.is-active::after {
  content: "選";
  position: absolute;
  top: -8px;
  right: -6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: .72rem;
  font-weight: 700;
  color: var(--paper-hi);
  background: var(--rouge);
  border-radius: 5px;
  transform: rotate(8deg);
  box-shadow: 1px 1px 3px rgba(157,50,50,.4);
}

/* ---------- 學制切換 ---------- */
.level-select {
  display: flex;
  gap: 8px;
  margin: 4px 0 14px;
}
.level-btn {
  appearance: none;
  cursor: pointer;
  flex: 1;
  padding: 8px 6px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--kai);
  font-weight: 700;
  font-size: .98rem;
  color: var(--ink-soft);
  background: var(--paper-hi);
  border: 1.5px solid rgba(157,50,50,.3);
  border-radius: 999px;
}
.level-btn.is-active {
  color: var(--paper-hi);
  background: var(--rouge);
  border-color: var(--rouge);
}

/* ---------- 難度篩選 ---------- */
.diff-select {
  display: flex;
  gap: 8px;
  margin: 10px 0 18px;
}
.diff-btn {
  appearance: none;
  cursor: pointer;
  flex: 1;
  padding: 8px 6px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--kai);
  font-weight: 700;
  font-size: .92rem;
  color: var(--ink-soft);
  background: var(--paper-hi);
  border: 1.5px solid rgba(39,75,99,.3);
  border-radius: 999px;
}
.diff-btn.is-active {
  color: var(--paper-hi);
  background: var(--teal);
  border-color: var(--teal-deep);
}

/* ---------- 模式按鈕 ---------- */
#mode-select {
  display: grid;
  gap: 12px;
}
.mode-btn {
  appearance: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 14px 12px;
  color: var(--paper-hi);
  /* 手繪筆觸感的不規則圓角 */
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  border: 2px solid rgba(248,243,230,.4);
  box-shadow: 0 5px 14px rgba(39,75,99,.28),
              inset 0 1px 0 rgba(248,243,230,.35);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.mode-btn:active { transform: scale(.97); }
.mode-btn:hover  { filter: brightness(1.06); }
.mode-btn--practice {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 60%, var(--navy) 100%);
}
.mode-btn--battle {
  background: linear-gradient(135deg, #d96a5f 0%, var(--rouge) 55%, var(--rouge-deep) 100%);
}
.mode-name {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: .35em;
  text-indent: .35em;
  text-shadow: 0 1px 3px rgba(39,75,99,.4);
}
.mode-desc {
  font-size: .8rem;
  opacity: .88;
  letter-spacing: .06em;
}

/* ---------- 無傷模式切換 ---------- */
.nodamage-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin-top: 8px;
  font-size: .75rem;
  color: var(--ink-soft);
  cursor: pointer;
}

/* ---------- 對戰狀態列 ---------- */
#battle-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 8px;
  background: linear-gradient(180deg, rgba(248,243,230,.85), rgba(240,233,216,.6));
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 12px;
}
#battle-hud[hidden] { display: none; }
.hp-side {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.hp-side--b { flex-direction: row-reverse; text-align: right; }
.hp-avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--gold);
}
/* 逐角色校準取臉位置（rival 髮飾高、臉再往下） */
.hp-avatar--a { object-position: 50% 30%; }
.hp-avatar--b { object-position: 50% 36%; transform: scaleX(-1); }
.hp-meta { flex: 1; min-width: 0; }
.hp-name {
  display: block;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--ink-soft);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-num {
  font-family: var(--serif);
  font-size: .85rem;
  color: var(--rouge-deep);
}
.hp-track {
  position: relative;
  height: 12px;
  border-radius: 7px;
  background: rgba(43,58,74,.14);
  box-shadow: inset 0 1px 3px rgba(43,58,74,.25);
  display: flex;
}
/* 綢帶兩端鎏金結釦 */
.hp-track::before,
.hp-track::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: radial-gradient(circle at 35% 30%, var(--gold-hi), var(--gold) 60%, #8a6d14 100%);
  box-shadow: 0 1px 2px rgba(36,31,26,.35);
  z-index: 1;
}
.hp-track::before { left: -4px; }
.hp-track::after  { right: -4px; }
/* B 側血條錨定外緣，雙方皆向中央消退 */
.hp-side--b .hp-track { justify-content: flex-end; }
.hp-fill {
  height: 100%;
  border-radius: 7px;
  /* 潑墨血條：青碧 → 鎏金 → 胭脂 */
  background: linear-gradient(90deg, var(--teal) 0%, var(--gold-hi) 55%, var(--rouge) 100%);
  box-shadow: inset 0 1px 0 rgba(248,243,230,.5);
  transition: width .45s cubic-bezier(.22,1,.36,1);
}
.hp-side--b .hp-fill {
  background: linear-gradient(-90deg, var(--navy) 0%, var(--gold-hi) 55%, var(--rouge) 100%);
}
/* 血量告急（app.js 於 HP≤30 加 .is-low） */
.hp-fill.is-low { animation: hpFlash 1s ease-in-out infinite; }
@keyframes hpFlash {
  0%, 100% { filter: none; }
  50%       { filter: brightness(1.35) saturate(1.4); }
}

/* 連對數（連對 <2 時由 app.js 隱藏） */
.combo {
  flex: none;
  min-width: 64px;
  padding: 6px 4px;
  text-align: center;
  font-family: var(--serif);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .05em;
  color: var(--ink);
  background: var(--paper-hi);
  border: 1px dashed rgba(201,162,39,.6);
  border-radius: 50%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  line-height: 1.2;
}
.combo[hidden] { display: none; }
/* 對手連擊（app.js 加 .is-rival）：黛藍警示 */
.combo.is-rival {
  color: var(--paper-hi);
  background: radial-gradient(circle, #3b5b73 40%, #22384a 100%);
  border-color: rgba(59,91,115,.7);
}
/* 連對更新時的印章跳出動畫（app.js 重播 .pop） */
.combo.pop { animation: comboPop .35s ease; }
@keyframes comboPop {
  0%   { transform: scale(.4) rotate(-10deg); opacity: 0; }
  70%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
/* 連對 3 以上（app.js 加 .is-hot）：鎏金燃燒 */
.combo.is-hot {
  color: var(--rouge-deep);
  border-style: solid;
  border-color: var(--gold);
  background: radial-gradient(circle, var(--paper-hi) 40%, var(--gold-hi) 100%);
  animation: comboGlow .9s ease-in-out infinite;
}
.combo.is-hot.pop {
  animation: comboPop .35s ease, comboGlow .9s ease-in-out .35s infinite;
}
@keyframes comboGlow {
  0%, 100% { box-shadow: 0 0 4px 1px rgba(230,201,106,.5); transform: scale(1); }
  50%       { box-shadow: 0 0 16px 5px rgba(230,201,106,.85); transform: scale(1.06); }
}

/* ---------- 答題區：灑金箋 ---------- */
#quiz-area[hidden] { display: none; }
.quiz-card {
  position: relative;
  padding: 26px 16px 18px;
  border: 1px solid rgba(193,75,75,.4);
  border-radius: 10px;
  background-image:
    /* 灑金：三層錯位金點 */
    radial-gradient(circle at 18% 24%, rgba(201,162,39,.3) 0 1.6px, transparent 2.4px),
    radial-gradient(circle at 72% 58%, rgba(230,201,106,.34) 0 1.2px, transparent 2px),
    radial-gradient(circle at 44% 86%, rgba(201,162,39,.22) 0 1.8px, transparent 2.6px),
    linear-gradient(180deg, var(--paper-hi) 0%, var(--paper) 100%);
  background-size: 130px 130px, 90px 90px, 170px 170px, 100% 100%;
  box-shadow: 0 6px 18px rgba(39,75,99,.15);
}
/* 鎏金角花 */
.quiz-card::before,
.quiz-card::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--gold);
  pointer-events: none;
}
.quiz-card::before {
  top: -2px; left: -2px;
  border-right: 0; border-bottom: 0;
  border-top-left-radius: 10px;
}
.quiz-card::after {
  bottom: -2px; right: -2px;
  border-left: 0; border-top: 0;
  border-bottom-right-radius: 10px;
}

/* 徽章騎在題目卡頂端 */
.card-seal {
  position: absolute;
  top: -20px;
  left: 50%;
  width: 40px;
  height: 40px;
  transform: translateX(-50%) rotate(-6deg);
  border-radius: 50%;
  object-fit: cover;
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 96%);
          mask-image: radial-gradient(circle, #000 55%, transparent 96%);
}

/* 練習/對戰 模式偽印章 */
.mode-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .25em;
  color: var(--paper-hi);
  padding: 6px 3px 4px;
  border-radius: 4px;
  transform: rotate(3deg);
  box-shadow: 1px 1px 3px rgba(43,58,74,.3);
}
body.mode-practice .mode-tag { background: var(--teal-deep); }
body.mode-battle   .mode-tag { background: var(--rouge); }

.question-image {
  display: block;
  width: min(100%, 1015px);
  height: auto;
  margin: 0 auto 16px;
  border: 1px solid rgba(43, 58, 74, .18);
  background: #fff;
}
.question-image[hidden] { display: none; }

/* 實戰題出處標註：證明「這是真正的官方考古題」，放在題幹正上方、字級較小不搶戲 */
.question-source {
  margin: 0 0 8px;
  padding: 0 24px;
  text-align: center;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gold-text);
  letter-spacing: .02em;
}
.question-source[hidden] { display: none; }

/* 題目文字用楷體（國小課本字體，降低認字負擔） */
#question-text {
  margin: 0 0 18px;
  padding: 0 24px; /* 避開右上角模式印章 */
  white-space: pre-line; /* 實戰題保留原題選項的逐行排版 */
  font-family: var(--kai);
  font-size: clamp(1.25rem, 5vw, 1.7rem);
  font-weight: 700;
  line-height: 1.7;
  color: var(--ink);
  text-align: center;
  min-height: 2.4em;
}

/* 選項：自動編甲乙丙丁 */
#options { counter-reset: opt; display: grid; gap: 10px; }
#options button {
  counter-increment: opt;
  appearance: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: block;
  width: 100%;
  padding: 13px 14px 13px 46px;
  text-align: left;
  font-family: var(--sans);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper-hi), var(--paper));
  border: 1.5px solid rgba(43,58,74,.28);
  border-radius: 160px 12px 160px 12px / 12px 120px 12px 120px;
  box-shadow: 0 2px 6px rgba(39,75,99,.1);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
#options button::before {
  content: counter(opt, cjk-heavenly-stem);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: .82rem;
  font-weight: 800;
  color: var(--paper-hi);
  background: var(--navy);
  border-radius: 6px;
}
#options button:hover {
  transform: translateX(3px);
  border-color: var(--teal);
  box-shadow: 0 3px 10px rgba(46,143,138,.25);
}
#options button:active { transform: scale(.985); }

/* 對戰模式選項：墨玉籤（與練習灑金箋視覺分家） */
body.mode-battle #options button {
  border-color: rgba(39,75,99,.5);
  background: linear-gradient(180deg, #eef0e9, var(--paper));
}
body.mode-battle #options button::before { background: var(--rouge-deep); }

/* --- 答對：墨暈擴散 + 金光（青碧淡染保持墨染感） --- */
#options button.correct {
  border-color: var(--gold);
  background:
    linear-gradient(180deg, rgba(46,143,138,.1), rgba(46,143,138,.18)),
    linear-gradient(180deg, var(--paper-hi), var(--paper));
  animation: goldGlow .8s ease forwards;
}
#options button.correct::before { background: var(--teal-deep); }
#options button.correct::after {
  content: "";
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: radial-gradient(circle,
              rgba(46,143,138,.4) 0%,
              rgba(201,162,39,.25) 45%,
              transparent 70%);
  animation: inkBloom .8s ease forwards;
  pointer-events: none;
}
@keyframes inkBloom {
  0%   { transform: scale(.15); opacity: .95; }
  70%  { opacity: .5; }
  100% { transform: scale(1.7); opacity: 0; }
}
@keyframes goldGlow {
  0%   { box-shadow: 0 0 0 0 rgba(230,201,106,0); }
  40%  { box-shadow: 0 0 20px 5px rgba(230,201,106,.85); }
  100% { box-shadow: 0 0 8px 2px rgba(230,201,106,.4); }
}

/* --- 答錯：紅墨潑濺 + 顫抖 --- */
#options button.wrong {
  border-color: var(--rouge);
  background: linear-gradient(180deg, #f7e8e4, #f2dcd6);
  animation: inkShake .45s ease;
}
#options button.wrong::before { background: var(--rouge-deep); }
#options button.wrong::after {
  content: "";
  position: absolute;
  right: -8%;
  top: -30%;
  width: 60%;
  height: 160%;
  background:
    radial-gradient(circle at 60% 45%, rgba(193,75,75,.4) 0 22%, transparent 40%),
    radial-gradient(circle at 30% 70%, rgba(157,50,50,.3) 0 10%, transparent 24%),
    radial-gradient(circle at 78% 76%, rgba(193,75,75,.32) 0 8%, transparent 20%);
  animation: splashIn .5s ease forwards;
  pointer-events: none;
}
@keyframes splashIn {
  0%   { transform: scale(.2) rotate(-14deg); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: scale(1) rotate(0deg);   opacity: .8; }
}
@keyframes inkShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px) rotate(-.5deg); }
  45% { transform: translateX(4px)  rotate(.4deg); }
  70% { transform: translateX(-3px); }
  85% { transform: translateX(2px); }
}

/* 答錯時揭示正解（app.js 加 .reveal）：青碧淡染＋金框 */
#options button.reveal {
  border: 2px dashed var(--gold);
  background:
    linear-gradient(180deg, rgba(46,143,138,.1), rgba(46,143,138,.16)),
    linear-gradient(180deg, var(--paper-hi), var(--paper));
}
#options button.reveal::before { background: var(--teal-deep); }

/* 實戰多選題：作答前勾選中的選項（app.js 加 .is-selected，尚未送出、可再點消掉） */
#options button.is-selected {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 2px rgba(201,162,39,.4);
}

/* 實戰題揭曉全部選項時，答完後既未選也非正解的選項淡出，不搶正解／錯選的視覺焦點 */
#options button.option--muted { opacity: .55; }

/* 答題解析卡：答完題後顯示，兼作螢幕報讀機的 aria-live 播報內容 */
.answer-feedback {
  margin-top: 10px;
  padding: 10px 12px;
  font-family: var(--kai);
  font-size: .88rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper-dim);
  border: 1px solid rgba(43,58,74,.22);
  border-radius: 10px;
}

/* 練習模式手動前進：讀完解析卡再按，取代原本的自動倒數 */
.answer-next-btn {
  display: block;
  margin: 10px 0 0 auto;
  padding: 8px 20px;
  font-family: var(--kai);
  font-size: .9rem;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

/* 對戰結束的徽章 */
.result-emblem {
  display: block;
  width: 110px;
  height: 110px;
  margin: 6px auto;
  border-radius: 50%;
  object-fit: cover;
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 96%);
          mask-image: radial-gradient(circle, #000 55%, transparent 96%);
  animation: comboPop .5s ease;
}

/* ---------- 回首頁 ---------- */
.back-btn {
  appearance: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px auto 0;
  padding: 8px 22px;
  min-height: 44px;
  font-family: var(--sans);
  font-size: .88rem;
  letter-spacing: .1em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid rgba(43,58,74,.3);
  border-radius: 999px;
  transition: color .15s ease, border-color .15s ease;
}
.back-btn:hover { color: var(--rouge); border-color: var(--rouge); }

/* ---------- 桌機：卷面加寬、山水兩側露出 ---------- */
@media (min-width: 768px) {
  .scroll-frame { max-width: 840px; padding-top: 28px; }
  .scroll-paper { padding: 36px 48px 44px; }
  .brand-emblem { width: 92px; height: 92px; }
  .brand-title  { font-size: 3.4rem; }
  .fighter      { max-width: 218px; }
  .vs-stage     { gap: 24px; }
  .vs-badge     { width: 78px; height: 78px; font-size: 1.4rem; }
  .bank-grid    { gap: 16px; }
  .bank-icon    { width: 78px; height: 78px; }
  #mode-select  { grid-template-columns: 1fr 1fr; gap: 18px; }
  #options      { gap: 12px; }
  #options button { font-size: 1.16rem; padding: 15px 18px 15px 52px; }
  .hp-avatar    { width: 54px; height: 54px; }
  .hp-track     { height: 14px; }
  .combo        { min-width: 76px; font-size: .95rem; }
}

/* 窄手機：連對章出現時避免角色名被截斷 */
@media (max-width: 420px) {
  .hp-name { letter-spacing: .02em; font-size: .7rem; }
  .combo   { min-width: 56px; font-size: .76rem; }
}

/* 超寬桌機答題中：兩側立繪站上戰場（柔邊＋呼吸浮動） */
@media (min-width: 1100px) {
  body.in-quiz .side-fig {
    display: block;
    position: fixed;
    bottom: 0;
    z-index: 0;
    width: 250px;
    aspect-ratio: 2 / 3;
    background-size: cover;
    background-position: center;
    pointer-events: none;
    opacity: .92;
    -webkit-mask-image: radial-gradient(ellipse 52% 52% at 50% 48%, #000 55%, transparent 82%);
            mask-image: radial-gradient(ellipse 52% 52% at 50% 48%, #000 55%, transparent 82%);
    animation: figBob 4.5s ease-in-out infinite;
  }
  .side-fig--player {
    left: 16px;
    background-image: url("../assets/web/char-player.jpg");
  }
  .side-fig--rival {
    right: 16px;
    background-image: url("../assets/web/char-rival.jpg");
    transform: scaleX(-1);
    animation-delay: -2.2s;
  }
}
@keyframes figBob {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -10px; }
}

/* ---------- 動效減量 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* =========================================================
   八角機制層（meta）— 面板 / 事件演出 / 戰報卷軸
   ========================================================= */

/* ---------- 主畫面八角面板 ---------- */
#meta-bar {
  display: flex;
  gap: 8px;
  margin: 4px 0 12px;
}
.meta-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 6px;
  background: linear-gradient(180deg, var(--paper-hi), rgba(240,233,216,.7));
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 10px;
  font-size: .72rem;
  color: var(--ink-soft);
  text-align: center;
}
.meta-chip--pearl b {
  font-family: var(--kai);
  font-size: 1.15rem;
  color: var(--gold-text);
  text-shadow: 0 1px 0 rgba(157,50,50,.15);
}
.meta-chip__label { letter-spacing: .2em; }
.meta-chip__rank {
  font-family: var(--kai);
  font-size: 1rem;
  color: var(--rouge-deep);
}
.meta-chip__sub {
  font-size: .68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.meta-chip--profile {
  position: relative;
  font: inherit;
  cursor: pointer;
  appearance: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.meta-chip--profile:hover { transform: translateY(-1px); border-color: var(--gold); box-shadow: 0 5px 14px rgba(43,58,74,.12); }
.meta-chip--profile:focus-visible { outline: 3px solid rgba(46,143,138,.38); outline-offset: 2px; }
.meta-chip__action { margin-top: 2px; color: var(--teal-deep); font-size: .62rem; font-weight: 800; letter-spacing: .04em; }
.rank-track {
  width: 90%;
  height: 5px;
  border-radius: 3px;
  background: var(--paper-dim);
  overflow: hidden;
}
.rank-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--teal), var(--teal-deep));
  transition: width .5s ease;
}
.lantern-flame {
  width: 12px;
  height: 12px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--paper-dim);
  box-shadow: none;
}
.lantern--lit .lantern-flame {
  background: radial-gradient(circle at 50% 65%, var(--gold-hi), var(--gold) 70%);
  box-shadow: 0 0 8px rgba(230,201,106,.85);
  animation: lantern-lit 2.4s ease-in-out infinite;
}
@keyframes lantern-lit {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}
.box-btn {
  margin-top: 2px;
  padding: 2px 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-family: var(--kai);
  color: var(--paper-hi);
  background: linear-gradient(180deg, var(--rouge), var(--rouge-deep));
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.box-btn:disabled {
  background: var(--paper-dim);
  color: var(--ink-soft);
  cursor: default;
}
.oath-line, .omen-line {
  margin: 0 0 10px;
  font-size: .78rem;
  text-align: center;
  color: var(--ink-soft);
}
.oath-notice {
  font-size: .78rem;
  text-align: center;
  color: var(--rouge-deep);
  margin: 0 0 8px;
}
.oath-line {
  appearance: none;
  display: block;
  width: 100%;
  border: none;
  background: none;
  padding: 4px;
  min-height: 44px;
  font-family: var(--kai);
  color: var(--teal-deep);
  cursor: pointer;
  text-decoration: underline dotted;
}

/* ---------- 事件 toast ---------- */
#event-toasts {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.event-toast {
  max-width: 100%;
  padding: 12px 20px;
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper-hi), var(--paper));
  border: 1px solid rgba(201,162,39,.5);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(43,58,74,.25);
  animation: toast-in .3s ease both;
}
.event-toast.is-out { opacity: 0; transition: opacity .35s ease; }
@keyframes toast-in {
  from { opacity: 0; translate: 0 -8px; }
  to   { opacity: 1; translate: 0 0; }
}
.event-toast--achievement {
  font-family: var(--kai);
  color: var(--rouge-deep);
  border-color: var(--rouge);
  animation: toast-in .3s ease both, ink-stamp .45s ease .1s both;
}
.event-toast--levelup {
  font-family: var(--kai);
  color: var(--teal-deep);
  border-color: var(--teal);
}
.event-toast--milestone,
.event-toast--lantern { color: var(--gold-text); border-color: var(--gold); }
.event-toast--charm { color: var(--gold-text); }
.event-toast--forge { font-family: var(--kai); color: var(--navy); }
.event-toast--letter { font-family: var(--kai); }
@keyframes ink-stamp {
  0%   { transform: scale(1.4) rotate(-6deg); }
  60%  { transform: scale(.94) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- 題卡飄字（文氣/字珠） ---------- */
.quiz-card { position: relative; }
.meta-float {
  position: absolute;
  top: 6px;
  right: 12px;
  font-family: var(--kai);
  font-size: 1.28rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(240,233,216,.9);
  pointer-events: none;
  animation: xp-rise 2s ease both;
}
.meta-float--xp { color: var(--teal-deep); }
/* 答對得字珠：放大＋鎏金光暈＋彈跳，讓「成功那一刻」有感（正增強） */
.meta-float--pearl {
  color: var(--gold-text);
  top: 22px;
  font-size: 1.72rem;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(240,233,216,.9), 0 0 12px rgba(230,201,106,.75);
  animation: pearl-pop 2s cubic-bezier(.22,1.2,.36,1) both;
}
@keyframes pearl-pop {
  0%   { opacity: 0; transform: scale(.6) translateY(6px); }
  22%  { opacity: 1; transform: scale(1.25) translateY(0); }
  40%  { transform: scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}
@media (prefers-reduced-motion: reduce) { .meta-float--pearl { animation: xp-rise 2s ease both; } }

/* 家長通行碼盒（每日上限突破前的關卡） */
#daily-limit-pinbox { margin: 10px 0; text-align: center; }
.daily-limit-pin-hint { font-size: .82rem; color: var(--ink-soft); margin: 0 0 6px; }
.daily-limit-pin-msg { min-height: 18px; font-size: .8rem; color: #b3402f; margin-top: 4px; }
/* 排行榜暱稱隱私提示 */
.sg-classbar__hint { display: block; width: 100%; font-size: .74rem; color: var(--ink-soft); margin-top: 4px; }
/* 家長頁隱私精確說明 */
.parent-note { font-size: .9rem; line-height: 1.7; }

/* 答題頁常駐 HUD：守燈今日進度＋本回合答對 */
.quiz-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
  margin: 2px 0 10px;
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 700;
}
.quiz-hud__item {
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(201,162,39,.10);
  border: 1px solid rgba(201,162,39,.35);
  color: var(--gold-text);
  white-space: nowrap;
}
.quiz-hud__item--pet { background: rgba(46,143,138,.12); border-color: rgba(46,143,138,.4); color: var(--teal-deep); }
/* 寵物主動技能「點化」按鈕 */
.pet-skill-btn {
  padding: 3px 14px; border-radius: 999px; font-family: var(--sans); font-size: .82rem; font-weight: 700;
  border: 1px solid var(--gold); color: #2a1c05; cursor: pointer; white-space: nowrap;
  background: linear-gradient(135deg, var(--gold-hi), var(--gold)); box-shadow: 0 1px 4px rgba(201,162,39,.3);
}
.pet-skill-btn:active { transform: translateY(1px); }
.pet-skill-btn:disabled { background: rgba(201,162,39,.14); border-color: rgba(201,162,39,.3); color: var(--ink-soft); cursor: default; box-shadow: none; }
/* 被點化劃掉的錯誤選項 */
#options button.is-eliminated { opacity: .32; text-decoration: line-through; pointer-events: none; filter: grayscale(.6); }

/* 里程碑卡的守燈提示 */
.milestone-lantern { color: var(--gold-text); font-weight: 700; margin-top: 4px; }
@keyframes xp-rise {
  0%   { opacity: 0; translate: 0 6px; }
  20%  { opacity: 1; }
  100% { opacity: 0; translate: 0 -18px; }
}

/* ---------- 墨靈泡泡／排除選項 ---------- */
#battle-hud { position: relative; }
.moling-bubble {
  position: absolute;
  right: 6px;
  top: calc(100% + 4px);
  z-index: 5;
  max-width: 78%;
  padding: 6px 10px;
  font-size: .78rem;
  color: var(--ink);
  background: var(--paper-hi);
  border: 1px solid rgba(39,75,99,.4);
  border-radius: 10px 10px 2px 10px;
  box-shadow: 0 3px 10px rgba(43,58,74,.2);
  animation: toast-in .25s ease both;
}
#options button.option--eliminated {
  opacity: .7;
  filter: grayscale(.5);
  color: #7a8794;
  cursor: not-allowed;
}
#options button.option--eliminated::after {
  content: '已排除';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--serif);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--rouge);
  border: 1.5px solid var(--rouge);
  border-radius: 999px;
  padding: 2px 9px;
  background: rgba(193,75,75,.1);
}

/* ---------- 覆蓋層（誓言 / 戰報卷軸） ---------- */
.meta-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(43,58,74,.55);
}
.meta-overlay[hidden] { display: none; }
.meta-overlay__card {
  width: min(92vw, 380px);
  max-height: 84vh;
  overflow-y: auto;
  padding: 20px 18px;
  background: linear-gradient(180deg, var(--paper-hi), var(--paper));
  border: 2px solid rgba(201,162,39,.55);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(36,31,26,.45);
}
.overlay-title {
  margin: 0 0 12px;
  font-family: var(--kai);
  font-size: 1.4rem;
  text-align: center;
  color: var(--rouge-deep);
  letter-spacing: .3em;
}
#oath-story p, #story-story p {
  margin: 0 0 8px;
  font-size: .85rem;
  line-height: 1.7;
  color: var(--ink);
}
.oath-prompt {
  margin: 12px 0 8px;
  font-family: var(--kai);
  font-size: .9rem;
  color: var(--teal-deep);
}

/* 更新公告卡：版本號徽章 + 條列更新項目 */
.announce-version {
  display: block;
  width: fit-content;
  margin: 0 auto 6px;
  padding: 2px 12px;
  font-family: var(--serif);
  font-size: .8rem;
  font-weight: 800;
  color: var(--paper-hi);
  background: var(--gold);
  border-radius: 999px;
}
.announce-list {
  margin: 0 0 16px;
  padding-left: 1.3em;
  list-style: '📜 ';
}
.announce-list li {
  margin-bottom: 10px;
  font-size: .92rem;
  line-height: 1.6;
  color: var(--ink);
}
.oath-btn {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 12px;
  font-family: var(--kai);
  font-size: .92rem;
  text-align: left;
  color: var(--ink);
  background: var(--paper-hi);
  border: 1px solid rgba(46,143,138,.5);
  border-radius: 10px;
  cursor: pointer;
}
.oath-btn:active { background: var(--paper-dim); }
.overlay-ghost-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 6px auto 0;
  padding: 6px 14px;
  font-size: .78rem;
  color: var(--ink-soft);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- 雲端存檔 ---------- */
.savesync-hint { margin: 0 0 10px; font-size: .8rem; line-height: 1.6; color: var(--ink-soft); }
.savesync-code-block { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.savesync-code {
  font-family: monospace; font-size: 1.6rem; font-weight: 700; letter-spacing: .2em;
  padding: 8px 16px; border-radius: 10px; color: var(--rouge-deep);
  background: var(--paper-hi); border: 1px dashed rgba(201,162,39,.6);
}
.savesync-copy-btn { width: auto; padding: 6px 12px; font-size: .8rem; }
.savesync-btn {
  display: block; width: 100%; margin-bottom: 6px; padding: 9px 12px;
  font-family: var(--kai); font-size: .88rem; color: var(--paper-hi);
  background: var(--teal-deep); border: none; border-radius: 10px; cursor: pointer;
}
.savesync-btn:disabled { background: var(--paper-dim); color: var(--ink-soft); cursor: default; }
.savesync-status { margin: 0 0 6px; font-size: .76rem; text-align: center; color: var(--ink-soft); }
.savesync-status--warn { color: var(--rouge-deep); font-weight: 600; }
.savesync-divider { border: none; border-top: 1px dashed rgba(85,99,111,.3); margin: 12px 0; }
.savesync-pull-row { display: flex; gap: 6px; }
.savesync-input {
  flex: 1; min-width: 0; padding: 8px 10px; font-family: monospace; font-size: 1rem;
  letter-spacing: .15em; text-transform: uppercase; border-radius: 8px;
  border: 1px solid rgba(43,58,74,.3); background: var(--paper-hi); color: var(--ink);
}
.savesync-pull-row .savesync-btn { width: auto; margin-bottom: 0; flex: none; }

/* ---------- 題目回報 ---------- */
.report-btn {
  margin-left: 6px; padding: 2px 8px; font-size: .95rem; line-height: 1;
  background: none; border: 1px dashed rgba(201,162,39,.6); border-radius: 8px;
  cursor: pointer; color: var(--rouge-deep);
}
.report-note {
  width: 100%; min-height: 60px; margin-bottom: 10px; padding: 8px 10px;
  font-family: var(--kai); font-size: .9rem; color: var(--ink);
  background: var(--paper-hi); border: 1px solid rgba(43,58,74,.3);
  border-radius: 8px; resize: vertical;
}
/* ---------- 戰報卷軸 ---------- */
.scroll-unroll { animation: scroll-unroll .45s ease both; }
@keyframes scroll-unroll {
  from { opacity: 0; transform: scaleY(.4); }
  to   { opacity: 1; transform: scaleY(1); }
}
.summary-card--gold-frame {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(230,201,106,.35), 0 12px 36px rgba(36,31,26,.45);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px;
  border-bottom: 1px dashed rgba(85,99,111,.25);
  font-size: .86rem;
}
.summary-row__key {
  flex-shrink: 0;
  font-family: var(--kai);
  color: var(--ink-soft);
  letter-spacing: .15em;
}
.summary-row__val {
  color: var(--ink);
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}
.summary-moling {
  margin: 12px 0 14px;
  font-size: .82rem;
  line-height: 1.6;
  color: var(--navy);
  font-family: var(--kai);
}
.summary-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.summary-btn {
  flex: 1 1 140px;
  padding: 10px 8px;
  font-family: var(--kai);
  font-size: .9rem;
  color: var(--paper-hi);
  background: linear-gradient(180deg, var(--rouge), var(--rouge-deep));
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.summary-btn--ghost {
  color: var(--ink);
  background: var(--paper-dim);
}

/* =========================================================
   山海寵物：首頁入口 + 寵物閣 overlay
   ========================================================= */

/* ---- 進階玩法：常駐區塊（WP1：跟收合區做視覺區隔，讓對戰/收藏/交易玩法被看見） ---- */
.advanced-play {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 12px 4px;
  margin: 4px 0 12px;
  border: 1.5px solid rgba(201,162,39,.6);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(46,143,138,.10), rgba(201,162,39,.08));
}
.pet-icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

/* ---- 首頁入口卡 ---- */
.pet-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(201,162,39,.5);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(46,143,138,.12), rgba(201,162,39,.10));
  cursor: pointer;
  font-family: var(--sans);
  color: var(--ink);
}
.pet-entry:active { transform: scale(.99); }
.pet-entry--glow { animation: pet-entry-glow 2s ease-in-out infinite; }
@keyframes pet-entry-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,162,39,0); }
  50% { box-shadow: 0 0 14px 2px rgba(201,162,39,.55); }
}
.pet-entry__img {
  width: 52px; height: 52px; flex: none;
  object-fit: cover; border-radius: 50%;
  background: var(--paper-dim);
  -webkit-mask-image: radial-gradient(circle, #000 60%, transparent 98%);
          mask-image: radial-gradient(circle, #000 60%, transparent 98%);
}
.pet-entry__body { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1; }
.pet-entry__title { font-family: var(--serif); font-weight: 800; font-size: 1.1rem; letter-spacing: .1em; }
.pet-entry__sub { font-size: .82rem; color: var(--ink-soft); }
.pet-entry__arrow { font-size: 1.6rem; color: var(--gold-text); font-weight: 700; }

/* ---- overlay 卡 ---- */
.pet-card { max-width: 560px; width: 92vw; max-height: 88vh; display: flex; flex-direction: column; }
.pet-hint { margin: 2px 0 12px; font-size: .82rem; color: var(--ink-soft); line-height: 1.5; }
.pet-progress { margin: 0 0 10px; font-size: .85rem; color: var(--ink); }
.pet-progress b { color: var(--teal-deep); font-size: 1rem; }

.pet-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.pet-tab {
  flex: 1; padding: 8px 0; border: 1px solid rgba(43,58,74,.2); border-radius: 10px;
  background: var(--paper-dim); color: var(--ink-soft); font-family: var(--serif);
  font-weight: 700; letter-spacing: .1em; cursor: pointer;
}
.pet-tab.is-active { background: var(--teal-deep); color: var(--paper-hi); border-color: var(--teal-deep); }

.pet-panel { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---- 神獸格 ---- */
.pet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pet-card-item {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  padding: 8px; border: 1px solid rgba(201,162,39,.4); border-radius: 12px;
  background: var(--paper-hi); font-family: var(--sans); color: var(--ink);
}
.pet-card-item.is-active { border-color: var(--rouge); box-shadow: 0 0 0 2px rgba(193,75,75,.35); }
.pet-card-item.is-locked { opacity: .55; filter: grayscale(.6); }
.pet-card-item__main {
  display: flex; gap: 10px; align-items: center; text-align: left; width: 100%;
  border: none; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit;
}
.pet-card-item.is-locked .pet-card-item__main { cursor: default; }
.pet-card-item__img {
  width: 56px; height: 56px; flex: none; object-fit: cover; border-radius: 10px;
  background: var(--paper-dim);
}
.pet-card-item__body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.pet-card-item__name { font-family: var(--serif); font-weight: 800; font-size: .98rem; display: flex; align-items: baseline; gap: 5px; }
.pet-card-item__cat { font-size: .68rem; color: var(--teal-deep); font-weight: 700; }
.pet-card-item__status { font-size: .72rem; color: var(--ink-soft); }
.pet-track { display: block; height: 5px; border-radius: 3px; background: var(--paper-dim); overflow: hidden; }
.pet-track__fill { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); }
.pet-card-item__bond { font-size: .68rem; color: var(--teal-deep); }
.pet-card-item__badge { font-size: .7rem; color: var(--rouge-deep); font-weight: 800; }
.pet-card-item__badge--sub { color: var(--teal-deep); }
.pet-card-item__hint { font-size: .7rem; color: var(--gold-text); }
.pet-card-item__actions { display: flex; gap: 6px; }
.pet-card-item__sub-btn, .pet-card-item__bio-btn {
  flex: 1; padding: 5px 0; border: 1px solid rgba(43,58,74,.2); border-radius: 8px;
  background: var(--paper-dim); color: var(--ink); font-size: .7rem; cursor: pointer;
}
.pet-card-item__sub-btn:disabled { opacity: .5; cursor: default; }
.pet-card-item__bio {
  font-size: .74rem; color: var(--ink-soft); line-height: 1.5;
  background: var(--paper-dim); border-radius: 8px; padding: 6px 8px;
}
.pet-card-item__bio p { margin: 0 0 3px; }
.pet-card-item__bio p:last-child { margin-bottom: 0; }

/* ---- 寵物設備 ---- */
.pet-equip-balance { font-size: .84rem; color: var(--ink-soft); margin: 0 0 10px; }
.pet-equip-balance b { color: var(--gold-text); font-size: 1rem; }
.pet-equip-grid { display: flex; flex-direction: column; gap: 8px; }
.pet-equip-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid rgba(43,58,74,.16); border-radius: 10px; background: var(--paper-hi);
}
.pet-equip-item__info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pet-equip-item__info b { font-family: var(--serif); font-size: .95rem; }
.pet-equip-item__info span { font-size: .76rem; color: var(--ink-soft); }
.pet-equip-item__tier {
  font-family: var(--sans, inherit); font-size: .68rem; font-weight: 700;
  color: var(--gold-text); background: var(--gold-hi); border-radius: 6px; padding: 1px 6px; margin-left: 4px;
}
.pet-equip-btn {
  flex: none; padding: 7px 12px; border: none; border-radius: 8px;
  background: var(--teal-deep); color: var(--paper-hi); font-weight: 700; font-size: .82rem; cursor: pointer;
}
.pet-equip-btn:disabled { background: var(--paper-dim); color: var(--ink-soft); cursor: default; }
.pet-equip-btn.is-installed { background: var(--rouge-deep); }
.pet-equip-item__lv { font-size: .68rem; font-weight: 700; color: var(--teal-deep); margin-left: 4px; }
.pet-equip-item__action { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.pet-equip-upgrade-btn {
  flex: none; padding: 5px 10px; border: 1px solid rgba(43,58,74,.2); border-radius: 8px;
  background: var(--paper-dim); color: var(--ink); font-weight: 700; font-size: .7rem; cursor: pointer;
  white-space: nowrap;
}
.pet-equip-upgrade-btn:disabled { opacity: .5; cursor: default; }

@media (max-width: 360px) { .pet-grid { grid-template-columns: 1fr; } }

/* ---- 成就總覽 ---- */
.ach-card { max-width: 560px; width: 92vw; max-height: 88vh; display: flex; flex-direction: column; }
.ach-grid { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; -webkit-overflow-scrolling: touch; margin-bottom: 10px; }
.ach-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: 1px solid rgba(201,162,39,.4); border-radius: 10px;
  background: var(--paper-hi); font-family: var(--sans); color: var(--ink);
}
.ach-item.is-locked { opacity: .55; filter: grayscale(.5); }
.ach-item__icon {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%;
  font-family: var(--kai); font-weight: 800; font-size: .9rem; color: var(--paper-hi);
  background: radial-gradient(circle at 34% 30%, var(--gold-hi), var(--gold-text) 72%);
}
.ach-item.is-locked .ach-item__icon { background: radial-gradient(circle at 34% 30%, #8a8a8a, #5a5a5a 72%); }
.ach-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ach-item__name { font-family: var(--serif); font-weight: 800; font-size: .94rem; }
.ach-item__desc { font-size: .74rem; color: var(--ink-soft); }
.ach-item__track { display: block; height: 4px; border-radius: 2px; background: var(--paper-dim); overflow: hidden; margin-top: 3px; }
.ach-item__track-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); }
.ach-item__pearls { flex: none; font-size: .78rem; color: var(--gold-text); font-weight: 700; }

.pet-equip-item__icon {
  width: 46px; height: 46px; flex: none; object-fit: cover; border-radius: 8px;
  background: var(--paper-dim);
}

/* =========================================================
   自學・墨池 ＆ 積分競技（M1／M2）
   沿用宣紙／黛藍／青碧／胭脂／鎏金；行動直向優先
   ========================================================= */

/* ---- 首頁入口（自學＋競技並排） ---- */
.extra-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.extra-entry {
  display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 10px 10px; border-radius: 14px; cursor: pointer;
  font-family: var(--sans); color: var(--ink); text-decoration: none;
  border: 1px solid rgba(201,162,39,.5);
}
.extra-entry:active { transform: scale(.98); }
.extra-entry--study { background: linear-gradient(120deg, rgba(46,143,138,.16), rgba(201,162,39,.10)); }
.extra-grid--learning { align-items: stretch; margin: 10px 0 4px; }
.extra-grid--learning .extra-entry { min-width: 0; min-height: 88px; }
.extra-entry--score { background: linear-gradient(120deg, rgba(193,75,75,.14), rgba(201,162,39,.10)); }
.extra-entry--ach { background: linear-gradient(120deg, rgba(201,162,39,.18), rgba(46,143,138,.10)); grid-column: 1 / -1; }
.extra-entry--sync { background: linear-gradient(120deg, rgba(59,111,138,.16), rgba(46,143,138,.10)); grid-column: 1 / -1; }
.extra-entry__icon {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 50%; font-family: var(--kai); font-weight: 800; font-size: 1.2rem;
  color: var(--paper-hi); background: radial-gradient(circle at 34% 30%, #3b6f8a, var(--navy) 70%);
}
.extra-entry--score .extra-entry__icon { background: radial-gradient(circle at 34% 30%, #d96a5f, var(--rouge-deep) 72%); }
.extra-entry--ach .extra-entry__icon { background: radial-gradient(circle at 34% 30%, var(--gold-hi), var(--gold-text) 72%); }
.extra-entry--sync .extra-entry__icon { background: radial-gradient(circle at 34% 30%, #3b6f8a, var(--navy) 72%); }
.extra-entry__body { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.extra-entry__title { font-family: var(--serif); font-weight: 800; font-size: .98rem; letter-spacing: .06em; }
.extra-entry__sub { font-size: .68rem; color: var(--ink-soft); overflow-wrap: anywhere; }

/* ---- 共用 overlay 卡 ---- */
.ss-card, .sg-card { max-width: 460px; width: 92vw; max-height: 88vh; display: flex; flex-direction: column; }

/* ---- 遊戲選單卡 ---- */
.ss-menu, .sg-menu { display: flex; flex-direction: column; gap: 10px; }
/* 進入遊戲後選單需隱藏：flex 顯示會蓋過 hidden 屬性，補回 */
.ss-menu[hidden], .sg-menu[hidden], .ss-game[hidden], .sg-play[hidden] { display: none; }
.ss-menu-card, .sg-menu-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  column-gap: 12px; align-items: center; text-align: left;
  padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: var(--paper-hi); border: 1px solid rgba(201,162,39,.45); color: var(--ink);
}
.ss-menu-card:active, .sg-menu-card:active { background: var(--paper-dim); }
.ss-menu-card__icon, .sg-menu-card__icon { grid-row: 1 / 3; font-size: 1.8rem; }
.ss-menu-card__name, .sg-menu-card__name { font-family: var(--serif); font-weight: 800; font-size: 1.05rem; letter-spacing: .08em; }
.ss-menu-card__desc, .sg-menu-card__desc { font-size: .76rem; color: var(--ink-soft); line-height: 1.4; }

/* ---- 遊戲上方工具列 ---- */
.ss-game__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.ss-barbtn {
  padding: 6px 12px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer; font-family: var(--kai);
  font-size: .84rem; color: var(--ink); background: var(--paper-dim); border: 1px solid rgba(43,58,74,.2);
}
.ss-status, .sg-score__round { font-family: var(--kai); font-size: .86rem; color: var(--teal-deep); letter-spacing: .06em; }
.ss-foot { margin-top: 12px; min-height: 8px; }

/* ---- 勝利／再來 ---- */
.ss-win { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; }
.ss-win b { font-family: var(--kai); font-size: 1.1rem; color: var(--rouge-deep); letter-spacing: .1em; }
.ss-win span { font-size: .82rem; color: var(--ink-soft); }
.ss-again {
  margin-top: 6px; padding: 9px 22px; border: none; border-radius: 10px; cursor: pointer;
  font-family: var(--kai); font-size: .92rem; color: var(--paper-hi);
  background: linear-gradient(180deg, var(--teal), var(--teal-deep));
}

/* ---- 記憶配對牌 ---- */
.ss-board--memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mem-card {
  position: relative; aspect-ratio: 3 / 4; border: none; padding: 0; cursor: pointer;
  background: none; perspective: 600px;
}
.mem-card__back, .mem-card__face {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 10px;
  backface-visibility: hidden; transition: transform .35s ease;
  font-family: var(--kai); font-weight: 700;
}
.mem-card__back {
  color: var(--gold-hi); font-size: 1.3rem; letter-spacing: .1em;
  background: radial-gradient(circle at 35% 28%, #3b5b73, #22384a 100%);
  border: 1px solid rgba(201,162,39,.5);
}
.mem-card__face {
  transform: rotateY(180deg); color: var(--ink); font-size: 1.25rem;
  background: linear-gradient(180deg, var(--paper-hi), var(--paper-dim));
  border: 1px solid rgba(46,143,138,.5);
}
.mem-card.is-flipped .mem-card__back { transform: rotateY(180deg); }
.mem-card.is-flipped .mem-card__face { transform: rotateY(360deg); }
.mem-card.is-matched { opacity: 0; transition: opacity .4s ease .1s; pointer-events: none; }

/* ---- 連連看 ---- */
.ss-board--link { display: grid; grid-template-columns: repeat(var(--link-cols, 4), 1fr); gap: 6px; }
.link-tile {
  aspect-ratio: 1; display: grid; place-items: center; cursor: pointer;
  font-family: var(--kai); font-weight: 700; font-size: 1.15rem; color: var(--ink);
  background: linear-gradient(180deg, var(--paper-hi), #efe6cf);
  border: 1px solid rgba(201,162,39,.5); border-radius: 8px;
}
.link-tile.is-zhuyin { color: var(--teal-deep); font-size: .95rem; }
.link-tile.is-sel { border-color: var(--rouge); box-shadow: 0 0 0 2px rgba(193,75,75,.4); transform: scale(.95); }
.link-tile.is-empty { background: none; border: 1px dashed rgba(85,99,111,.18); }

/* ---- 閃卡 ---- */
.ss-board--flash { display: block; }
.flash-card {
  width: 100%; min-height: 180px; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; text-align: center; cursor: pointer;
  padding: 20px 16px; border-radius: 14px; color: var(--ink);
  background: linear-gradient(180deg, var(--paper-hi), var(--paper-dim));
  border: 1px solid rgba(201,162,39,.5); transition: transform .12s ease;
}
.flash-card:active { transform: scale(.99); }
.flash-card.is-flipped { border-color: var(--teal); background: linear-gradient(180deg, #eef4f2, #e2ece8); }
.flash-card__tag {
  font-family: var(--kai); font-size: .74rem; letter-spacing: .3em; color: var(--ink-soft);
  border: 1px solid rgba(85,99,111,.3); border-radius: 20px; padding: 2px 12px;
}
.flash-card__tag--a { color: var(--teal-deep); border-color: rgba(46,143,138,.5); }
.flash-card__q { font-size: .98rem; line-height: 1.7; }
.flash-card__a { font-family: var(--serif); font-weight: 800; font-size: 1.6rem; letter-spacing: .06em; color: var(--rouge-deep); }
.flash-card__note { font-size: .74rem; color: var(--ink-soft); line-height: 1.5; }
.flash-card__hint { font-size: .72rem; color: var(--ink-soft); }
.flash-rate { display: flex; gap: 10px; justify-content: center; margin-top: 4px; }
.flash-rate__hint { font-size: .76rem; color: var(--ink-soft); }
.flash-rate__btn {
  flex: 1; max-width: 160px; padding: 11px 0; border: none; border-radius: 10px; cursor: pointer;
  font-family: var(--kai); font-size: .95rem; color: var(--paper-hi);
}
.flash-rate__btn--no { background: linear-gradient(180deg, #8895a0, var(--ink-soft)); }
.flash-rate__btn--yes { background: linear-gradient(180deg, var(--teal), var(--teal-deep)); }

/* =========================================================
   積分競技
   ========================================================= */
.sg-hud { display: flex; gap: 8px; margin-bottom: 8px; }
.sg-score {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 6px; border-radius: 12px; background: var(--paper-hi);
  border: 1px solid rgba(201,162,39,.4);
}
.sg-score.is-active { border-color: var(--rouge); box-shadow: 0 0 0 2px rgba(193,75,75,.3); }
.sg-score__name { font-family: var(--kai); font-size: .82rem; color: var(--ink-soft); letter-spacing: .1em; }
.sg-score__val { font-family: var(--serif); font-weight: 800; font-size: 1.6rem; color: var(--navy); line-height: 1.1; }
.sg-score__tier { font-size: .72rem; color: var(--gold-text); font-family: var(--kai); letter-spacing: .1em; }
.sg-score__combo {
  position: absolute; top: -8px; right: -4px; font-size: .68rem; color: var(--paper-hi);
  background: var(--rouge); border-radius: 20px; padding: 1px 7px; font-family: var(--kai);
}
.sg-ctrl { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; min-height: 34px; }
.sg-ctrl-btn {
  padding: 7px 16px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 20px; cursor: pointer;
  font-family: var(--kai); font-size: .84rem; color: var(--paper-hi); letter-spacing: .06em;
}
.sg-ctrl-btn--up { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: #4a3a08; }
.sg-ctrl-btn--ins { background: linear-gradient(180deg, #6f9c93, var(--teal-deep)); }
.sg-ctrl-btn:disabled { opacity: .4; cursor: default; }

.sg-quiz { min-height: 120px; }
.sg-question {
  margin: 0 0 12px; font-size: 1rem; line-height: 1.7; color: var(--ink);
  font-family: var(--serif); text-align: center;
}
.sg-options { display: grid; gap: 8px; }
.sg-opt {
  padding: 12px 10px; border-radius: 10px; cursor: pointer; font-size: 1rem; color: var(--ink);
  background: var(--paper-hi); border: 1px solid rgba(46,143,138,.5); font-family: var(--serif);
}
.sg-opt:active { background: var(--paper-dim); }
.sg-opt .opt-num { font-weight: 700; color: var(--teal-deep); margin-right: 2px; }
.sg-opt.is-correct { background: linear-gradient(180deg, #d8efe0, #bfe6cf); border-color: var(--teal); color: var(--teal-deep); font-weight: 700; }
.sg-opt.is-wrong { background: #f2dcd6; border-color: var(--rouge); color: var(--rouge-deep); }

.sg-turn { position: relative; min-height: 22px; text-align: center; font-family: var(--kai); font-size: .9rem; color: var(--rouge-deep); margin-top: 8px; }
.sg-float {
  display: inline-block; margin: 0 4px; font-family: var(--kai); font-weight: 700; font-size: .95rem;
  animation: sg-float-up 1.1s ease both;
}
.sg-float--gain, .sg-float--up { color: var(--teal-deep); }
.sg-float--pen { color: var(--rouge); }
.sg-float--ins { color: var(--gold-text); }
.sg-float--reveal { color: var(--ink-soft); font-weight: 400; }
@keyframes sg-float-up {
  from { opacity: 0; transform: translateY(6px); }
  30%  { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

.sg-result { display: flex; flex-direction: column; gap: 8px; padding: 6px 2px; }
.sg-result__row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline;
  padding: 8px 10px; border-radius: 10px; background: var(--paper-hi); border: 1px solid rgba(201,162,39,.35);
}
.sg-result__name { font-family: var(--kai); font-weight: 700; color: var(--ink); }
.sg-result__score { font-family: var(--serif); font-weight: 800; color: var(--navy); }
.sg-result__meta { grid-column: 1 / -1; font-size: .74rem; color: var(--ink-soft); }
.sg-result__best { text-align: center; font-size: .82rem; color: var(--gold-text); font-family: var(--kai); margin-top: 2px; }
.sg-result__sharefallback {
  width: 100%; min-height: 64px; margin-top: 6px; padding: 8px; box-sizing: border-box;
  font-family: var(--sans); font-size: .82rem; color: var(--ink);
  border: 1px solid rgba(201,162,39,.5); border-radius: 8px; background: var(--paper);
}

/* ---------- M3 班級共享排行榜 ---------- */
.sg-classbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 12px; margin-bottom: 10px;
  border-radius: 10px; background: var(--paper-hi);
  border: 1px solid rgba(46,143,138,.35);
}
.sg-classbar__info { font-size: .92rem; color: var(--ink); }
.sg-classbar__info b { font-family: var(--serif); color: var(--teal-deep); }
.sg-classbar__btn {
  appearance: none; cursor: pointer; font-family: var(--kai); font-weight: 700;
  font-size: .86rem; padding: 6px 14px; border-radius: 999px;
  color: var(--paper-hi); background: var(--teal); border: 1px solid var(--teal-deep);
}
.sg-classbar__btn:active { transform: translateY(1px); }
.sg-classbar__btn--ghost {
  color: var(--teal-deep); background: transparent; padding: 6px 10px;
}
.sg-classbar__in {
  font-family: var(--sans); font-size: .9rem; padding: 6px 10px;
  border-radius: 8px; border: 1px solid rgba(39,75,99,.4); background: var(--paper);
  color: var(--ink); min-width: 0; flex: 1 1 96px;
}
.sg-classbar__err { flex-basis: 100%; font-size: .8rem; color: var(--rouge-deep); }
.sg-classbar__hide {
  display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-soft);
  flex-basis: 100%; cursor: pointer;
}

.sg-lb__self {
  text-align: center; font-family: var(--kai); font-weight: 700; font-size: 1rem;
  color: var(--teal-deep); padding: 14px 0;
}

.sg-lb {
  padding: 12px; border-radius: 12px; background: var(--paper-hi);
  border: 1px solid rgba(201,162,39,.4);
}
.sg-lb__title {
  font-family: var(--kai); font-weight: 800; font-size: 1.1rem;
  color: var(--navy); text-align: center; margin-bottom: 10px;
}
.sg-lb__load { text-align: center; color: var(--ink-soft); font-size: .9rem; padding: 12px 0; }
.sg-lb__list { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.sg-lb__row {
  counter-increment: rank;
  display: grid; grid-template-columns: 2.2em 1fr auto auto; gap: 8px; align-items: baseline;
  padding: 8px 10px; border-radius: 8px;
}
.sg-lb__row:nth-child(odd) { background: rgba(46,143,138,.06); }
.sg-lb__row::before {
  content: counter(rank); font-family: var(--serif); font-weight: 800;
  color: var(--gold-text); text-align: center;
}
.sg-lb__row:nth-child(1)::before { color: var(--rouge); }
.sg-lb__name { font-family: var(--kai); font-weight: 700; color: var(--ink); }
.sg-lb__score { font-family: var(--serif); font-weight: 800; color: var(--navy); }
.sg-lb__cheer {
  appearance: none; cursor: pointer; border: none; background: transparent;
  font-size: .84rem; color: var(--ink-soft); padding: 2px 6px; border-radius: 999px;
}
.sg-lb__cheer:active { transform: translateY(1px); }

/* ---------- 字珠寶殿（收藏總覽） ---------- */
.extra-entry--pearls { background: linear-gradient(120deg, rgba(160,82,45,.14), rgba(201,162,39,.12)); }
.extra-entry--pearls .extra-entry__icon { background: radial-gradient(circle at 30% 30%, #f5e6c8, #c9a227); }
.pearls-card { max-width: 560px; }
.pearls-stats {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 0 14px; padding: 10px 12px;
  background: rgba(46,143,138,.06); border-radius: 12px;
}
.pearls-stat-row {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center;
}
.pearls-stat-label {
  font-family: var(--kai); font-weight: 700; font-size: .85rem; color: var(--ink);
}
.pearls-stat-nums {
  font-family: var(--kai); font-size: .78rem; color: var(--ink-soft);
  grid-column: 2; text-align: right;
}
.pearls-stat-bar {
  grid-column: 1 / -1; display: block; height: 6px; border-radius: 999px;
  background: rgba(0,0,0,.08); overflow: hidden;
}
.pearls-stat-bar__fill {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #2e8f8a, #c9a227);
}
.pearls-counts {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  margin: 0 0 12px;
}
.pearls-count {
  font-size: .8rem; padding: 3px 10px; border-radius: 999px;
  font-family: var(--kai); color: var(--ink);
  background: rgba(46,143,138,.08);
}
.pearls-count--g0 { background: rgba(120,120,120,.12); }
.pearls-count--g1 { background: rgba(46,143,138,.16); }
.pearls-count--g2 { background: rgba(201,162,39,.22); }
.pearls-count--g3 { background: rgba(40,40,40,.16); }
.pearls-count--dusty { background: rgba(110,90,60,.14); color: var(--ink-soft); }
.pearls-grid {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  max-height: 46vh; overflow-y: auto; padding: 4px;
}
.pearl-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.4em; padding: 6px 10px; border-radius: 999px;
  font-family: var(--kai); font-weight: 700; font-size: 1rem; color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.6), 0 1px 3px rgba(0,0,0,.12);
}
.pearl-chip--g0 { background: radial-gradient(circle at 30% 30%, #ffffff, #dcdcd4); }
.pearl-chip--g1 { background: radial-gradient(circle at 30% 30%, #d8f3f1, #7ec8c3); }
.pearl-chip--g2 { background: radial-gradient(circle at 30% 30%, #fdf3d0, #dcb84a); }
.pearl-chip--g3 { background: radial-gradient(circle at 30% 30%, #6b6b6b, #2c2c2c); color: #f5efe2; }
.pearl-chip.is-dusty { opacity: .55; filter: grayscale(.5); }
.pearls-empty { text-align: center; color: var(--ink-soft); font-size: .9rem; }

/* ---------- 自訂誓言＋寵物暱稱輸入列 ---------- */
.oath-custom, .pet-nickname-row {
  display: flex; gap: 8px; align-items: center;
  margin: 8px 0;
}
.oath-custom input, .pet-nickname-row input {
  flex: 1; min-width: 0;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(46,143,138,.35);
  background: rgba(255,255,255,.7);
  font-family: var(--kai); font-size: .95rem; color: var(--ink);
}
.oath-btn--custom { flex: none; white-space: nowrap; }
.pet-nickname-row .pet-equip-btn { flex: none; white-space: nowrap; }

/* ---------- 修行小抄（術語解說） ---------- */
.terms-help {
  appearance: none; cursor: pointer;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(46,143,138,.4);
  background: rgba(255,255,255,.6);
  color: var(--teal-deep); font-weight: 700; font-size: .85rem;
  align-self: center; flex: none;
}
.terms-help:active { transform: translateY(1px); }
.terms-list { margin: 0 0 12px; }
.terms-list dt {
  font-family: var(--kai); font-weight: 800; color: var(--teal-deep);
  margin-top: 10px;
}
.terms-list dd { margin: 2px 0 0; color: var(--ink); font-size: .92rem; line-height: 1.6; }

/* ---------- 今日天機籤形徽章 ---------- */
.omen-line {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  width: fit-content; max-width: 100%;
  margin-left: auto; margin-right: auto;
  background: rgba(46,143,138,.08);
  border: 1px dashed rgba(46,143,138,.35);
}
.omen-glyph {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 26px; height: 26px; border-radius: 50%;
  font-family: var(--kai); font-weight: 800; font-size: .9rem; color: #fff;
  background: var(--teal-deep);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  animation: omen-breathe 2.6s ease-in-out infinite;
}
@keyframes omen-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
@media (prefers-reduced-motion: reduce) { .omen-glyph { animation: none; } }
.omen-body { display: inline-flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; text-align: left; }
.omen-name { font-family: var(--kai); color: var(--ink); font-size: .82rem; }
.omen-desc { color: var(--ink-soft); font-size: .78rem; }
.omen-line--moyu .omen-glyph    { background: #4a6b8a; }
.omen-line--zhufeng .omen-glyph { background: #c9a227; }
.omen-line--linggan .omen-glyph { background: #7b5ea7; }
.omen-line--jingxin .omen-glyph { background: #2e8f8a; }
.omen-line--mingmu .omen-glyph  { background: #b0563a; }
.omen-line--lianxin .omen-glyph { background: #c05a78; }
.omen-line--wenqu .omen-glyph   { background: #3b6f8a; }

/* ───────── 字靈書院 ───────── */
#shuyuan-overlay { padding: 12px; overscroll-behavior: contain; }
.shuyuan-card {
  width: min(94vw, 720px); max-width: 720px; max-height: calc(100dvh - 24px);
  padding: 14px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
}
.shuyuan-head {
  position: sticky; top: -14px; z-index: 12;
  display: grid; grid-template-columns: 1fr auto 44px; align-items: center; gap: 10px;
  margin: -2px -2px 10px; padding: 8px 2px 7px;
  background: linear-gradient(180deg, rgba(248,243,230,.98) 82%, rgba(248,243,230,.86));
}
.shuyuan-head .overlay-title { margin: 0; text-align: left; font-size: 1.35rem; letter-spacing: .22em; }
.shuyuan-kicker { display: block; margin-bottom: 1px; font: 700 .65rem var(--sans); color: var(--gold-text); letter-spacing: .16em; }
.shuyuan-rank {
  padding: 5px 9px; border: 1px solid rgba(201,162,39,.45); border-radius: 999px;
  background: rgba(201,162,39,.1); color: var(--ink); font: 700 .72rem var(--serif); white-space: nowrap;
}
.shuyuan-icon-btn {
  width: 44px; height: 44px; border: 1px solid rgba(43,58,74,.2); border-radius: 50%;
  background: rgba(255,255,255,.62); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.shuyuan-scene {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  border: 1px solid rgba(125,92,15,.32); border-radius: 14px; overflow: hidden;
  background: #ded4bd; box-shadow: inset 0 0 0 3px rgba(248,243,230,.55), 0 8px 20px rgba(43,58,74,.16);
}
.sy-map-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; }
.sy-landmark {
  position: absolute; z-index: 3; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 76px; min-height: 44px; padding: 5px 8px; border: 1px solid rgba(230,201,106,.72); border-radius: 8px;
  color: #fff8de; background: rgba(32,38,38,.82); box-shadow: 0 3px 10px rgba(20,20,18,.3), inset 0 1px rgba(255,255,255,.12);
  font-family: var(--serif); cursor: pointer; backdrop-filter: blur(2px);
}
.sy-landmark::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 9px; height: 9px; transform: translateX(-50%) rotate(45deg); background: inherit; border-right: inherit; border-bottom: inherit; }
.sy-landmark--xing { left: 50%; top: 34%; }
.sy-landmark--yin { left: 18%; top: 54%; }
.sy-landmark--chengyu { left: 82%; top: 54%; }
.sy-landmark--gate { left: 50%; top: 83%; }
.sy-landmark__name { position: relative; z-index: 1; font-weight: 900; font-size: clamp(.72rem, 2vw, .9rem); letter-spacing: .08em; white-space: nowrap; }
.sy-landmark__progress { position: relative; z-index: 1; margin-top: 1px; font: 600 clamp(.55rem, 1.5vw, .68rem) var(--sans); color: #e8d99f; white-space: nowrap; }
.sy-couplet {
  position: absolute; z-index: 3; writing-mode: vertical-rl; letter-spacing: .2em;
  background: #a33b2e; color: #f7ecd0; padding: .5em .15em; border-radius: 3px; font-size: .78rem;
}
.sy-couplet--up { left: 38%; bottom: 7%; }
.sy-couplet--down { right: 38%; bottom: 7%; }
.sy-decor {
  position: absolute; width: clamp(34px, 8%, 50px); aspect-ratio: 1;
  transform: translate(-50%, -50%); cursor: grab; z-index: 4; touch-action: none;
}
.sy-decor__art { position: absolute; inset: 15%; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); pointer-events: none; }
.sy-decor--path .sy-decor__art { inset: 30% 8%; border: 2px solid #8b806b; border-radius: 50%; background: #d8cfb9; }
.sy-decor--lantern .sy-decor__art { inset: 12% 24%; border: 2px solid #773327; border-radius: 45%; background: #bd5141; box-shadow: inset 0 0 0 3px rgba(230,201,106,.42); }
.sy-decor--koi .sy-decor__art { inset: 16%; border: 3px solid #5b7f79; border-radius: 50%; background: radial-gradient(circle at 60% 42%, #d98a43 0 14%, #79b3ad 16% 56%, #d9c998 58%); }
.sy-decor--statue .sy-decor__art { inset: 12% 20%; background: linear-gradient(145deg,#4d5b5b,#1f2c31); clip-path: polygon(50% 0,70% 23%,88% 32%,76% 55%,91% 100%,9% 100%,24% 55%,12% 32%,30% 23%); }
.sy-decor[data-style="1"] .sy-decor__art { filter: sepia(.35) saturate(1.2) drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.sy-decor[data-style="2"] .sy-decor__art { filter: hue-rotate(25deg) saturate(1.25) drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.sy-decor.is-dragging { cursor: grabbing; z-index: 9; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35)); }
.sy-learning-seals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 9px; }
.sy-learning-seal { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 5px; min-width: 0; padding: 6px 8px; border: 1px solid rgba(125,92,15,.25); border-radius: 9px; background: rgba(255,255,255,.55); }
.sy-learning-seal i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--rouge-deep); color: #fff4d2; font: 800 .78rem var(--kai); font-style: normal; }
.sy-learning-seal span { overflow: hidden; color: var(--ink-soft); font-size: .66rem; white-space: nowrap; text-overflow: ellipsis; }
.sy-learning-seal b { color: var(--gold-text); font-size: 1rem; }
.shuyuan-hint { margin: 7px 0 5px; color: #6b5b44; font-size: .75rem; text-align: center; }
.shuyuan-hint::before { content: "ⓘ "; color: var(--teal-deep); font-weight: 900; }
.shuyuan-toolbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shuyuan-toolbar .overlay-ghost-btn { min-height: 44px; margin: 0; }
.sy-style-opt { display: inline-flex; flex-direction: column; align-items: center; gap: .3em; margin: .3em; padding: .5em; border: 2px solid transparent; border-radius: 8px; background: #efe8d8; cursor: pointer; width: 7em; }
.sy-style-opt .sy-decor { position: relative; left: auto !important; top: auto !important; width: 4em; transform: none; cursor: pointer; }
.sy-style-opt.is-active { border-color: #a33b2e; }
.sy-char-bank { display: grid; grid-template-columns: repeat(8, 1fr); gap: .35em; margin: .5em 0; }
.sy-char { font-size: 1.15rem; padding: .4em 0; border: 1px solid #c9b98f; border-radius: 6px; background: #f7f1e2; cursor: pointer; }
.sy-preview b { letter-spacing: .2em; }
.sy-couplet-list { display: flex; flex-direction: column; gap: .35em; }
.sy-couplet-opt { text-align: left; padding: .45em .6em; border: 1px solid #c9b98f; border-radius: 6px; background: #f7f1e2; cursor: pointer; }
.sy-sub { margin: .8em 0 .3em; font-size: .95rem; }
.shuyuan-card.is-wall .shuyuan-scene { min-height: 300px; aspect-ratio: auto; overflow-y: auto; background: rgba(255,255,255,.44); }
.shuyuan-card.is-wall .sy-learning-seals { display: none; }

@media (max-width: 600px) {
  #shuyuan-overlay { align-items: stretch; padding: 0; }
  .shuyuan-card {
    width: 100%; max-width: none; height: 100dvh; max-height: 100dvh;
    padding: max(10px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom));
    border: 0; border-radius: 0; box-shadow: none;
  }
  .shuyuan-head { top: calc(-1 * max(10px, env(safe-area-inset-top))); margin: 0 0 8px; padding-top: 3px; }
  .shuyuan-head .overlay-title { font-size: 1.2rem; }
  .shuyuan-kicker { font-size: .58rem; }
  .shuyuan-rank { padding-inline: 7px; font-size: .65rem; }
  .shuyuan-scene { flex: none; }
  .sy-landmark { min-width: 70px; padding: 4px 6px; }
  .sy-landmark--xing { top: 35%; }
  .sy-landmark--yin, .sy-landmark--chengyu { top: 55%; }
  .sy-learning-seals { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .sy-learning-seal { padding-block: 4px; }
  .shuyuan-toolbar { position: sticky; bottom: calc(-1 * max(10px, env(safe-area-inset-bottom))); z-index: 12; padding: 6px 0 max(3px, env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(248,243,230,.98) 82%, rgba(248,243,230,.86)); }
}

.sy-epic { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(20, 12, 6, .6); animation: syFade .3s ease; }
.sy-epic-card { background: #f7f1e2; border: 2px solid #b49b5a; border-radius: 14px; padding: 1.4em 1.8em; text-align: center; max-width: 22em; animation: syPop .45s cubic-bezier(.2, 1.4, .4, 1); }
.sy-epic-icon { font-size: 3rem; animation: syGlow 1.6s ease infinite alternate; }
.sy-epic-card h3 { margin: .4em 0; letter-spacing: .1em; }
.sy-epic-card button { margin: .6em .3em 0; }
@keyframes syFade { from { opacity: 0; } }
@keyframes syPop { from { transform: scale(.6); opacity: 0; } }
@keyframes syGlow { from { filter: drop-shadow(0 0 2px #d8b45a); } to { filter: drop-shadow(0 0 14px #d8b45a); } }
.sy-wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11em, 1fr)); gap: .5em; padding: .5em; }
.sy-wall-item { display: flex; flex-direction: column; gap: .15em; background: #efe8d8; border: 1px solid #c9b98f; border-radius: 8px; padding: .55em .7em; font-size: .82rem; }
.sy-wall-item i { color: #8a7a5e; font-style: normal; font-size: .72rem; }

/* 即時對戰：房號大字 */
.rt-code { font-size: 3rem; letter-spacing: .3em; text-align: center; font-weight: 700; margin: .5em 0; }

/* =========================================================
   神獸融合坊：overlay + 融合分頁 + 稚靈收藏分頁
   ========================================================= */

.fusion-panel { max-width: 560px; width: 92vw; max-height: 88vh; display: flex; flex-direction: column; }
.fusion-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.fusion-head .overlay-title { margin: 0; }
.fusion-crystals { font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }
.fusion-crystals b { color: var(--gold-text); font-size: 1rem; }

.fusion-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.fusion-tab {
  flex: 1; padding: 8px 0; border: 1px solid rgba(43,58,74,.2); border-radius: 10px;
  background: var(--paper-dim); color: var(--ink-soft); font-family: var(--serif);
  font-weight: 700; letter-spacing: .1em; cursor: pointer;
}
.fusion-tab.is-active { background: var(--teal-deep); color: var(--paper-hi); border-color: var(--teal-deep); }
.fusion-panel-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---- 融合分頁：類別卡 ---- */
.fusion-cat-card {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px;
  padding: 10px; border: 1px solid rgba(201,162,39,.4); border-radius: 12px;
  background: var(--paper-hi); font-family: var(--sans); color: var(--ink);
}
.fusion-cat-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--serif); }
.fusion-elig { font-size: .74rem; color: var(--ink-soft); }
.fusion-cat-card__recipe { display: flex; align-items: center; gap: 10px; }
.fusion-recipe-img {
  width: 48px; height: 48px; flex: none; border-radius: 10px; object-fit: cover;
  background: var(--ink);
}
.fusion-recipe-img.is-silhouette, .is-silhouette { filter: brightness(0) opacity(.75); }
.fusion-recipe-unknown { font-family: var(--serif); font-weight: 800; color: var(--ink-soft); }
.fusion-recipe-known { font-size: .84rem; color: var(--teal-deep); }
.fusion-reveal-btn, .fusion-start-btn, .fusion-cancel-btn, .fusion-cub-card__btn {
  padding: 7px 10px; border-radius: 8px; font-size: .78rem; cursor: pointer;
  border: 1px solid rgba(43,58,74,.2); background: var(--paper-dim); color: var(--ink);
}
.fusion-start-btn { background: var(--teal-deep); color: var(--paper-hi); border-color: var(--teal-deep); }
.fusion-start-btn:disabled { background: var(--paper-dim); color: var(--ink-soft); cursor: default; }
.fusion-reveal-btn:disabled { opacity: .6; cursor: default; }

.fusion-pet-picker { display: flex; flex-direction: column; gap: 8px; }
.fusion-pet-picker__list { display: flex; flex-wrap: wrap; gap: 6px; }
.fusion-pet-picker__btn {
  padding: 6px 10px; border-radius: 8px; font-size: .78rem; cursor: pointer;
  border: 1px solid rgba(43,58,74,.2); background: var(--paper-dim); color: var(--ink);
}
.fusion-pet-picker__btn.is-picked { background: var(--rouge); color: var(--paper-hi); border-color: var(--rouge); }

.fusion-confirm p { margin: 0 0 8px; font-size: .84rem; color: var(--ink-soft); }

.fusion-result {
  margin-bottom: 12px; padding: 10px; border-radius: 10px;
  background: var(--paper-dim); font-size: .84rem; color: var(--ink);
}
.fusion-result__born { font-style: italic; color: var(--teal-deep); margin: 0 0 6px; }
.fusion-result__title { font-family: var(--serif); font-weight: 800; margin: 0; }
.fusion-result__line { margin: 0 0 6px; color: var(--ink-soft); }
.fusion-result__pearls { margin: 0 0 8px; color: var(--gold-text); font-weight: 700; }

.fusion-passive-picker { display: flex; flex-direction: column; gap: 8px; }
.fusion-passive-picker__hint { font-size: .84rem; color: var(--ink-soft); margin: 0; }
.fusion-passive-btn {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(201,162,39,.4); background: var(--paper-hi); color: var(--ink);
}
.fusion-passive-btn span { font-size: .78rem; color: var(--ink-soft); }

.fusion-nickname-panel { display: flex; flex-direction: column; gap: 8px; }
.fusion-nickname-input {
  padding: 8px 10px; border-radius: 8px; font-size: .9rem;
  border: 1px solid rgba(43,58,74,.3); background: var(--paper-hi); color: var(--ink);
}
.fusion-card-panel { display: flex; flex-direction: column; gap: 8px; }
#fusion-card-canvas { width: 100%; max-width: 320px; margin: 0 auto; border-radius: 10px; }

.fusion-riddle-panel { display: flex; flex-direction: column; gap: 8px; }
.fusion-riddle-panel__q { font-size: .88rem; color: var(--ink); margin: 0; }
.fusion-riddle-panel__opt {
  padding: 8px 10px; border-radius: 8px; font-size: .84rem; text-align: left; cursor: pointer;
  border: 1px solid rgba(43,58,74,.2); background: var(--paper-dim); color: var(--ink);
}
.fusion-riddle-panel__correct { color: var(--teal-deep); font-weight: 700; }
.fusion-riddle-panel__wrong { color: var(--ink-soft); }

/* ---- 稚靈收藏分頁 ---- */
.fusion-cubs-empty { font-size: .84rem; color: var(--ink-soft); text-align: center; padding: 20px 0; }
.fusion-cub-card {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  padding: 8px; border: 1px solid rgba(201,162,39,.4); border-radius: 12px;
  background: var(--paper-hi); color: var(--ink);
}
.fusion-cub-card.is-active { border-color: var(--rouge); box-shadow: 0 0 0 2px rgba(193,75,75,.35); }
.fusion-cub-card__img { width: 52px; height: 52px; flex: none; object-fit: cover; border-radius: 10px; background: var(--paper-dim); }
.fusion-cub-card__body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.fusion-cub-card__name { font-family: var(--serif); font-weight: 800; font-size: .9rem; display: flex; align-items: baseline; gap: 5px; }
.fusion-cub-card__cat { font-size: .68rem; color: var(--teal-deep); font-weight: 700; }
.fusion-cub-card__title { font-size: .72rem; color: var(--ink-soft); }
.fusion-cub-card__badge { font-size: .68rem; color: var(--rouge-deep); font-weight: 800; }
.fusion-cub-card__actions { display: flex; flex-direction: column; gap: 4px; flex: none; }

/* ---------- 翰墨集市 ---------- */
.extra-entry--market { background: linear-gradient(120deg, rgba(193,75,75,.14), rgba(201,162,39,.12)); }
.extra-entry--market .extra-entry__icon { background: radial-gradient(circle at 30% 30%, #ffe6b8, #c9a227); }
.mkt-card-wrap { max-width: 560px; }
.mkt-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: center;
  margin: 0 0 10px;
}
.mkt-badge {
  font-family: var(--kai); font-size: .82rem; font-weight: 700; padding: 4px 12px; border-radius: 999px;
}
.mkt-open { background: rgba(193,75,75,.16); color: var(--rouge-deep); }
.mkt-closed { background: rgba(120,120,120,.14); color: var(--ink-soft); }
.mkt-status__hint { font-size: .78rem; color: var(--ink-soft); }
.mkt-status__balance { font-size: .82rem; color: var(--ink); font-weight: 700; }
.mkt-rules {
  margin: 0 0 12px; padding: 8px 12px; border-radius: 12px;
  background: rgba(46,143,138,.06); font-size: .78rem; color: var(--ink-soft);
}
.mkt-rules__summary { cursor: pointer; font-family: var(--kai); font-weight: 700; color: var(--ink); }
.mkt-rules__list { margin: 8px 0 0; padding-left: 1.2em; line-height: 1.7; }
.mkt-tabs { display: flex; gap: 6px; justify-content: center; margin: 0 0 10px; }
.mkt-tab {
  font-family: var(--kai); font-size: .82rem; padding: 5px 16px; border-radius: 999px;
  border: 1px solid rgba(201,162,39,.5); background: var(--paper-hi); color: var(--ink-soft); cursor: pointer;
}
.mkt-tab.is-active { background: var(--gold); color: var(--paper-hi); border-color: var(--gold); }
.mkt-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; padding: 4px; }
.mkt-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid rgba(201,162,39,.4); border-radius: 12px;
  background: linear-gradient(180deg, var(--paper-hi), var(--paper));
}
.mkt-card--reserved { border-color: var(--rouge); box-shadow: 0 0 0 2px rgba(193,75,75,.25); }
.mkt-card__meta { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.mkt-card__line1, .mkt-card__line2 { display: flex; align-items: center; gap: 8px; font-size: .78rem; }
.mkt-card__tier { font-weight: 700; color: var(--teal-deep); }
.mkt-card__seller { color: var(--ink-soft); }
.mkt-card__lock { color: var(--rouge-deep); font-weight: 700; }
.mkt-card__price { margin-left: auto; font-weight: 800; color: var(--gold-text); }
.mkt-empty { text-align: center; color: var(--ink-soft); font-size: .9rem; }
.mkt-stars-list { list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.mkt-stars-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  border: 1px solid rgba(201,162,39,.4); border-radius: 12px;
  background: linear-gradient(180deg, var(--paper-hi), var(--paper));
  font-size: .82rem;
}
.mkt-stars-row__rank { font-weight: 800; color: var(--gold-text); width: 1.4em; text-align: center; }
.mkt-stars-row__name { flex: 1; font-weight: 700; color: var(--ink); }
.mkt-stars-row__deals { color: var(--ink-soft); }
.mkt-stars-row__badge { font-size: .74rem; color: var(--rouge-deep); font-weight: 700; }
.mkt-ever-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; padding: 4px; }
.mkt-ever-card {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px;
  border: 1px solid rgba(201,162,39,.4); border-radius: 12px;
  background: linear-gradient(180deg, var(--paper-hi), var(--paper));
  font-size: .82rem;
}
.mkt-ever-card__name { font-weight: 700; color: var(--ink); }
.mkt-ever-card__peer { color: var(--ink-soft); }
.mkt-ever-card__date { color: var(--ink-soft); font-size: .74rem; }

/* ── 我的修行簿：個人狀態＋雙排行榜 ── */
.profile-card { width: min(94vw, 680px); max-width: 680px; max-height: calc(100dvh - 28px); padding: 16px; overflow: auto; }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.profile-head .overlay-title { margin: 0; text-align: left; letter-spacing: .2em; }
.profile-kicker { display: block; margin-bottom: 2px; color: var(--gold-text); font-size: .67rem; font-weight: 800; letter-spacing: .12em; }
.profile-identity {
  display: grid; grid-template-columns: 52px minmax(0,1fr) auto; align-items: center; gap: 10px;
  padding: 12px; border: 1px solid rgba(201,162,39,.48); border-radius: 14px;
  background: linear-gradient(135deg, rgba(230,201,106,.2), rgba(46,143,138,.1));
}
.profile-seal { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; background: var(--rouge-deep); color: #fff4d2; font: 900 1.35rem var(--kai); box-shadow: inset 0 0 0 3px rgba(255,244,210,.22); }
.profile-identity__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.profile-identity__body strong { overflow: hidden; color: var(--ink); font-family: var(--kai); font-size: 1.05rem; text-overflow: ellipsis; white-space: nowrap; }
.profile-identity__body span { color: var(--ink-soft); font-size: .76rem; }
.profile-rank-pill { padding: 6px 9px; border: 1px solid rgba(46,143,138,.38); border-radius: 999px; background: rgba(255,255,255,.58); color: var(--teal-deep); font-size: .7rem; font-weight: 800; white-space: nowrap; }
.profile-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; margin-top: 9px; }
.profile-stats > div { min-width: 0; padding: 9px 7px; border: 1px solid rgba(125,92,15,.24); border-radius: 10px; background: rgba(255,255,255,.55); text-align: center; }
.profile-stats span { display: block; overflow: hidden; color: var(--ink-soft); font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.profile-stats b { display: block; margin-top: 3px; overflow: hidden; color: var(--gold-text); font: 900 1.05rem var(--kai); text-overflow: ellipsis; white-space: nowrap; }
.profile-nickname { margin-top: 9px; padding: 10px; border-radius: 12px; background: rgba(43,58,74,.055); }
.profile-nickname h3 { margin: 0; color: var(--ink); font-size: .88rem; }
.profile-nickname p { margin: 2px 0 7px; color: var(--ink-soft); font-size: .7rem; line-height: 1.45; }
.profile-nickname__row { display: flex; gap: 7px; }
.profile-nickname__row input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid rgba(125,92,15,.38); border-radius: 9px; background: rgba(255,255,255,.75); color: var(--ink); font: inherit; }
.profile-nickname__row input[aria-invalid="true"] { border-color: var(--rouge); box-shadow: 0 0 0 2px rgba(193,75,75,.14); }
.profile-nickname__row button { min-height: 44px; white-space: nowrap; }
.profile-suggestions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.profile-suggestions button { min-height: 44px; padding: 7px 10px; border: 1px solid rgba(46,143,138,.35); border-radius: 999px; background: rgba(255,255,255,.62); color: var(--teal-deep); font-size: .68rem; cursor: pointer; }
.profile-message { min-height: 1em; margin-bottom: 0 !important; color: var(--teal-deep) !important; }
.profile-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; padding: 4px; border-radius: 12px; background: rgba(43,58,74,.07); }
.profile-tab { min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-soft); font-weight: 800; cursor: pointer; }
.profile-tab.is-active { background: var(--paper-hi); color: var(--rouge-deep); box-shadow: 0 2px 8px rgba(43,58,74,.12); }
.profile-tab:focus-visible { outline: 3px solid rgba(46,143,138,.35); }
.profile-ranking { margin-top: 7px; border: 1px solid rgba(201,162,39,.3); border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.46); }
.profile-ranking-list { max-height: 230px; margin: 0; padding: 5px; overflow-y: auto; list-style: none; }
.profile-ranking-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 7px; min-height: 42px; padding: 5px 7px; border-bottom: 1px solid rgba(125,92,15,.13); }
.profile-ranking-row:last-child { border-bottom: 0; }
.profile-ranking-row.is-me { border-radius: 8px; background: linear-gradient(90deg, rgba(230,201,106,.28), rgba(46,143,138,.08)); }
.profile-ranking-pos { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(201,162,39,.16); color: var(--gold-text); font-size: .68rem; font-weight: 900; }
.profile-ranking-name { overflow: hidden; color: var(--ink); font-size: .8rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.profile-ranking-row b { color: var(--teal-deep); font-size: .72rem; white-space: nowrap; }
.profile-ranking-empty { padding: 18px 8px; color: var(--ink-soft); font-size: .78rem; line-height: 1.5; text-align: center; }
.profile-ranking-self { margin: 0; padding: 8px 10px; border-top: 1px solid rgba(125,92,15,.18); background: rgba(230,201,106,.13); color: var(--ink); font-size: .76rem; text-align: center; }
.profile-disclosure { margin: 6px 0; color: var(--ink-soft); font-size: .65rem; text-align: center; }
.profile-close { display: block; min-height: 44px; margin: 0 auto; }

/* ── 天下文氣榜（全服前 500）── */
.extra-entry--tianxia .extra-entry__icon { background: linear-gradient(135deg,#b8860b,#e8c86a); color:#2a1c05; }
.tianxia-card { max-width: 460px; }
.tianxia-hint { font-size: .82rem; opacity: .78; margin: .2rem 0 .6rem; line-height: 1.5; }
.tianxia-list { list-style: none; margin: 0; padding: 0; max-height: 56vh; overflow-y: auto; }
.tx-row { display: grid; grid-template-columns: 2.4rem 1fr auto auto; gap: .5rem; align-items: baseline;
  padding: .38rem .5rem; border-bottom: 1px solid rgba(184,134,11,.18); }
.tx-row:nth-child(-n+3) .tx-rank { font-size: 1.15rem; }
.tx-rank { font-weight: 700; color: #b8860b; text-align: center; }
.tx-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-realm { font-size: .82rem; color: #8a6d1f; white-space: nowrap; }
.tx-xp { font-size: .8rem; opacity: .7; white-space: nowrap; }
.tx-row--me { background: linear-gradient(90deg, rgba(232,200,106,.28), transparent); border-radius: 6px; }
.tx-empty { list-style: none; padding: 1rem .5rem; opacity: .8; line-height: 1.6; text-align: center; }
.tianxia-self { margin: .7rem 0 .2rem; padding: .5rem .6rem; border-radius: 8px;
  background: rgba(184,134,11,.12); font-size: .9rem; line-height: 1.5; }

/* ── 寵物養成心法頁 ── */
.pet-guide__lead { font-size: .9rem; line-height: 1.6; margin: 0 0 .7rem; color: #7d5c0f; }
.pet-guide__item { border-left: 3px solid rgba(184,134,11,.5); padding: .1rem .1rem .1rem .7rem; margin: 0 0 .8rem; }
.pet-guide__item--power { border-left-color: var(--teal); background: rgba(46,143,138,.07); border-radius: 0 8px 8px 0; padding: .5rem .6rem .5rem .7rem; }
.pet-guide__item h3 { font-size: .98rem; margin: 0 0 .25rem; color: #5a3e0a; }
.pet-guide__item p { font-size: .86rem; line-height: 1.65; margin: 0; opacity: .92; }
.pet-guide__tip { font-size: .84rem; line-height: 1.6; margin: .4rem 0 0; padding: .55rem .65rem;
  border-radius: 8px; background: rgba(184,134,11,.12); }

/* 天下榜：面板內取綽號上榜（脫鉤班級） */
.tianxia-nickrow { display: flex; gap: .5rem; margin: 0 0 .7rem; }
.tianxia-nickrow input { flex: 1; min-width: 0; padding: .5rem .6rem; border-radius: 8px;
  border: 1px solid rgba(184,134,11,.45); background: rgba(255,255,255,.7); font-size: .9rem; }
.tianxia-nickrow input:focus-visible { outline: 2px solid #2e8b8b; outline-offset: 1px; }

/* ── 每日任務 ── */
.extra-entry--quests .extra-entry__icon { background: linear-gradient(135deg,#2e8b8b,#5bc2c2); color:#08302f; position: relative; }
.quests-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: #d13a3a; color: #fff; font-size: .72rem; line-height: 18px; text-align: center; font-weight: 700; }
/* ===== 每日任務首頁常駐面板：六項緊湊任務卡 ===== */
.home-quests { margin: .3rem auto .8rem; max-width: 560px; width: 100%; padding: .7rem .75rem .85rem;
  border: 1px solid var(--gold); border-radius: 14px; background: var(--paper-hi);
  box-shadow: 0 1px 0 rgba(201,162,39,.3) inset, 0 2px 10px rgba(43,58,74,.08); }
.home-quests__head { display: flex; align-items: baseline; justify-content: space-between; gap: .35rem .5rem; margin-bottom: .65rem; flex-wrap: wrap; }
.home-quests__title { font-family: var(--kai), var(--serif), serif; font-size: 1.05rem; margin: 0; color: var(--ink); letter-spacing: .05em; }
.home-quests__sub { font-size: .66rem; color: var(--ink-soft); }
.home-quests__toggle { display: block; margin: .65rem auto 0; min-height: 36px; padding: .35rem .8rem;
  border: 1px solid var(--teal); border-radius: 999px; background: transparent; color: var(--teal-deep); font-weight: 700; }

.quest-lines { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.quest-line { position: relative; min-width: 0; background: var(--paper); border: 1px solid var(--paper-dim); border-radius: 9px; padding: .55rem .55rem .6rem; }
.quest-line--boosted { border-color: rgba(201,162,39,.7); background: linear-gradient(145deg, rgba(230,201,106,.2), var(--paper) 55%); }
.quest-line--boosted .quest-line__head { padding-right: 1.6rem; }
.quest-line--boosted .quest-line__name { overflow: visible; font-size: .8rem; }
.quest-line--boosted .quest-line__boost { position: absolute; top: .48rem; right: .42rem; }
.quest-line--boosted .quest-line__value { position: absolute; top: 1.55rem; right: .48rem; }
.quest-line__head { display: flex; align-items: center; gap: .3rem; margin-bottom: 1rem; min-width: 0; }
.quest-line__icon { display: inline-flex; align-items: center; justify-content: center; min-width: 1.2rem; height: 1.2rem; font-family: var(--kai), serif; font-size: .85rem; font-weight: 700; }
.quest-line__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--kai), var(--serif), serif; font-size: .88rem; font-weight: 700; color: var(--navy); }
.quest-line__boost { flex: none; padding: .05rem .25rem; border-radius: 999px; color: #fff; background: var(--rouge); font-size: .61rem; font-weight: 700; }
.quest-line__value { margin-left: auto; flex: none; font-size: .66rem; color: var(--ink-soft); white-space: nowrap; }
.quest-line__value strong { color: var(--teal-deep); font-weight: 700; }

/* 軸 */
.quest-track { position: relative; height: 4px; margin: 0 20px; }
.quest-track__base { position: absolute; inset: 0; border-radius: 999px; background: var(--paper-dim); border: 1px solid rgba(201,162,39,.5); }
.quest-track__fill { position: absolute; top: 0; left: 0; bottom: 0; width: var(--fill,0%); border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--gold-hi)); transition: width .6s cubic-bezier(.22,1,.36,1); }

/* 里程碑節點 */
.quest-node { position: absolute; top: 50%; transform: translate(-50%,-50%); z-index: 1; }
.quest-node__dot { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--kai), serif; font-size: .66rem; font-weight: 700; background: var(--paper-hi);
  border: 2px solid var(--paper-dim); color: var(--ink-soft); transition: background .3s, border-color .3s, color .3s; }

/* 三階領取列：軸下方三等分格線，永遠留在卡片內、彼此不重疊（原本的絕對定位泡泡在窄卡片會互相蓋住） */
.quest-tiers { list-style: none; margin: .55rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .25rem; }
.quest-tier { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quest-tier__goal { font-size: .58rem; color: var(--ink-soft); text-align: center; white-space: nowrap; }
.quest-node__claim { width: 100%; min-width: 0; min-height: 28px; padding: 0 4px; border-radius: 7px; white-space: nowrap;
  border: 1px solid var(--paper-dim); background: var(--paper-dim); color: var(--ink-soft);
  font-family: var(--sans); font-size: .65rem; font-weight: 600; cursor: default; }

/* 未達標 */
.quest-node--locked .quest-node__dot { background: var(--paper-hi); border-color: var(--paper-dim); color: var(--ink-soft); }
/* 可領取：鎏金脈動吸睛 */
.quest-node--claimable .quest-node__dot { background: var(--gold-hi); border-color: var(--gold); color: var(--gold-text);
  animation: quest-pulse 1.6s ease-out infinite; }
.quest-tier--claimable .quest-tier__goal { color: var(--gold-text); font-weight: 700; }
.quest-tier--claimable .quest-node__claim { background: linear-gradient(135deg, var(--gold), var(--gold-hi)); border-color: var(--gold);
  color: #2a1c05; font-weight: 700; cursor: pointer; }
.quest-tier--claimable .quest-node__claim:active { transform: translateY(1px); }
/* 已領取：青碧沉澱 */
.quest-node--claimed .quest-node__dot { background: var(--teal); border-color: var(--teal-deep); color: var(--paper-hi); }
.quest-tier--claimed .quest-node__claim { background: transparent; border-color: var(--teal); color: var(--teal-deep); }
@keyframes quest-pulse { 0% { box-shadow: 0 0 0 0 rgba(201,162,39,.55); } 70% { box-shadow: 0 0 0 9px rgba(201,162,39,0); } 100% { box-shadow: 0 0 0 0 rgba(201,162,39,0); } }
@media (prefers-reduced-motion: reduce) { .quest-node--claimable .quest-node__dot { animation: none; } }

/* 手機改單欄：兩欄時每張卡只剩約 150px，三顆 44px 領取鈕塞不下會互相重疊 */
@media (max-width: 520px) {
  .quest-lines { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 400px) {
  .home-quests { padding: .65rem .5rem .75rem; }
  .quest-lines { gap: .45rem; }
  .quest-line { padding: .5rem .42rem .55rem; }
  .quest-line__name { font-size: .8rem; }
  .quest-line__value { font-size: .6rem; }
  .quest-track { margin: 0 20px; }
  .quest-tiers { gap: .18rem; }
  .quest-node__claim { padding: 0 2px; font-size: .61rem; }
  .quest-claim-verb { display: none; }
}

/* ===== 漢字探險：拆字工坊／疊字探源 ===== */
.extra-entry--glyph .extra-entry__icon {
  background: linear-gradient(135deg, #8e5d2f, #d5a96b);
  color: #fff8e8;
}
.extra-entry--glyph {
  background:
    radial-gradient(circle at 90% 12%, rgba(201,162,39,.18), transparent 42%),
    linear-gradient(120deg, rgba(142,93,47,.14), rgba(46,143,138,.10));
}
.glyph-card { width: min(720px, calc(100vw - 24px)); max-height: min(88vh, 820px); overflow: auto; }
.glyph-topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; position: sticky;
  top: 0; z-index: 4; padding: .2rem 0 .7rem; background: var(--paper-hi); }
.glyph-topbar h2 { margin: 0; text-align: center; }
.glyph-topbar #glyph-back { justify-self: start; }
.glyph-topbar #glyph-close { justify-self: end; }
.glyph-content { min-height: 320px; }
.glyph-status { min-height: 1.6em; margin: .65rem 0 0; color: var(--teal-deep); font-weight: 700; line-height: 1.5; }
.glyph-weekly { padding: 1rem; border: 1px solid rgba(201,162,39,.55); border-radius: 14px;
  background: radial-gradient(circle at 90% 0, rgba(201,162,39,.2), transparent 42%), rgba(255,255,255,.5); }
.glyph-kicker { font-size: .75rem; color: var(--gold-text); letter-spacing: .08em; }
.glyph-weekly h3 { margin: .25rem 0 .35rem; font-family: var(--kai), serif; font-size: 1.35rem; }
.glyph-weekly p, .glyph-section-head p, .glyph-map-intro { margin: .3rem 0; line-height: 1.65; color: var(--ink-soft); }
.glyph-weekly-progress { display: flex; gap: .5rem; margin-top: .7rem; }
.glyph-weekly-progress span { padding: .3rem .55rem; border-radius: 999px; background: var(--paper-dim); font-size: .78rem; }
.glyph-weekly-progress .is-done { color: #fff; background: var(--teal-deep); }
.glyph-mode-grid, .glyph-paths { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-top: .9rem; }
.glyph-mode, .glyph-paths button { min-height: 132px; padding: 1rem; border: 1px solid rgba(142,93,47,.35); border-radius: 14px;
  background: rgba(255,255,255,.58); color: var(--ink); text-align: left; cursor: pointer; }
.glyph-mode b, .glyph-paths b { display: block; font-family: var(--kai), serif; font-size: 1.25rem; margin-bottom: .35rem; }
.glyph-mode span, .glyph-paths span { display: block; line-height: 1.55; color: var(--ink-soft); }
.glyph-mode i { display: block; margin-top: .6rem; color: var(--teal-deep); font-style: normal; font-weight: 700; }
.glyph-scroll-library { margin-top: .9rem; padding: .7rem .85rem; border-radius: 10px; background: rgba(142,93,47,.07); }
.glyph-scroll-library summary { cursor: pointer; font-weight: 700; }
.glyph-scroll-library p { line-height: 1.7; font-size: .86rem; }
.glyph-archive-list { display: grid; gap: .4rem; margin-top: .6rem; }
.glyph-archive-list button { display: flex; justify-content: space-between; gap: .6rem; padding: .55rem .65rem; border: 1px solid var(--paper-dim);
  border-radius: 8px; background: rgba(255,255,255,.56); color: var(--ink); }
.glyph-archive-list button.is-dusty { filter: saturate(.3); opacity: .72; background: rgba(90,82,74,.09); }
.glyph-archive-list button.is-done { border-color: var(--teal); color: var(--teal-deep); }
.glyph-list { display: grid; gap: .55rem; }
.glyph-list-item { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: .6rem; min-height: 58px;
  padding: .65rem .8rem; border: 1px solid var(--paper-dim); border-radius: 10px; background: rgba(255,255,255,.6); color: var(--ink); text-align: left; }
.glyph-list-item span { color: var(--ink-soft); font-size: .8rem; }
.glyph-list-item i { color: var(--teal-deep); font-style: normal; }
.glyph-list-item.is-done { background: rgba(46,143,138,.08); border-color: rgba(46,143,138,.35); }
.glyph-run-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.glyph-run-head > span { color: var(--gold-text); }
.glyph-run-head > b { margin-left: auto; }
.glyph-card-dots { display: flex; gap: .28rem; width: 100%; }
.glyph-card-dots i { flex: 1; height: 5px; border-radius: 999px; background: var(--paper-dim); }
.glyph-card-dots .is-done { background: var(--teal); }
.glyph-card-dots .is-current { background: var(--gold); }
.glyph-secret { padding: .65rem; border-radius: 8px; background: rgba(43,58,74,.06); color: var(--ink-soft); text-align: center; }
.glyph-secret-meaning { margin: .6rem 0; padding: .75rem .85rem; border-left: 3px solid var(--gold-text); border-radius: 6px; background: rgba(142,93,47,.08); color: var(--ink); line-height: 1.65; }
.glyph-secret-meaning b { display: block; margin-bottom: .15rem; color: var(--gold-text); font-size: .82rem; letter-spacing: .12em; }
.glyph-attempts { width: fit-content; margin: .55rem auto 0; padding: .3rem .7rem; border: 1px solid rgba(46,143,138,.35);
  border-radius: 999px; background: rgba(46,143,138,.08); color: var(--teal-deep); font-size: .82rem; font-weight: 700; }
.glyph-slots { display: grid; gap: .55rem; width: min(330px, 100%); min-height: 150px; margin: 1rem auto; padding: .75rem;
  border: 2px solid rgba(142,93,47,.36); border-radius: 16px; background: rgba(255,255,255,.45); }
.glyph-slots[data-structure="left-right"] { grid-template-columns: 1fr 1fr; }
.glyph-slots[data-structure="top-bottom"] { grid-template-rows: 1fr 1fr; }
.glyph-slots[data-structure="semi-enclosure"] { grid-template-columns: 1.2fr 1fr; border-left-width: 9px; border-top-width: 9px; }
.glyph-slot { min-height: 62px; border: 1px dashed rgba(142,93,47,.5); border-radius: 10px; background: rgba(255,250,235,.7);
  color: var(--ink); font-family: var(--kai), serif; font-size: 2.2rem; cursor: pointer; }
.glyph-slot span { font: 500 .75rem var(--sans); color: var(--ink-soft); }
.glyph-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem; margin: .6rem 0; }
.glyph-component { min-width: 62px; min-height: 52px; border: 1px solid var(--gold); border-radius: 10px; background: var(--paper-hi);
  font-family: var(--kai), serif; font-size: 1.55rem; color: var(--ink); cursor: grab; }
.glyph-component.is-eliminated { opacity: .28; text-decoration: line-through; }
.glyph-component.is-selected { opacity: .48; border-style: dashed; }
.glyph-hints { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; margin-top: .8rem; }
.glyph-hints button, .glyph-actions button, .glyph-primary { min-height: 44px; padding: .55rem .7rem; border: 1px solid rgba(142,93,47,.35);
  border-radius: 9px; background: rgba(255,255,255,.6); color: var(--ink); font-weight: 700; }
.glyph-hint-text { min-height: 1.5em; text-align: center; color: var(--gold-text); }
.glyph-primary { display: block; width: 100%; background: linear-gradient(135deg, var(--teal), var(--teal-deep)); color: #fff; }
.glyph-reveal { padding: 1.2rem; border: 1px solid var(--gold); border-radius: 16px; text-align: center;
  background: radial-gradient(circle, rgba(201,162,39,.22), transparent 70%); }
.glyph-reveal h3 { margin: .35rem 0; font: 700 2rem var(--kai), serif; letter-spacing: .16em; color: var(--navy); }
.glyph-reveal p { line-height: 1.8; }
.glyph-story-card { display: grid; grid-template-columns: minmax(180px, .78fr) 1.22fr; gap: 1rem; align-items: stretch;
  margin-top: .85rem; padding: .85rem; border: 1px solid rgba(142,93,47,.35); border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,.78), rgba(248,239,214,.78));
  box-shadow: 0 12px 28px rgba(43,58,74,.12); animation: glyph-story-rise .45s ease-out both; }
.glyph-story-visual { position: relative; min-height: 188px; overflow: hidden; border-radius: 12px;
  background: var(--paper-dim); }
.glyph-story-visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
.glyph-story-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 48%, rgba(43,58,74,.2)); }
.glyph-story-beads { position: absolute; z-index: 1; left: 50%; top: 57%; display: grid; grid-template-columns: repeat(4, 1fr); gap: .28rem;
  width: min(88%, 260px); transform: translate(-50%, -50%); }
.glyph-story-beads b { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid rgba(184,134,11,.65); border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #fff 0 8%, #fff4c7 30%, #d9a928 70%, #8e5d2f 100%);
  color: var(--navy); font: 700 clamp(1.15rem, 5vw, 1.7rem) var(--kai), serif; text-shadow: 0 1px 0 #fff;
  box-shadow: 0 4px 10px rgba(43,58,74,.22), inset 0 0 0 2px rgba(255,255,255,.35); }
.glyph-story-copy { padding: .15rem .1rem; }
.glyph-story-copy > span { display: inline-block; padding: .22rem .5rem; border-radius: 999px; background: rgba(46,143,138,.12);
  color: var(--teal-deep); font-size: .875rem; font-weight: 800; letter-spacing: .08em; }
.glyph-story-copy h4 { margin: .42rem 0 .55rem; color: var(--navy); font: 700 1.2rem var(--kai), serif; }
.glyph-story-body { margin: 0; color: var(--ink); font-weight: 700; line-height: 1.75; }
.glyph-story-prompt { margin: .55rem 0; padding-left: .65rem; border-left: 3px solid var(--gold); color: var(--ink-soft); line-height: 1.7; }
.glyph-story-copy small { color: var(--ink-soft); font-size: .875rem; }
.glyph-story-copy small a { color: var(--teal-deep); font-weight: 700; }
@keyframes glyph-story-rise {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.glyph-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .8rem; }
.glyph-family-map { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.glyph-family-node { min-height: 105px; padding: .7rem .4rem; border: 1px solid rgba(142,93,47,.28); border-radius: 14px;
  background: rgba(255,255,255,.58); color: var(--ink); }
.glyph-family-node b { display: block; font: 700 2rem var(--kai), serif; }
.glyph-family-node span, .glyph-family-node i { display: block; margin-top: .2rem; font-size: .75rem; font-style: normal; color: var(--ink-soft); }
.glyph-family-node.is-done { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(46,143,138,.12) inset; }
.glyph-character-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; }
.glyph-character-grid button { min-height: 105px; border: 1px solid var(--paper-dim); border-radius: 12px; background: rgba(255,255,255,.55); }
.glyph-character-grid b { display: block; font: 700 2.2rem var(--kai), serif; }
.glyph-character-grid span { color: var(--ink-soft); }
.glyph-character-grid .is-done, .glyph-paths .is-done { border-color: var(--teal); background: rgba(46,143,138,.1); }
.glyph-big-character { width: 140px; height: 140px; margin: .5rem auto 1rem; display: grid; place-items: center;
  border: 2px solid rgba(142,93,47,.4); border-radius: 24px; background: rgba(255,255,255,.6); font: 700 5rem var(--kai), serif; }
.glyph-character-grid button,
.glyph-big-character {
  border-color: rgba(142,93,47,.46);
  background:
    linear-gradient(145deg, rgba(248,243,230,.88), rgba(240,233,216,.70) 58%, rgba(231,221,198,.84)),
    url("../assets/web/bg-ink.jpg") center 42% / cover;
  box-shadow:
    0 8px 18px rgba(43,58,74,.12),
    inset 0 0 0 1px rgba(230,201,106,.28);
}
.glyph-big-character {
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255,255,255,.75);
}
.glyph-big-character.is-recognized { box-shadow: 0 0 24px rgba(201,162,39,.34); }
.glyph-choice-grid, .glyph-answer-list { display: grid; gap: .55rem; }
.glyph-choice-grid { grid-template-columns: repeat(3, 1fr); }
.glyph-choice-grid button { min-height: 70px; font: 700 1.7rem var(--kai), serif; }
.glyph-choice-grid button, .glyph-answer-list button { padding: .7rem; border: 1px solid rgba(142,93,47,.35); border-radius: 10px;
  background: rgba(255,255,255,.62); color: var(--ink); }
.glyph-story { margin-top: .8rem; padding: .7rem .8rem; border-radius: 10px; background: rgba(201,162,39,.09); }
.glyph-story p { line-height: 1.8; }
.glyph-error { padding: 2rem 1rem; text-align: center; }
.pearls-glyph-collection { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid rgba(184,134,11,.28); }
.pearls-glyph-collection h3 { margin: 0 0 .45rem; font-family: var(--kai), serif; }
.pearls-glyph-collection p { margin: .55rem 0 .3rem; color: var(--ink-soft); font-size: .82rem; }
.pearl-chip--glyph, .pearl-chip--family { display: inline-flex; flex-direction: column; align-items: center; gap: .1rem; }
.pearl-chip--glyph i, .pearl-chip--family i { font: 500 .56rem var(--sans); opacity: .72; }
.sy-glyph-gallery { position: absolute; right: 2%; bottom: 2%; display: flex; flex-direction: column; gap: .15rem;
  padding: .45rem .55rem; border: 1px solid rgba(184,134,11,.4); border-radius: 8px; background: rgba(255,248,225,.82);
  color: var(--ink); font-size: .68rem; box-shadow: 0 2px 8px rgba(0,0,0,.1); }

@media (max-width: 560px) {
  .glyph-card { width: calc(100vw - 12px); max-height: 94vh; padding-inline: .8rem; }
  .glyph-topbar { grid-template-columns: auto 1fr auto; }
  .glyph-mode-grid, .glyph-paths, .glyph-actions { grid-template-columns: 1fr; }
  .glyph-story-card { grid-template-columns: 1fr; }
  .glyph-story-visual { height: 168px; min-height: 0; }
  .glyph-mode { min-height: 105px; }
  .glyph-family-map { grid-template-columns: repeat(2, 1fr); }
  .glyph-list-item { grid-template-columns: 1fr auto; }
  .glyph-list-item span { grid-column: 1 / -1; }
  .glyph-hints { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .extra-grid--learning { gap: 8px; }
  .extra-grid--learning .extra-entry { gap: 6px; min-height: 94px; padding: 9px 7px; }
  .extra-grid--learning .extra-entry__icon { width: 36px; height: 36px; font-size: 1.05rem; }
  .extra-grid--learning .extra-entry__title { font-size: .88rem; letter-spacing: .02em; }
  .extra-grid--learning .extra-entry__sub { font-size: .63rem; line-height: 1.35; }
  .extra-grid--learning .pet-entry__arrow { display: none; }
}

/* 外部平台入口在小螢幕只保留一個；答題時全部收起，避免覆蓋選項與每日任務。 */
@media (max-width: 480px) {
  #danai-learning-passport,
  #danai-public-counter { display: none !important; }
  body.in-quiz #danai-family-classroom,
  body.in-quiz #danai-learning-passport,
  body.in-quiz #danai-public-counter { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .glyph-reveal, .glyph-big-character { animation: none; }
}

/* ── 修行紀錄：弱點雷達／錯題本／精熟地圖／自訂目標 ── */
.extra-entry--study-record .extra-entry__icon { background: linear-gradient(135deg,#2e8b8b,#5bc2c2); color:#08302f; }
.study-record-card { max-width: 560px; width: min(94vw, 560px); max-height: 86vh; overflow-y: auto; }
.study-record-section { margin: 0 0 1.1rem; padding-bottom: 1.1rem; border-bottom: 1px solid rgba(184,134,11,.18); }
.study-record-section:last-of-type { border-bottom: none; }
.study-record-section h3 { font-size: 1rem; margin: 0 0 .5rem; color: #5a3e0a; }
.sr-hint { font-size: .82rem; opacity: .78; margin: .2rem 0 .5rem; line-height: 1.5; }
.sr-empty { color: var(--ink-soft, #7d6a4a); font-size: .86rem; text-align: center; padding: .6rem 0; }

.sr-weak-list { display: flex; flex-direction: column; gap: .45rem; margin-bottom: .6rem; }
.sr-weak-row { display: flex; align-items: center; gap: 8px; }
.sr-weak-row .sr-weak-label { flex: 0 0 4.6rem; color: var(--ink); font-size: .86rem; }
.sr-weak-bar { flex: 1; height: 10px; border-radius: 6px; background: rgba(184,134,11,.15); overflow: hidden; }
.sr-weak-bar > span { display: block; height: 100%; background: var(--teal, #2e8b8b); }
.sr-weak-pct { flex: 0 0 42px; text-align: right; color: var(--ink-soft, #7d6a4a); font-size: .8rem; }

.sr-mistakes-list { list-style: none; margin: 0 0 .6rem; padding: 0; max-height: 30vh; overflow-y: auto; }
.sr-mistakes-list li { display: flex; justify-content: space-between; gap: .6rem; padding: .35rem .1rem;
  border-bottom: 1px dashed rgba(184,134,11,.18); font-size: .86rem; }
.sr-mistakes-list li:last-child { border-bottom: none; }

.sr-mastery-map { display: flex; gap: .5rem; align-items: flex-end; height: 90px; padding: 0 .2rem; }
.sr-box-node { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .3rem; }
.sr-box-node__bar { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(180deg,#5bc2c2,#2e8b8b); min-height: 3px; }
.sr-box-node__label { font-size: .74rem; color: var(--ink-soft, #7d6a4a); text-align: center; line-height: 1.3; }

.sr-goal-row { display: flex; gap: .5rem; align-items: center; }
.sr-goal-row input { width: 5rem; padding: .45rem .5rem; border-radius: 8px;
  border: 1px solid rgba(184,134,11,.45); background: rgba(255,255,255,.7); font-size: .92rem; }
.sr-goal-row input:focus-visible { outline: 2px solid #2e8b8b; outline-offset: 1px; }

/* =========================================================
   首頁瘦身增量：守燈卡片／漸進解鎖鎖頭／按鈕蓄力回饋／
   連對封頂慶祝／開卷收卷儀式（見 docs 無，純增量 CSS，不動既有規則）
   ========================================================= */

/* ---- 守燈卡片：首頁最顯眼的今日目標卡 ---- */
.retention-hero {
  position: relative;
  margin: .7rem auto .85rem;
  max-width: 620px;
  padding: 1rem 1.05rem 1.05rem;
  border: 2px solid rgba(119, 57, 38, .34);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 250, 230, .96), rgba(238, 222, 181, .9)),
    url("../assets/web/bg-ink.jpg") center/cover;
  box-shadow: 0 12px 30px rgba(55, 36, 21, .13), inset 0 0 0 4px rgba(255,255,255,.35);
  text-align: left;
}
.retention-hero__kicker { margin: 0 0 .2rem; color: var(--vermillion); font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.retention-hero__title { margin: 0; font-family: var(--kai), var(--serif), serif; font-size: 1.45rem; color: var(--ink); }
.retention-hero__reason { margin: .45rem 0 .5rem; font-size: .94rem; color: var(--ink); }
.retention-hero__facts { display: grid; gap: .2rem; margin-bottom: .45rem; font-size: .76rem; color: var(--ink-soft); }
.retention-hero__facts span::before { content: '・'; color: var(--vermillion); font-weight: 800; }
.retention-hero__progress { margin: .3rem 0 .65rem; font-size: .74rem; color: var(--ink-soft); }
.retention-hero__choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; margin: .55rem 0; }
.retention-choice {
  min-height: 44px; padding: .5rem .6rem; border: 1px solid rgba(119,57,38,.25); border-radius: 12px;
  background: rgba(255,255,255,.62); color: var(--ink); font: inherit; cursor: pointer;
}
.retention-choice.is-selected { border-color: var(--vermillion); background: rgba(164, 58, 42, .1); box-shadow: inset 0 0 0 1px var(--vermillion); }
.retention-hero__primary {
  width: 100%; min-height: 48px; border: 0; border-radius: 13px; padding: .7rem 1rem;
  background: linear-gradient(135deg, #9e3529, #6f211b); color: #fff8e8;
  font: 800 1rem/1.2 var(--kai), var(--serif), serif; letter-spacing: .05em;
  box-shadow: 0 6px 16px rgba(111,33,27,.24); cursor: pointer;
}
.retention-hero__primary:disabled { opacity: .55; cursor: not-allowed; }
.reminder-invite { margin: .65rem 0 1rem; padding: .8rem; border: 1px solid rgba(137, 91, 40, .28); border-radius: 12px; background: rgba(255, 250, 235, .86); }
.reminder-invite h3, .reminder-invite p { margin: 0 0 .45rem; }
.reminder-invite p { color: var(--ink-soft); font-size: .82rem; line-height: 1.55; }
.reminder-invite__actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.reminder-invite__actions button { min-height: 44px; flex: 1 1 130px; border: 1px solid rgba(137, 91, 40, .35); border-radius: 9px; background: var(--paper-dim); color: var(--ink); font-family: var(--kai); }
.reminder-invite__actions button:first-child { background: var(--rouge); color: var(--paper-hi); border-color: transparent; }
.journey-guide {
  margin: .2rem 0 .65rem; padding: .55rem .7rem; border-left: 3px solid var(--vermillion);
  border-radius: 0 9px 9px 0; background: rgba(164,58,42,.08); color: var(--ink); font-size: .82rem;
}
@media (max-width: 520px) {
  .retention-hero { padding: .85rem .75rem .9rem; }
  .retention-hero__choices { grid-template-columns: 1fr; }
}

.lantern-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(230,201,106,.22), var(--paper-hi) 60%);
  border: 1.5px solid var(--gold);
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(201,162,39,.22);
}
.lantern-hero__flame {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 65%, var(--paper-dim), var(--paper-dim) 70%);
}
.lantern-hero--lit .lantern-hero__flame {
  background: radial-gradient(circle at 50% 65%, var(--gold-hi), var(--gold) 70%);
  box-shadow: 0 0 14px rgba(230,201,106,.9);
  animation: lantern-lit 2.4s ease-in-out infinite;
}
.lantern-hero__body { flex: 1; min-width: 0; }
.lantern-hero__tier {
  margin: 0 0 4px;
  font-family: var(--kai);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-text);
}
.lantern-hero__track {
  width: 100%;
  height: 7px;
  border-radius: 4px;
  background: var(--paper-dim);
  overflow: hidden;
  margin: 0 0 6px;
}
.lantern-hero__fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gold), var(--gold-hi));
  transition: width .5s ease;
}
.lantern-hero__msg { margin: 0 0 2px; font-size: .84rem; color: var(--ink); }
.lantern-hero__note { margin: 0; font-size: .68rem; color: var(--ink-soft); }
.lantern-hero__cta {
  flex: 0 0 auto;
  appearance: none;
  cursor: pointer;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: .82rem;
  color: var(--paper-hi);
  background: linear-gradient(180deg, var(--teal), var(--teal-deep));
  box-shadow: 0 2px 6px rgba(31,111,116,.35);
  transition: transform .14s ease;
}
.lantern-hero__cta:hover { transform: translateY(-1px); }
.lantern-hero__cta:active { transform: scale(.96); }
@media (max-width: 420px) {
  .lantern-hero { flex-wrap: wrap; }
  .lantern-hero__cta { flex: 1 1 100%; }
}

/* ---- 漸進解鎖：未達門檻的入口不隱藏，只加鎖頭與提示（見 js/onboarding.js） ---- */
.extra-entry.is-locked,
.pet-entry.is-locked {
  opacity: .62;
  filter: grayscale(.35);
}
.entry-lock-hint {
  display: block;
  margin-top: 2px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* ---- 選項按鈕蓄力下壓：按下時輕微下壓＋陰影內縮，放開時彈回 ---- */
#options button {
  transition: transform .12s cubic-bezier(.34,1.4,.64,1), box-shadow .12s ease, border-color .14s ease;
}
#options button:active {
  transform: scale(.96) translateY(1px);
  box-shadow: inset 0 2px 5px rgba(43,58,74,.22);
}

/* ---- 連對封頂：呼應成就冊「十連珠」門檻，達到時印章短暫爆閃 ---- */
.combo.is-peak {
  animation: comboPeakFlash .5s ease 1;
}
@keyframes comboPeakFlash {
  0%   { box-shadow: 0 0 6px 2px rgba(230,201,106,.6); }
  40%  { box-shadow: 0 0 26px 10px rgba(230,201,106,.95); transform: scale(1.18); }
  100% { box-shadow: 0 0 16px 5px rgba(230,201,106,.85); transform: scale(1.06); }
}

/* ---- 開卷／收卷儀式：整屏題目卡進出時的墨韻轉場（app.js playQuizCardCeremony 觸發） ---- */
.quiz-card--enter {
  animation: quizCardEnter .42s ease both;
}
@keyframes quizCardEnter {
  0%   { opacity: 0; transform: translateY(10px) scale(.98); filter: blur(2px); }
  60%  { filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.quiz-card--exit {
  animation: quizCardExit .22s ease both;
}
@keyframes quizCardExit {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-8px) scale(.98); }
}

/* ---- M14 揪同學：邀請 QR Code＋今日戰報預覽卡（皆為原生尺寸 canvas，縮放顯示） ---- */
.invite-qr-canvas {
  display: block;
  width: min(240px, 70vw);
  height: auto;
  margin: 12px auto;
  border-radius: 8px;
  background: #fff;
}
.invite-link {
  word-break: break-all;
  font-size: .85em;
}
.daily-report-canvas {
  display: block;
  width: min(320px, 80vw);
  height: auto;
  margin: 12px auto;
  border-radius: 12px;
}

/* ---------- 手機版面一致性：共用邊界、觸控區與安全區 ---------- */
@media (max-width: 767px) {
  .parent-cta {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.35;
    text-align: center;
  }

  .terms-help {
    width: 44px;
    height: 44px;
  }

  .lantern-hero__cta,
  .home-quests__toggle,
  .quest-node__claim,
  .oath-btn,
  .summary-btn,
  .savesync-btn,
  .answer-next-btn {
    min-height: 44px;
  }

  .quest-node__claim { min-width: 44px; }

  .meta-overlay {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  .meta-overlay__card,
  .pet-card,
  .ach-card,
  .fusion-panel,
  .ss-card,
  .sg-card,
  .glyph-card {
    width: min(100%, 560px);
    max-width: 100%;
    max-height: 100%;
    overscroll-behavior: contain;
  }

  .profile-card { width: 100%; max-width: 100%; max-height: calc(100dvh - 32px); padding: 13px; }
  .profile-identity { grid-template-columns: 46px minmax(0,1fr); padding: 9px; }
  .profile-seal { width: 44px; height: 44px; }
  .profile-rank-pill { grid-column: 1 / -1; justify-self: stretch; text-align: center; }
  .profile-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profile-nickname__row { flex-direction: column; }
  .profile-nickname__row button { width: 100%; }
  .profile-ranking-list { max-height: 27vh; }
}

@media (max-width: 374px) {
  .extra-grid--learning { grid-template-columns: 1fr; }
  .extra-grid--learning .extra-entry {
    min-height: 72px;
    padding: 10px 12px;
  }
  .extra-grid--learning .pet-entry__arrow { display: inline; }
}
