/* 國語五上學習樂園：iPad 觸控優先，低視覺干擾 */
/* 楷書：全字庫正楷體（數位發展部 CNS11643 全字庫，政府資料開放授權），只含網站用到的字，由 tools/build_font.py 產生 */
@font-face { font-family: 'TW-Kai'; src: url('fonts/twkai.woff2') format('woff2'); font-display: swap; }
:root {
  --bg: #F6F1E7;
  --card: #FFFFFF;
  --ink: #2A2825;
  --muted: #6E675D;
  --line: #E4DCCD;
  --soft: #FBF8F2;
  --accent: #2F6DB0;
  --accent-soft: #E3EDF8;
  --right: #2E8B57;
  --right-soft: #E2F3E8;
  --wrong: #C2554F;
  --wrong-soft: #FBE7E5;
  --reveal: #E8B63A;
  --reveal-soft: #FDF3D7;
  --star: #E8A92A;
  --c-chars: #2F6DB0;
  --c-words: #2E8B6E;
  --c-phrases: #3E8A99;
  --c-sentences: #C77A2B;
  --c-reading: #B04A6A;
  --c-lookalikes: #6A5AB0;
  --c-idioms: #A8553A;
  --c-review: #3A8C8C;
  --c-test: #4B5BA6;
  --c-listening: #2C7F8C;
  --c-rhetoric: #7A5C2E;
  --c-zhuyinGame: #85A5A1;
  --conn1: #D2553F;
  --conn2: #2F6DB0;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(60, 45, 20, .08);
  --font: 'Noto Sans TC', 'PingFang TC', 'Heiti TC', 'Microsoft JhengHei', sans-serif;
  --kai: 'TW-Kai', 'LXGW WenKai TC', 'Kaiti TC', 'BiauKai', 'DFKai-SB', serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-synthesis: none; /* 正楷體只有一種粗細，不要讓瀏覽器假加粗 */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── 版面 ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(246, 241, 231, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { font-weight: 700; font-size: 20px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.crumbs { flex: 1; min-width: 0; display: flex; gap: 6px; align-items: center; font-size: 17px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.crumbs a { color: var(--accent); text-decoration: none; padding: 6px 2px; }
.gear {
  position: relative; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); font-size: 22px;
  display: grid; place-items: center; flex: none;
}
.gear .ring { position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--accent); clip-path: inset(0 100% 0 0); }
.gear.holding .ring { animation: hold 1.5s linear forwards; }
@keyframes hold { to { clip-path: inset(0 0 0 0); } }

main { max-width: 920px; margin: 0 auto; padding: 18px 16px 40px; }
.footer { text-align: center; color: var(--muted); font-size: 15px; line-height: 1.8; padding: 24px 16px 40px; border-top: 1px solid var(--line); margin-top: 24px; }

h1, h2, h3 { margin: 0; line-height: 1.35; }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
h3 { font-size: 21px; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid var(--line); }

/* ── 按鈕 ── */
.btn {
  min-height: 56px; padding: 10px 22px; border-radius: 14px;
  border: 2px solid transparent; font-weight: 700; font-size: 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:disabled { background: #A9B8C9; }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-block { width: 100%; }
.say {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  border: 1px solid var(--line); background: var(--soft);
  display: inline-grid; place-items: center; font-size: 19px; padding: 0;
}
.say.speaking { background: var(--accent-soft); border-color: var(--accent); }

/* ── 首頁 ── */
.hero { margin-bottom: 18px; }
.hero p { margin: 6px 0 0; color: var(--muted); }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.lesson-tile {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; text-decoration: none; color: var(--ink);
  border-top: 6px solid var(--accent); min-height: 132px;
}
.lesson-tile.off { opacity: .55; border-top-color: var(--line); box-shadow: none; }
.lesson-tile .no { font-size: 16px; color: var(--muted); }
.lesson-tile .t { font-size: 23px; font-weight: 700; font-family: var(--kai); }
.lesson-tile .meta { margin-top: auto; display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--muted); }

/* ── 本課地圖 ── */
.lesson-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; margin-bottom: 18px; }
.lesson-head .kicker { color: var(--muted); font-size: 16px; }
.lesson-head h1 { font-family: var(--kai); font-size: 34px; }
.focus { margin-top: 10px; background: var(--soft); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; }
.focus b { display: block; font-size: 15px; color: var(--muted); }
.ring-wrap { text-align: center; min-width: 140px; }
.ring-wrap .num { font-size: 16px; color: var(--muted); }
.stars-total { font-size: 18px; margin-top: 4px; }
.section-label { margin: 22px 0 10px; font-size: 18px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.station {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
  border-top: 6px solid var(--mc, var(--accent)); display: flex; flex-direction: column; gap: 8px;
}
.station.locked { opacity: .55; }
.station .icon { width: 48px; height: 48px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; font-size: 26px; }
.station .desc { color: var(--muted); font-size: 17px; }
.station .status { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--muted); }
.station .go { margin-top: auto; background: var(--mc, var(--accent)); color: #fff; }
.station .badge-next {
  position: absolute; top: -16px; left: 16px; background: var(--reveal-soft); color: #8A6400;
  border: 1px solid var(--reveal); border-radius: 999px; padding: 2px 12px; font-size: 15px; font-weight: 700;
}
.extra-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.extra-links a { text-decoration: none; }
.stars { color: var(--star); letter-spacing: 2px; white-space: nowrap; }
.stars .off { color: #D9CFBD; }

/* ── 活動頁 ── */
.task-head { margin-bottom: 14px; }
.task-title { display: flex; align-items: center; gap: 12px; }
.task-title .icon { font-size: 28px; }
.unit-pill { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: 16px; color: var(--muted); white-space: nowrap; }
/* 步驟選單：老師可以直接跳到某一步 */
.step-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.step-tab { font: inherit; font-size: 16px; min-height: 40px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink, inherit); cursor: pointer; }
.step-tab.on { background: var(--soft); background: color-mix(in srgb, var(--mc, var(--accent)) 16%, #fff); border-color: var(--mc, var(--accent)); font-weight: 700; }
.step-tab.done { color: var(--muted); }
.progress { height: 10px; border-radius: 99px; background: #E7DFD0; overflow: hidden; margin: 12px 0; }
.progress > i { display: block; height: 100%; background: var(--mc, var(--accent)); border-radius: 99px; transition: width .3s ease; }
.now {
  background: var(--card); border: 1px solid var(--line); border-left: 8px solid var(--mc, var(--accent));
  border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: center;
}
.now .lbl { font-size: 15px; color: var(--muted); }
.now .txt { font-size: 22px; font-weight: 700; line-height: 1.45; }
.now .step { font-size: 16px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.stage { margin-top: 16px; }

/* 題目 */
.qbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--muted); font-size: 17px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: #E2D9C8; }
.dots i.done { background: var(--mc, var(--accent)); }
.dots i.cur { background: var(--card); border: 3px solid var(--mc, var(--accent)); }
.prompt { text-align: center; padding: 10px 0 6px; }
.prompt .big { font-family: var(--kai); font-size: 110px; line-height: 1.15; }
.prompt .sentence { font-size: 28px; line-height: 1.8; font-family: var(--kai); }
.prompt .blank {
  display: inline-block; min-width: 1.6em; border-bottom: 3px solid var(--mc, var(--accent));
  color: var(--mc, var(--accent)); text-align: center; margin: 0 2px;
}
.prompt .sub { color: var(--muted); font-size: 19px; margin-top: 4px; }
.listen-btn {
  width: 120px; height: 120px; border-radius: 50%; font-size: 48px;
  border: 3px solid var(--mc, var(--accent)); background: var(--accent-soft);
}
.options { display: grid; gap: 12px; margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.options.long { grid-template-columns: 1fr; }
.opt {
  min-height: 72px; border-radius: 16px; border: 3px solid var(--line); background: var(--card);
  font-size: 26px; padding: 10px 16px; line-height: 1.4; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease, background .15s ease;
}
.opt.kai { font-family: var(--kai); font-size: 44px; min-height: 96px; white-space: nowrap; }
.options.wide { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.options.wide .opt.kai { font-size: 36px; }
.options.long .opt { font-size: 22px; justify-content: flex-start; text-align: left; }
.opt:active:not(:disabled) { transform: scale(.97); }
.opt.right { border-color: var(--right); background: var(--right-soft); }
.opt.wrong { border-color: var(--wrong); background: var(--wrong-soft); opacity: .55; }
.opt.gone { visibility: hidden; }
.options.long .row.gone { display: none; }
.opt.reveal { border-color: var(--reveal); background: var(--reveal-soft); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.shake { animation: shake .35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.hintbox { margin-top: 14px; background: var(--reveal-soft); border: 1px solid var(--reveal); border-radius: 14px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; font-size: 19px; }
.feedback { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.praise { text-align: center; font-size: 26px; font-weight: 700; color: var(--right); }
.tools { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }

/* 字卡、詞卡 */
.card-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.flash {
  position: relative; text-align: center; background: var(--card); border: 3px solid var(--line);
  border-radius: var(--radius); padding: 14px 12px 16px; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.flash.seen { border-color: var(--right); }
.flash .check { position: absolute; top: 8px; right: 10px; color: var(--right); font-size: 22px; opacity: 0; }
.flash.seen .check { opacity: 1; }
.flash .hanzi { font-family: var(--kai); font-size: 88px; line-height: 1.1; }
.flash .facts { font-size: 17px; color: var(--muted); }
.flash .facts b { color: var(--ink); font-family: var(--kai); font-size: 22px; }
.flash .wds { font-size: 19px; }
.flash .pedia { margin-top: 8px; font-size: 16px; color: var(--accent); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; background: var(--soft); }
.flash .poly { margin-top: 6px; padding: 6px 10px; border-radius: 12px; background: var(--reveal-soft); border: 1px solid var(--reveal); font-size: 18px; }
.flash .poly .tag { display: inline-block; font-size: 14px; font-weight: 700; color: var(--muted); }
.flash .poly b { color: var(--mc, var(--accent)); }
.word-card { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: center; text-align: left; padding: 14px; }
.word-card .word { font-family: var(--kai); font-size: 34px; font-weight: 700; line-height: 1.8; }
.word-card .meaning { font-size: 19px; }
.word-card .ex { font-size: 17px; color: var(--muted); margin-top: 6px; }
.word-card .lines { display: flex; flex-direction: column; gap: 6px; }
.word-card .line { display: flex; align-items: flex-start; gap: 8px; }
.pic { width: 100%; aspect-ratio: 1; border-radius: 14px; background: var(--soft); border: 2px dashed var(--line); display: grid; place-items: center; overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: contain; background: #fff; display: block; }
.pic .ph { color: #B5AA97; font-size: 15px; text-align: center; line-height: 1.5; }
.pic .ph span { font-size: 36px; display: block; }
.pic.big { max-width: 320px; margin: 0 auto; }
/* 注音：直排在國字右側 */
.zy-c { display: inline-flex; align-items: center; gap: .04em; margin-right: .1em; vertical-align: middle; }
.zy-v { display: inline-grid; grid-template-columns: auto .45em; font-family: var(--font); font-size: .46em; line-height: 1; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.zy-s { text-align: center; }
.zy-t { align-self: start; margin-top: -.2em; font-size: .9em; }
.zy-light { text-align: center; line-height: .6; }

/* 配對 */
.match { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px 16px; }
.match .col { display: flex; flex-direction: column; gap: 12px; }
.tile {
  min-height: 72px; border: 3px solid var(--line); border-radius: 16px; background: var(--card);
  padding: 10px 14px; font-size: 20px; text-align: left; display: flex; align-items: center; gap: 8px;
}
.tile.w { font-family: var(--kai); font-size: 30px; justify-content: center; text-align: center; }
.tile.sel { border-color: var(--accent); background: var(--accent-soft); }
.tile.done { border-style: solid; opacity: .9; }
.tile.reveal { border-color: var(--reveal); background: var(--reveal-soft); animation: pulse 1s ease-in-out infinite; }
.pair-0 { border-color: #2E8B6E !important; background: #E3F2EC !important; }
.pair-1 { border-color: #2F6DB0 !important; background: #E3EDF8 !important; }
.pair-2 { border-color: #C77A2B !important; background: #FBEBDA !important; }
.pair-3 { border-color: #6A5AB0 !important; background: #ECE8F8 !important; }
.pair-4 { border-color: #B04A6A !important; background: #F8E4EB !important; }
.pair-5 { border-color: #7A8B2E !important; background: #EFF3DF !important; }
.memory { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.mem {
  min-height: 130px; border-radius: 16px; border: 3px solid var(--line); background: var(--accent);
  color: #fff; font-size: 40px; display: grid; place-items: center; padding: 10px;
}
.mem.up { background: var(--card); color: var(--ink); font-size: 18px; text-align: center; }
.mem.up.w { font-family: var(--kai); font-size: 30px; }

/* 排句子 */
.slots { display: flex; flex-wrap: wrap; gap: 8px; min-height: 84px; padding: 12px; border: 3px dashed var(--line); border-radius: 16px; background: var(--soft); align-items: center; }
.slots.vertical, .pool.vertical { flex-direction: column; align-items: stretch; }
.slot-num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--mc, var(--accent)); color: #fff; font-size: 17px; font-weight: 700; flex: none; }
.pool { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.chip {
  min-height: 60px; border: 3px solid var(--line); border-radius: 14px; background: var(--card);
  padding: 8px 16px; font-size: 24px; font-family: var(--kai); display: inline-flex; align-items: center; gap: 10px; text-align: left;
}
.vertical .chip { font-family: var(--font); font-size: 20px; }
.chip.placed { border-color: var(--right); background: var(--right-soft); }
.chip.reveal { border-color: var(--reveal); background: var(--reveal-soft); animation: pulse 1s ease-in-out infinite; }
.conn-a { color: var(--conn1); font-weight: 700; }
.conn-b { color: var(--conn2); font-weight: 700; }

/* 句型卡 */
.pattern-card { text-align: center; }
.pattern-card .pat { font-family: var(--kai); font-size: 44px; margin: 6px 0; }
.pattern-card .kind { display: inline-block; background: var(--soft); border-radius: 999px; padding: 2px 14px; font-size: 16px; color: var(--muted); }
.pattern-card .explain { font-size: 20px; margin: 10px 0 16px; }
.model .tag { flex: none; font-family: var(--font); font-size: 14px; color: var(--muted); background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; }
.model.origin .tag { color: var(--mc, var(--accent)); border-color: currentColor; }
.ex.origin b { color: var(--mc, var(--accent)); font-weight: 700; }
.btn-read { background: #D6A27A; color: #fff; }
.btn-sm { padding: 4px 12px; font-size: 15px; min-height: 0; border-radius: 999px; text-decoration: none; }
/* 課文點讀 */
.reader-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; background: var(--card); padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.reader-title { font-family: var(--kai); font-weight: 400; font-size: 34px; text-align: center; margin: 18px 0 8px; }
.reader-h { font-family: var(--kai); font-weight: 400; font-size: 28px; color: var(--mc, var(--accent)); margin: 22px 0 4px; }
.reader-text { font-family: var(--kai); font-size: 32px; line-height: 2.1; }
.reader-p { text-indent: 2em; margin: 0 0 14px; }
.reader-p .zy-c, .reader-p .zy-v { text-indent: 0; }
.reader-p .nw-grp { white-space: nowrap; display: inline-block; text-indent: 0; }
.reader-p .rc { cursor: pointer; border-radius: 6px; transition: background .15s; }
.reader-p .rc.punct { cursor: default; }
.reader-p .hl-read { background: var(--reveal-soft); box-shadow: 0 0 0 2px var(--reveal-soft); }
@media (max-width: 640px) { .reader-text { font-size: 26px; } }
.btn-score { background: #8C9E74; color: #fff; }
/* ── 朗讀挑戰 ── */
.score-head { margin-bottom: 10px; font-size: 18px; }
.score-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.score-dots .sd { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); padding: 0; }
.score-dots .sd.cur { border-color: var(--c-reading); box-shadow: 0 0 0 3px rgba(176, 74, 106, .2); }
.score-dots .sd.s0 { background: var(--wrong-soft); border-color: var(--wrong); }
.score-dots .sd.s1 { background: var(--reveal-soft); border-color: var(--reveal); }
.score-dots .sd.s2, .score-dots .sd.s3 { background: var(--right-soft); border-color: var(--right); }
.score-dots .sd.s3::after { content: '★'; font-size: 12px; color: var(--star); line-height: 18px; }
.score-sec { font-size: 16px; margin-bottom: 4px; }
.score-line { text-indent: 0; }
.score .rc { border-radius: 8px; transition: background .2s; }
.score .rc.sc-ok { background: var(--right-soft); }
.score .rc.sc-tone { background: #FCE3C8; box-shadow: inset 0 -4px 0 #E08A2E; }
.score .rc.sc-miss { background: var(--wrong-soft); box-shadow: inset 0 -4px 0 var(--wrong); }
.score-mic.rec { background: var(--wrong); border-color: var(--wrong); animation: pulse 1.2s ease-in-out infinite; }
.score-live { text-align: center; margin-top: 10px; font-size: 18px; min-height: 1.6em; }
.score-res { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; font-size: 20px; }
.score-res b { font-size: 28px; }
.score-sum { text-align: center; padding: 10px 0; }
.score-sum .big { font-size: 56px; font-weight: 700; }

/* ── 注音聽打 ── */
.zg-top { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 6px 0 10px; }
.zg-pic { display: none; width: 180px; aspect-ratio: 1; border-radius: 14px; overflow: hidden; border: 2px solid var(--line); background: #fff; }
.zg-pic.on { display: block; }
.zg-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.zg-main { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.zg-play { min-width: 180px; }
.zg-slots { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.zg-slot {
  display: inline-flex; align-items: center; gap: 2px; min-width: 104px; height: 112px; padding: 6px 10px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card);
}
.zg-slot.cur { border-color: var(--c-zhuyinGame); box-shadow: 0 0 0 3px rgba(133, 165, 161, .25); }
.zg-slot.bad { border-color: var(--wrong); background: var(--wrong-soft); }
.zg-slot.ok { border-color: var(--right); background: var(--right-soft); }
.zg-han { font-family: var(--kai); font-size: 56px; line-height: 1; color: var(--ink); }
.zg-han:not(.got) { color: #B9AF9E; }
/* 選好的字跟選字列用同一種字型（常用字都有，不會缺字）；答對後才換成楷書（正確的字一定在楷書字型裡） */
.zg-han.got { font-family: var(--font); font-size: 50px; }
.zg-slot.ok .zg-han.got { font-family: var(--kai); font-size: 56px; }
.zg-cands { display: none; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 4px auto 0; padding: 10px 12px; border-radius: 14px; background: var(--accent-soft); border: 1px solid #C9DBEF; max-width: 720px; }
.zg-cands.on { display: flex; }
.zg-cands-t { font-size: 17px; color: var(--muted); }
.zg-cand { min-width: 64px; height: 64px; border-radius: 12px; border: 1px solid #C9DBEF; background: var(--card); font-family: var(--font); font-size: 36px; line-height: 1; }
.zg-cand:active { transform: scale(.95); }
.zg-cand.reveal { border-color: var(--reveal); background: var(--reveal-soft); animation: pulse 1s ease-in-out infinite; }
.zg-none { font-size: 18px; color: var(--wrong); }
.zg-slot .zg-zy { display: inline-flex; min-width: 30px; }
.zg-slot .zg-zy .zy-v { font-size: 26px; }
.zg-ans { font-family: var(--kai); font-size: 30px; }
.zg-kb { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding: 12px; border-radius: var(--radius); background: var(--soft); border: 1px solid var(--line); }
/* 鍵盤照標準注音鍵盤（大千式）排列，每排往右錯開一點，跟真的鍵盤一樣 */
.zg-row { display: flex; gap: 6px; justify-content: center; }
.zg-row.r1 { padding-left: 24px; }
.zg-row.r2 { padding-left: 48px; }
.zg-row.r3 { padding-left: 72px; }
.zg-key {
  flex: 0 1 56px; min-width: 0; height: 60px; padding: 0 2px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-size: 28px; line-height: 1; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 1px 0 rgba(60, 45, 20, .08);
}
.zg-key:active { transform: scale(.95); }
.zg-key.ini { background: #EEF4F3; border-color: #D3E1DE; }
.zg-key.med { background: #FDF3E4; border-color: #EEDDBF; }
.zg-key.fin { background: #F1EEF8; border-color: #DCD5EC; }
.zg-key.tone { background: #FBF1EF; border-color: #EBD6D1; }
.zg-key .zg-tmark { font-size: 28px; height: 24px; }
.zg-key small { font-size: 12px; color: var(--muted); margin-top: 2px; }
.zg-key.del { flex-basis: 72px; font-size: 26px; }
.zg-key.space { flex: 0 1 360px; height: 52px; }
.zg-key.space small { font-size: 15px; margin: 0; }
@media (max-width: 600px) {
  .zg-kb { padding: 8px 4px; } .zg-row { gap: 3px; } .zg-row.r1 { padding-left: 10px; } .zg-row.r2 { padding-left: 20px; } .zg-row.r3 { padding-left: 30px; }
  .zg-key { height: 48px; font-size: 20px; border-radius: 8px; } .zg-key .zg-tmark { font-size: 20px; height: 18px; } .zg-key small { font-size: 9px; }
  .zg-slot { min-width: 84px; height: 96px; } .zg-han, .zg-han.got, .zg-slot.ok .zg-han.got { font-size: 42px; } .zg-cand { min-width: 52px; height: 52px; font-size: 30px; }
}
.game-frame { display: block; width: 100%; height: min(72vh, 640px); border: 1px solid var(--line); border-radius: var(--radius); background: #F5F5F0; }
.rh-clue { text-decoration-color: var(--reveal); text-decoration-thickness: 3px; text-underline-offset: 5px; }
/* 字族文 */
.fam-poem { margin-bottom: 16px; }
.fam-base { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 22px; color: var(--muted); margin-bottom: 8px; }
.fam-base .b { font-family: var(--kai); font-size: 56px; color: var(--ink); line-height: 1.6; }
.fam-line { display: flex; align-items: center; gap: 10px; font-family: var(--kai); font-size: 30px; padding: 8px 4px; border-top: 1px dashed var(--line); }
.formula { font-family: var(--kai); white-space: nowrap; }
.flash .formula b { font-size: 30px; }
.formula b.part { color: var(--mc, var(--accent)); }
.flash .fam-pic { width: 100%; max-width: 180px; margin-bottom: 4px; }
.flash .tip { font-size: 16px; color: var(--muted); line-height: 1.5; }
.flash .hanzi .zy-v { font-size: .26em; }
.zy-strong .zy-v, .poly-char .zy-v, .opt .zy-v { color: var(--mc, var(--accent)); font-weight: 700; }
.poly-char { font-family: var(--kai); font-size: 30px; }
.nw { white-space: nowrap; display: inline-block; }
.hl-char { color: var(--mc, var(--accent)); }
.fam-line .hl-char { font-size: 38px; }

/* 短語：詞性上色（動詞紅、名詞藍、形容詞綠） */
.ph-v { color: var(--conn1); }
.ph-n { color: var(--conn2); }
.ph-a { color: var(--right); }
.ph-q { color: #6A5AB0; }
.ph-structure { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: center; font-size: 22px; font-weight: 700; margin: 6px 0; }
.ph-slot { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 2px 8px; }
.model { display: flex; align-items: center; gap: 10px; justify-content: center; font-family: var(--kai); font-size: 26px; padding: 8px 0; border-top: 1px dashed var(--line); }

/* 慶祝 */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(40, 32, 20, .45); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--card); border-radius: 22px; padding: 26px 22px; width: min(560px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); }
.celebrate { text-align: center; }
.celebrate .big-stars { font-size: 64px; letter-spacing: 6px; color: var(--star); }
.celebrate .big-stars .off { color: #E3DACB; }
.celebrate h2 { font-size: 30px; margin: 8px 0; }
.celebrate .acts { display: grid; gap: 10px; margin-top: 18px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall 2.4s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* 老師設定 */
.teacher h2 { margin-bottom: 4px; }
.teacher section { margin-top: 20px; }
.teacher h3 { font-size: 19px; margin-bottom: 8px; }
.levels { display: grid; gap: 10px; }
.level-opt { text-align: left; border: 3px solid var(--line); border-radius: 14px; background: var(--card); padding: 12px 14px; }
.level-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.level-opt b { font-size: 20px; }
.level-opt div { font-size: 16px; color: var(--muted); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 18px; }
.switch { width: 64px; height: 36px; border-radius: 99px; border: none; background: #CFC6B6; position: relative; flex: none; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--right); }
.switch.on::after { left: 32px; }
.seg { display: flex; gap: 6px; }
.seg button { min-height: 44px; padding: 4px 14px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); font-size: 17px; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.records { width: 100%; border-collapse: collapse; font-size: 16px; }
.records th, .records td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; }
.records th { color: var(--muted); font-weight: 500; }
.gate input { width: 100%; font-size: 30px; padding: 10px; border-radius: 12px; border: 2px solid var(--line); text-align: center; margin: 12px 0; }
.danger { color: var(--wrong); }

@media (max-width: 640px) {
  body { font-size: 18px; }
  .lesson-head { grid-template-columns: 1fr; }
  .word-card { grid-template-columns: 1fr; text-align: center; }
  .word-card > .pic { max-width: 220px; margin: 0 auto; }
  .word-card .line { justify-content: center; }
  .match { grid-template-columns: 1fr; }
  .prompt .big { font-size: 90px; }
  .brand { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 自己造句 */
.make-frame { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 10px; font-family: var(--kai); font-size: 28px; line-height: 1.6; }
.make-lead { text-align: right; }
.make-end { min-width: 1em; }
.make-conn { white-space: nowrap; }
.make-slot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.make-free .make-slot { width: 100%; }
.make-in {
  flex: 1; min-width: 0; min-height: 60px; font-size: 24px; font-family: var(--font);
  border: 3px solid var(--line); border-radius: 14px; padding: 8px 14px; background: var(--card); color: var(--ink);
}
.make-in:focus { outline: none; border-color: var(--mc, var(--accent)); }
.make-in:disabled { background: var(--soft); }
.mic-btn { width: 54px; height: 54px; font-size: 24px; }
.made-card { margin-top: 10px; text-align: center; }
.made-text { font-family: var(--kai); font-size: 28px; line-height: 1.7; }

/* 錯題複習、單課小考 */
.review-banner {
  display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 14px 18px; border-radius: 16px;
  background: var(--card); border: 2px solid var(--c-review); border-left: 10px solid var(--c-review);
  color: var(--ink); text-decoration: none; font-size: 20px; font-weight: 700;
}
.test-score { text-align: center; font-size: 44px; color: var(--c-test); margin: 4px 0 8px; }
/* 小考、錯題複習：每題上面的「這題要做什麼」 */
.q-ask { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 10px 14px; border-radius: 14px; background: var(--soft); border-left: 6px solid var(--mc, var(--accent)); font-size: 20px; font-weight: 700; }
/* 自己造句：學生自我檢查、老師批改 */
.self-check { margin-top: 12px; padding: 14px; border-radius: 16px; background: var(--soft); border: 2px dashed var(--line); text-align: center; }
.self-check b { font-size: 21px; }
.self-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.self-btn { min-width: 180px; min-height: 60px; font-size: 21px; }
.mark-btns { display: inline-flex; gap: 6px; }
.mark-btn { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-size: 20px; font-weight: 700; color: var(--muted); }
.mark-btn.on.ok { border-color: var(--right, #2E8B57); background: #E2F3E8; color: #2E8B57; }
.mark-btn.on.redo { border-color: var(--wrong, #C2554F); background: #FBE7E5; color: #C2554F; }
.make-who { color: var(--muted); font-family: var(--font); font-size: 22px; }

/* 老師設定：可收合的區塊 */
.teacher details.fold { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.teacher details.fold > summary { cursor: pointer; list-style: none; padding: 12px 14px; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.teacher details.fold > summary::-webkit-details-marker { display: none; }
.teacher details.fold > summary::after { content: '＋'; margin-left: auto; color: var(--muted); font-weight: 400; }
.teacher details.fold[open] > summary::after { content: '－'; }
.teacher .fold-body { padding: 0 12px 12px; }
.teacher .fold-body details.fold { margin-top: 8px; background: var(--soft); }
.teacher .fold-body details.fold > summary { font-size: 16px; padding: 10px 12px; }
.records td.nw { white-space: nowrap; }
.made-tbl td { vertical-align: top; }

/* ── 讀懂課文：課文地圖、一段一段讀 ── */
.rmap { display: flex; flex-direction: column; align-items: stretch; gap: 4px; max-width: 640px; margin: 0 auto; }
.rmap-box { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 12px 16px; cursor: pointer; transition: border-color .2s, background .2s; }
.rmap-box.seen { border-color: var(--c-reading); background: #FBF2F5; }
.rmap-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 20px; }
.rmap-tag { background: var(--c-reading); color: #fff; border-radius: 999px; padding: 2px 12px; font-size: 16px; font-weight: 700; }
.rmap-range { margin-left: auto; color: var(--muted); font-size: 15px; }
.rmap-sum { margin-top: 6px; font-size: 19px; line-height: 1.7; }
.rmap-arrow { text-align: center; color: var(--muted); font-size: 22px; line-height: 1; }
.rpara { text-align: left; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; max-height: 46vh; overflow-y: auto; }
.rpara .reader-p { font-family: var(--kai); font-size: 26px; line-height: 2; margin: 4px 0; text-indent: 2em; }
.rpara .rc { text-indent: 0; }
.show-key .rpara .rkey { background: #FFF07A; box-shadow: 0 0 0 2px #FFF07A; border-radius: 3px; transition: background .4s; }
/* 讀懂課文：畫面上方的小課文地圖 */
.mmap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; margin-bottom: 12px; }
.mmap-label { font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.mmap-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.mmap-arrow { color: var(--muted); }
.mmap-box { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 4px 10px; border: 2px solid var(--line); border-radius: 12px; background: var(--soft); font-size: 15px; line-height: 1.4; text-align: left; }
.mmap-box b { color: var(--c-reading); font-size: 14px; }
.mmap-box.on { border-color: var(--c-reading); background: #FBF2F5; }
.mmap-box.lit { box-shadow: 0 0 0 3px #FFF07A; border-color: #E8C400; }
.mmap-detail { margin-top: 8px; }
.mmap-sum { font-size: 17px; line-height: 1.7; margin-bottom: 6px; }
.mmap-detail .rpara { max-height: 32vh; }
.q-evidence { margin-top: 10px; }

/* 說明文「總—分—總」：分說的格子並排 */
.rmap-branch { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.rmap-branch .rmap-range { margin-left: 0; width: 100%; }
.mmap-branch { display: flex; flex-direction: column; gap: 4px; }

/* 分類：卡片裡的關鍵詞（提示時畫線）、分類表 */
.skw.on { border-bottom: 4px solid var(--c-reading); background: #FFF07A; }
.sort-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-top: 16px; }
.sort-col { border: 2px dashed var(--line); border-radius: 14px; padding: 8px; min-height: 70px; }
.sort-col h4 { margin: 0 0 6px; font-size: 18px; text-align: center; }
.sort-col h4 small { display: block; color: var(--muted); font-weight: 400; font-size: 14px; }
.sort-card { background: #EAF6EC; border: 2px solid #5BAE6A; border-radius: 10px; padding: 6px 8px; font-size: 16px; line-height: 1.5; margin-top: 6px; }

/* 詩：一行一行排，不縮排 */
.rpara.poem .reader-p { text-indent: 0; margin: 0; line-height: 1.9; }
/* 上下文線索：畫底線（show-ctx 才出現） */
.show-ctx .rpara .rkey2 { border-bottom: 4px solid var(--c-reading); }
.kw-mark { background: #FFF07A; padding: 0 4px; border-radius: 4px; }
.mmap-row.wrap { row-gap: 6px; }

/* 讀懂課文還沒改成新版的課 */
.badge-todo { display: inline-block; margin-left: 8px; padding: 1px 10px; border-radius: 999px; background: #EEE; color: #777; font-size: 14px; font-weight: 700; vertical-align: middle; }

/* ── 短語積木：顏色固定（紅＝做什麼、藍＝誰／什麼、紫＝後來怎樣、綠＝樣子、橘＝數量）── */
.blk-v { --bk: #D2553F; --bkbg: #FDECE8; }
.blk-n { --bk: #2F6DB0; --bkbg: #E6EFFA; }
.blk-r { --bk: #7A4FB5; --bkbg: #F1EAFB; }
.blk-a { --bk: #2E8B57; --bkbg: #E7F5EC; }
.blk-q { --bk: #C77A12; --bkbg: #FCF1E1; }
.blk-row { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: flex-end; margin: 6px 0; }
.blk { display: inline-flex; flex-direction: column; align-items: center; min-width: 64px; padding: 4px 10px 6px; border: 3px solid var(--bk, transparent); background: var(--bkbg, transparent); border-radius: 14px; transition: box-shadow .2s, transform .2s; }
.blk small { font-size: 13px; color: var(--bk, var(--muted)); font-weight: 700; line-height: 1.2; }
.blk b { font-family: var(--kai); font-size: 30px; font-weight: 400; line-height: 1.3; }
.blk-row.big .blk b { font-size: 36px; }
.blk.blank { border-style: dashed; background: #fff; }
.blk.blank b { color: var(--bk); }
.blk-glue { min-width: 0; padding: 4px 2px 6px; }
.blk.lit, .blk.cur { box-shadow: 0 0 0 4px #FFF07A; transform: translateY(-3px); }
.blk[role=button] { cursor: pointer; }
.blk-row.pop { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.94); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
.think-txt { display: flex; gap: 8px; align-items: flex-start; text-align: left; background: #FFFBEA; border-radius: 12px; padding: 0; font-size: 19px; line-height: 1.7; margin-top: 10px; }
.think-txt:not(:empty) { padding: 10px 12px; }
.blk-examples { margin-top: 8px; }
.bchips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0; }
.bchip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--kai); font-size: 26px; padding: 8px 16px; border: 3px solid var(--bk); background: var(--bkbg); color: var(--ink); border-radius: 14px; cursor: pointer; }
.bchip i { font-style: normal; font-size: 24px; }
.bchip.picked { box-shadow: 0 0 0 4px #FFF07A; }
.bchip:disabled:not(.picked) { opacity: .45; }
.wbank { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; margin-bottom: 10px; }
.wbank-title { font-size: 15px; color: var(--muted); margin-bottom: 4px; }
.wbank-col { border-left: 6px solid var(--bk); padding: 4px 8px; margin: 4px 0; border-radius: 6px; transition: background .2s, box-shadow .2s; }
.wbank-col.lit { background: var(--bkbg); box-shadow: 0 0 0 3px #FFF07A; }
.wbank-head { font-size: 15px; font-weight: 700; color: var(--bk); }
.wbank-words { display: flex; flex-wrap: wrap; gap: 4px 12px; font-family: var(--kai); font-size: 21px; }
.wbank-w i { font-style: normal; margin-right: 2px; }
.made-list { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 16px; }
.made-chip { background: #EAF6EC; border: 2px solid #5BAE6A; border-radius: 999px; padding: 2px 12px; font-family: var(--kai); font-size: 20px; }
.own-box { display: inline-flex; gap: 6px; align-items: center; }
.own-word { font-size: 20px; padding: 8px 10px; border: 2px dashed var(--bk, #2F6DB0); border-radius: 12px; width: 210px; }
.dice.roll { animation: roll .5s ease; }
.dice.again { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.dice-tally { font-size: 16px; }
@keyframes roll { 0% { transform: rotate(0); } 50% { transform: rotate(-12deg) scale(1.08); } 100% { transform: rotate(0); } }
.judge-s { font-size: 34px; margin-top: 8px; }

/* 短語積木：情境圖、三個問題、課本例子配圖 */
.scene { text-align: center; margin-bottom: 8px; }
.scene .pic { margin: 0 auto 6px; }
.scene-say { font-size: 20px; line-height: 1.7; max-width: 560px; }
.ask3 { background: #FFFBEA; border: 1px solid #F1E2A6; border-radius: 14px; padding: 8px 12px; margin: 8px 0; text-align: left; }
.ask3-title { font-size: 15px; color: var(--muted); margin-bottom: 4px; }
.ask3-q { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; font-size: 19px; border-left: 6px solid var(--bk); margin: 4px 0; background: #fff; }
.ask3-q small { color: var(--bk); font-size: 14px; font-weight: 700; margin-left: 4px; }
.ask3-q.on { box-shadow: 0 0 0 3px #FFF07A; background: var(--bkbg); }
.ask3-q.done { opacity: .75; }
.ask3-q b { color: var(--bk); font-family: var(--kai); font-size: 22px; }
.ask3-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--bk); color: #fff; font-weight: 700; font-size: 15px; flex: none; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 6px; }
.ex-card { border: 1px solid var(--line); border-radius: 14px; padding: 8px; background: #fff; }
.ex-card .pic { margin: 0 auto; }
.ex-card .blk b { font-size: 24px; }
.ex-card .blk { min-width: 48px; }
.ex-say { font-size: 17px; color: var(--muted); line-height: 1.6; }
.bchip.plain { border-color: var(--line); background: var(--card); }
.bchip.wrong { opacity: .45; }
.bchip.reveal { box-shadow: 0 0 0 4px var(--reveal-soft, #FFE08A); }
.dice-game { margin-top: 12px; border-top: 2px dashed var(--line); padding-top: 10px; }
[hidden] { display: none !important; }
.ex-card .blk-row { flex-wrap: nowrap; gap: 3px; }
.ex-card .blk { min-width: 0; padding: 2px 5px 4px; border-width: 2px; border-radius: 10px; }
.ex-card .blk b { font-size: 21px; }
.ex-card .blk small { font-size: 11px; }
.ex-card > .row { flex-direction: column; gap: 2px; }
.ex-grid { grid-template-columns: 1fr; }
.ex-card { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; text-align: left; }
.ex-card .pic { width: 150px; }
.ex-card > .row { flex-direction: row; justify-content: flex-start !important; gap: 6px; }
.ex-card .blk b, .ex-card .blk small { white-space: nowrap; }
.ex-card .ex-say { font-size: 18px; }
.ex-card .blk-row { justify-content: flex-start; }
.try-box { border-top: 2px dashed var(--line); margin-top: 10px; padding-top: 10px; }
.swap-cmp { display: flex; flex-direction: column; align-items: center; gap: 0; margin: 6px 0; }
.swap-arrow { font-size: 20px; line-height: 1; }
.bchip.plain { border: 2px solid #C9BFAE; background: #fff; }

/* 首頁：期中考、期末考範圍各一個大框 */
.exam-group { border: 2px solid var(--line); border-radius: 20px; padding: 12px 14px 16px; margin-bottom: 18px; background: rgba(255,255,255,.35); }
.exam-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.exam-head h2 { margin: 0; font-size: 22px; }
.exam-head span { color: var(--muted); font-size: 17px; }
.exam-head .say { margin-left: auto; }

/* ── 語詞挑戰：選玩法、識字讀詞 ── */
.mode-group { margin: 6px 0 16px; }
.mode-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 6px; }
.mode-opt { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; font: inherit; border: 3px solid var(--line); border-radius: 16px; background: var(--card); padding: 14px 16px; min-height: 84px; cursor: pointer; color: inherit; }
.mode-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.mode-opt .mode-ic { grid-row: 1 / 3; font-size: 30px; font-family: var(--kai); min-width: 52px; text-align: center; }
.mode-opt b { font-size: 20px; }
.mode-opt small { font-size: 15px; color: var(--muted); }
.sw-card { text-align: center; padding: 20px 14px; }
.sw-word { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; font-family: var(--kai); font-size: 88px; line-height: 1.2; margin: 6px 0; }
.sw-c { border-radius: 12px; padding: 0 6px; border: 3px solid transparent; }
.sw-c.ok { border-color: var(--good, #2E8B6E); }
.sw-c.tone { border-color: #E0A030; }
.sw-c.miss { border-color: #C0504D; background: #FBEDEC; }
.sw-heard { min-height: 1.6em; font-size: 18px; margin: 4px 0 12px; }
.sw-mic { font-size: 22px; min-height: 64px; padding: 0 28px; border-radius: 999px; }
.sw-mic.listening { background: #2E8B6E; border-color: #2E8B6E; animation: swPulse 1.2s ease-in-out infinite; }
@keyframes swPulse { 50% { box-shadow: 0 0 0 10px rgba(46, 139, 110, .18); } }
@media (max-width: 640px) { .sw-word { font-size: 64px; } }

.sw-pic { margin: 6px auto 4px; }

/* ── 課文詞語：讀懂課文裡畫底線，點一下看意思 ── */
.tw { border-bottom: 3px dotted var(--accent); cursor: pointer; border-radius: 4px; }
.tw.on { background: var(--accent-soft); border-bottom-style: solid; }
.tw-box { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; padding: 10px 14px; border: 2px solid var(--accent); border-radius: 14px; background: var(--accent-soft); font-size: 18px; line-height: 1.6; text-align: left; }
.tw-box[hidden] { display: none; }
.tw-box b, .tw-item b { font-family: var(--kai); font-size: 24px; white-space: nowrap; }
.tw-list { margin-top: 14px; }
.tw-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 17px; line-height: 1.6; }
.tw-item:last-child { border-bottom: 0; }
details.tw-list { border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
details.tw-list > summary { cursor: pointer; list-style: none; padding: 12px 14px; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
details.tw-list > summary::-webkit-details-marker { display: none; }
details.tw-list > summary::after { content: '＋'; margin-left: auto; color: var(--muted); font-weight: 400; }
details.tw-list[open] > summary::after { content: '－'; }
details.tw-list .fold-body { padding: 0 14px 10px; }

/* 句型練習：句子合併（兩張句子卡、連接詞空格、念一遍、想法卡） */
.sc-pair { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; align-items: stretch; margin: 10px 0; padding: 4px; border-radius: 14px; transition: box-shadow .2s; }
.sc-pair.lit { box-shadow: 0 0 0 4px #FFF07A; }
.sc-emoji { font-size: 40px; display: grid; place-items: center; padding: 0 4px; }
.sc-card { background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; position: relative; text-align: left; }
.sc-card small { color: var(--muted); font-size: 13px; }
.sc-card b { font-family: var(--kai); font-weight: 400; font-size: 24px; line-height: 1.5; padding-right: 36px; }
.sc-card .say { position: absolute; right: 6px; bottom: 6px; }
.sc-a { border-left: 6px solid var(--conn1); }
.sc-b { border-left: 6px solid var(--conn2); }
.sc-join { margin: 10px 0; line-height: 2; }
.sc-conn { display: inline-block; min-width: 2.6em; text-align: center; border-bottom: 3px dashed var(--line); margin: 0 2px; color: var(--muted); }
.sc-conn.filled { border-bottom-style: solid; }
.sc-conn.filled.conn-a { color: var(--conn1); border-color: var(--conn1); }
.sc-conn.filled.conn-b { color: var(--conn2); border-color: var(--conn2); }
.conn-chip { font-weight: 700; border: 3px solid var(--line); background: #fff; color: var(--ink); }
.conn-chip.conn-a { border-color: var(--conn1); color: var(--conn1); }
.conn-chip.conn-b { border-color: var(--conn2); color: var(--conn2); }
.read-box { text-align: center; background: #F3F8FF; border: 1px solid #CFE0F5; border-radius: 14px; padding: 10px; margin: 8px 0; }
.idea-box { background: #FFFBEA; border: 1px solid #F1E2A6; border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; text-align: left; font-size: 19px; }
.idea-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.idea-chip { background: #fff; border: 2px solid #F1E2A6; border-radius: 999px; padding: 2px 12px; font-size: 18px; }
@media (max-width: 560px) { .sc-pair { grid-template-columns: 1fr 1fr; } .sc-emoji { grid-column: 1 / -1; } }
.read-line .rd-ok { color: var(--right); }
.read-line .rd-miss { color: #D2553F; text-decoration: underline wavy #D2553F; }
.read-heard { font-size: 16px; min-height: 1.4em; }
.mic-read.listening { background: #D2553F; }
.sc-pair.three { grid-template-columns: auto 1fr 1fr 1fr; } .sc-c { border-left: 6px solid #7A4FB5; } @media (max-width: 560px) { .sc-pair.three { grid-template-columns: 1fr; } }

/* ── 拆字解說（認識生字）：部件＋部件→字；意思部件綠、念法部件藍；點卡片時依序亮起、合成 ── */
.pc-card { position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 14px 16px 12px; cursor: pointer; text-align: center; }
.pc-card.seen { border-color: var(--good, #2E8B6E); }
.pc-type { position: absolute; top: 10px; left: 12px; font-size: 14px; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 2px 10px; }
.pc-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.pc-part { min-width: 92px; border-radius: 14px; padding: 6px 10px 8px; border: 3px solid; }
.pc-part b { display: block; font-family: var(--kai); font-size: 56px; line-height: 1.15; font-weight: 400; }
.pc-part small { display: block; font-size: 15px; line-height: 1.3; }
.pc-part.mean { border-color: #2E8B6E; background: #EAF6F0; color: #1F6B52; }
.pc-part.snd { border-color: #2F6DB0; background: #EAF1FA; color: #1F4F86; }
.pc-plus { font-size: 30px; color: var(--muted); }
.pc-char { font-family: var(--kai); font-size: 76px; line-height: 1.1; padding: 0 6px; border-radius: 14px; }
.pc-card .pic { max-width: 220px; margin: 6px auto; }
/* 點了以後：部件依序亮一下，最後字跳出來 */
.pc-card.go .pc-part:nth-of-type(1) { animation: pcPop .5s ease 0s; }
.pc-card.go .pc-part:nth-of-type(2) { animation: pcPop .5s ease .6s backwards; }
.pc-card.go .pc-char { animation: pcJoin .6s ease 1.2s backwards; }
@keyframes pcPop { 0% { transform: scale(.7); opacity: .3; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes pcJoin { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); background: #FFF3C4; } 100% { transform: scale(1); opacity: 1; background: transparent; } }
@media (max-width: 640px) { .pc-part b { font-size: 42px; } .pc-char { font-size: 58px; } .pc-part { min-width: 72px; } }
.pc-thumb { width: 96px; height: 96px; padding: 0; border: 2px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; cursor: zoom-in; margin-left: 6px; position: relative; }
.pc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-thumb::after { content: '🔍'; position: absolute; right: 2px; bottom: 0; font-size: 16px; }
.pc-big { width: 100%; max-width: 480px; border-radius: 14px; display: block; margin: 0 auto; }
@media (max-width: 640px) { .pc-thumb { width: 72px; height: 72px; } }
/* 字源小圖：卡片右下角 */
.pc-card .pc-thumb { position: absolute; right: 10px; bottom: 10px; margin: 0; }
.pc-card.has-pic .facts, .pc-card.has-pic .wds, .pc-card.has-pic .poly { padding: 0 104px; }
@media (max-width: 640px) { .pc-card.has-pic .facts, .pc-card.has-pic .wds, .pc-card.has-pic .poly { padding: 0 80px 0 0; } }
/* 部件很多：部件縮小，字換到下一行（→ 也換行） */
.pc-row.many { gap: 6px; }
.pc-row.many .pc-part { min-width: 66px; padding: 4px 6px 6px; }
.pc-row.many .pc-part b { font-size: 40px; }
.pc-row.many .pc-part small { font-size: 13px; }
.pc-row.many > .pc-plus:last-of-type { flex-basis: 100%; height: 0; overflow: hidden; }
.pc-row.many .pc-char { flex-basis: 100%; }
/* 改錯字 */
.fx-card { text-align: center; padding: 18px 12px; }
.fx-sent { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin: 10px 0 6px; font-family: var(--kai); }
.fx-c { font: inherit; font-family: var(--kai); font-size: 40px; line-height: 1.3; min-width: 50px; padding: 2px 3px; border: 2px solid transparent; border-radius: 10px; background: transparent; color: inherit; cursor: pointer; }
.fx-c.p { cursor: default; min-width: 0; }
.fx-c.wrong { border-color: var(--wrong); background: var(--wrong-soft); border-radius: 50%; }
.fx-c.fixed { border-color: var(--right); background: var(--right-soft); }
@media (max-width: 640px) { .fx-c { font-size: 30px; min-width: 36px; } }
.fx-g { display: inline-flex; white-space: nowrap; }
.stroke-link { min-height: 40px; padding: 4px 14px; font-size: 16px; white-space: nowrap; }
.stroke-link { text-decoration: none; }
/* 句型練習：示範圖、看圖造句 */
.sc-pic .pic { width: 150px; margin: 0 auto; }
.look-box { text-align: center; margin-bottom: 10px; }
.look-box .pic.big { max-width: 360px; margin: 0 auto 8px; }
.look-hints { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.sc-pic img { width: 160px; height: 160px; object-fit: cover; border-radius: 14px; border: 2px solid var(--line); display: block; margin: 0 auto; }
/* 詞性小卡、分一分 */
details.pos-card { margin: 10px auto; max-width: 560px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-align: left; }
details.pos-card > summary { cursor: pointer; list-style: none; padding: 10px 14px; font-size: 17px; font-weight: 700; display: flex; gap: 8px; }
details.pos-card > summary::-webkit-details-marker { display: none; }
details.pos-card > summary::after { content: '＋'; margin-left: auto; color: var(--muted); font-weight: 400; }
details.pos-card[open] > summary::after { content: '－'; }
.pos-body { padding: 0 14px 10px; }
.pos-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 17px; }
.pos-row b { min-width: 76px; }
.sort-word { font-family: var(--kai); font-size: 52px; padding: 4px 18px; border: 3px dashed var(--line); border-radius: 14px; margin: 6px 0 10px; }
.sort-box .btn.right { border-color: var(--right); background: var(--right-soft); }
.sort-word { font-size: 40px; }
.sort-hl { text-decoration: none; border-bottom: 4px solid var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 0 4px; }
