/* 正式學習島:接在引擎 style.css、展場版 expo.css / quest.css(vision.css 由 vision.js 載入)後面。
   明亮兒童風:白 / 奶油底,黃綠藍橘四座島的主色;字大、按鈕大,手機平板點得到。 */

/* ---------- 模擬模式提示(右下角小字,截圖時看得出是哪一種模式) ---------- */
.tmi-mode { position: absolute; z-index: 21; left: 50%; bottom: 8px; transform: translateX(-50%); margin: 0; padding: 4px 12px; border-radius: 999px;
  background: rgba(255, 246, 214, .92); color: #8a5a00; font-size: 12px; font-weight: 800; pointer-events: none; box-shadow: var(--shadow-s); white-space: nowrap; }
body.xp-quest .tmi-mode { display: none; }

/* ---------- AI 護照:9 課分三章 + 桌寵 ---------- */
.tmi-pp #xp-stamps { gap: 4px; }
.tmi-pp #xp-stamps li.tmi-ch-start:not(:first-child) { margin-left: 8px; padding-left: 8px; border-left: 2px dashed var(--line); }
.tmi-pp #xp-stamps button { width: 46px; }
.tmi-pp .xp-st { width: 42px; height: 37px; font-size: 14px; letter-spacing: -.02em; }
.tmi-pp .round .xp-st { width: 37px; height: 37px; font-size: 18px; }
.tmi-pp .xp-st-lab { font-size: 11px; }
.tmi-pp #xp-stamps .locked { opacity: .45; }
.tmi-pp #xp-stamps .locked .xp-st::after { content: "🔒"; position: absolute; font-size: 11px; transform: translate(14px, -12px); }
.tmi-pp .xp-st { position: relative; }
body.xp-quest .tmi-pp .xp-st { width: 36px; height: 32px; font-size: 12.5px; }
body.xp-quest .tmi-pp .round .xp-st { width: 32px; height: 32px; font-size: 15px; }
body.xp-quest .tmi-pp #xp-stamps button { width: 40px; }

/* ---------- 攤位:一章三課的選單 ---------- */
.tmi-picks { display: grid; gap: 8px; margin: 12px 0 8px; padding: 0; list-style: none; text-align: left; }
.tmi-pick { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 10px; padding: 10px 12px; border-radius: 18px; background: #fff;
  box-shadow: inset 0 0 0 2px var(--line); }
.tmi-pick.next { box-shadow: inset 0 0 0 3px var(--c), 0 6px 16px rgba(48, 78, 70, .12); background: color-mix(in srgb, var(--c) 8%, #fff); }
.tmi-pick.done { background: #f4fbf6; }
.tmi-pick.locked { opacity: .6; }
.tmi-pick-code { display: grid; place-items: center; width: 48px; height: 42px; clip-path: var(--hex); background: var(--c); color: #fff; font-weight: 900; font-size: 15px; }
.tmi-pick-t { font-size: 17px; font-weight: 900; line-height: 1.35; }
.tmi-pick .xp-btn { min-height: 42px; padding: 0 16px; font-size: 15px; }
.tmi-pick-ok { grid-column: 2; font-size: 13px; font-weight: 900; color: #23805a; }
.tmi-pick-s { font-size: 13px; font-weight: 800; color: var(--soft); }
.xp-sheet-chapter { width: min(560px, 100%); }
.tmi-parent { padding: 10px 14px; border-radius: 16px; background: #fff6dc; font-size: 15px; }
.xp-sheet a.xp-btn { text-decoration: none; }

/* ---------- 一課:三扇視窗 ---------- */
.xq-comicview { --k: #f4b63f; }
.xq-lessontext { --k: #4a97dd; }
.xq-quiz { --k: #3fae7a; }
.xv .xq-props > .xq-comicview { width: min(600px, 100%); height: 100%; }
.xv .xq-props > .xq-lessontext, .xv .xq-props > .xq-quiz { width: min(600px, 100%); height: 100%; }
.xq-comicview .xq-card-body, .xq-lessontext .xq-card-body, .xq-quiz .xq-card-body { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.xq-lessontext .xq-card-body, .xq-quiz .xq-card-body { padding: 16px 22px 22px; }

/* 漫畫 */
/* 圖片照視窗高度整張縮進來(桌機):用絕對定位 + contain,百分比高度在 flex 裡才算得準 */
.tmi-comic-frame { position: relative; flex: 1 1 0; min-height: 0; padding: 0; border: 0; border-radius: 16px; background: #fff; cursor: zoom-in; touch-action: pan-y; container-type: inline-size;
  box-shadow: inset 0 0 0 3px #3d5175, 3px 3px 0 rgba(61, 81, 117, .2); }
.tmi-comic-img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; -webkit-user-drag: none; user-select: none; }
.tmi-comic-nav { justify-content: center; flex: none; }
.tmi-page-no { min-width: 6.5em; text-align: center; font-weight: 900; color: var(--soft); font-variant-numeric: tabular-nums; }
.tmi-alt-box { flex: none; padding: 6px 12px; border-radius: 14px; background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 1.5px var(--line); }
.tmi-alt-box summary { cursor: pointer; font-size: 14px; font-weight: 900; color: #2d4a78; }
.tmi-alt { margin: 6px 0 4px; font-size: 15px; line-height: 1.7; color: #2d4a78; font-weight: 600; }
/* 疊字漫畫格的對白(這一堂的漫畫字都畫在圖裡,沒用到;老師加了對白行時才會出現) */
.tmi-balloons { position: absolute; inset: 0; pointer-events: none; font-size: clamp(12px, 3.4cqw, 17px); }
.tmi-bln { position: absolute; max-width: 46%; padding: .45em .7em; border-radius: 1em; background: #fff; border: 2.5px solid #c9b89a; font-weight: 700; line-height: 1.45; color: #243b5e; box-shadow: 0 2px 6px rgba(45, 74, 120, .18); }
.tmi-bln b { display: inline-block; margin-right: .4em; padding: 0 .5em; border-radius: 999px; background: #e8dcc4; font-size: .82em; }
.tmi-bln[data-who="探長"] { border-color: #e8b21f; } .tmi-bln[data-who="探長"] b { background: #f7c948; }
.tmi-bln[data-who="奇奇"] { border-color: #7fb2dd; } .tmi-bln[data-who="奇奇"] b { background: #b7d6ef; }
.tmi-bln[data-who="望望"] { border-color: #5b93c9; } .tmi-bln[data-who="望望"] b { background: #cfe4f6; }
.tmi-bln[data-who="唬唬"] { border-color: #9b8bc4; } .tmi-bln[data-who="唬唬"] b { background: #c3b8e4; }
.tmi-bln.think { border-radius: 1.4em; }
.tmi-bln.narrate { border-radius: 6px; border-color: #3d5175; background: #fffdf6; color: #2d4a78; }
.tmi-bln.z-左上 { left: 3.5%; top: 4%; } .tmi-bln.z-中上 { left: 50%; top: 4%; transform: translateX(-50%); } .tmi-bln.z-右上 { right: 3.5%; top: 4%; }
.tmi-bln.z-左下 { left: 3.5%; bottom: 4%; } .tmi-bln.z-中下 { left: 50%; bottom: 4%; transform: translateX(-50%); } .tmi-bln.z-右下 { right: 3.5%; bottom: 4%; }

/* 放大的漫畫 */
.tmi-zoom { position: fixed; inset: 0; z-index: 90; background: rgba(45, 74, 120, .9); display: flex; }
.tmi-zoom-scroll { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; padding: 56px 12px 64px; }
.tmi-zoom-scroll img { width: 100%; max-width: 900px; height: auto; border-radius: 12px; background: #fff; }
.tmi-zoom-x { position: fixed; right: 14px; top: 12px; height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: #fff; color: #2d4a78; font: 900 16px/1 var(--font); cursor: pointer; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.tmi-zoom-nav { position: fixed; top: 50%; width: 56px; height: 56px; margin-top: -28px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #2d4a78; font: 900 32px/1 var(--font); cursor: pointer; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.tmi-zoom-nav.prev { left: 12px; } .tmi-zoom-nav.next { right: 12px; }
.tmi-zoom-nav:disabled { opacity: .25; cursor: default; }
.tmi-zoom-no { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; padding: 6px 16px; border-radius: 999px; background: #fff; color: #2d4a78; font-weight: 900; }

/* 課文(照正式站 prose-lesson 的感覺:大字、行距寬、深藍標題) */
.tmi-prose { color: #34433f; font-size: 17px; line-height: 1.8; }
.tmi-prose > :first-child { margin-top: 0; }
.tmi-kicker { margin: 0; font-size: 13px; font-weight: 900; letter-spacing: .12em; color: #2f78bd; }
.tmi-prose h1 { margin: 2px 0 12px; font-size: 26px; font-weight: 900; line-height: 1.35; color: var(--ink); }
.tmi-sub { margin: -6px 0 12px; font-weight: 700; color: var(--soft); }
.tmi-prose h2 { margin: 22px 0 8px; padding-left: 12px; border-left: 6px solid #ffd24a; font-size: 21px; font-weight: 900; color: #2d4a78; line-height: 1.4; }
.tmi-prose p { margin: 10px 0; }
.tmi-prose ul, .tmi-prose ol { margin: 8px 0 12px; padding-left: 1.4em; }
.tmi-prose li { margin: 5px 0; }
.tmi-prose li::marker { color: #e8a522; font-weight: 900; }
.tmi-prose strong { color: #c2410c; font-weight: 900; }
.tmi-prose code { padding: 1px 6px; border-radius: 6px; background: #f1ece0; font: 700 .9em Consolas, "Cascadia Mono", monospace; color: #8a3b12; }
.tmi-prose pre { overflow-x: auto; padding: 12px 14px; border-radius: 14px; background: #263238; color: #eceff1; font: 14px/1.6 Consolas, "Cascadia Mono", monospace; }
.tmi-prose pre code { padding: 0; background: none; color: inherit; }
.tmi-prose a { color: #2f78bd; font-weight: 800; text-decoration-style: wavy; }
.tmi-prose blockquote { margin: 14px 0; padding: 12px 16px; border-left: 5px solid #ffd24a; border-radius: 0 14px 14px 0; background: #fffdf6; color: #2d4a78; font-size: 18px; font-weight: 800; line-height: 1.75; }
.tmi-prose blockquote p { margin: 2px 0; }
.tmi-fig { margin: 14px 0; } .tmi-fig img { width: 100%; border-radius: 16px; border: 2px solid #f1ece0; } .tmi-fig figcaption { margin-top: 4px; font-size: 14px; font-weight: 800; color: #9aa5a1; }
.tmi-box { margin: 16px 0; overflow: hidden; border-radius: 16px; border: 3px solid #3d5175; background: #fff; }
.tmi-box-h { display: flex; gap: 8px; padding: 8px 14px; background: #3d5175; color: #fff; font-weight: 900; }
.tmi-box-b { padding: 8px 14px; font-weight: 700; color: #2d4a78; }
.tmi-prompt { display: grid; gap: 8px; margin: 14px 0; } .tmi-prompt pre { white-space: pre-wrap; }
.tmi-pill { display: inline-block; padding: 10px 20px; border-radius: 999px; background: #ffd24a; color: var(--ink) !important; text-decoration: none !important; font-weight: 900; }
.tmi-check { list-style: none; padding: 0 !important; }
.tmi-check label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); cursor: pointer; }
.tmi-check input { width: 22px; height: 22px; margin-top: 3px; accent-color: #3fae7a; }

/* 小考(照正式站 QuizRunner) */
.tmi-quiz-banner { margin: 0 0 4px; padding: 10px 14px; border-radius: 16px; font-size: 15px; font-weight: 900; background: #fff6d6; color: #5d4a12; box-shadow: inset 0 0 0 2px #ffe08a; }
.tmi-quiz-banner.ok { background: #e9f8ef; color: #23805a; box-shadow: inset 0 0 0 2px #9fdcb7; }
.tmi-quiz-banner.bad { background: #fff0ee; color: #c2410c; box-shadow: inset 0 0 0 2px #ffc3b5; }
.tmi-q { margin: 0; padding: 14px 16px 12px; border: 0; border-radius: 22px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); display: grid; gap: 8px; }
.tmi-q legend { float: left; width: 100%; margin-bottom: 4px; padding: 0; font-size: 17px; font-weight: 900; line-height: 1.5; color: var(--ink); }
.tmi-q.wrong { box-shadow: inset 0 0 0 3px #f39b85; background: #fffaf8; }
.tmi-opt { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 2px #ece6d6;
  font-size: 16px; font-weight: 700; line-height: 1.5; color: #4a5753; cursor: pointer; transition: box-shadow .15s, background .15s; }
.tmi-opt:hover { box-shadow: inset 0 0 0 2px #9cc8ef; }
.tmi-opt.on { background: #eef6ff; box-shadow: inset 0 0 0 3px #4a97dd; color: #1f5a92; }
.tmi-opt input { flex: none; width: 20px; height: 20px; accent-color: #4a97dd; }
.tmi-opt:has(input:disabled) { cursor: default; }
.tmi-q-hint { margin: 2px 0 0; padding: 8px 12px; border-radius: 14px; background: #fff0ee; color: #c2410c; font-size: 14.5px; font-weight: 800; }
.tmi-q-hint[hidden] { display: none; }
.tmi-submit { width: 100%; min-height: 52px; font-size: 18px; }
.tmi-submit[hidden] { display: none; }

/* ---------- 手機、直立平板 ---------- */
@media (max-width: 900px), (max-width: 1100px) and (orientation: portrait) {
  .tmi-pp #xp-stamps li.tmi-ch-start:not(:first-child) { margin-left: 2px; padding-left: 2px; border-left-width: 1.5px; }
  body.xp-map .tmi-pp #xp-stamps button, body.xp-quest .tmi-pp #xp-stamps button { width: auto; min-width: 0; flex: 1; }
  body.xp-map .tmi-pp #xp-stamps li, body.xp-quest .tmi-pp #xp-stamps li { flex: 1; min-width: 0; display: flex; }
  body.xp-map .tmi-pp .xp-st, body.xp-quest .tmi-pp .xp-st { width: 30px; height: 27px; font-size: 10.5px; margin: 0 auto; }
  body.xp-map .tmi-pp .round .xp-st, body.xp-quest .tmi-pp .round .xp-st { width: 27px; height: 27px; font-size: 13px; }
  body.xp-map .tmi-pp .xp-st-lab, body.xp-quest .tmi-pp .xp-st-lab { display: none; }
  .tmi-pp { padding-top: 6px !important; padding-bottom: 6px !important; }
  .tmi-mode { bottom: auto; top: calc(118px + var(--safe-t, 0px)); font-size: 11px; }
  .xq-lessontext .xq-card-body, .xq-quiz .xq-card-body { padding: 12px 14px 16px; }
  .tmi-prose { font-size: 16px; line-height: 1.75; }
  .tmi-prose h1 { font-size: 22px; }
  .tmi-prose h2 { font-size: 19px; }
  .tmi-comic-nav { order: -1; }   /* 手機:翻頁鈕放在圖上面,不用先捲到底才翻得到 */
  .tmi-comic-frame { flex: none; padding: 5px; }
  .tmi-comic-img { position: static; display: block; width: 100%; height: auto; }
  .tmi-q legend { font-size: 16px; }
  .tmi-opt { font-size: 15px; }
  .tmi-pick { grid-template-columns: auto 1fr; }
  .tmi-pick .xp-btn, .tmi-pick-s { grid-column: 1 / -1; }
  .tmi-pick-ok { grid-column: 1 / -1; }
}
