/* ============================================================================
   css/layout.css — v5.3 全站完整樣式（黃金平衡 HUD ＋ 滿屏默書板 ＋ 非 MC 考場）
   ============================================================================ */
#game-client {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  border: 6px solid var(--wood-frame);
  box-shadow: inset 0 0 0 2px var(--wood-edge);
  background: #d8ccb8;
  transition: filter 0.4s ease;
}

#game-client.term-2 #diorama-canvas { filter: hue-rotate(8deg) saturate(1.06); }

#diorama-viewport { position: absolute; inset: 0; width: 100%; height: 100%; }
#diorama-canvas { display: block; width: 100%; height: 100%; cursor: pointer; touch-action: pan-x pan-y; }
#diorama-pins { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

.ico-slot { display: inline-flex; align-items: center; justify-content: center; width: 23px; height: 23px; flex-shrink: 0; }
.ico-slot.sm { width: 18px; height: 18px; }
.ico-slot.lg { width: 32px; height: 32px; }

.craft-ico-img,
.craft-beast-img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(45, 32, 20, 0.28)); pointer-events: none; }

.zhe-composite { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.zhe-base-img { position: relative; z-index: 2; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.zhe-aura-layer { position: absolute; inset: -8%; z-index: 1; pointer-events: none; animation: slowSpin 10s linear infinite; }
.zhe-outfit-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
@keyframes slowSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* 建築浮動牛皮紙名牌 ＋ 中央燈柱學期統測名牌 */
.bldg-pin {
  position: absolute;
  transform: translate(-50%, 0);
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 6px;
  background-color: rgba(255, 253, 247, 0.96);
  background-image: var(--paper-grain);
  border: 2px solid var(--paper-kraft-deep);
  border-radius: 999px;
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 3px 0 #a98c61, 0 5px 12px rgba(45, 36, 30, 0.24);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.18s ease;
}
.bldg-pin:hover,
.bldg-pin.active {
  transform: translate(-50%, -3px) scale(1.06);
  border-color: var(--warm-amber-dark);
  background-color: #fff6db;
  box-shadow: 0 3px 0 var(--warm-amber-dark), 0 0 14px var(--warm-glow);
  z-index: 8;
}
.bldg-pin.center-exam-pin {
  border-color: #c96f2d;
  background-color: #fff8e1;
  box-shadow: 0 3px 0 #9e5017, 0 5px 14px rgba(158, 80, 23, 0.3);
  z-index: 7;
}
.bldg-pin-lv { font-size: 10px; font-weight: 900; padding: 1px 6px; border-radius: 999px; background: var(--paper-kraft); color: var(--ink-primary); }
.bldg-pin.lit .bldg-pin-lv { background: var(--warm-bulb); color: #4a2906; }

/* ============================================================================
   頂部雙行黃金平衡 HUD
   ============================================================================ */
#hud-top { position: absolute; top: 9px; left: 9px; right: 9px; z-index: 20; display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; pointer-events: none; }
#hud-top > * { pointer-events: auto; }
.hud-left-cluster, .hud-right-cluster { display: flex; flex-direction: column; gap: 6px; }
.hud-left-cluster { align-items: flex-start; }
.hud-right-cluster { align-items: flex-end; }

.passport-combo-pill { display: inline-flex; align-items: center; background-color: rgba(255, 252, 244, 0.96); background-image: var(--paper-grain); border: 2px solid var(--paper-kraft-deep); border-radius: 999px; box-shadow: 0 4px 0 #9f8258, 0 6px 14px var(--paper-shadow); padding: 3px 5px 3px 4px; gap: 4px; }
.passport-head-area { display: inline-flex; align-items: center; gap: 6px; padding: 1px 4px 1px 1px; background: transparent; color: var(--ink-primary); text-align: left; }
.passport-avatar { width: 36px; height: 36px; min-width: 36px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #fffdf7 0%, #ead8b8 100%); border: 2px solid var(--warm-amber); overflow: hidden; }
.passport-avatar .craft-player-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; transform: scale(1.38); transform-origin: 50% 16%; }
.passport-name-row { font-size: 13px; font-weight: 900; white-space: nowrap; }
#hud-player-name { display: inline-block; max-width: 72px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.passport-sub-row { font-size: 10px; color: var(--ink-secondary); font-weight: 700; white-space: nowrap; }

.grade-term-bookmark { display: inline-flex; align-items: center; gap: 3px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; white-space: nowrap; border: 1.8px solid #c97a2b; background: linear-gradient(180deg, #ffe7a8 0%, #f7be5c 100%); color: #4a2504; box-shadow: 0 2px 0 #b36619; }
.grade-term-bookmark.term-2 { border-color: #3d8b6c; background: linear-gradient(180deg, #d8f5e5 0%, #8ad1b0 100%); color: #16422f; box-shadow: 0 2px 0 #2b6b51; }
.bm-arrow { font-size: 10px; opacity: 0.85; }

.daily-quest-pill { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border-radius: 11px; background-color: rgba(255, 253, 247, 0.96); background-image: var(--paper-grain); border: 2px solid #b5976b; box-shadow: 0 3px 0 #8c7047; color: var(--ink-primary); font-size: 11.5px; font-weight: 900; white-space: nowrap; }
.mini-dot { width: 9px; height: 9px; border-radius: 50%; background: #d9413b; border: 1.5px solid #fffdf7; }

.resource-bar, .hud-tool-btns { display: flex; align-items: center; gap: 5px; }
.res-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px 4px 6px; background-color: rgba(255, 252, 244, 0.96); background-image: var(--paper-grain); border: 2px solid var(--paper-kraft-deep); border-radius: 999px; box-shadow: 0 3px 0 #9f8258; font-size: 12px; font-weight: 900; color: var(--ink-primary); white-space: nowrap; }
.res-chip.ticket-chip { background-color: #fff5db; border-color: #d98c2b; color: #6b3b09; box-shadow: 0 3px 0 #b86d16; }
.res-chip.streak-chip { background-color: #fff0ea; border-color: #d96b43; color: #7c2d12; box-shadow: 0 3px 0 #a84825; }

.clear-pill-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 32px; padding: 0 9px; border-radius: 11px; background-color: #fff8e6; background-image: var(--paper-grain); border: 2px solid #d4892a; box-shadow: 0 3px 0 #a86416; color: #4a2906; font-size: 11.5px; font-weight: 900; white-space: nowrap; }
.clear-pill-btn.muted { background-color: #e8e0d2; border-color: #a89985; box-shadow: 0 3px 0 #8a7c6a; color: #706458; }
.clear-pill-btn.parent-btn { background-color: #fff0ec; border-color: #c95547; box-shadow: 0 3px 0 #96382d; color: #6e1f16; }
.clear-pill-btn.menu-btn { background-color: #fffdf7; border-color: #7d6040; box-shadow: 0 3px 0 #5c4329; color: var(--ink-primary); }
.clear-pill-btn.icon-only { width: 34px; padding: 0; }

@keyframes parcelBounce { 0%, 100% { transform: translateY(0) rotate(0deg); } 45% { transform: translateY(-5px) rotate(-3deg); } 55% { transform: translateY(-5px) rotate(3deg); } }
.floating-parcel { position: absolute; right: 10px; top: 96px; z-index: 18; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 9px; background-color: #fff6db; background-image: var(--paper-grain); border: 2px solid var(--warm-amber-dark); border-radius: var(--rad-lg); box-shadow: 0 4px 0 var(--warm-amber-dark), 0 8px 18px var(--paper-shadow); animation: parcelBounce 2.6s infinite ease-in-out; }
.parcel-tag { font-size: 10px; font-weight: 900; color: #7c3510; }

/* ============================================================================
   底部懸浮 HUD
   ============================================================================ */
#hud-bottom { position: absolute; left: 9px; right: 9px; bottom: 9px; z-index: 20; display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
#hud-bottom > * { pointer-events: auto; }
.mascot-dock { display: flex; align-items: flex-end; gap: 8px; max-width: 560px; }
.mascot-avatar-btn { width: 64px; height: 64px; min-width: 64px; border-radius: 17px; background-color: var(--paper-white); background-image: var(--paper-grain); border: 2.5px solid var(--warm-amber); box-shadow: 0 4px 0 var(--warm-amber-dark), 0 8px 16px var(--paper-shadow); padding: 3px; }
.mascot-slot-fill { width: 100%; height: 100%; }
.mascot-ribbon { flex: 1; background-color: rgba(255, 253, 247, 0.96); background-image: var(--paper-grain); border: 2px solid var(--paper-kraft-deep); border-radius: var(--rad-lg); padding: 7px 11px; box-shadow: 0 4px 0 #a98c61, 0 6px 14px var(--paper-shadow); }
.mascot-top-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 2px; flex-wrap: wrap; }
.mascot-name { font-size: 11px; font-weight: 900; color: var(--warm-amber-dark); }
.secret-letter-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: #fde2df; border: 1.5px solid #c94a3b; color: #7d1e14; font-size: 10.5px; font-weight: 900; animation: gachaPulse 1.6s infinite ease-in-out; }
.mascot-speech { font-size: 12px; font-weight: 700; color: var(--ink-primary); line-height: 1.38; }

.bottom-dock-bar.four-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; max-width: 560px; }
.bottom-dock-bar.three-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; max-width: 560px; }
.main-dock-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 10px 4px; background-color: rgba(255, 253, 247, 0.98); background-image: var(--paper-grain); border: 2.5px solid #9f8258; border-radius: 14px; box-shadow: 0 4px 0 #7e633f, 0 6px 14px rgba(45, 36, 30, 0.2); color: var(--ink-primary); font-size: 13.5px; font-weight: 900; white-space: nowrap; }
.main-dock-btn.gacha-btn { background: linear-gradient(180deg, #fff5d1 0%, #ffd97d 100%); border-color: #c96f2d; box-shadow: 0 4px 0 #9e5017; color: #4a2204; }
.main-dock-btn.gacha-btn.has-reward { animation: gachaPulse 1.8s infinite ease-in-out; }
@keyframes gachaPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.main-dock-btn.hub-btn { background: linear-gradient(180deg, #fffdf7 0%, #f3eafc 100%); border-color: #7d6b91; box-shadow: 0 4px 0 #57466b; color: #36254a; }
.main-dock-btn.dict-btn { background: linear-gradient(180deg, #fffdf7 0%, #e4f3f7 100%); border-color: #488299; box-shadow: 0 4px 0 #2d5a6b; color: #1c3f4d; }
.notify-badge { position: absolute; top: -7px; right: -4px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 999px; background: #d9413b; color: #ffffff; border: 2px solid #fffdf7; font-size: 10.5px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(217, 65, 59, 0.45); }

/* ============================================================================
   紙藝彈窗共用結構 ＋ 全站「← 上一頁」立體牛皮紙按鈕
   ============================================================================ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(38, 25, 16, 0.64); backdrop-filter: blur(5px); display: none; align-items: center; justify-content: center; padding: 12px; z-index: 100; }
.modal-backdrop.open { display: flex; animation: modalPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes modalPop { from { opacity: 0; transform: scale(0.93) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.paper-modal { position: relative; width: 100%; max-width: 680px; max-height: 92dvh; overflow-y: auto; background-color: var(--paper-cream); background-image: var(--paper-grain); border: 3px solid var(--paper-kraft-deep); border-radius: var(--rad-xl); padding: 18px 16px 16px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65), 0 20px 50px rgba(32, 20, 10, 0.45); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.modal-header-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.modal-header h2 { font-size: 16.5px; font-weight: 900; color: var(--ink-primary); }
.modal-subtitle { font-size: 11.5px; color: var(--ink-secondary); margin-top: 2px; }
.title-with-icon { display: flex; align-items: center; gap: 8px; min-width: 0; }
.modal-lead { font-size: 13.5px; color: var(--ink-secondary); line-height: 1.5; margin-bottom: 12px; }

/* 全站統一立體「← 上一頁」按鈕 */
.btn-back-paper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 10px;
  border-radius: 10px;
  background: linear-gradient(180deg, #fffdf7 0%, #f0e4ce 100%);
  border: 2px solid #b5976b;
  box-shadow: 0 3px 0 #8c7047;
  color: #4a3425;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-close-paper { width: 34px; height: 34px; border-radius: 50%; background: #f5e6d8; color: #7c3525; border: 2px solid #c99a86; box-shadow: 0 3px 0 #a37460; font-size: 18px; font-weight: 900; line-height: 1; flex-shrink: 0; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.modal-footer.center { justify-content: center; flex-wrap: wrap; }
.modal-footer.space-between { justify-content: space-between; flex-wrap: wrap; }

.paper-select { width: 100%; padding: 9px 10px; border-radius: 10px; border: 2px solid var(--paper-kraft-deep); background: #ffffff; color: var(--ink-primary); font-size: 13px; font-weight: 800; font-family: inherit; }
.exam-textarea { width: 100%; padding: 10px; border-radius: 10px; border: 2px solid var(--paper-kraft-deep); background: #ffffff; color: var(--ink-primary); font-size: 14px; font-weight: 700; font-family: inherit; line-height: 1.5; resize: vertical; }
.voice-note-box { font-size: 12px; color: #5c4028; background: #faf2e1; border: 1.5px dashed #cbb184; border-radius: 9px; padding: 8px 10px; line-height: 1.45; }

/* ============================================================================
   紙藝默書房：雙語音切換 ＋ 100% 滿屏手指巨無霸寫字頁（零走位・零斷線）
   ============================================================================ */
.dict-modal-wide { max-width: 720px; }

.engine-switch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.engine-pick-btn { padding: 10px; border-radius: 12px; background: #faf4e8; border: 2px solid #cbb99d; box-shadow: 0 3px 0 #a99272; text-align: left; display: flex; flex-direction: column; gap: 2px; color: var(--ink-primary); }
.engine-pick-btn strong { font-size: 13px; font-weight: 900; }
.engine-pick-btn span { font-size: 11px; color: var(--ink-secondary); }
.engine-pick-btn.active { background: linear-gradient(180deg, #fff5d1 0%, #ffd97d 100%); border-color: #c96f2d; box-shadow: 0 3px 0 #9e5017; }

/* 開始默書時：解除細彈窗限制，100% 貼邊全螢幕書寫頁 */
.modal-backdrop.dict-fs-backdrop { padding: 0; align-items: stretch; justify-content: stretch; }
.paper-modal.dict-fs-card {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  border: none;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dict-fs-card .modal-brass-pins { display: none; }

.dict-fs-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 6px; overflow: hidden; }
.dict-fs-topbar { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-shrink: 0; }
.dict-fs-top-left, .dict-fs-top-right { display: flex; align-items: center; gap: 6px; }

.dict-grid-popover { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: #fff6db; border: 1.5px dashed #d49a2a; border-radius: 10px; flex-shrink: 0; flex-wrap: wrap; }

/* 頂部已寫字詞縮圖列 */
.dict-strip-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; background: #f6ecd8; border: 1.5px solid #cbb48c; border-radius: 11px; flex-shrink: 0; min-height: 48px; overflow-x: auto; }
.dict-char-thumbs { display: flex; align-items: center; gap: 6px; }
.char-thumb-slot { width: 38px; height: 38px; min-width: 38px; border-radius: 8px; background: #fffdf7; border: 2px solid #c9ae82; padding: 1px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.char-thumb-slot.active { border-color: #d97a2b; box-shadow: 0 0 0 2px rgba(244, 162, 97, 0.45); background: #fff8e1; }
.char-thumb-slot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb-placeholder { font-size: 10px; font-weight: 900; color: #8a7358; }

.dict-answer-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: #fff3c4; border: 2px solid #c96f2d; color: #4a2204; font-size: 14px; font-weight: 900; white-space: nowrap; flex-shrink: 0; }
.dict-answer-pill strong { font-size: 17px; letter-spacing: 2px; }

/* 中央手指巨無霸寫字區 */
.dict-fs-canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 180px;
  border: 2.5px solid var(--paper-kraft-deep);
  border-radius: 14px;
  background: #fffdf7;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.dict-notebook-box { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; background: #f7efe0; border: 2px dashed #b89f79; border-radius: 14px; text-align: center; }

.dict-fs-pad-bar { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn-next-char { flex: 1; padding: 9px 12px; border-radius: 11px; background: linear-gradient(180deg, #56a887 0%, #3d8b6c 100%); color: #ffffff; border: 2px solid #245c45; box-shadow: 0 3px 0 #1b4735; font-size: 13.5px; font-weight: 900; white-space: nowrap; }
.dict-fs-judge-bar { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ============================================================================
   通用迷你工具按鈕（修復所有無框純文字掣！）
   ============================================================================ */
.hw-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 9px;
  background: linear-gradient(180deg, #fffdf7 0%, #efe3cc 100%);
  border: 1.8px solid #b5976b;
  box-shadow: 0 2px 0 #8c7047;
  color: #4a3425;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.hw-mini-btn.active {
  background: linear-gradient(180deg, #ffe294 0%, #f4b24e 100%);
  border-color: #c96f2d;
  box-shadow: 0 2px 0 #9e5017;
  color: #3d1c02;
}

/* ============================================================================
   非 MC 全題型考場艙 ＋ 中央燈柱學期終極統測（js/exam.js）
   ============================================================================ */
.exam-hub-modal { max-width: 600px; }
.exam-stage-modal { max-width: 760px; padding: 14px 16px; }
.exam-timer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.exam-mode-btn { padding: 10px 8px; border-radius: 12px; background: #faf4e8; border: 2px solid #cbb99d; box-shadow: 0 3px 0 #a99272; text-align: left; display: flex; flex-direction: column; gap: 3px; color: var(--ink-primary); }
.exam-mode-btn strong { font-size: 13px; font-weight: 900; }
.exam-mode-btn span { font-size: 11px; color: var(--ink-secondary); line-height: 1.35; }
.exam-mode-btn.active { background: linear-gradient(180deg, #fff5d1 0%, #ffd97d 100%); border-color: #c96f2d; box-shadow: 0 3px 0 #9e5017; }

.scratch-drawer { background: #fbf5e6; border: 2px dashed #b89f79; border-radius: 12px; padding: 8px; margin-bottom: 10px; }
.scratch-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 900; color: #6b4e31; margin-bottom: 6px; }
#exam-scratch-canvas { display: block; width: 100%; height: 140px; border-radius: 8px; border: 1.5px solid #d4bfa0; touch-action: none; cursor: crosshair; }

.exam-desk-box { background: #fffdf7; border: 2px solid var(--paper-kraft-deep); border-radius: var(--rad-lg); padding: 12px; margin-bottom: 10px; box-shadow: 0 3px 0 #c9ae82; }
.exam-field-lbl { display: block; font-size: 12.5px; font-weight: 900; color: var(--ink-secondary); margin-bottom: 6px; }
.exam-fill-row { display: flex; gap: 8px; }
.exam-fill-row input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--paper-kraft-deep); background: #ffffff; font-size: 16px; font-weight: 900; color: var(--ink-primary); }

.reorder-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.reorder-tray { min-height: 52px; padding: 8px; background: #fbf4e4; border: 2px dashed #c4a678; border-radius: 12px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.reorder-bank { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
.reorder-tile { padding: 8px 13px; border-radius: 10px; background: linear-gradient(180deg, #fffdf7 0%, #f1e3c6 100%); border: 2px solid #b5976b; box-shadow: 0 3px 0 #8c7047; color: #3d2410; font-size: 14.5px; font-weight: 900; }
.reorder-tile.selected { background: linear-gradient(180deg, #ffe294 0%, #f4b24e 100%); border-color: #c96f2d; box-shadow: 0 3px 0 #9e5017; }

.listen-controls-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.listen-script-box { padding: 9px 11px; background: #e8f5ee; border-left: 4px solid #3d8b6c; border-radius: 8px; font-size: 12.5px; line-height: 1.5; color: #1b4735; margin-top: 6px; }

.hw-scaffold-box { padding: 8px 10px; background: #fff7e0; border: 1.5px dashed #d49a2a; border-radius: 10px; margin-bottom: 10px; }
.hw-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.punct-keyboard-bar { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 7px; padding: 6px 8px; background: #f6ecd8; border-radius: 10px; }
.punct-lbl { font-size: 11.5px; font-weight: 900; color: #6b4e31; }
.punct-key { min-width: 34px; height: 32px; padding: 0 8px; border-radius: 8px; background: #ffffff; border: 1.8px solid #b5976b; box-shadow: 0 2px 0 #8c7047; font-size: 15px; font-weight: 900; color: #2d241e; }
.hw-meta-strip { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 800; color: #6b4e31; margin-top: 5px; }

.hw-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.hw-tool-group { display: flex; align-items: center; gap: 5px; }
.pen-dot { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid #ffffff; box-shadow: 0 0 0 1.5px #8c7047; }
.pen-dot.active { transform: scale(1.14); box-shadow: 0 0 0 2.5px #c96f2d; }
.hw-canvas-frame { border: 2px solid var(--paper-kraft-deep); border-radius: 12px; overflow: hidden; background: #fffdf7; touch-action: none; }
#hw-write-canvas { display: block; width: 100%; height: 240px; touch-action: none; cursor: crosshair; }
.hw-model-box { margin-top: 10px; padding: 10px 12px; background: #e8f5ee; border: 1.5px solid #3d8b6c; border-radius: 10px; font-size: 12.5px; line-height: 1.55; color: #1b4735; }
.exam-grade-seal { display: inline-flex; align-items: center; justify-content: center; width: 68px; height: 68px; border-radius: 50%; background: linear-gradient(135deg, #ffe08a, #e07a5f); border: 3px double #7c2d12; color: #3d1c02; font-size: 28px; font-weight: 900; margin: 8px auto; box-shadow: 0 6px 16px rgba(158, 80, 23, 0.3); }

/* ============================================================================
   年級 / 選單 / 盲盒 / 裝扮大本營 / 建築 / 對戰艙 / 家長後台樣式
   ============================================================================ */
.grade-switch-modal { max-width: 560px; }
.profiles-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.profile-card-btn { padding: 9px 6px; border-radius: var(--rad-md); background: #faf4e8; border: 2px solid #cbb99d; text-align: center; font-size: 12.5px; font-weight: 900; color: var(--ink-primary); }
.profile-card-btn.active { background: #fff4d1; border-color: #d4892a; box-shadow: 0 3px 0 #b36b19; }
.grades-6-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grade-pick-btn { padding: 11px 8px; border-radius: var(--rad-md); background: var(--paper-white); border: 2px solid var(--paper-kraft-deep); box-shadow: 0 3px 0 #b5976b; font-size: 14px; font-weight: 900; color: var(--ink-primary); }
.grade-pick-btn.active { background: linear-gradient(180deg, #ffe294, #f4b24e); border-color: #c96f2d; box-shadow: 0 3px 0 #9e5017; color: #3d2105; }
.grade-pick-btn.p56-badge::after { content: ' · 含升中'; font-size: 10px; color: #7b4bb8; }
.terms-2-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.term-pick-btn { padding: 11px 10px; border-radius: var(--rad-md); text-align: left; border: 2px solid #cbb99d; background: #faf4e8; display: flex; flex-direction: column; gap: 3px; }
.term-pick-btn strong { font-size: 13.5px; font-weight: 900; color: var(--ink-primary); }
.term-pick-btn span { font-size: 11px; color: var(--ink-secondary); }
.term-pick-btn.term-1-card.active { background: #fff3d1; border-color: #d4892a; box-shadow: 0 3px 0 #b36b19; }
.term-pick-btn.term-2-card.active { background: #e3f7ec; border-color: #3d8b6c; box-shadow: 0 3px 0 #2b6b51; }

.diff-tabs-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; margin-bottom: 10px; }
.diff-tab-btn { padding: 8px 6px; border-radius: var(--rad-md); background: var(--paper-kraft); border: 2px solid var(--paper-kraft-deep); color: var(--ink-secondary); font-size: 12px; font-weight: 900; text-align: center; }
.diff-tab-btn.active { color: #ffffff; border-color: rgba(0, 0, 0, 0.25); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
.zhe-rec-tag { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px; background: #ffd166; border: 1.5px solid #b86214; color: #4a2204; font-size: 10.5px; font-weight: 900; animation: gachaPulse 1.6s infinite ease-in-out; }

.menu-modal { max-width: 460px; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-tile { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--paper-white); border: 2px solid var(--paper-kraft-deep); border-radius: var(--rad-lg); box-shadow: 0 4px 0 #c9ae82; text-align: left; color: var(--ink-primary); }
.menu-tile.muted { background: #ebe4d6; opacity: 0.72; }
.menu-tile-txt { display: flex; flex-direction: column; gap: 2px; }
.menu-tile-txt strong { font-size: 13.5px; font-weight: 900; }
.menu-tile-txt span { font-size: 11px; color: var(--ink-secondary); }

.gacha-modal { max-width: 520px; }
.gacha-balance-row { display: flex; align-items: center; justify-content: space-around; gap: 10px; padding: 8px 12px; background: #fff6db; border: 2px dashed #d49a2a; border-radius: var(--rad-md); margin-bottom: 12px; }
.gacha-stage { position: relative; min-height: 255px; border-radius: var(--rad-lg); background: radial-gradient(circle at 50% 45%, #fffdf7 0%, #f1e3c6 72%, #e0caa1 100%); border: 2.5px solid #c9ae82; padding: 18px 14px; display: flex; align-items: center; justify-content: center; text-align: center; margin-bottom: 14px; overflow: hidden; }
.gacha-stage-inner { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.gacha-hero-icon { width: 108px; height: 108px; }
.gacha-prompt { font-size: 14px; font-weight: 900; color: var(--ink-primary); }
.gacha-rates { font-size: 11.5px; color: var(--ink-secondary); }
.mystery-box-btn { width: 146px; height: 146px; border-radius: 26px; background: radial-gradient(circle, rgba(255, 224, 130, 0.55) 0%, rgba(255, 224, 130, 0) 70%); padding: 10px; }
.mystery-box-visual { width: 100%; height: 100%; }
@keyframes boxShake1 { 0%, 100% { transform: rotate(0deg) scale(1); } 25% { transform: rotate(-10deg) scale(1.08); } 75% { transform: rotate(10deg) scale(1.08); } }
@keyframes boxShake2 { 0%, 100% { transform: rotate(0deg) scale(1.04); } 20% { transform: rotate(-15deg) scale(1.16); } 60% { transform: rotate(15deg) scale(1.16); } }
.mystery-box-btn.shake-1 { animation: boxShake1 0.35s ease; }
.mystery-box-btn.shake-2 { animation: boxShake2 0.35s ease; filter: drop-shadow(0 0 18px #ffd166); }
.gacha-tap-hint { font-size: 15px; font-weight: 900; color: #8a4408; }
.tap-dots-row { display: flex; gap: 8px; }
.tap-dot { width: 14px; height: 14px; border-radius: 50%; background: #d8c6a6; border: 2px solid #9f8258; }
.tap-dot.filled { background: #ffd166; border-color: #c96f2d; box-shadow: 0 0 8px #ffd166; }
.rarity-pill { font-size: 12px; font-weight: 900; padding: 3px 12px; border-radius: 999px; color: #ffffff; }
.rarity-pill.common { background: #5c8a72; }
.rarity-pill.rare { background: #d97a2b; box-shadow: 0 0 12px rgba(217, 122, 43, 0.45); }
.rarity-pill.legendary { background: linear-gradient(90deg, #e69d1e, #d9534f, #8b5cf6); box-shadow: 0 0 16px rgba(255, 209, 102, 0.85); }
.gacha-prize-visual { width: 118px; height: 118px; animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.gacha-prize-name { font-size: 18px; font-weight: 900; color: var(--ink-primary); }
.gacha-prize-desc { font-size: 12.5px; color: var(--ink-secondary); max-width: 340px; }
.gacha-prize-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.gacha-draw-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.hub-modal { max-width: 720px; }
.hub-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.hub-tab { padding: 9px 6px; border-radius: var(--rad-md); background: var(--paper-kraft); border: 2px solid var(--paper-kraft-deep); color: var(--ink-secondary); font-size: 12.5px; font-weight: 900; white-space: nowrap; }
.hub-tab.active { background: linear-gradient(180deg, #ffe294, #f4b24e); border-color: #c96f2d; color: #3d2308; box-shadow: 0 3px 0 #a85c18; }
.hub-preview-banner { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: linear-gradient(135deg, #fffdf7, #fff3d4); border: 2px dashed #d49a2a; border-radius: var(--rad-lg); margin-bottom: 12px; }
.hub-zhe-stage { width: 86px; height: 86px; min-width: 86px; background: #ffffff; border-radius: 20px; border: 2px solid #e3b254; padding: 4px; }
.hub-cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.hub-item-card { background: #efe7d8; border: 2px solid #cbb99d; border-radius: var(--rad-lg); padding: 10px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 5px; opacity: 0.72; }
.hub-item-card.unlocked { opacity: 1; background: var(--paper-white); border-color: #d49a2a; box-shadow: 0 3px 0 #b88121; }
.hub-item-card.active { background: var(--good-tint); border-color: var(--good-paper); box-shadow: 0 3px 0 #245c45; }
.hub-item-vis { width: 64px; height: 64px; }
.hub-item-title { font-size: 13px; font-weight: 900; color: var(--ink-primary); }
.hub-item-sub { font-size: 10.5px; color: var(--ink-secondary); line-height: 1.35; }
.hub-item-btn { width: 100%; padding: 6px 8px; border-radius: 9px; font-size: 11.5px; font-weight: 900; border: 1.5px solid #c9ae82; background: var(--paper-kraft); color: var(--ink-primary); }
.hub-item-card.active .hub-item-btn { background: var(--good-paper); border-color: #215741; color: #ffffff; }

.voucher-shop-list { display: flex; flex-direction: column; gap: 10px; }
.voucher-shop-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: linear-gradient(135deg, #fffdf7 0%, #fff4d6 100%); border: 2px solid #d49a2a; border-radius: var(--rad-lg); box-shadow: 0 4px 0 #b88121; }
.voucher-shop-info { flex: 1; min-width: 0; }
.voucher-shop-title { font-size: 15px; font-weight: 900; color: #4a2906; }
.voucher-shop-desc { font-size: 12px; color: var(--ink-secondary); margin-top: 2px; }
.voucher-modal { max-width: 460px; text-align: center; }
.golden-ticket-card { position: relative; padding: 18px 16px; border-radius: 18px; background: linear-gradient(135deg, #fff9e3 0%, #ffe08a 45%, #f4b24e 100%); border: 3px double #8a4b08; box-shadow: 0 10px 26px rgba(138, 75, 8, 0.32); color: #3d2105; text-align: center; margin-bottom: 10px; }
.ticket-kicker { font-size: 11px; font-weight: 900; letter-spacing: 2px; color: #7c3c06; margin-bottom: 6px; }
.ticket-zhe-wrap { width: 82px; height: 82px; margin: 0 auto 6px; }
.ticket-prize-big { font-size: 20px; font-weight: 900; color: #3d1c02; padding: 8px 10px; background: rgba(255, 253, 247, 0.78); border: 2px dashed #b86b14; border-radius: 12px; margin: 8px 0; }
.ticket-meta { font-size: 12px; font-weight: 800; color: #633308; line-height: 1.6; }
.voucher-tip { font-size: 12px; color: var(--ink-secondary); margin-top: 6px; }

.reward-admin-box { background: #fff9eb; border-color: #d49a2a; }
.parent-rewards-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.parent-rw-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; background: #ffffff; border: 1.5px solid #e0cba6; border-radius: 9px; font-size: 12.5px; }
.add-reward-form { display: grid; grid-template-columns: 1fr 92px auto; gap: 6px; margin-bottom: 10px; }
.add-reward-form input { padding: 8px 10px; border-radius: 9px; border: 1.5px solid var(--paper-kraft-deep); background: #ffffff; font-size: 13px; font-weight: 700; font-family: inherit; }
.vouchers-history-wrap { display: flex; flex-direction: column; gap: 5px; }

.step-indicators { display: flex; gap: 6px; }
.step-chip { font-size: 11px; font-weight: 900; padding: 4px 9px; border-radius: 999px; background: var(--paper-kraft); color: var(--ink-secondary); }
.step-chip.active { background: var(--warm-bulb); color: #452505; }
.role-cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.role-card { background: linear-gradient(180deg, #fffdf7 0%, #f5ecdc 100%); border: 2px solid var(--paper-kraft-deep); border-radius: var(--rad-lg); padding: 12px 8px 14px; text-align: center; box-shadow: 0 4px 0 #c9ae82; display: flex; flex-direction: column; align-items: center; }
.role-card.selected { background: linear-gradient(180deg, #fffdf4 0%, #ffefc2 100%); border-color: var(--warm-amber-dark); box-shadow: 0 4px 0 var(--warm-amber-dark), 0 0 0 3px var(--warm-glow); }
.role-preview-slot { width: 100%; height: 158px; margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 65%, rgba(255, 214, 102, 0.24) 0%, rgba(255, 253, 247, 0) 70%); border-radius: var(--rad-md); }
.role-preview-slot .craft-player-img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 6px rgba(58, 40, 24, 0.28)); }
.role-name { font-size: 14px; font-weight: 900; color: var(--ink-primary); }
.role-desc { font-size: 11px; color: var(--ink-secondary); margin-top: 3px; line-height: 1.35; }
.paper-field { margin-bottom: 12px; }
.paper-field label { display: block; font-size: 12.5px; font-weight: 900; color: var(--ink-secondary); margin-bottom: 5px; }
.paper-field input { width: 100%; padding: 10px 13px; border-radius: var(--rad-md); border: 2px solid var(--paper-kraft-deep); background: var(--paper-white); color: var(--ink-primary); font-size: 15px; font-weight: 800; font-family: inherit; }
.info-callout { padding: 10px 12px; background: var(--good-tint); border: 1.5px dashed var(--good-paper); border-radius: var(--rad-md); font-size: 12.5px; color: #215741; line-height: 1.5; }

.bldg-progress-card { background: #fff6db; border: 2px dashed var(--warm-amber-dark); border-radius: var(--rad-lg); padding: 11px 14px; margin-bottom: 12px; }
.bldg-prog-top { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 900; color: #5e340b; margin-bottom: 6px; }
.bldg-prog-track { height: 10px; background: rgba(255, 255, 255, 0.85); border: 1.5px solid #d49a2a; border-radius: 999px; overflow: hidden; }
.bldg-prog-fill { height: 100%; background: linear-gradient(90deg, #ffd166, #f4a261); transition: width 0.4s ease; }
.levels-list { display: flex; flex-direction: column; gap: 10px; }
.level-paper-card { background: var(--paper-white); border: 2px solid var(--paper-kraft-deep); border-radius: var(--rad-lg); padding: 12px 14px; box-shadow: 0 4px 0 #c9ae82; }
.level-paper-card.cleared { background: #f4fbf7; border-color: var(--good-paper); box-shadow: 0 4px 0 #2b6b51; }
.level-head-row { display: flex; align-items: center; gap: 10px; }
.level-num-seal { width: 34px; height: 34px; border-radius: 10px; background: var(--warm-bulb); color: #452505; font-size: 15px; font-weight: 900; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1.5px solid #d49a2a; }
.level-paper-card.cleared .level-num-seal { background: var(--good-paper); color: #ffffff; border-color: #245c45; }
.level-meta { flex: 1; min-width: 0; }
.level-title { font-size: 14.5px; font-weight: 900; color: var(--ink-primary); }
.level-desc { font-size: 12px; color: var(--ink-secondary); margin-top: 2px; }
.mode-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; background: #f2e8d7; border: 1.5px solid #c9ae82; font-size: 11px; font-weight: 900; color: #5c4028; white-space: nowrap; }
.level-btns-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.btn-play-quick { padding: 9px; border-radius: var(--rad-md); background: linear-gradient(180deg, #ffe08a, #f4b24e); color: #3d2308; border: 1.5px solid #d4892a; box-shadow: 0 3px 0 #b36b19; font-size: 13px; font-weight: 900; }
.btn-play-full { padding: 9px; border-radius: var(--rad-md); background: linear-gradient(180deg, #56a887, #3d8b6c); color: #ffffff; border: 1.5px solid #2b6b51; box-shadow: 0 3px 0 #1f523d; font-size: 13px; font-weight: 900; }
.btn-play-locked { grid-column: 1 / -1; padding: 9px; border-radius: var(--rad-md); background: #e8dfd0; color: var(--ink-muted); font-size: 12.5px; font-weight: 800; border: none; }

.mode-strip { display: flex; align-items: center; gap: 8px; padding: 10px 13px; border-radius: var(--rad-md); background: #4a3425; color: #fff6db; font-size: 13.5px; font-weight: 800; margin-bottom: 12px; }
.guide-scroll-box { background: var(--paper-white); border: 2px dashed var(--paper-kraft-deep); border-radius: var(--rad-lg); padding: 12px 14px; margin-bottom: 12px; }
.guide-scroll-head { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 900; color: var(--warm-amber-dark); margin-bottom: 7px; }
.tips-list { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.5; }
.guide-reward-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #fff6db; border: 2px solid #e3b254; border-radius: var(--rad-lg); }
.reward-emblem { width: 48px; height: 48px; flex-shrink: 0; }
.reward-kicker { font-size: 11px; font-weight: 800; color: #9c5b14; }
.reward-title { font-size: 15px; font-weight: 900; color: var(--ink-primary); }
.reward-sub { font-size: 12px; color: var(--ink-secondary); }

.arena-modal { max-width: 740px; padding: 14px 16px; }
.arena-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.arena-title-wrap { display: flex; align-items: center; gap: 8px; }
.arena-title { font-size: 14px; font-weight: 900; color: var(--ink-primary); }
.arena-mode-tag { font-size: 11px; font-weight: 900; background: #4a3425; color: #ffe08a; padding: 3px 9px; border-radius: 999px; }
.arena-metrics { display: flex; align-items: center; gap: 6px; }
.metric-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; background: var(--paper-white); border: 1.5px solid var(--paper-kraft-deep); font-size: 12px; font-weight: 900; }
.metric-pill.combo { background: #fff6db; border-color: #d49a2a; color: #8a4b08; }
.metric-pill.count { background: var(--good-tint); border-color: var(--good-paper); color: #215741; }
.arena-question-strip { display: flex; align-items: center; gap: 10px; background: var(--paper-white); border: 2px solid var(--paper-kraft-deep); border-radius: var(--rad-lg); padding: 9px 12px; margin-bottom: 10px; box-shadow: 0 3px 0 #c9ae82; }
.btn-gramophone { display: inline-flex; align-items: center; gap: 5px; padding: 8px 11px; border-radius: var(--rad-md); background: linear-gradient(180deg, #ffe08a, #f4b24e); color: #452505; border: 1.5px solid #d4892a; box-shadow: 0 3px 0 #b36b19; font-size: 12.5px; font-weight: 900; white-space: nowrap; flex-shrink: 0; }
.arena-q-text { font-size: 16px; font-weight: 900; line-height: 1.45; color: var(--ink-primary); }
.arena-stage-frame { position: relative; width: 100%; height: 215px; border-radius: var(--rad-lg); overflow: hidden; border: 3px solid var(--wood-frame); background: #3d2c20; margin-bottom: 10px; box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35); }
#arena-canvas { display: block; width: 100%; height: 100%; cursor: pointer; touch-action: manipulation; }
.arena-options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 9px; }
.craft-option-btn { display: flex; align-items: center; gap: 9px; padding: 10px 12px; background-color: var(--paper-white); background-image: var(--paper-grain); border: 2px solid var(--paper-kraft-deep); border-radius: var(--rad-md); box-shadow: 0 4px 0 #b5976b; color: var(--ink-primary); font-size: 15px; font-weight: 900; text-align: left; }
.opt-key-seal { width: 26px; height: 26px; border-radius: 8px; background: var(--paper-kraft); color: #4a3425; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 900; flex-shrink: 0; }
.craft-option-btn.eliminated { opacity: 0.25; text-decoration: line-through; pointer-events: none; }
.craft-option-btn.correct { background: var(--good-paper) !important; border-color: #215741 !important; box-shadow: 0 4px 0 #194232 !important; color: #ffffff !important; }
.craft-option-btn.correct .opt-key-seal { background: #ffffff; color: var(--good-paper); }
.craft-option-btn.wrong { background: var(--bad-paper) !important; border-color: #8f352e !important; box-shadow: 0 4px 0 #702620 !important; color: #ffffff !important; }
.craft-option-btn.wrong .opt-key-seal { background: #ffffff; color: var(--bad-paper); }
.arena-tools-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.tool-card-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 6px; border-radius: var(--rad-sm); font-size: 12px; font-weight: 900; border: 1.5px solid var(--paper-kraft-deep); background: var(--paper-kraft); color: var(--ink-primary); box-shadow: 0 3px 0 #9f8258; }
.tool-card-btn.ult:not(:disabled) { background: linear-gradient(180deg, #ffe08a, #f4a261); border-color: var(--warm-amber-dark); color: #452505; box-shadow: 0 3px 0 var(--warm-amber-dark); }
.hints-drawer { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.hint-strip-item { padding: 7px 10px; background: #fff6db; border-left: 4px solid var(--warm-amber-dark); border-radius: 6px; font-size: 12.5px; color: #4a2906; line-height: 1.45; }
.arena-footer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; min-height: 46px; }
.arena-mascot-feedback { display: flex; align-items: center; gap: 8px; flex: 1; }
.mini-mascot-slot { width: 48px; height: 48px; min-width: 48px; }
.arena-feedback-text { font-size: 13.5px; font-weight: 800; color: var(--ink-primary); }
.arena-feedback-text.good { color: var(--good-paper); }
.arena-feedback-text.bad { color: var(--bad-paper); }

.workshop-balance { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 13px; background: #fff6db; border: 2px dashed #d49a2a; border-radius: var(--rad-md); margin-bottom: 12px; font-size: 12.5px; flex-wrap: wrap; }
.balance-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: #6b3b09; font-weight: 800; }
.workshop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.workshop-card { background: var(--paper-white); border: 2px solid var(--paper-kraft-deep); border-radius: var(--rad-lg); padding: 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; box-shadow: 0 4px 0 #c9ae82; }
.ws-head { display: flex; align-items: center; gap: 10px; }
.ws-ico { width: 40px; height: 40px; flex-shrink: 0; }
.ws-name { font-size: 14.5px; font-weight: 900; }
.ws-lv { font-size: 11.5px; font-weight: 900; color: var(--warm-amber-dark); }
.ws-desc { font-size: 12px; color: var(--ink-secondary); line-height: 1.4; }

.result-modal { text-align: center; max-width: 480px; }
.result-visual { width: 106px; height: 106px; margin: 0 auto 8px; }
.result-heading { font-size: 20px; font-weight: 900; color: #7c420e; }
.result-score { font-size: 13.5px; color: var(--ink-secondary); margin: 6px 0 14px; font-weight: 700; }
.result-reward-box { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; background: var(--good-tint); border: 2px solid var(--good-paper); border-radius: var(--rad-lg); text-align: left; }

.gate-modal { max-width: 400px; text-align: center; }
.gate-math-box { font-size: 28px; font-weight: 900; letter-spacing: 2px; padding: 14px; margin-bottom: 12px; background: var(--paper-white); border: 2px dashed var(--paper-kraft-deep); border-radius: var(--rad-md); }
.gate-error { font-size: 12.5px; font-weight: 800; color: var(--bad-paper); min-height: 18px; }

.parent-dash-modal { max-width: 780px; }
.parent-kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi-card { background: var(--paper-white); border: 1.5px solid var(--paper-kraft-deep); border-radius: var(--rad-md); padding: 10px 12px; }
.kpi-label { font-size: 11px; font-weight: 800; color: var(--ink-muted); }
.kpi-val { font-size: 19px; font-weight: 900; color: var(--ink-primary); margin-top: 2px; }
.parent-analytics-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.parent-panel-box { background: var(--paper-white); border: 1.5px solid var(--paper-kraft-deep); border-radius: var(--rad-lg); padding: 12px 14px; margin-bottom: 10px; }
.parent-panel-box h3 { font-size: 13.5px; font-weight: 900; color: var(--ink-primary); margin-bottom: 8px; }
.radar-holder { width: 100%; max-width: 260px; margin: 0 auto; }
.weakness-list, .mistake-list { display: flex; flex-direction: column; gap: 7px; max-height: 200px; overflow-y: auto; }
.weak-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; background: #faf5eb; border-radius: var(--rad-sm); font-size: 12.5px; }
.mistake-row { padding: 8px 10px; background: var(--bad-tint); border-left: 3px solid var(--bad-paper); border-radius: 6px; font-size: 12.5px; line-height: 1.45; }

/* ============================================================================
   手機與平板自適應
   ============================================================================ */
@media (max-width: 680px) {
  #game-client { border-width: 4px; }
  #hud-top { top: 7px; left: 7px; right: 7px; gap: 4px; }
  .passport-avatar { width: 32px; height: 32px; min-width: 32px; }
  .passport-sub-row { display: none; }
  .grade-term-bookmark { padding: 5px 8px; font-size: 11px; }
  .daily-quest-pill { height: 29px; padding: 0 8px; font-size: 11px; }
  .res-chip { padding: 3px 7px 3px 5px; font-size: 11px; }
  .clear-pill-btn { height: 29px; padding: 0 7px; font-size: 11px; }
  .clear-pill-btn.icon-only { width: 30px; }
  .mascot-avatar-btn { width: 56px; height: 56px; min-width: 56px; }
  .mascot-speech { font-size: 11.5px; }
  .main-dock-btn { padding: 9px 3px; font-size: 12.5px; gap: 4px; }

  .role-cards-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .role-card { padding: 8px 5px 10px; }
  .role-preview-slot { height: 124px; margin-bottom: 6px; }
  .role-name { font-size: 12px; }
  .role-desc { font-size: 10px; }

  .menu-grid,
  .gacha-draw-bar,
  .arena-options-grid,
  .workshop-grid,
  .parent-analytics-split,
  .terms-2-grid,
  .engine-switch-grid,
  .exam-timer-grid { grid-template-columns: 1fr; }
  .hub-cards-grid { grid-template-columns: repeat(2, 1fr); }
  .hub-tabs { grid-template-columns: repeat(2, 1fr); }
  .add-reward-form { grid-template-columns: 1fr; }
  .parent-kpi-grid { grid-template-columns: 1fr; }
  .arena-stage-frame { height: 175px; }
}

/* ============================================================================
   A4 列印樣式
   ============================================================================ */
.a4-print-only { display: none; }
@media print {
  html, body { height: auto !important; overflow: visible !important; background: #ffffff !important; color: #000000 !important; }
  #game-client, .modal-backdrop { display: none !important; }
  #a4-print-sheet { display: block !important; width: 100%; padding: 12mm 14mm; font-family: "Noto Sans TC", "PingFang HK", "Microsoft JhengHei", serif; color: #111111; }
  .a4-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #222222; padding-bottom: 8px; margin-bottom: 14px; }
  .a4-title { font-size: 20px; font-weight: 900; }
  .a4-meta { font-size: 12px; line-height: 1.6; text-align: right; }
  .a4-q-item { margin-bottom: 14px; page-break-inside: avoid; }
  .a4-q-stem { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
  .a4-q-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 14px; font-size: 13px; padding-left: 18px; }
  .a4-answer-page { page-break-before: always; padding-top: 8px; }
  .a4-ans-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 12.5px; margin-top: 10px; }
  .print-voucher-box { border: 4px double #222222; border-radius: 16px; padding: 24px; max-width: 150mm; margin: 20mm auto; text-align: center; }
}
