/* pixel.css — 批次 B：JRPG 16-bit 像素風視覺地基
 *
 * 字型：Cubic 11（俐方體 11 號，OFL 開源繁中點陣字），已子集化到 UI 用字
 *       （見 tools/subset_font.py）。像素字用於整個 UI；195 題的題目與解析
 *       「本文」維持可讀的 Noto Sans TC（方案 B）。
 *
 * 載入順序：本檔在 app.css 之後載入，才能覆蓋既有 font-family。
 */

@font-face {
  font-family: "Cubic 11";
  src: url("../assets/fonts/Cubic_11_subset.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-pixel: "Cubic 11", var(--font-cjk);
  /* 數字/讀數也走像素字（題數、%、Box、進度 0/7、時數、連續天數…）。
   * 覆蓋 tokens.css 的 IBM Plex Mono，讓整個 UI 一致麥塊化；缺字時退回 Noto。
   * 題目/解析本文不受影響——那些在下方明確指定了 Noto。 */
  --font-data: var(--font-pixel);
}

/* 整個 UI 預設走像素字 */
body {
  font-family: var(--font-pixel);
}

/* 點陣字在非整數倍縮放時瀏覽器會反鋸齒糊掉；關掉平滑、保持像素邊緣銳利 */
body {
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  text-rendering: optimizeSpeed;
}

/* ── 學習本文維持 Noto（方案 B：UI 像素、題目/解析不像素）──
 * 這些是長篇可讀內容：題幹、答案、解析、重點、physics 白話/科學、
 * MCQ 選項、空難案例與來源說明。其餘 UI chrome 全部走像素字。 */
.card-face .q,
.card-face .a,
.card-face .explain,
.card-face .hint,
.key-points,
.physics-body,
.choice-text,
.lib-q,
.lib-answer .a,
.lib-answer .explain,
.lib-answer .key-points,
.accident-event,
.accident-summary,
.accident-source,
.source-ref,
.source-note {
  font-family: var(--font-cjk);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 像素藝術圖（機長頭像等，批次 B2）放大時保持硬邊、不要模糊 */
.pixel-art,
img.pixel-art,
.pixel-art img,
.pixel-art svg {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* 品牌字標「FLIGHT DECK」原走 IBM Plex Sans（--font-ui）；改用像素字當招牌，
 * 是整個 JRPG 識別最顯眼的一槍。 */
.logo { font-family: var(--font-pixel); }

/* ── 像素質感微調 ──
 * 標題/導覽/按鈕等短字串加一點字距，讓 11px 點陣在大字級下更好認。 */
.logo,
.sortie-kicker,
.callsign,
.nav-zh,
.home-title,
.section-h,
.lib-domain-zh,
.lib-module-zh,
.ladder-zh,
.rank-zh,
.state-card h2,
.sortie-card h2 {
  letter-spacing: 1px;
}

/* 數字/讀數已改像素字（見上方 --font-data 覆蓋）：.study-counter / .tile-num /
 * .mastery-meta / .chip b / .home-domain-count / .lib-stat 等隨之變像素，
 * 與 UI 一致。題目/解析本文仍走 Noto（下方明確指定）。 */

/* ── 機長角色（批次 B2）── */
.pixel-art .captain-svg,
.captain-svg {
  width: 100%; height: 100%; display: block;
  image-rendering: pixelated;
}

/* JRPG 對話框：左頭像 + 右文字框 */
.captain-dialog {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--gold); border-radius: var(--radius);
  padding: 16px; margin-top: 16px;
  animation: slide-down .2s ease;
}
.captain-portrait {
  width: 72px; height: 72px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 4px;
}
.captain-bubble { flex: 1; min-width: 0; }
.captain-name {
  font-family: var(--font-pixel); color: var(--gold);
  font-size: 13px; letter-spacing: 1px; margin-bottom: 5px;
}
.captain-line {
  font-family: var(--font-pixel); color: var(--text);
  line-height: 1.7; margin: 0; font-size: 15px;
}
.captain-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.captain-actions .btn { flex: none; padding: 8px 16px; }

/* 學習中的反應條（答對/答錯換表情） */
.captain-react {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 2px; padding: 8px 12px;
  border-radius: var(--radius-sm);
  animation: slide-down .22s ease;
}
.captain-react .captain-portrait {
  width: 40px; height: 40px; padding: 2px;
}
.captain-react-line { font-family: var(--font-pixel); font-size: 14px; line-height: 1.5; }
.captain-react.react-right { background: rgba(159,230,160,.08); border: 1px solid rgba(159,230,160,.25); }
.captain-react.react-right .captain-react-line { color: var(--success); }
.captain-react.react-wrong { background: rgba(255,180,84,.07); border: 1px solid rgba(255,180,84,.22); }
.captain-react.react-wrong .captain-react-line { color: var(--amber-soft); }

/* 升階慶祝：機長入鏡（RPG 風） */
.celebrate .captain-portrait {
  width: 72px; height: 72px; margin: 0 auto 8px;
  background: var(--surface-2); border: 1px solid var(--gold);
}
.celebrate .captain-name { text-align: center; }
.celebrate-line {
  font-family: var(--font-pixel); color: var(--amber-soft);
  font-size: 14px; line-height: 1.6; margin: 4px 0 14px; text-align: center;
}
