/* ============================================================
   衝衝英文 — 樣式
   設計基準:參考 Engoo Daily News / VoiceTube 等真實教學網站
   白底、深灰內文、單一藍主色、螢光筆黃標記、淺色提示盒
   ============================================================ */

:root {
  --ink: #404040;
  --ink-light: #5f6770;   /* 白底 5.9:1、淺灰底 5.5:1(以前 #767f88 只有 4.07:1) */
  --ink-soft: #5d6670;   /* 白底 5.8:1。付款視窗與價格頁的說明小字用 */
  --primary: #0b72c4;          /* 字、框線、聚焦外框 */
  --primary-dark: #095d9f;     /* 淡底上的字 */
  --primary-tint: #e5faff;
  --fill: #00cdfe;             /* 主色的填色:主按鈕、進度條、選中的圓 */
  --fill-dark: #00b9e6;        /* 填色滑過、按下 */
  --on-fill: #095d9f;          /* 填色上的小字(主按鈕的大字用白) */
  --highlight: #ffedad;        /* 螢光筆黃:已完成單字 */
  --highlight-deep: #f7d764;
  --hint-orange: #e8890c;
  --tint-green: #eef7dc;
  --tint-orange: #fff0e1;
  --ok: #2f7a42;          /* 白字疊上去 5.3:1;當字色疊淺灰底也過 4.5:1 */
  --ok-tint: #e8f4ea;
  --bad: #c94040;
  --bad-tint: #fbecec;
  --line: #e3e8ed;
  --bg-soft: #f5f7f9;
  --radius: 8px;
  --font: -apple-system, "Segoe UI", Roboto, "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font);
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  line-height: 1.75;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--font); cursor: pointer; }

/* ---------------- 頂欄 ---------------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
/* 品牌字左邊的手繪 R:純裝飾,用背景圖畫(圖載不到就整塊不畫,不會跳出破圖圖示);寬高寫死不位移,不加高頂欄;手機縮成 24px。圖是手繪的 Y2.svg 輸出成 28/56/84 px 的 PNG(1x/2x/3x) */
.brand-logo { width: 28px; height: 28px; flex: none; display: block; background: url(../img/brand-y2-28.png) center / contain no-repeat; }
@supports (background-image: -webkit-image-set(url(a.png) 1x)) { .brand-logo { background-image: -webkit-image-set(url(../img/brand-y2-28.png) 1x, url(../img/brand-y2-56.png) 2x, url(../img/brand-y2-84.png) 3x); } }
@supports (background-image: image-set(url(a.png) 1x)) { .brand-logo { background-image: image-set(url(../img/brand-y2-28.png) 1x, url(../img/brand-y2-56.png) 2x, url(../img/brand-y2-84.png) 3x); } }
@media (max-width: 600px) { .brand-logo { width: 24px; height: 24px; } }
.brand-mark {
  background: var(--fill);
  color: var(--on-fill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  border-radius: 5px;
  padding: 3px 7px;
}
.topnav { display: flex; gap: 4px; margin-left: auto; min-width: 0; }
.topnav a {
  color: var(--ink);
  font-size: 15px;
  padding: 6px 14px;
  border-radius: 6px;
  white-space: nowrap;
}
.topnav a:hover { background: var(--bg-soft); text-decoration: none; }
.topnav a.active { color: var(--primary-dark); font-weight: 700; background: var(--primary-tint); }   /* 淡藍底上的字用深一階的藍(4.46 → 6.2:1) */
/* 十項導覽在 860-1180px 會把學生選單擠出畫面:縮間距,再不夠就橫向滑動 */
@media (max-width: 1180px) {
  .topbar-inner { gap: 14px; }
  .topnav a { padding: 6px 9px; font-size: 14px; }
}

/* ---------------- 版面容器 ---------------- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 810px; margin: 0 auto; padding: 0 20px; }

/* ---------------- 首頁 ---------------- */
.hero {
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 52px 20px 56px;
}
/* 首頁 h1 只在「：」「、」後面換行,不把「刷題」「閱讀」拆成兩行(360、320 寬會拆);太窄放不下才照字斷 */
.hero h1 { font-size: 32px; line-height: 1.35; letter-spacing: .5px; word-break: keep-all; overflow-wrap: anywhere; }
.hero .stats { display: flex; gap: 28px; margin-top: 26px; flex-wrap: wrap; }
.hero .stat b { font-size: 24px; color: var(--primary); font-weight: 700; }
.hero .stat span { display: block; font-size: 13px; color: var(--ink-light); }

.module-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin: 34px 0 14px;
}
.module-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  background: #fff;
  display: block;
  color: var(--ink);
  transition: box-shadow .15s, border-color .15s;
}
.module-card:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: 0 3px 14px rgba(0, 205, 254, .1);
}
.module-card h2 { font-size: 21px; margin: 10px 0 6px; }
.module-card p { color: var(--ink-light); font-size: 14.5px; }

/* 每日練習(首頁那一區與 daily.html 共用):三項各一列,名稱、進度、細進度條 */
.daily-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px 24px 14px;
}
.daily-home { margin-top: 34px; }
.daily-home + .module-cards { margin-top: 22px; }
.page-head + .daily-card { margin-top: 18px; }
.daily-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.daily-head h2 { font-size: 21px; }
.daily-count { font-size: 14px; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.daily-list { list-style: none; margin-top: 6px; }
.daily-list li + li { border-top: 1px solid var(--line); }
.daily-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px;
  padding: 13px 2px 14px; color: var(--ink); border-radius: 6px;
}
.daily-row:hover { text-decoration: none; }
.daily-row:hover .daily-name { color: var(--primary); }
.daily-row:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.daily-name { font-size: 16px; font-weight: 700; transition: color .15s; }
.daily-st { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.daily-bar { grid-column: 1 / -1; height: 6px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; }
.daily-bar i { display: block; height: 100%; background: var(--fill); border-radius: 3px; }
.daily-row.is-done .daily-st { color: var(--ok); font-weight: 700; }
.daily-row.is-done .daily-bar i { background: var(--ok); }
.daily-done { margin: 4px 0 6px; font-size: 15px; }
.daily-card .daily-list:first-child { margin-top: -6px; }
.explain .daily-more { margin-top: 8px; font-size: 14px; }
.daily-miss .vq-item span { color: var(--ink); }
.daily-miss .vq-item span b { display: inline-block; margin-top: 2px; min-width: 0; }
.daily-miss + .daily-done { margin-top: 14px; }
/* 寬螢幕首頁:三項並排,名稱和進度不會隔一整個版面寬 */
@media (min-width: 861px) {
  .daily-home .daily-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 32px; }
  .daily-home .daily-list li + li { border-top: 0; }
}

/* ---------------- 練習/章節標頭(Engoo 式) ---------------- */
.exercise-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 38px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
}
.exercise-head h2 { font-size: 19px; }
.exercise-head .en { color: var(--ink-light); font-size: 13.5px; font-weight: 400; }

/* ---------------- 徽章 ---------------- */
.badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 8px;
  vertical-align: middle;
}
.badge.level-basic { background: var(--tint-green); color: #4c7a1e; }
.badge.level-mid { background: var(--primary-tint); color: var(--primary-dark); }
.badge.level-adv { background: var(--tint-orange); color: #b05e0a; }
.badge.level-high { background: var(--bad-tint); color: var(--bad); }
.badge.cat { background: var(--bg-soft); color: var(--ink-light); font-weight: 400; }

/* ---------------- 文章列表 ---------------- */
.page-head { margin: 34px 0 6px; }
.page-head h1 { font-size: 26px; }
.page-head p { color: var(--ink-light); font-size: 15px; margin-top: 4px; }

.article-list { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 24px 0 60px; }
.article-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, border-color .15s;
}
.article-card:hover { text-decoration: none; border-color: var(--primary); box-shadow: 0 3px 14px rgba(0,205,254,.1); }
.article-card .thumb { background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.article-card .thumb img, .article-card .thumb svg { width: 100%; height: 150px; display: block; object-fit: cover; }
.article-card .body { padding: 15px 18px 16px; }
.article-card .meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-light); margin-bottom: 6px; flex-wrap: wrap; }
.article-card h3 { font-size: 17px; line-height: 1.45; }
.article-card .zh { color: var(--ink-light); font-size: 14px; margin-top: 2px; }
.article-card .progress-note { margin-top: 8px; font-size: 12.5px; color: var(--ok); }

/* ---------------- 閱讀器 ---------------- */
.reader-head { margin: 30px 0 4px; }
.reader-head .meta { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--ink-light); flex-wrap: wrap; }
.reader-head h1 { font-size: 27px; line-height: 1.4; margin-top: 8px; }
.reader-head .zh-title { color: var(--ink-light); font-size: 16px; margin-top: 2px; }
.reader-illust { margin: 18px 0 6px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); }
.reader-illust img, .reader-illust svg { width: 100%; height: auto; display: block; max-height: 260px; object-fit: cover; }

.reader-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 18px 0 8px;
  flex-wrap: wrap;
}
.bank-golink { font-size: 13.5px; }

/* ---------------- 單字考題(同字新文挖空) ---------------- */
.tq-bank { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.tq-chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}
.tq-chip:hover { border-color: var(--primary); color: var(--primary); }
.tq-chip.on { background: var(--fill); border-color: var(--fill); color: var(--on-fill); font-weight: 700; }
.tq-chip.used { opacity: .3; cursor: default; }
.tq-passage p { line-height: 2.2; margin: 0 0 14px; font-size: 16.5px; }
.tq-blank {
  display: inline-block;
  border: none;
  border-bottom: 2px solid #b8c4cf;
  background: var(--primary-tint);
  border-radius: 3px 3px 0 0;
  min-width: 76px;
  padding: 0 8px;
  margin: 0 2px;
  font: inherit;
  line-height: 1.9;
  cursor: pointer;
  vertical-align: baseline;
  color: var(--ink);
  text-align: left;
}
.tq-blank .no { font-size: 11px; color: var(--ink-light); margin-right: 5px; }
.tq-blank.on { border-bottom-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.tq-blank.filled { background: var(--highlight); border-bottom-color: var(--highlight-deep); }
.tq-blank.ok { background: var(--ok-tint); border-bottom-color: var(--ok); cursor: default; }
.tq-blank.bad { background: var(--bad-tint); border-bottom-color: var(--bad); cursor: default; }
.tq-blank.bad s { color: var(--bad); margin-right: 4px; }
.tq-result { font-size: 16px; font-weight: 700; margin: 4px 0 16px; }
.tq-zh { border-top: 1px solid var(--line); padding-top: 14px; }
.tq-zh p { color: var(--ink-light); font-size: 14.5px; line-height: 1.9; margin: 0 0 10px; }
.tq-review {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px 18px;
  margin: 12px 0 4px;
  font-size: 14.5px;
  color: var(--ink-light);
}
.tq-review b { color: var(--ink); margin-right: 8px; font-weight: 700; }
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 14.5px;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--fill); border-color: var(--fill); color: #fff; font-size: var(--fs-btn); font-weight: 700; }
.btn.primary:hover { background: var(--fill-dark); border-color: var(--fill-dark); color: #fff; }
.btn.on { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-dark); font-weight: 700; }
.btn:disabled { opacity: .45; cursor: default; }
.toolbar-note { font-size: 13px; color: var(--ink-light); }

.vocab-progress { font-size: 13px; color: var(--ink-light); margin-left: auto; }
.vocab-progress b { color: var(--hint-orange); }

/* 文章本文 */
.article-body { margin: 10px 0 8px; }
.article-body p.para { margin: 0 0 20px; font-size: 17px; line-height: 1.85; }

/* 對照翻譯(兩欄) */
.article-body.bilingual .para-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--line);
}
.article-body.bilingual .para-row:last-child { border-bottom: none; }
.article-body.bilingual .para-row .en { font-size: 16.5px; line-height: 1.8; }
.article-body.bilingual .para-row .zh { font-size: 15.5px; line-height: 1.9; color: #57606a; }

/* 可點單字 */
.vw {
  border-bottom: 2px dotted #b8c4cf;
  cursor: pointer;
  transition: background .12s;
  border-radius: 2px;
}
.vw:hover { background: var(--primary-tint); border-bottom-color: var(--primary); }
.vw.done { background: var(--highlight); border-bottom: 2px solid var(--highlight-deep); padding: 0 2px; }
.vw.done:hover { background: var(--highlight-deep); }
/* 填空中:原位置變空格,文字隱形所以寬度、版面完全不動 */
.vw.gap {
  color: transparent;
  background: var(--primary-tint);
  border-bottom: 2px solid var(--primary);
  border-radius: 3px 3px 0 0;
  user-select: none;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* 填空卡內部 */
.pop-fill-row { display: flex; gap: 6px; margin-top: 9px; }
.pop-fill-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font);
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  outline: none;
  color: var(--ink);
}
.pop-fill-input:focus { border-color: var(--primary); }
.pop-fill-input.wrong { border-color: var(--bad); background: var(--bad-tint); animation: shake .25s; }
.pop-fill-input.close { border-color: var(--hint-orange); background: var(--tint-orange); }
.pop-fill-btn { padding: 6px 14px; font-size: 14px; flex: none; }
.pop-msg { font-size: 13px; color: var(--bad); margin-top: 6px; min-height: 0; }
.pop-btns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pop-mini {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 3px 12px;
  font-size: 12.5px;
  color: var(--hint-orange);
  font-weight: 700;
}
.pop-mini:hover { border-color: var(--hint-orange); background: var(--tint-orange); }
.pop-mini.danger { color: var(--bad); }
.pop-mini.danger:hover { border-color: var(--bad); background: var(--bad-tint); }
.pop-zh-hint {
  background: var(--primary-tint);
  border-radius: 6px;
  padding: 8px 11px;
  margin-top: 8px;
  font-size: 14.5px;
  color: var(--primary-dark);
}
.pop-zh-hint b { font-size: 12px; letter-spacing: 1px; display: block; margin-bottom: 2px; }

/* 單字浮層 */
.vocab-pop {
  position: absolute;
  z-index: 100;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(30, 40, 50, .16);
  padding: 13px 16px;
  max-width: 320px;
  min-width: 200px;
  font-size: 14.5px;
  line-height: 1.6;
}
.vocab-pop .pop-word { font-weight: 700; font-size: 16px; }
.vocab-pop .pop-pos { color: var(--ink-light); font-size: 13px; margin-left: 6px; }
.vocab-pop .pop-hint {
  background: var(--tint-orange);
  border-radius: 6px;
  padding: 8px 11px;
  margin-top: 8px;
  font-size: 14px;
  color: #7a4a05;
}
.vocab-pop .pop-hint b { color: var(--hint-orange); font-size: 12px; letter-spacing: 1px; display: block; margin-bottom: 2px; }
.vocab-pop .pop-zh { margin-top: 8px; font-size: 15px; }
.vocab-pop .pop-zh .base { color: var(--ink-light); font-size: 13px; }
.vocab-pop .pop-actions { margin-top: 9px; display: flex; gap: 8px; }
.vocab-pop .pop-actions button {
  font-size: 13px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  padding: 3px 10px;
  color: var(--ink-light);
}
.vocab-pop .pop-actions button:hover { color: var(--bad); border-color: var(--bad); }
.vocab-pop .pop-ok { color: var(--ok); font-weight: 700; }
.vocab-pop .pop-close {
  position: absolute;
  top: 6px; right: 8px;
  border: none; background: none;
  color: var(--ink-light);
  font-size: 15px;
  padding: 2px 5px;
}

/* ---------------- 題目(共用) ---------------- */
.q-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  background: #fff;
}
.q-block .q-text { font-size: 16px; margin-bottom: 13px; }
.q-block .q-no { font-weight: 700; color: var(--primary); margin-right: 8px; }
.opts { display: grid; gap: 8px; }
.opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 13px;
  font-size: 15px;
  background: #fff;
  text-align: left;
  width: 100%;
  line-height: 1.55;
  color: var(--ink);
}
.opt:hover { border-color: var(--primary); background: var(--primary-tint); }
.opt .letter {
  font-weight: 700;
  color: var(--ink-light);
  flex: none;
  width: 22px; height: 22px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  font-size: 12.5px;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.opt.sel { border-color: var(--primary); background: var(--primary-tint); }
.opt.correct { border-color: var(--ok); background: var(--ok-tint); }
.opt.correct .letter { border-color: var(--ok); color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-tint); }
.opt.wrong .letter { border-color: var(--bad); color: var(--bad); }
.opt:disabled { cursor: default; }
.opt:disabled:hover { background: inherit; }
.opt.correct:disabled:hover { background: var(--ok-tint); }
.opt.wrong:disabled:hover { background: var(--bad-tint); }
.opt.plain:disabled:hover { border-color: var(--line); background: #fff; }

.explain {
  margin-top: 13px;
  border-left: 3px solid var(--primary);
  background: var(--bg-soft);
  border-radius: 0 6px 6px 0;
  padding: 12px 16px;
  font-size: 14.5px;
}
.explain .verdict { font-weight: 700; margin-bottom: 4px; }
.explain .verdict.ok { color: var(--ok); }
.explain .verdict.bad { color: var(--bad); }
.explain .tr { color: var(--ink-light); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }

/* ---------------- 刷題頁 ---------------- */
.part-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 24px 0 20px; }
.part-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: #fff;
  text-align: left;
  transition: box-shadow .15s, border-color .15s;
}
.part-card:hover { border-color: var(--primary); box-shadow: 0 3px 14px rgba(0,205,254,.1); }
.part-card h3 { font-size: 18.5px; margin: 5px 0 3px; }
.part-card p { font-size: 13.5px; color: var(--ink-light); }
.part-card .p-stats { margin-top: 13px; font-size: 13px; color: var(--ink-light); }
.part-card .bar { height: 6px; background: var(--bg-soft); border-radius: 3px; margin-top: 7px; overflow: hidden; }
.part-card .bar i { display: block; height: 100%; background: var(--fill); border-radius: 3px; }

/* 刷題首頁面板 */
.practice-panels { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; align-items: start; margin: 24px 0 50px; }
@media (min-width: 861px) { .practice-panels > #wrongbook { grid-row: span 2; } }   /* 桌機:錯題本在右欄佔兩列,左欄上下是隨機練習與聽力 */
.practice-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  background: #fff;
}
.practice-panel .tag {
  display: inline-block;
  font-size: 12px; font-weight: 700;
  color: var(--primary);
  background: var(--primary-tint);
  border-radius: 4px;
  padding: 2px 8px;
  letter-spacing: 1px;
}
.practice-panel h2 { font-size: 20px; margin: 10px 0 4px; }
.practice-panel p { font-size: 14px; color: var(--ink-light); margin-bottom: 4px; }
.cfg-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.cfg-rows { display: grid; gap: 8px; margin-top: 12px; }
.cfg-part-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cfg-part-check {
  display: flex; gap: 7px; align-items: center;
  font-size: 14.5px; cursor: pointer;
  width: 150px; flex: none;
}
.cfg-part-check input { width: 16px; height: 16px; accent-color: var(--fill); cursor: pointer; }
.cfg-select {
  font-family: var(--font);
  font-size: 14.5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  color: var(--ink);
}
.review-rows { margin-top: 12px; display: grid; gap: 8px; }
.review-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 14.5px;
}
.review-row span:first-child { flex: 1; }
.review-row .btn { padding: 4px 14px; font-size: 13.5px; }
@media (max-width: 860px) { .practice-panels { grid-template-columns: 1fr; } }

.drill-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 16px;
  flex-wrap: wrap;
}
.drill-top h1 { font-size: 21px; margin-right: auto; }
.drill-filters { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 13.5px;
  color: var(--ink-light);
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; }

.drill-progress { font-size: 13.5px; color: var(--ink-light); margin: 0 0 14px; }
.drill-progress b { color: var(--primary); }

/* Part 6/7 左右欄 */
.set-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 20px; }
.passage-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf7;
  padding: 22px 24px;
  font-size: 15.5px;
  line-height: 1.8;
  white-space: pre-line;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.passage-box .p-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ink-light);
  background: var(--bg-soft);
  display: inline-block;
  border-radius: 4px;
  padding: 1px 8px;
  margin-bottom: 8px;
  white-space: normal;
}
.passage-box + .passage-box { margin-top: 14px; }

/* Part 7 結構化文件(表格/表單/簡訊/傳單) */
.ps-blocks { white-space: normal; }
.ps-blocks .ps-h { font-weight: 700; font-size: 16.5px; margin: 10px 0 4px; }
.ps-advertisement .ps-h, .ps-notice .ps-h, .ps-flyer .ps-h, .ps-coupon-doc .ps-h { text-align: center; letter-spacing: .5px; }
.ps-blocks .ps-sub { color: var(--ink-light); font-size: 13.5px; margin: 0 0 10px; }
.ps-advertisement .ps-sub, .ps-flyer .ps-sub { text-align: center; }
.ps-blocks .ps-p { margin: 8px 0; }
.ps-blocks .ps-note { font-size: 12.5px; color: var(--ink-light); margin: 8px 0 2px; }
.ps-blocks .ps-list { margin: 8px 0 8px 22px; padding: 0; }
.ps-blocks .ps-list.numbered { list-style: none; margin-left: 4px; }
.ps-blocks .ps-list li { margin: 4px 0; }
.ps-kv { margin: 10px 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.ps-kv-row { display: flex; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.55; }
.ps-kv-row:last-child { border-bottom: none; }
.ps-kv-k { flex: 0 0 38%; background: var(--bg-soft); padding: 7px 11px; font-weight: 600; }
.ps-kv-v { flex: 1; padding: 7px 11px; }
.ps-table-wrap { overflow-x: auto; margin: 10px 0; }
.ps-table { border-collapse: collapse; width: 100%; font-size: 13.5px; line-height: 1.5; background: #fff; }
.ps-table th, .ps-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.ps-table th { background: var(--bg-soft); font-weight: 700; }
.ps-chat { display: flex; flex-direction: column; gap: 9px; margin: 10px 0; }
.ps-msg { max-width: 86%; align-self: flex-start; }
.ps-msg.right { align-self: flex-end; text-align: right; }
.ps-msg-meta { font-size: 11.5px; color: var(--ink-light); margin-bottom: 2px; }
.ps-msg-bubble { display: inline-block; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; font-size: 14px; line-height: 1.55; text-align: left; }
.ps-msg.right .ps-msg-bubble { background: var(--primary-tint); border-color: var(--primary); }
.ps-coupon { border: 2px dashed var(--primary); border-radius: 8px; padding: 12px 16px; text-align: center; margin: 12px 0; }
.ps-coupon-main { font-weight: 700; font-size: 15.5px; color: var(--primary-dark); }
.ps-coupon-line { font-size: 12.5px; color: var(--ink-light); margin-top: 3px; }

/* 模擬考 */
.mock-timer { font-size: 18px; font-weight: 700; color: var(--primary-dark); font-variant-numeric: tabular-nums; margin-left: auto; }
.mock-timer.low { color: var(--bad); }
.q-nav button.mock-l { border-bottom: 3px solid var(--highlight-deep); }

/* 文法基礎 */
.gx-goal { font-size: 14.5px; color: var(--ink-light); margin: -6px 0 16px; }
.gx-p { margin: 10px 0; line-height: 1.9; font-size: 15.5px; }
.gx-ex { border: 1px solid var(--line); border-left: 3px solid var(--primary); border-radius: var(--radius); background: #fff; padding: 10px 16px; margin: 10px 0; }
.gx-ex-en { font-size: 15.5px; }
.gx-ex-zh { font-size: 13.5px; color: var(--ink-light); margin-top: 2px; }
.gx-focus { background: var(--highlight); border-radius: 3px; padding: 0 2px; }
.gx-table { border-collapse: collapse; margin: 12px 0; font-size: 14.5px; background: #fff; }
.gx-table th, .gx-table td { border: 1px solid var(--line); padding: 6px 14px; text-align: left; }
.gx-table th { background: var(--bg-soft); }
.gx-tip { background: var(--bg-soft); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; margin: 10px 0; line-height: 1.75; }
.gx-tip b { margin-right: 4px; }
.gx-unit-done { color: var(--ok); font-weight: 700; }

/* 自訂題庫編輯 */
.bank-word { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 7px 2px; font-size: 14.5px; }
.bank-word-main { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; min-width: 0; }
.bank-word-main b { flex: 0 0 auto; }
.bank-word-zh { color: var(--ink-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-word-del { border: none; background: none; color: var(--ink-light); cursor: pointer; font-size: 14px; padding: 2px 8px; }
.bank-word-del:hover { color: #c0392b; }
/* 兩台同時改了同一個字的中文:另一個寫法(alt)列在那個字下面,可以換成它或刪掉 */
.bank-word.has-alt { flex-wrap: wrap; }
.bank-word-alt { flex-basis: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 2px 0 2px 32px; font-size: 13px; color: var(--ink-light); }
.passage-col .passage-box { position: static; max-height: none; }
.passage-sticky-wrap { position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow-y: auto; }
.passage-sticky-wrap .passage-box { position: static; max-height: none; }
.gap-mark {
  display: inline-block;
  border-bottom: 2px solid var(--primary);
  background: var(--primary-tint);
  border-radius: 3px 3px 0 0;
  padding: 0 10px;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 13.5px;
}
.gap-mark.answered { background: var(--highlight); border-bottom-color: var(--highlight-deep); color: var(--ink); }
.gap-mark.filled { background: var(--primary-tint); color: var(--primary-dark); }

/* 交卷式作答:已選選項與答題進度點 */
.opt.picked { border-color: var(--primary); background: var(--primary-tint); }
.opt.picked .letter { background: var(--fill); color: var(--on-fill); }
.letter-big.picked { border-color: var(--primary); background: var(--primary-tint); color: var(--primary-dark); }
.q-nav button.ans { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-dark); }

.set-translation {
  margin: 6px 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 16px 20px;
  font-size: 14.5px;
  line-height: 1.9;
  color: #57606a;
  white-space: pre-line;
}

/* 題號導覽 */
.q-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 22px; }
.q-nav button {
  width: 34px; height: 30px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--ink-light);
}
.q-nav button:hover { border-color: var(--primary); color: var(--primary); }
.q-nav button.cur { border-color: var(--ink); color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--ink); }
.q-nav button.ok { background: var(--ok-tint); border-color: #bcdcc3; color: var(--ok); }
.q-nav button.ng { background: var(--bad-tint); border-color: #ecc7c7; color: var(--bad); }

.drill-nav-btns { display: flex; gap: 10px; margin: 6px 0 50px; }
.drill-nav-btns > .btn { display: inline-flex; align-items: center; justify-content: center; }   /* 一列裡主按鈕字較大,描邊鈕被拉高時字也置中 */

.result-note { font-size: 14px; color: var(--ink-light); margin: 8px 0 18px; }

/* ---------------- 寫作練習 ---------------- */
/* 單元路徑 */
.unit-list { margin: 18px 0 30px; display: grid; gap: 8px; }
.unit-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px 16px;
  color: var(--ink);
  font-size: 15px;
}
.unit-row:hover { text-decoration: none; border-color: var(--primary); }
.unit-row.done { background: var(--bg-soft); }
.unit-num {
  width: 28px; height: 28px; flex: none;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--ink-light); font-weight: 700;
}
.unit-num.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.unit-title { display: flex; flex-direction: column; min-width: 0; }
.unit-sub {
  font-size: 12.5px; color: var(--ink-light); font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 460px;
}
.unit-head { margin: 26px 0 18px; }
.unit-back { font-size: 13.5px; }
.unit-block { padding: 26px 30px; }
.unit-title-lg { font-size: 20px; margin-bottom: 12px; }

/* 技巧課(整頁寬鬆排版) */
.lesson-view {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 30px 34px;
}
.lesson-title { font-size: 22px; margin-bottom: 10px; }
.lesson-intro { color: var(--ink-light); font-size: 15px; line-height: 1.85; margin-bottom: 24px; }
.lesson-point { margin-bottom: 26px; }
.lp-tip { font-size: 16px; font-weight: 700; line-height: 1.7; margin-bottom: 10px; }
.lp-ex-box {
  border-left: 3px solid var(--primary);
  background: var(--bg-soft);
  border-radius: 0 8px 8px 0;
  padding: 13px 18px;
}
.lp-ex { font-size: 16px; line-height: 1.7; }
.lp-zh { font-size: 13.5px; color: var(--ink-light); margin-top: 4px; }

.assembly {
  min-height: 44px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 7px 9px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-bottom: 8px;
}
.assembly.done-line { border-style: solid; border-color: var(--highlight-deep); background: var(--highlight); font-size: 15.5px; padding: 10px 14px; }
.assembly-hint { color: var(--ink-light); font-size: 13px; }
.tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.tile {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 14.5px;
  color: var(--ink);
  font-family: var(--font);
}
.tile:hover { border-color: var(--primary); background: var(--primary-tint); }
.tile.picked { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-dark); font-weight: 700; }

.write-area {
  width: 100%;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  resize: vertical;
  outline: none;
  color: var(--ink);
}
.write-area:focus { border-color: var(--primary); }
.wc-bar { display: flex; gap: 12px; justify-content: flex-end; margin-top: 4px; }
.wc { font-size: 12.5px; color: var(--ink-light); }

.kw-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-light); margin-bottom: 10px; }
.kw-chip {
  background: var(--tint-orange);
  color: #b05e0a;
  border-radius: 4px;
  padding: 1px 9px;
  font-size: 13px;
  font-weight: 700;
}
.model-box { background: var(--ok-tint); border-radius: 8px; padding: 12px 16px; margin-top: 10px; font-size: 14.5px; }
.model-box b { display: block; font-size: 12.5px; letter-spacing: 1px; color: var(--ok); margin-bottom: 6px; }
.model-line { margin-bottom: 6px; }
.model-line.pre { white-space: pre-line; line-height: 1.75; }
.check-box { background: var(--bg-soft); border-radius: 8px; padding: 12px 16px; margin-top: 10px; font-size: 14px; }
.check-box b { display: block; font-size: 12.5px; letter-spacing: 1px; color: var(--ink-light); margin-bottom: 6px; }
.check-item { display: block; padding: 3px 0; cursor: pointer; }
.task-list { font-size: 14.5px; margin-bottom: 10px; }
.task-list b { font-size: 13px; color: var(--primary-dark); }
.task-list ol { margin: 4px 0 0 22px; }
.passage-box.letter { background: #fff; }
.outline-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 8px; }
.outline-cell b {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 15px; color: var(--primary-dark); margin-bottom: 4px;
}
.outline-target { font-size: 12.5px; color: var(--ink-light); font-weight: 400; }
.outline-hint { font-size: 13.5px; color: var(--ink-light); line-height: 1.75; margin-bottom: 8px; }

/* ---------------- 聽力 ---------------- */
.player { display: flex; align-items: center; gap: 12px; margin: 6px 0; }
.player-btn { padding: 9px 22px; font-size: 15px; }
.player-note { font-size: 13px; color: var(--ink-light); }
.letter-row { display: flex; gap: 12px; margin: 10px 0 4px; }
.letter-big {
  width: 56px; height: 56px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 20px; font-weight: 700; color: var(--ink);
}
.letter-big:hover { border-color: var(--primary); background: var(--primary-tint); }
.letter-big.correct { border-color: var(--ok); background: var(--ok-tint); color: var(--ok); }
.letter-big.wrong { border-color: var(--bad); background: var(--bad-tint); color: var(--bad); }
.letter-big:disabled { cursor: default; }
.listen-photo { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); margin-bottom: 12px; }
.listen-photo img { width: 100%; max-height: 340px; object-fit: contain; display: block; }
.photo-missing { padding: 60px 0; text-align: center; color: var(--ink-light); font-size: 14px; }
.transcript-box { background: var(--bg-soft); border-radius: 8px; padding: 14px 18px; margin-top: 12px; font-size: 14.5px; }
.transcript-box b { display: block; font-size: 12.5px; letter-spacing: 1px; color: var(--ink-light); margin-bottom: 6px; }
.tr-en { white-space: pre-line; line-height: 1.8; }
.tr-zh { white-space: pre-line; line-height: 1.9; color: #57606a; font-size: 13.5px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* 英語耳 */
.speed-sel { padding: 5px 8px; font-size: 12.5px; }
.shadow-stage {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 34px 10px;
  color: var(--ink);
  background: var(--bg-soft);
  border-radius: 10px;
  margin-bottom: 12px;
}
.shadow-stage.pulse { color: var(--hint-orange); animation: pulse 1s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
.dict-diff { margin: 8px 0 4px; line-height: 2; }
.dict-word { display: inline-block; margin: 0 3px; padding: 1px 6px; border-radius: 4px; font-size: 15px; }
.dict-word.hit { background: var(--ok-tint); color: var(--ok); }
.dict-word.miss { background: var(--bad-tint); color: var(--bad); font-weight: 700; }
.pair-row { display: flex; gap: 14px; margin-top: 10px; }
.pair-btn {
  flex: 1;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; padding: 16px 10px;
  font-size: 19px; font-weight: 700; color: var(--ink);
}
.pair-btn:hover { border-color: var(--primary); background: var(--primary-tint); }
.pair-btn.correct { border-color: var(--ok); background: var(--ok-tint); color: var(--ok); }
.pair-btn.wrong { border-color: var(--bad); background: var(--bad-tint); color: var(--bad); }

/* ---------------- 單字訓練:掉落遊戲 ---------------- */
.game-hud {
  display: flex; align-items: center; gap: 18px;
  font-size: 15px; margin: 10px 0;
}
.hud-score { font-size: 20px; font-weight: 700; color: var(--primary); }
.hud-lives { font-size: 20px; color: var(--bad); letter-spacing: 3px; }
.game-hud .btn { margin-left: auto; padding: 4px 14px; font-size: 13.5px; }
.game-field {
  position: relative;
  height: 430px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fdfefe 0%, var(--bg-soft) 100%);
  overflow: hidden;
}
.fall-block {
  position: absolute;
  top: 0;
  background: #fff;
  border: 1.5px solid var(--primary);
  border-radius: 10px;
  padding: 8px 14px;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0, 205, 254, .12);
  will-change: transform;
}
.fb-zh { font-size: 16.5px; font-weight: 700; white-space: nowrap; }
.fb-hint {
  font-family: Consolas, monospace;
  font-size: 13.5px;
  color: var(--ink-light);
  letter-spacing: 2px;
  margin-top: 2px;
}
.fall-block.boom {
  border-color: var(--ok);
  background: var(--ok-tint);
  transition: transform .25s, opacity .25s;
  opacity: 0;
  transform: scale(1.35) !important;
}
.fall-block.missed {
  border-color: var(--bad);
  background: var(--bad-tint);
  transition: opacity .35s;
  opacity: 0;
}
.game-input-row { margin-top: 12px; }
.game-input {
  width: 100%;
  font-family: var(--font);
  font-size: 18px;
  border: 2px solid var(--primary);
  border-radius: 10px;
  padding: 11px 16px;
  outline: none;
  text-align: center;
}
.game-input.wrong { border-color: var(--bad); background: var(--bad-tint); animation: shake .25s; }
.game-over {
  position: absolute; inset: 0;
  background: rgba(255, 255, 255, .95);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.game-over h2 { font-size: 24px; margin-bottom: 12px; }
.miss-list { max-width: 420px; width: 100%; font-size: 14.5px; margin-bottom: 8px; }
.miss-list b { display: block; font-size: 13px; color: var(--ink-light); margin-bottom: 6px; }
.miss-item {
  display: flex; gap: 12px;
  padding: 5px 2px;
  border-bottom: 1px dashed var(--line);
}
.miss-en { font-weight: 700; color: var(--primary-dark); min-width: 130px; }

/* 片語特訓 */
.phrase-table { margin-top: 12px; font-size: 14px; }
.phrase-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 2px 12px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.phrase-row b { color: var(--primary-dark); }
.phrase-row .ph-ex { grid-column: 2; color: var(--ink-light); font-size: 13px; }
.phrase-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--hint-orange);
  border-radius: 0 8px 8px 0;
  background: #fffdf6;
  padding: 14px 18px;
  margin-top: 10px;
  font-size: 14.5px;
}
.pc-head { display: flex; gap: 12px; align-items: baseline; }
.pc-head b { font-size: 18px; color: var(--primary-dark); }
.pc-tip { color: #7a4a05; font-size: 13.5px; margin-top: 6px; }
.pc-ex { margin-top: 8px; font-size: 15px; }
.pc-exzh { color: var(--ink-light); font-size: 13.5px; }

/* ---------------- 頁尾 ---------------- */
footer {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding: 22px 0 30px;
  font-size: 13px;
  color: var(--ink-light);
}
footer p { margin: 0; }
/* 方案、條款、隱私、退款、客服信箱：藍新商店規範要求每頁都看得到（2026-10-15） */
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot-links a { color: var(--ink-light); text-decoration: underline; text-underline-offset: 2px; }
.foot-links a:hover { color: var(--primary-dark); }
/* 說明句預設收起來,連結列照舊每頁看得到 */
.foot-about { margin-top: 10px; }
.foot-about > summary {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-light);
  list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.foot-about > summary::-webkit-details-marker { display: none; }
.foot-about > summary::after {
  content: ''; flex: none; width: 6px; height: 6px; margin: 0 2px 3px 0;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg);
  transition: transform .2s var(--ease-out);
}
.foot-about[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.foot-about > summary:hover { color: var(--primary-dark); }
.foot-about > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
.foot-about > p { margin-top: 6px; max-width: 68ch; }
@media (prefers-reduced-motion: reduce) { .foot-about > summary::after { transition: none; } }
/* 頁尾不在第一屏:有頁尾的頁面 main 至少一個視窗高,頁尾一律要捲到最底才看得到(內容短的頁面第一屏底下是留白)。
   100vh 在手機上是網址列收起來時的高度(比當下可見的高),寧可多推一點也不要露出來;支援 lvh 的瀏覽器明確用最大的那個高度。
   沒有頁尾的頁(搬家、重設密碼、離線)不撐高;不支援 :has 的舊瀏覽器那幾頁照樣撐高,只是多一段留白。
   作答中(html.is-quiz)頁尾整個不顯示,main 的高度由專心模式那一段管。
   main 前面有頂欄時扣掉頂欄最矮的高度(App 外殼的 52 加底線 1 = 53;網頁版頂欄都比這高),頁尾剛好在第一屏下緣外面,
   短頁面不用多捲一個頂欄的高度;頂欄比 53 高時頁尾再往下多推一點,一樣看不到。 */
body > main { min-height: 100vh; }
@supports (min-height: 100lvh) { body > main { min-height: 100lvh; } }
body > .topbar ~ main { min-height: calc(100vh - 53px); }
@supports (min-height: 100lvh) { body > .topbar ~ main { min-height: calc(100lvh - 53px); } }
body:not(:has(> footer)) > main, body:not(:has(> footer)) > .topbar ~ main { min-height: 0; }
html.is-quiz footer { display: none; }
@media print { body > main, body > .topbar ~ main { min-height: 0; } }
@media (max-width: 860px) {
  footer { padding: 18px 0 24px; }
  .foot-links { gap: 4px 14px; }
  .foot-about { margin-top: 8px; }
}

/* ---------------- 學生檔案 ---------------- */
.profile-widget { position: relative; margin-left: 12px; flex: none; }
.profile-btn {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 20px;
  padding: 4px 12px 4px 5px;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
}
.profile-btn:hover { border-color: var(--primary); }
.profile-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--on-fill);
  font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.profile-menu {
  position: absolute;
  right: 0; top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(30,40,50,.16);
  min-width: 230px;
  padding: 8px;
  z-index: 120;
}
.pm-head { font-size: 12px; font-weight: 700; color: var(--ink-light); letter-spacing: 1px; padding: 4px 8px; }
.pm-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  border: none; background: none;
  text-align: left;
  padding: 8px 10px;
  font-size: 14.5px;
  border-radius: 6px;
  color: var(--ink);
}
.pm-item:hover { background: var(--bg-soft); }
.pm-item.cur { color: var(--primary); font-weight: 700; }
.pm-item.danger { color: var(--bad); }
.pm-item.big { border: 1px solid var(--line); margin-bottom: 6px; }
.pm-sep { border-top: 1px solid var(--line); margin: 6px 4px; }

/* 視窗比畫面高時(矮手機的註冊卡、手機橫放、鍵盤打開)遮罩可以捲,從頂端排,X 和標題才看得到;
   放得下時 margin:auto 照舊上下左右置中,跟以前一模一樣(以前只有矮於 480 和 App 外殼才這樣) */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(30, 40, 50, .45);
  z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto;
  padding: 20px;
}
.modal-mask > .modal { margin: auto; }
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 26px 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(20,30,40,.3);
}
.modal h2 { font-size: 20px; }
.modal-sub { color: var(--ink-light); font-size: 13.5px; margin: 6px 0 14px; }
.modal-list { max-height: 200px; overflow-y: auto; }
.modal-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.modal-row .btn { white-space: nowrap; }   /* 主按鈕字大:按鈕不折行,排不下就整顆換到下一行 */
.modal-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 15px;
  font-family: var(--font);
  outline: none;
}
.modal-input:focus { border-color: var(--primary); }

/* ---------------- 程度檢測 ---------------- */
.diag-intro { border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 34px; margin: 26px 0 50px; background: #fff; }
.diag-intro h2 { font-size: 21px; margin-bottom: 8px; }
.diag-intro ul { margin: 12px 0 20px 22px; color: var(--ink-light); font-size: 14.5px; }
.diag-intro li { margin-bottom: 4px; }
.diag-bar { height: 8px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; margin: 8px 0 20px; }
.diag-bar i { display: block; height: 100%; background: var(--fill); border-radius: 4px; transition: width .2s; }
.diag-count { font-size: 13.5px; color: var(--ink-light); }

/* 檢測報告 */
.report-head {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 8px 0 20px;
  background: var(--bg-soft);
}
.report-head .who { font-size: 13.5px; color: var(--ink-light); }
.report-head h2 { font-size: 22px; margin: 4px 0 2px; }
.band-line { display: flex; gap: 26px; margin-top: 14px; flex-wrap: wrap; }
.band-line .item b { font-size: 22px; color: var(--primary); }
.band-line .item span { display: block; font-size: 12.5px; color: var(--ink-light); }
.band-note { font-size: 12.5px; color: var(--ink-light); margin-top: 10px; }
/* 模擬考交卷時存不進去(js/mock.js):寫明還沒存、先留在這個分頁 */
.mock-unsaved { margin-top: 14px; padding: 12px 14px; border: 1px solid #ecc7c7; border-radius: var(--radius); background: var(--bad-tint); font-size: 13.5px; }
.mock-unsaved b { color: var(--bad); }
.mock-unsaved p { margin: 4px 0 10px; }

.bar-line { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; }
.bar-line .lb { width: 130px; flex: none; }
.bar-line .track { flex: 1; height: 10px; background: var(--bg-soft); border-radius: 5px; overflow: hidden; }
.bar-line .track i { display: block; height: 100%; border-radius: 5px; background: var(--fill); }
.bar-line .track i.weak { background: var(--bad); }
.bar-line .track i.mid { background: var(--hint-orange); }
.bar-line .val { width: 74px; text-align: right; color: var(--ink-light); font-size: 13px; flex: none; }

.verdict-pill { display: inline-block; font-size: 12.5px; font-weight: 700; border-radius: 4px; padding: 1px 8px; }
.verdict-pill, table.cat-table a { white-space: nowrap; }
.cat-few { font-size: 12px; color: var(--ink-light); margin-left: 4px; }
.verdict-pill.good { background: var(--ok-tint); color: var(--ok); }
.verdict-pill.mid { background: var(--tint-orange); color: #b05e0a; }
.verdict-pill.weak { background: var(--bad-tint); color: var(--bad); }

table.cat-table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 6px 0 10px; }
table.cat-table th, table.cat-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
table.cat-table th { font-size: 12.5px; color: var(--ink-light); letter-spacing: 1px; font-weight: 700; }
table.cat-table td.num { white-space: nowrap; }


.wrong-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 12px; background: #fff; font-size: 14.5px; }
.wrong-item .w-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.wrong-item .w-q { margin-bottom: 6px; }
.wrong-item .w-ans { margin-bottom: 6px; }
.wrong-item .w-ans .you { color: var(--bad); font-weight: 700; }
.wrong-item .w-ans .right { color: var(--ok); font-weight: 700; }
.wrong-item .w-skill { background: var(--primary-tint); border-radius: 6px; padding: 7px 11px; font-size: 13.5px; color: var(--primary-dark); margin-bottom: 6px; }
.wrong-item .w-exp { color: #57606a; font-size: 13.5px; }

.next-steps { border: 1px solid var(--line); border-left: 3px solid var(--primary); border-radius: var(--radius); padding: 16px 20px; margin: 14px 0 30px; font-size: 14.5px; }
.next-steps li { margin: 4px 0 4px 20px; }

/* 能力分析:級距刻度尺與長條圖 */
.band-scale { position: relative; margin: 26px 8px 34px; height: 40px; }
.bs-track {
  position: absolute; left: 0; right: 0; top: 14px; height: 10px;
  border-radius: 5px; background: var(--bg-soft); border: 1px solid var(--line);
}
.bs-seg { position: absolute; top: 14px; height: 12px; margin-top: -1px; border-radius: 6px; background: var(--fill); }
.bs-label {
  position: absolute; top: -10px; transform: translateX(-50%);
  font-size: 14px; font-weight: 700; color: var(--primary-dark); white-space: nowrap;
}
.bs-tick { position: absolute; top: 28px; transform: translateX(-50%); font-size: 11.5px; color: var(--ink-light); }
.bar-line .track i.ok { background: var(--ok); }
.bar-go { font-size: 13px; flex: none; width: 34px; }
.cat-bars { margin-top: 6px; }
.cat-bars .bar-line { margin-bottom: 10px; }
.cat-bars .lb { width: 150px; font-size: 13.5px; }

/* 能力分析:錯題分類列 */
.wrong-cat-row {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%;
  border: none; border-top: 1px solid var(--line);
  background: none;
  padding: 9px 4px;
  font-size: 14.5px; color: var(--ink);
  text-align: left;
}
.wrong-cat-row:hover { background: var(--bg-soft); }
.wrong-cat-row b { color: var(--bad); font-size: 13.5px; }
.wrong-cat-list { padding: 2px 4px 10px; }
.wrong-cat-item {
  font-size: 13.5px; color: var(--ink-light);
  padding: 4px 0 4px 14px;
  border-left: 2px solid var(--line);
  margin: 4px 0;
}

/* 錯題本分組(js/wrongbook-ui.js,錯題本頁與能力分析共用):沿用上面的錯題分類列,組的標題列右邊多一個「複習」 */
.wb-tools { margin: 4px 0 8px; }
.wb-tools .btn { padding: 4px 14px; font-size: 13.5px; }
.wb-start { margin: 0 0 18px; }
.wb-head { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.wb-head .wrong-cat-row { border-top: none; flex: 1; min-width: 0; justify-content: flex-start; gap: 8px; }
.wb-h { margin: 0; font-size: inherit; font-weight: inherit; flex: 1; min-width: 0; }
.wb-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.wb-head .wrong-cat-row b, .wb-go { flex: none; }
.wb-head .wb-go { padding: 4px 14px; font-size: 13.5px; margin: 4px 0; }   /* 跟 .review-row .btn 一樣;要比檔案後面的 .btn 規則具體 */
.wb-caret { flex: none; color: var(--ink-light); font-size: 12px; transition: transform .15s; }
.wb-toggle[aria-expanded="true"] .wb-caret { transform: rotate(180deg); }
.wb-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.wb-item { padding-top: 6px; padding-bottom: 6px; }
.wb-meta { font-size: 12.5px; color: var(--ink-light); }
.wb-stem { color: var(--ink); overflow-wrap: anywhere; margin: 2px 0; }
.wb-ans { overflow-wrap: anywhere; }
/* 「你的答案：…」「正解：…」各自是一整段:放不下就整段換到下一行,標籤和答案不拆開(以前「· 正⏎解：D. …」) */
.wb-you, .wb-key { display: inline-block; max-width: 100%; }
.wb-you { color: var(--bad); }
.wb-key { color: var(--ok); }
@media (max-width: 600px) {
  .wb-you, .wb-key { display: block; }   /* 手機各佔一行,中間的「 · 」不要 */
  .wb-sep { display: none; }
}
.wb-groups { margin-bottom: 40px; }
.q-block .wb-groups { margin-bottom: 0; }
/* 能力分析錯題區每個 Part 的標題列(js/analysis.js):Part 名稱是 h3,樣子跟以前的粗體字一樣;
   題數、看錯題本跟上面 .wb-head 的題數、複習一樣不縮、不斷行(以前 320 寬三段都被擠成兩行,「63 / 題」「看錯題 / 本」)。
   間距跟 .wb-head 一樣 8px(320 寬兩位數題數剛好一行);再放不下(三位數題數)只讓 Part 名稱在空格換行(「Part 5 / 單句填空」,不拆中文字) */
.wb-part-head { display: flex; align-items: center; gap: 8px; }
.wb-part-title { margin: 0; font-size: inherit; font-weight: 700; line-height: inherit; min-width: 0; word-break: keep-all; }
.wb-part-n { color: var(--bad); font-weight: 700; }
.wb-part-n, .wb-part-head .wb-book { flex: none; white-space: nowrap; }
.wb-part-head .wb-book { margin-left: auto; padding: 4px 14px; font-size: 13.5px; }

@media print {
  .topbar, .drill-nav-btns, .no-print, footer { display: none !important; }
  body { font-size: 13px; }
  .report-head { background: none; }
}

/* ---------------- RWD ---------------- */
@media (max-width: 860px) {
  /* 頂欄:第一列=品牌+學生選單,第二列=可橫向滑動的導覽 */
  .topbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 14px 0;
    gap: 0 10px;
  }
  .brand { order: 1; flex: 1; min-width: 0; font-size: 16px; }
  .profile-widget { order: 2; margin-left: auto; }
  .profile-btn { max-width: 150px; overflow: hidden; }
  /* 導覽收成 5 項後不再需要橫向捲動;捲動容器會把下拉選單裁掉,所以改成塞不下就換行 */
  .topnav {
    order: 3;
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px 0 8px;
  }
  .topnav a { padding: 5px 10px; font-size: 14px; }

  .container, .container-narrow { padding: 0 16px; }
  .hero-inner { padding: 30px 16px 34px; }
  .hero h1 { font-size: 24px; }
  .hero .stats { gap: 20px; margin-top: 18px; }
  .daily-home { margin-top: 24px; }
  .daily-home + .module-cards { margin-top: 16px; }
  .daily-card { padding: 16px 18px 10px; }

  .module-cards, .article-list, .part-cards { grid-template-columns: 1fr; gap: 14px; }
  .module-card { padding: 20px 20px 18px; }
  .practice-panels { gap: 14px; }
  .practice-panel { padding: 18px 18px 16px; }
  .cfg-part-check { width: 126px; font-size: 14px; }

  .set-layout { grid-template-columns: 1fr; gap: 14px; }
  .passage-box, .passage-sticky-wrap { position: static; max-height: none; }
  .passage-box { padding: 16px 16px; font-size: 15px; }
  .q-block { padding: 16px 16px; }
  .unit-block { padding: 18px 18px; }
  .lesson-view { padding: 20px 18px; }
  .report-head { padding: 18px 18px; }
  .diag-intro { padding: 20px 18px; }
  .drill-top h1 { font-size: 18px; }
  .page-head h1 { font-size: 22px; }
  .reader-head h1 { font-size: 22px; }

  .article-body.bilingual .para-row { grid-template-columns: 1fr; gap: 6px; }
  .article-body.bilingual .para-row .zh { background: var(--bg-soft); border-radius: 6px; padding: 8px 12px; }
  .article-body p.para { font-size: 16px; }

  .vocab-pop { max-width: calc(100vw - 20px); }
  .modal { padding: 20px 18px; }

  .bar-line { gap: 8px; }
  .bar-line .lb { width: 92px; flex: none; font-size: 13px; }
  .bar-line .val { width: auto; min-width: 56px; font-size: 12px; }
  .cat-bars .lb { width: 104px; }
  table.cat-table { display: block; overflow-x: auto; }
  .unit-sub { max-width: 56vw; }
  .outline-grid { gap: 14px; }
  .wc-bar { flex-wrap: wrap; }
}

/* ---------------- 單字訓練:更多玩法 ---------------- */
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 30px; }
.mem-card {
  min-height: 78px;
  border: 2px solid var(--fill-dark);
  border-radius: var(--radius);
  background: var(--fill);
  color: var(--on-fill);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 8px 6px;
  cursor: pointer;
  transition: transform .18s, background .18s;
  word-break: break-word;
}
.mem-card:hover { transform: translateY(-2px); }
.mem-card.flipped { background: #fff; color: var(--ink); border-color: var(--primary); }
.mem-card.flipped.zh { font-weight: 400; }
.mem-card.matched { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); cursor: default; transform: none; }
.toast-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.toast-card {
  background: #fbe9c8;
  border: 2px solid #e2b96f;
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
}
.toast-card b { display: block; font-size: 17px; color: #5b3d10; margin-bottom: 4px; }
.toast-card span { font-size: 13.5px; color: #7a5a1e; }
.toast-timer { height: 8px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; margin: 4px 0 14px; }
.toast-timer i { display: block; height: 100%; background: var(--hint-orange); transition: width .1s linear; }
.toast-stem { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.vq-list { margin: 14px 0 4px; }
.vq-item { display: flex; gap: 12px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.vq-item b { min-width: 130px; color: var(--primary-dark); }
.vq-item span { color: var(--ink-light); flex: 1; }
.vq-item i { font-style: normal; font-weight: 700; color: var(--ok); }
.vq-item.bad i { color: var(--bad); }

/* ---------------- 學習記錄 ---------------- */
.hist-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.hist-stats .stat { background: var(--bg-soft); border-radius: var(--radius); padding: 12px 8px; text-align: center; }
.hist-stats .stat b { display: block; font-size: 22px; color: var(--primary); }
.hist-stats .stat span { font-size: 12.5px; color: var(--ink-light); }
.hist-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.hist-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
}
.hist-tab.on { background: var(--fill); color: var(--on-fill); border-color: var(--fill); }
.hist-day-head { font-weight: 700; margin: 18px 0 8px; color: var(--ink-light); font-size: 13.5px; }
.hist-row { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: #fff; }
.hist-row.wrong { border-left: 4px solid var(--bad); }
.hist-row-head { display: flex; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; font-size: 14px; }
.hist-row-head:hover { background: var(--bg-soft); }
.hist-time { color: var(--ink-light); font-variant-numeric: tabular-nums; flex: none; }
.hist-stem { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-verdict { flex: none; font-weight: 700; }
.hist-verdict.ok { color: var(--ok); }
.hist-verdict.bad { color: var(--bad); }
.hist-caret { flex: none; color: var(--ink-light); font-size: 12px; transition: transform .15s; }
.hist-row.open .hist-caret { transform: rotate(180deg); }
.hist-row-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.hist-tab.wrong-only.on { border-color: var(--bad); color: var(--bad); background: var(--bad-tint); }
.hist-row-body { padding: 6px 14px 14px; border-top: 1px dashed var(--line); }
.hist-row-body .q-text { margin-top: 10px; }
.hist-tag { font-size: 12.5px; color: var(--ink-light); margin: 8px 0 2px; }

@media (max-width: 860px) {
  .mem-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .mem-card { min-height: 66px; font-size: 14px; }
  .toast-grid { grid-template-columns: 1fr 1fr; }
  .hist-stats { grid-template-columns: 1fr 1fr; }
  .hist-stem { white-space: normal; }
}

/* ---------------- 導覽列群組下拉 ---------------- */
.nav-group { position: relative; }
.nav-btn {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: none;
  border: none;
  padding: 6px 12px 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.nav-btn::after { content: '▾'; font-size: 11px; margin-left: 5px; color: var(--ink-light); }
.nav-btn:hover, .nav-group.open .nav-btn { background: var(--bg-soft); }
.nav-btn.active { color: var(--primary-dark); font-weight: 700; background: var(--primary-tint); }
.nav-btn.active::after { color: var(--primary-dark); }
.nav-menu {
  display: none;
  position: absolute;
  top: 100%; left: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(30,40,50,.16);
  padding: 6px;
  min-width: 150px;
  z-index: 120;
}
.nav-group.open .nav-menu, .nav-group:focus-within .nav-menu { display: block; }
/* 只有真的有滑鼠時才用滑過展開;觸控裝置點一下會殘留 hover 狀態,會讓選單忽開忽關 */
@media (hover: hover) and (pointer: fine) {
  .nav-group:hover .nav-menu { display: block; }
}
.nav-menu a { display: block; padding: 8px 14px; }
@media (max-width: 1180px) {
  .nav-btn { padding: 6px 8px 6px 9px; font-size: 14px; }
}
@media (max-width: 860px) {
  /* 行動版一樣是下拉,只是選單放大好按 */
  .nav-btn { padding: 5px 9px 5px 10px; font-size: 14px; }
  .nav-menu { min-width: 170px; padding: 8px; }
  .nav-menu a { padding: 11px 14px; font-size: 15px; }
  /* 靠右的群組把選單往左收,免得超出螢幕 */
  .nav-group:last-of-type .nav-menu { left: auto; right: 0; }
}

/* 單字考題:拖曳 */
.tq-chip, .tq-blank { touch-action: none; user-select: none; -webkit-user-select: none; }
.tq-chip.dragging, .tq-blank.dragging { opacity: .4; }
.tq-blank.over { outline: 2px dashed var(--primary); outline-offset: 2px; background: var(--primary-tint); }
.tq-ghost {
  position: fixed;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 500;
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--fill);
  color: var(--on-fill);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 6px 18px rgba(0,205,254,.35);
  white-space: nowrap;
}


/* ---------------- 文法:左側路徑導引 ----------------
   左一排=八章圓環(永遠看得到),右一排=目前這章的課程路徑 */
.gx-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 34px; align-items: start; }
.gx-col { min-width: 0; max-width: 770px; }
.gx-rail { position: sticky; top: 74px; display: flex; gap: 8px; align-items: flex-start; padding-top: 20px; }
.gx-stations { position: relative; flex: none; display: flex; flex-direction: column; gap: 4px; }
.gx-stations::before { content: ''; position: absolute; top: 24px; bottom: 24px; left: 50%; border-left: 2px solid var(--line); }
.gx-station {
  position: relative; z-index: 1;
  display: block;
  background: none; border: none;
  padding: 3px;
  border-radius: 50%;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.gx-station:hover { text-decoration: none; }
.gx-ring { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; transition: transform .12s; }
.gx-station:hover .gx-ring { transform: scale(1.06); }
.gx-ring span {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
}
.gx-station.on { box-shadow: 0 0 0 2px var(--primary); }
.gx-station.on .gx-ring span { background: var(--fill); color: var(--on-fill); }
.gx-station.full .gx-ring span { background: var(--ok); color: #fff; }
.gx-pathwrap { flex: 1; min-width: 0; max-height: calc(100vh - 110px); overflow-y: auto; scrollbar-width: thin; padding: 2px 4px 20px; }
.gx-path-title { padding: 6px 4px 2px; }
.gx-path-title b { display: block; font-size: 13.5px; line-height: 1.4; }
.gx-path-title i { font-style: normal; font-size: 12px; color: var(--ink-light); }
.gx-path {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 120px;
  margin: 0 auto;
  padding: 12px 0 14px;
}
.gx-path::before {
  content: ''; position: absolute; top: 10px; bottom: 10px; left: 50%;
  border-left: 2px dotted var(--line);
}
.gx-node {
  position: relative; z-index: 1;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13.5px; font-weight: 700;
  background: #fff;
  border: 2px solid var(--line);
  color: var(--ink-light);
  box-shadow: 0 3px 0 var(--line);
}
.gx-node:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.gx-node.done { background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 3px 0 #2c6c3b; }
.gx-node.next { border-color: var(--primary); color: var(--primary); box-shadow: 0 3px 0 var(--primary-dark); }
.gx-node.cur, .gx-node.cur:hover { background: var(--fill); border-color: var(--fill); color: var(--on-fill); box-shadow: 0 3px 0 var(--fill-dark); }
.gx-continue { display: flex; align-items: center; gap: 12px; margin: -4px 0 20px; font-size: 13.5px; color: var(--ink-light); }
.gx-unit-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 8px;
  color: var(--ink);
}
.gx-unit-row:hover { border-color: var(--primary); text-decoration: none; }
.gx-unit-row .n {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-soft);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--ink-light);
}
.gx-unit-row.done .n { background: var(--ok); color: #fff; }
.gx-unit-row .t { flex: 1; font-size: 15px; }
@media (max-width: 860px) {
  .gx-layout { display: block; }
  .gx-rail { position: static; display: block; padding-top: 10px; }
  .gx-stations { flex-direction: row; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 3px 2px 6px; }
  .gx-stations::-webkit-scrollbar { display: none; }
  .gx-stations::before { display: none; }
  .gx-ring { width: 40px; height: 40px; }
  .gx-ring span { width: 31px; height: 31px; font-size: 14px; }
  .gx-pathwrap { max-height: none; overflow-x: auto; overflow-y: hidden; display: flex; align-items: center; gap: 8px; padding: 4px 0 8px; scrollbar-width: none; }
  .gx-pathwrap::-webkit-scrollbar { display: none; }
  .gx-path-title { display: none; }
  .gx-path { flex-direction: row; width: auto; margin: 0; padding: 0 2px 4px; gap: 6px; }
  .gx-path::before { display: none; }
  .gx-node { flex: none; transform: none !important; width: 32px; height: 32px; font-size: 12.5px; }
}

/* 單字訓練首頁:先勾要練哪些字,再選玩法 */
.vg-source { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 2px 0 16px; font-size: 14.5px; color: var(--ink-light); }
/* 練哪些字:長得像下拉選單的框(summary),點開是一列一個的勾選清單,推開下面的內容(不浮在上面,手機上不會被切掉) */
.vg-pick { flex: 1 1 260px; min-width: 0; max-width: 480px; }
.vg-pick > summary { display: flex; align-items: center; min-height: 40px; cursor: pointer; list-style: none; color: var(--ink); }
.vg-pick > summary::-webkit-details-marker { display: none; }
.vg-pick > summary::after { content: ''; flex: none; margin-left: auto; width: 7px; height: 7px; border: solid var(--ink-light); border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.vg-pick[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.vg-pick > summary:hover { border-color: var(--primary); }
.vg-pick > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vg-pick-sum-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vg-pick-sum-n { flex: none; white-space: pre; padding-right: 8px; }
.vg-pick-panel { margin-top: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.vg-pick-list { border: 0; margin: 0; padding: 0; min-width: 0; }
.vg-pick-legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.vg-pick-row { display: flex; align-items: center; gap: 8px; padding: 0 8px; border-radius: 6px; }
.vg-pick-row:hover { background: var(--bg-soft); }
.vg-pick-check { display: flex; align-items: center; gap: 9px; flex: 1 1 auto; min-width: 0; min-height: 40px; padding: 6px 0; cursor: pointer; color: var(--ink); }
.vg-pick-check input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--fill); cursor: pointer; }
/* 名稱整個顯示、太長就換行(老師按週出的題庫前面都一樣,切成省略號就分不出來;title 提示在手機上不會出現) */
.vg-pick-name { min-width: 0; line-height: 1.4; overflow-wrap: anywhere; }
.vg-pick-n { flex: none; margin-left: auto; font-size: 12.5px; color: var(--ink-light); white-space: nowrap; }
.vg-pick-row .cfg-select { flex: none; padding: 5px 8px; font-size: 14px; }
/* 「我的題庫」小標題;全選是它下面的第一列(.vg-pick-row),勾選框跟各題庫同一欄 */
.vg-pick-group { margin-top: 4px; padding: 8px 8px 2px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.4; color: var(--ink-light); }
.vg-pick-note { margin: 4px 8px 6px; font-size: 13px; color: var(--ink-light); }
.vg-pick-note.warn { color: var(--bad); }
/* 手機:清單佔滿一整行,「練哪些字」換到上面(放在左邊會吃掉一段寬度,清單反而比更窄的手機還窄) */
@media (max-width: 480px) {
  .vg-source { row-gap: 6px; }
  .vg-pick { flex-basis: 100%; max-width: none; }
}
/* 我的單字本卡片:桌機兩欄;600 以下一欄整寬,三顆按鈕排一行、字數那行不折 */
.vg-bank-cards { grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) {
  .vg-bank-cards { grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
  .vg-bank-cards .vg-bank-btns { flex-wrap: nowrap; }
}
.vg-games { grid-template-columns: 1fr 1fr; margin-top: 0; }
.vg-games .part-card { display: flex; flex-direction: column; }
.vg-games .part-card .cfg-row { margin-top: auto; padding-top: 12px; }
@media (max-width: 860px) { .vg-games { grid-template-columns: 1fr; } }

/* ======== 視覺系統(2026-09):螢光筆+筆跡 ========
   規則:元件是平的(不做厚底立體邊);標題與按鈕用圓體;
   螢光筆=圓順的一道(重點與「目前」),其餘筆跡=潦草的原子筆(圈起來、畫線)。
   一頁的螢光筆最多兩處。 */
:root {
  --round: "Chiron GoRound TC", -apple-system, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  --marker: #ffd84d;
  --radius: 12px;
}
h1, h2, h3, .brand, .btn, .hist-tab, .nav-btn { font-family: var(--round); }
h1, h2, h3, .brand { font-weight: 700; }
.nav-btn { font-weight: 400; font-family: var(--font); }

/* 按鈕:圓角、平的 */
.btn { border-radius: 12px; padding: 8px 18px; font-weight: 700; transition: background .15s, border-color .15s, transform .1s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

/* 螢光筆:圓順的一道,壓在頁面標題下半部 */
.page-head h1 { display: inline-block; position: relative; z-index: 0; }
.page-head h1::before {
  content: ''; position: absolute; z-index: -1;
  left: -8px; right: -10px; top: 46%; bottom: 3%;
  background: var(--marker);
  border-radius: 40% 60% 55% 45% / 60% 50% 50% 40%;
  transform: rotate(-1.2deg);
}

/* 文法路徑:上過的課=用筆圈起來;目前這課=螢光筆塗底;還沒上的=淡淡一個圈 */
.gx-node, .gx-node.done, .gx-node.next, .gx-node.cur, .gx-node.cur:hover {
  box-shadow: none; background: none; border: 1.5px solid var(--line); color: var(--ink-light);
}
.gx-node:hover { border-color: var(--primary); color: var(--primary); }
.gx-node.done {
  border-color: transparent; color: var(--ink);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cfilter id='r' x='-20%25' y='-20%25' width='140%25' height='140%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.07' numOctaves='2' seed='4'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='1.8'/%3E%3C/filter%3E%3Cpath d='M21 4.5C30 3.5 36.5 11 36 20.5C35.5 30 28 36.5 19 36C10 35.5 3.5 28 4.5 18.5C5.5 9.5 13 3 23.5 5.5' fill='none' stroke='%23222b36' stroke-width='2' stroke-linecap='round' filter='url(%23r)'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.gx-node.done:nth-child(even) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cfilter id='r' x='-20%25' y='-20%25' width='140%25' height='140%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.07' numOctaves='2' seed='9'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='1.8'/%3E%3C/filter%3E%3Cpath d='M17.5 5C27 2.5 35.5 9 36.5 19C37.5 29 30 36 20.5 36.5C11 37 4 30 4 20.5C4 11 10 4.5 21 4' fill='none' stroke='%23222b36' stroke-width='2' stroke-linecap='round' filter='url(%23r)'/%3E%3C/svg%3E");
}
.gx-node.done:hover { color: var(--primary); }
.gx-node.cur, .gx-node.next, .gx-node.cur:hover, .gx-node.next:hover { border-color: transparent; color: var(--ink); background: none; }
.gx-node.cur::before, .gx-node.next::before {
  content: ''; position: absolute; z-index: -1; inset: 1px -5px;
  background: var(--marker);
  border-radius: 46% 54% 50% 50% / 58% 46% 54% 42%;
  transform: rotate(-5deg);
}
.gx-path::before { border-left: 2px dotted #c9d2da; }
/* 右側課程列表同一套語言 */
.gx-unit-row .n, .gx-unit-row.done .n { background: none; color: var(--ink-light); border: 1.5px solid var(--line); position: relative; z-index: 0; width: 30px; height: 30px; }
.gx-unit-row.done .n {
  border-color: transparent; color: var(--ink);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cfilter id='r' x='-20%25' y='-20%25' width='140%25' height='140%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.07' numOctaves='2' seed='4'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='1.8'/%3E%3C/filter%3E%3Cpath d='M21 4.5C30 3.5 36.5 11 36 20.5C35.5 30 28 36.5 19 36C10 35.5 3.5 28 4.5 18.5C5.5 9.5 13 3 23.5 5.5' fill='none' stroke='%23222b36' stroke-width='2.2' stroke-linecap='round' filter='url(%23r)'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.gx-unit-row.next .n { border-color: transparent; color: var(--ink); }
.gx-unit-row.next .n::before {
  content: ''; position: absolute; z-index: -1; inset: 1px -5px;
  background: var(--marker);
  border-radius: 46% 54% 50% 50% / 58% 46% 54% 42%;
  transform: rotate(-5deg);
}

/* 單字遊戲卡:大圖示在左 */
.vg-top { display: flex; gap: 16px; align-items: center; }
.vg-icon { flex: none; width: 84px; height: 84px; }
.vg-icon svg { width: 100%; height: 100%; display: block; overflow: visible; }
@media (max-width: 860px) { .vg-icon { width: 68px; height: 68px; } }

/* ---------------- 不規則動詞表 ---------------- */
.vb-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0 12px; }
.vb-bar .btn.on { background: var(--marker); border-color: var(--marker); color: var(--ink); }
.vb-count { font-size: 13.5px; color: var(--ink-light); margin-left: auto; }
.vb-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.vb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.vb-code { font-size: 12.5px; color: var(--ink-light); font-weight: 400; margin-left: 8px; letter-spacing: .5px; }
.vb-wrap { overflow-x: auto; }
.vb-table { width: 100%; margin-top: 4px; }
.vb-table td, .vb-table th { padding: 7px 12px; }
.vb-table b { font-size: 15.5px; }
.vb-en { font-variant-numeric: tabular-nums; }
.vb-zh { color: var(--ink-light); font-size: 14px; }
.vb-mask {
  border: 1px dashed var(--line); background: var(--bg-soft); color: var(--ink-light);
  border-radius: 6px; padding: 1px 14px; font: inherit; font-size: 14px; cursor: pointer;
}
.vb-mask:hover { border-color: var(--primary); color: var(--primary); }
.vb-extra-row td { border-top: 0; padding-top: 0; }
.vb-extra { background: #fff; }
.vb-ex { font-size: 13.5px; color: var(--ink); }
.vb-ex span { color: var(--ink-light); margin-left: 10px; }
.vb-note { font-size: 13px; color: var(--hint-orange); margin-top: 2px; }
.vb-stem { font-size: 30px; font-weight: 700; font-family: var(--round); }
.vb-stem span { font-size: 15px; font-weight: 400; color: var(--ink-light); margin-left: 12px; font-family: var(--font); }
.vb-inputs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.vb-input { max-width: 180px; }
.vb-input.vb-ok { border-color: var(--ok); background: var(--ok-tint); }
.vb-input.vb-no { border-color: var(--bad); background: var(--bad-tint); }
@media (max-width: 860px) {
  .vb-count { margin-left: 0; width: 100%; }
  .vb-table td, .vb-table th { padding: 6px 9px; font-size: 14px; }
  .vb-input { max-width: 100%; flex: 1; }
}

/* ======== 登入/註冊卡(登入視窗與 signup.html 共用) ========
   排法參考 Engoo、VoiceTube、Busuu、均一:Google 在最上面、標籤常駐、密碼可切換顯示。
   一律平的:沒有厚底陰影;圓角刻意不統一(輸入框 10px、按鈕 12px),免得整片看起來是套版。 */
.auth { display: grid; gap: 14px; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 8px 16px;
  border: 1px solid #dadce0; border-radius: 12px; background: #fff;
  font-family: var(--round); font-size: 15px; font-weight: 700; color: #3c4043;
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
}
.btn-google:hover { background: #f7f8f9; border-color: #c6cacd; }
.btn-google:active { transform: scale(.97); }
.btn-google:disabled { opacity: .5; cursor: default; transform: none; }
.btn-google .g-logo { display: flex; flex: none; }

.auth-or { display: flex; align-items: center; gap: 12px; color: var(--ink-light); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.auth-form { display: grid; gap: 14px; }
.auth-field { display: grid; gap: 5px; }
.auth-field > label { font-size: 13.5px; color: var(--ink-light); }
.auth-input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 16px; font-family: var(--font); color: var(--ink);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.auth-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.auth-field.is-bad .auth-input { border-color: var(--bad); }
.auth-field.is-bad .auth-hint { display: none; }   /* 出錯就不要把規則跟錯誤疊兩行 */
.auth-field.is-bad .auth-input:focus { box-shadow: 0 0 0 3px var(--bad-tint); }

.auth-pw { position: relative; }
.auth-pw .auth-input { padding-right: 44px; }
.auth-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: flex; padding: 6px; border: 0; background: none; color: var(--ink-light); cursor: pointer;
}
.auth-eye:hover { color: var(--primary); }

.auth-hint { font-size: 12.5px; color: var(--ink-light); }
.auth-note { font-size: 13px; min-height: 0; }
.auth-note.bad { color: var(--bad); }
.auth-note.tip { color: var(--hint-orange); }
.auth-aside { display: flex; justify-content: flex-end; }
.auth-link {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--primary);
}
.auth-link:hover { text-decoration: underline; }
.auth-link.tip { color: var(--hint-orange); text-decoration: underline; }

.auth-msg { font-size: 13.5px; }
.auth-msg.bad { color: var(--bad); }
.auth-msg.ok { color: var(--ok); }
.auth-msg:empty { display: none; }
.auth-submit { width: 100%; min-height: 44px; font-size: 15.5px; }
.auth-full { width: 100%; }
.auth-fine { font-size: 12.5px; color: var(--ink-light); line-height: 1.7; }
.auth-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.auth-head h2 { font-size: 19px; }
.auth-sent { font-size: 14.5px; }
.auth-row { display: flex; gap: 8px; }

/* 標題置中、底部一行切換:大部分網站的登入卡都是這個排法 */
.auth-h { font-size: 21px; text-align: center; margin-bottom: 2px; }
.auth-switch { font-size: 14px; color: var(--ink-light); text-align: center; }
.auth-link.strong { font-weight: 700; margin-left: 4px; }

.modal-auth { max-width: 400px; position: relative; }
.modal-close {
  position: absolute; top: 8px; right: 8px;
  display: flex; padding: 9px; border: 0; background: none;
  color: var(--ink-light); cursor: pointer; border-radius: 10px;
}
.modal-close:hover { background: var(--bg-soft); color: var(--ink); }
/* 內容頁作答被攔下時開的登入卡、本機的「你是哪位？」:標題下面一句為什麼要登入(js/profile.js) */
.auth-why { font-size: 14px; color: var(--ink-soft); text-align: center; margin-top: -8px; }
.modal-gate { position: relative; }
.modal-gate h2 { padding-right: 34px; }
.modal-why { font-size: 14.5px; margin: 8px 0 0; }
/* 觸控螢幕開視窗時焦點先停在標題(不跳出鍵盤),標題不是按鈕,不畫框 */
.modal-auth .auth-h:focus, .modal-gate h2:focus { outline: none; }

/* signup.html:卡片居中,頁面其他東西都拿掉 */
.auth-page { max-width: 400px; margin: 40px auto 60px; }
.auth-page .page-head { margin-bottom: 20px; }
.auth-page .page-head h1 { font-size: 26px; }
.auth-signed { font-size: 15px; display: grid; gap: 14px; justify-items: start; }
@media (max-width: 560px) {
  .auth-page { margin: 24px auto 44px; }
}

/* ======== 安裝後的 App 外殼(2026-10) ========
   head 的開機程式只在主畫面開啟時於 <html> 加 class:
   is-app 處理安全區;app-shell 是外殼版面(外殼程式失敗就拿掉,自動回到網站版面);
   has-tabbar 這頁有分頁列;is-tab-root 分頁根頁;app-kb 鍵盤打開中。
   網站模式這些 class 都不存在,這一段不作用。元件一律平的:不加厚底陰影,不加螢光筆。 */
.app-tabbar, .app-back, .app-title { display: none; }

/* 「我的」頁(me.html;網站直接打開也正常) */
.me-head { display: flex; align-items: center; gap: 14px; margin: 18px 0 20px; }
.me-dot { width: 56px; height: 56px; font-size: 24px; font-family: var(--round); }
.me-who { display: grid; min-width: 0; line-height: 1.5; }
.me-name { font-family: var(--round); font-size: 20px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-mail { font-size: 13.5px; color: var(--ink-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.me-list { list-style: none; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.me-list li + li { border-top: 1px solid var(--line); }
.me-row {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 48px; padding: 0 16px;
  border: 0; background: none; font: inherit; font-size: 16px; color: var(--ink);
  text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.me-row:hover, .me-row:active { background: var(--bg-soft); text-decoration: none; }
.me-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
a.me-row::after { content: '›'; margin-left: 12px; font-size: 20px; line-height: 1; color: #b4bcc4; }
.me-row.danger { color: var(--bad); }
.me-delete { margin: 22px 0 0; }
.me-delete button { border: 0; background: none; min-height: 44px; padding: 0 4px; margin-left: -4px; font: inherit; font-size: 13.5px; color: var(--bad); cursor: pointer; }
.me-delete button:hover { text-decoration: underline; }
/* 班級區(js/classes.js):一個小標、已加入的班一列一個(班名 + 退出)、最後一列「加入班級」 */
.me-sec { margin: 0 0 14px; scroll-margin-top: 72px; }
.me-sec .me-list { margin-bottom: 0; }
.me-sec-h { margin: 22px 0 8px 4px; font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink-light); }
.me-class-msg { margin: 0 0 8px 4px; font-size: 13.5px; overflow-wrap: anywhere; }
.me-class-msg:empty { display: none; }
.me-class-msg.ok { color: var(--ok); }
.me-class-msg.bad { color: var(--bad); }
.me-class { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 8px 0 16px; }
.me-class-name { flex: 1; min-width: 0; font-size: 16px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-class-leave { flex: none; min-height: 44px; padding: 0 10px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14.5px; color: var(--bad); cursor: pointer; }
.me-class-leave:hover { background: var(--bad-tint); }
.me-class-leave:focus-visible { outline: 2px solid var(--primary); outline-offset: 0; }
.me-class-leave:disabled { opacity: .5; cursor: default; }
.me-class.is-loading .me-class-name { color: var(--ink-light); }
.modal-join { max-width: 360px; }
.modal-join .auth-fine { margin-top: 12px; }
.join-code { font-size: 20px; letter-spacing: .12em; text-transform: uppercase; font-variant-numeric: tabular-nums; }

/* 「安裝到手機」說明視窗:沿用登入視窗的 .modal-mask、.modal、.modal-close */
.app-install { max-width: 400px; position: relative; }
.app-steps { margin: 14px 0 16px 22px; display: grid; gap: 10px; font-size: 15.5px; line-height: 1.6; }
.app-share { display: inline-flex; vertical-align: -3px; margin-left: 6px; color: var(--primary); }
.app-install-note { padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }

/* 安全區:斷點照網站,左右留白取「原值或安全區」較大的那個,直放時就是原值 */
html.is-app { --app-tab-h: 56px; --app-bar-h: 52px; --tab-ink: #5f6770; }
html.is-app .topbar { padding-top: env(safe-area-inset-top); }
html.is-app .topbar-inner { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
html.is-app .container, html.is-app .container-narrow, html.is-app .hero-inner { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
html.is-app .passage-box, html.is-app .passage-sticky-wrap { top: calc(76px + env(safe-area-inset-top)); }
html.is-app .gx-rail { top: calc(74px + env(safe-area-inset-top)); }
@media (max-width: 860px) {
  html.is-app .topbar-inner { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  html.is-app .container, html.is-app .container-narrow, html.is-app .hero-inner { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}

/* 外殼:任何寬度都有返回鍵(iOS 主畫面 App 沒有瀏覽器返回) */
html.app-shell .app-back {
  display: inline-flex; align-items: center; justify-content: center; flex: none; order: -1;
  width: 44px; height: 44px; margin-left: -12px; padding: 0;
  border: 0; border-radius: 12px; background: none; color: var(--primary);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
html.app-shell .app-back:active { background: var(--bg-soft); }
html.app-shell .app-back:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
html.app-shell .modal-mask { overflow-y: auto; align-items: flex-start; }
html.app-shell .modal-mask > .modal { margin: auto; }
/* 強制登入(個人頁)和付費牆的遮罩不蓋頂欄和分頁列。付費牆用自己的 class:內容頁是先看再登入(on-action),
   不能靠 data-require-profile 認 */
html.app-shell body[data-require-profile]:not([data-require-profile="on-action"]) .modal-mask,
html.app-shell .modal-mask.pw-mask { top: calc(59px + env(safe-area-inset-top)); }
/* 強制登入時頂欄露在遮罩上方:頂欄自己要疊在遮罩之上,寬視窗的選單下拉才點得到 */
html.app-gate .topbar { z-index: 210; }
html.app-gate .profile-widget { display: none; }   /* 登入卡上已經有登入和註冊,選單裡那兩項會重複而且按了沒反應 */

/* 外殼版面:手機直放、手機橫放、窄的 App 視窗 */
@media (max-width: 860px), (pointer: coarse) and (max-height: 500px) {
  html.app-shell .topbar-inner {
    position: relative; height: var(--app-bar-h); flex-wrap: nowrap; gap: 0 10px;
    padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  }
  html.app-shell .topnav, html.app-shell .profile-widget { display: none; }
  /* 非分頁根頁:品牌字不顯示,但手繪 Y2 留著(每個頂欄都要有)。字寫成 0 號不佔位,圖是固定寬高不受影響;標題兩側讓開返回鍵和 Y2 */
  html.app-shell:not(.is-tab-root) .brand { font-size: 0; gap: 0; flex: none; }
  html.app-shell:not(.is-tab-root) .app-title { left: 96px; right: 96px; }
  html.app-shell .app-title {
    display: block; position: absolute; top: 0; left: 60px; right: 60px;
    line-height: var(--app-bar-h); text-align: center;
    font-family: var(--round); font-size: 16px; font-weight: 700; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    opacity: 0; transition: opacity .2s; pointer-events: none;
  }
  html.app-shell .topbar.is-scrolled .app-title { opacity: 1; }

  html.app-shell.has-tabbar { scroll-padding-bottom: calc(var(--app-tab-h) + 8px); }
  html.app-shell.has-tabbar body { padding-bottom: calc(var(--app-tab-h) + env(safe-area-inset-bottom)); }
  /* 沒有分頁列的頁面(條款、價格、註冊):頁尾連結要讓開 iPhone 底部的手勢條 */
  html.app-shell:not(.has-tabbar) body { padding-bottom: env(safe-area-inset-bottom); }
  html.app-shell.has-tabbar body::after {
    content: ''; position: fixed; left: 0; right: 0; bottom: 0; z-index: 89;
    height: calc(var(--app-tab-h) + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--line);
  }
  html.app-shell .app-tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    height: calc(var(--app-tab-h) + env(safe-area-inset-bottom));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: #fff; border-top: 1px solid var(--line);
  }
  html.app-shell .app-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    height: var(--app-tab-h); color: var(--tab-ink);
    font-family: var(--font); font-size: 12px; line-height: 16px; font-weight: 400; text-decoration: none;
    transition: transform .1s;
    -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
    -webkit-user-select: none; user-select: none; touch-action: manipulation;
  }
  html.app-shell .app-tab:hover { text-decoration: none; }
  html.app-shell .app-tab:active { transform: scale(.97); }
  html.app-shell .app-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -4px; border-radius: 12px; }
  html.app-shell .app-tab svg { display: block; width: 24px; height: 24px; }
  html.app-shell .app-tab .ico-f { display: none; }
  html.app-shell .app-tab.on { color: var(--primary); font-weight: 700; }
  html.app-shell .app-tab.on .ico-o { display: none; }
  html.app-shell .app-tab.on .ico-f { display: inline; }
  html.app-shell.app-kb .app-tabbar, html.app-shell.app-kb.has-tabbar body::after { display: none; }

  /* 強制登入、付費牆的遮罩不蓋頂欄和分頁列,沒登入、到期的學生還能點分頁離開 */
  html.app-shell body[data-require-profile]:not([data-require-profile="on-action"]) .modal-mask,
  html.app-shell .modal-mask.pw-mask {
    top: calc(var(--app-bar-h) + 1px + env(safe-area-inset-top));
    bottom: calc(var(--app-tab-h) + env(safe-area-inset-bottom));
  }
  html.app-shell.app-kb body[data-require-profile]:not([data-require-profile="on-action"]) .modal-mask,
  html.app-shell.app-kb .modal-mask.pw-mask { bottom: 0; }
}
/* 大手機橫放(寬過 860,網站版的黏住欄位還在):黏住的文章框、文法路線扣掉分頁列的高度,最後幾行才不會壓在分頁列底下 */
@media (min-width: 861px) and (pointer: coarse) and (max-height: 500px) {
  html.app-shell.has-tabbar .passage-box, html.app-shell.has-tabbar .passage-sticky-wrap {
    max-height: calc(100vh - 100px - var(--app-tab-h) - env(safe-area-inset-bottom));
  }
  html.app-shell.has-tabbar .passage-col .passage-box, html.app-shell.has-tabbar .passage-sticky-wrap .passage-box { max-height: none; }
  html.app-shell.has-tabbar .gx-pathwrap { max-height: calc(100vh - 110px - var(--app-tab-h) - env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  html.app-shell .app-title, html.app-shell .app-tab { transition: none; }
}
@media print {
  .app-tabbar, .app-back, .app-title { display: none !important; }
  html.app-shell.has-tabbar body { padding-bottom: 0 !important; }
  html.app-shell.has-tabbar body::after { display: none !important; }
}
/* ---------------- 12 時態總整理 ---------------- */
.tn-wrap { overflow-x: auto; margin: 16px 0 4px; }
.tn-grid { display: grid; grid-template-columns: 150px repeat(3, minmax(190px, 1fr)); gap: 8px; min-width: 700px; }
.tn-head {
  font-family: var(--round); font-weight: 700; font-size: 16px;
  text-align: center; padding: 6px 0 2px; position: relative; z-index: 0;
}
.tn-head::before {
  content: ''; position: absolute; z-index: -1; left: 50%; width: 58px; margin-left: -29px;
  top: 40%; bottom: 10%; background: var(--marker);
  border-radius: 44% 56% 50% 50% / 60% 44% 56% 40%; transform: rotate(-1.5deg);
}
.tn-side { align-self: center; padding-right: 8px; }
.tn-side b { display: block; font-family: var(--round); font-size: 15.5px; }
.tn-side span { font-size: 12.5px; color: var(--ink-light); line-height: 1.5; display: block; margin-top: 2px; }
.tn-cell {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  padding: 8px 12px 12px; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; transition: border-color .15s;
}
.tn-cell:hover { border-color: var(--primary); }
.tn-cell.on { border-color: var(--primary); background: var(--primary-tint); }
.tn-cell.empty { border: 0; background: none; cursor: default; }
.tn-axis svg { width: 100%; height: auto; max-width: 172px; display: block; overflow: visible; }
.tn-axis-big svg { max-width: 300px; margin: 10px 0 2px; }
.tn-form { font-size: 13.5px; font-weight: 700; color: var(--primary-dark); }
.tn-ex { font-size: 12.5px; color: var(--ink-light); line-height: 1.5; }

.tn-detail { border: 1px solid var(--primary); border-radius: var(--radius); padding: 18px 20px 20px; margin: 14px 0 6px; background: #fff; }
.tn-detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tn-detail-head h2 { font-size: 20px; margin: 0; }
.tn-detail-head code { font-size: 14px; background: var(--bg-soft); padding: 3px 10px; border-radius: 6px; color: var(--primary-dark); }
.tn-detail-head .pop-mini { margin-left: auto; }
.tn-feel { font-size: 15.5px; margin: 10px 0 14px; line-height: 1.8; }
.tn-formnote { font-size: 13.5px; color: var(--ink-light); line-height: 1.75; margin: -6px 0 14px; }
.tn-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.tn-sub { font-size: 13px; font-weight: 700; color: var(--ink-light); margin: 14px 0 6px; }
.tn-sub:first-child { margin-top: 0; }
.tn-when { margin: 0; padding-left: 20px; display: grid; gap: 5px; font-size: 14.5px; }
.tn-signals { display: flex; gap: 6px; flex-wrap: wrap; }
.tn-signals span { border: 1px solid var(--line); border-radius: 20px; padding: 2px 12px; font-size: 13px; color: var(--ink-light); }
.tn-contrast, .tn-mistake { font-size: 13.5px; line-height: 1.7; margin-top: 12px; padding-left: 12px; border-left: 3px solid var(--line); color: var(--ink-light); }
.tn-mistake { border-left-color: var(--hint-orange); color: var(--ink); }
.tn-exbox { margin-bottom: 10px; }
.tn-pair-en { font-size: 15px; }
.tn-pair-zh { font-size: 13px; color: var(--ink-light); margin-top: 1px; }
.tn-pair-note { font-size: 12.5px; color: var(--hint-orange); margin-top: 2px; }
.tn-partner { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.tn-partner:first-of-type { border-top: 0; }

.tn-group { font-size: 15px; font-family: var(--round); margin: 20px 0 8px; }
.tn-pairs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 14px; }
.tn-pair { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; background: #fff; }
.tn-pair-head { display: flex; align-items: baseline; gap: 10px; }
.tn-pair-head b { font-size: 16px; }
.tn-pair-head span { font-size: 13px; color: var(--ink-light); }
.tn-pattern { font-size: 13px; color: var(--primary-dark); background: var(--primary-tint); border-radius: 6px; padding: 5px 10px; margin: 8px 0; line-height: 1.6; }
.tn-explain { font-size: 14px; margin: 0 0 10px; line-height: 1.75; }
.tn-pair-ex > div { margin-bottom: 8px; }

@media (max-width: 860px) {
  .tn-grid { grid-template-columns: 112px repeat(3, minmax(165px, 1fr)); min-width: 620px; }
  .tn-side span { display: none; }
  .tn-cols { grid-template-columns: 1fr; gap: 4px; }
  .tn-detail { padding: 16px 16px 18px; }
}

/* 章末附錄列(查得到的表,不是一堂課) */
.gx-appendix { border-style: dashed; margin-top: 14px; }
.gx-appendix .n { background: var(--marker); color: var(--ink); border-color: transparent; font-size: 12.5px; }
.gx-appendix .t i { display: block; font-style: normal; font-size: 12.5px; color: var(--ink-light); margin-top: 1px; }

/* 登入失效提示(profile.js expiredNotice):頂欄下面一行,只出現一次,可關閉 */
.auth-expired {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 20px;
  font-size: 14px;
  color: var(--ink);
  border-top: 1px solid var(--line);
}
.auth-expired-login {
  border: 0;
  background: none;
  padding: 4px 2px;
  color: var(--primary);
  font-size: 14px;
}
.auth-expired-login:hover { text-decoration: underline; }
.auth-expired-x {
  margin-left: auto;
  border: 0;
  background: none;
  padding: 4px;
  border-radius: 6px;
  color: var(--ink-light);
  display: flex;
}
.auth-expired-x:hover { background: var(--bg-soft); color: var(--ink); }
.auth-expired button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
html.is-app .auth-expired { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
@media (max-width: 860px) {
  html.is-app .auth-expired { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}

/* ============ 對話練習(dialogue.html) ============ */
.dlg-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0 60px; }
.dlg-card {
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink); transition: box-shadow .15s, border-color .15s;
}
.dlg-card .thumb { background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.dlg-card .thumb img { width: 100%; height: 170px; display: block; object-fit: cover; object-position: center 30%; }
.dlg-illust img { object-position: center 30%; }
.dlg-card .body { padding: 15px 18px 16px; }
.dlg-card:hover { text-decoration: none; border-color: var(--primary); box-shadow: 0 3px 14px rgba(0,205,254,.1); }
.dlg-card .meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-light); margin-bottom: 6px; flex-wrap: wrap; }
.dlg-card-title { font-size: 17px; font-weight: 700; line-height: 1.45; }
.dlg-card-en { color: var(--ink-light); font-size: 14px; margin-top: 1px; }
.dlg-card-scene { font-size: 14px; margin: 8px 0 0; line-height: 1.7; }
.dlg-card .progress-note { margin-top: 8px; font-size: 12.5px; color: var(--ok); }
.dlg-scene { margin: 12px 0 4px; padding: 10px 14px; border-radius: var(--radius); background: var(--bg-soft); font-size: 15px; line-height: 1.8; }
.dlg-msg { font-size: 13px; color: var(--bad); }
.dlg-lines { display: flex; flex-direction: column; gap: 14px; margin: 20px 0 30px; }
.dlg-line { display: flex; flex-direction: column; max-width: 82%; }
.dlg-line.left { align-self: flex-start; }
.dlg-line.right { align-self: flex-end; align-items: flex-end; }
.dlg-who { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-light); margin: 0 4px 4px; }
.dlg-dot { width: 22px; height: 22px; font-size: 12px; }
.dlg-bubble {
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff;
  font-size: 16.5px; line-height: 1.7; cursor: pointer; transition: border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.dlg-line.left .dlg-bubble { border-top-left-radius: 4px; }
.dlg-line.right .dlg-bubble { border-top-right-radius: 4px; background: var(--primary-tint); border-color: var(--line); }
.dlg-bubble:hover { border-color: var(--primary); }
.dlg-bubble:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.dlg-bubble.playing { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-tint); }
.dlg-bubble .zh { display: none; margin-top: 4px; font-size: 14.5px; color: var(--ink-light); line-height: 1.7; }
.dlg-lines.show-zh .dlg-bubble .zh { display: block; }
.dlg-sl { cursor: pointer; }
.dlg-pop-m { margin-top: 6px; font-size: 15px; line-height: 1.7; }
.dlg-pop-n { margin-top: 4px; font-size: 13.5px; color: var(--ink-light); line-height: 1.6; }
.dlg-glossary { margin: 10px 0 60px; padding-top: 18px; border-top: 1px solid var(--line); }
.dlg-glossary h2 { font-size: 18px; margin-bottom: 10px; }
.dlg-glossary dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; }
.dlg-glossary dt { font-weight: 700; }
.dlg-glossary dd { margin: 0; line-height: 1.7; }
.dlg-note { display: block; font-size: 13.5px; color: var(--ink-light); }
@media (max-width: 860px) {
  .dlg-list { grid-template-columns: 1fr; }
  .dlg-line { max-width: 92%; }
  .dlg-glossary dl { grid-template-columns: 1fr; gap: 2px; }
  .dlg-glossary dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { .dlg-bubble, .dlg-card { transition: none; } }

/* 文法路徑:章內的查表節點(三態表)與全部章節後的總整理站 */
.gx-node-ref { border-style: dashed; font-size: 12.5px; }
.gx-station-sum .gx-ring { background: repeating-conic-gradient(var(--line) 0 9deg, transparent 9deg 18deg); }
.gx-station-sum .gx-ring span { font-family: var(--round); }
/* 嵌在文法區右欄時,時態矩陣收窄一點 */
.gx-col .tn-grid { grid-template-columns: 124px repeat(3, minmax(176px, 1fr)); min-width: 680px; }

/* ======== 手機版修正(2026-10 全站手機稽核) ======== */
/* 篩選小圓鈕與標籤不拆字:對話、閱讀的分類一排放不下就換行,寫作單元的「技巧課」不被擠成直排 */
.drill-filters { flex-wrap: wrap; }
.chip, .badge { white-space: nowrap; }
.unit-row .badge { flex: none; }
/* 觸控螢幕上「← 回…」連結的可點範圍加高(上下內距配負外距,畫面位置不變) */
@media (pointer: coarse) {
  .drill-top > a, .meta > a, .unit-back { padding-top: 10px; padding-bottom: 10px; margin-top: -10px; margin-bottom: -10px; }
}
/* 條款頁的清單:全站 reset 把 ul 內距歸零,圓點會貼在卡片邊上 */
.lesson-view > ul, .lesson-view > ol { padding-left: 1.4em; }

@media (max-width: 600px) {
  /* 12 時態總整理:手機上整張表三欄都看得到。面向名稱改直排,格子只留時間軸與公式,例句在點開的說明裡 */
  .tn-wrap { overflow: visible; margin: 12px 0 4px; }
  .tn-grid, .gx-col .tn-grid { grid-template-columns: 26px repeat(3, minmax(0, 1fr)); gap: 6px; min-width: 0; }
  .tn-head { font-size: 14px; }
  .tn-head::before { width: 44px; margin-left: -22px; }
  .tn-side { padding-right: 0; justify-self: center; }
  .tn-side b { writing-mode: vertical-rl; font-size: 14px; letter-spacing: 3px; }
  .tn-cell { padding: 6px 6px 9px; gap: 4px; }
  .tn-cell .tn-axis text { display: none; }
  .tn-ex { display: none; }
  .tn-form { font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
  .tn-form .nobr { white-space: nowrap; }

  /* 動詞測驗:過去式、過去分詞兩格一樣寬,對答案鈕放下一行 */
  .vb-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .vb-inputs .btn { grid-column: 1 / -1; }
  .vb-input { max-width: none; width: 100%; min-width: 0; }

  /* 文法課內文的表格:縮小格子內距,欄位才不會被擠成一字一行 */
  .lesson-view { padding: 18px 14px; }
  .lesson-view .gx-table { font-size: 14px; }
  .lesson-view .gx-table th, .lesson-view .gx-table td { padding: 6px 8px; }

  /* 程度檢測報告的考點表:格子內距縮小,「僅1題」放到判定下面 */
  table.cat-table th, table.cat-table td { padding: 8px 6px; }
  .cat-few { display: block; margin: 2px 0 0; }

  /* 學習記錄:時間、類別、對錯放第一行,題目整行放第二行 */
  .hist-row-head { flex-wrap: wrap; row-gap: 4px; }
  .hist-verdict { margin-left: auto; }
  .hist-stem { order: 5; flex: 0 0 100%; white-space: normal; }
}

/* ======== 自然發音(phonics.html):路徑沿用 .gx-*,這裡是字卡、對比字、聽音題 ======== */
.ph-key { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
.ph-key-kk {
  font-size: 26px; font-weight: 700; padding: 0 10px; position: relative; z-index: 0;
  font-family: "Segoe UI", "Lucida Sans Unicode", "Noto Sans", sans-serif;
}
.ph-key-kk::before {
  content: ''; position: absolute; z-index: -1; left: 2px; right: 2px; top: 38%; bottom: 8%;
  background: var(--marker); border-radius: 44% 56% 50% 50% / 60% 44% 56% 40%; transform: rotate(-1.5deg);
}
.ph-key-play, .ph-chart-play {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff;
  border-radius: 12px; padding: 6px 14px; font: inherit; font-size: 17px; font-weight: 700; color: var(--ink); cursor: pointer;
}
.ph-key-hint { font-size: 13.5px; color: var(--ink-light); }
.ph-slow {
  border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 4px 14px;
  font: inherit; font-size: 13.5px; color: var(--ink-light); cursor: pointer;
}
.ph-key .ph-slow { margin-left: auto; }
.ph-slow.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.ph-spk { display: inline-flex; width: 18px; height: 18px; color: var(--ink-light); flex: none; }
.ph-spk svg { width: 100%; height: 100%; }
.playing .ph-spk, .ph-sent-play.playing { color: var(--primary); }
.ph-sub { font-size: 13.5px; font-weight: 700; color: var(--ink-light); margin: 16px 0 8px; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin: 10px 0 16px; }
.ph-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 10px 12px 9px;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer; transition: border-color .15s;
}
.ph-card .ph-spk { position: absolute; top: 9px; right: 9px; width: 15px; height: 15px; }
.ph-card:hover, .ph-key-play:hover, .ph-chart-play:hover { border-color: var(--primary); }
.ph-card.playing, .ph-key-play.playing, .ph-chart-play.playing { border-color: var(--primary); background: var(--primary-tint); }
.ph-card:active, .ph-key-play:active, .ph-chart-play:active, .ph-sent-play:active { transform: scale(.97); }
.ph-w { font-size: 20px; font-weight: 700; letter-spacing: .3px; overflow-wrap: anywhere; padding-right: 14px; }
.ph-hl { color: #d2443c; font-weight: 800; }
.ph-zh { font-size: 13px; color: var(--ink-light); line-height: 1.5; }
.ph-card-sm { padding: 7px 12px; flex-direction: row; align-items: baseline; gap: 8px; }
.ph-card-sm .ph-w { font-size: 17px; }
.ph-card-sm .ph-spk { position: static; order: 3; width: 14px; height: 14px; align-self: center; }
.ph-pairs { display: grid; gap: 8px; margin: 10px 0 16px; }
.ph-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 6px 8px; max-width: 520px; }
.ph-vs { color: var(--ink-light); align-self: center; }
.ph-pair-note { grid-column: 1 / -1; font-size: 13.5px; color: var(--ink-light); line-height: 1.6; margin-bottom: 4px; }
.ph-sent { display: flex; gap: 12px; align-items: flex-start; background: var(--bg-soft); border-radius: 12px; padding: 12px 14px; margin: 12px 0 16px; }
.ph-sent-play {
  flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  color: var(--ink-light); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 9px;
}
.ph-sent-play svg { width: 100%; height: 100%; }
.ph-sent-en { font-size: 16px; line-height: 1.7; }
.ph-sent-zh { font-size: 13.5px; color: var(--ink-light); }
.ph-listen-row { margin-top: 12px; }
.ph-listen { display: inline-flex; align-items: center; gap: 8px; }
.ph-listen .ph-spk { color: currentColor; }
.ph-compare { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.ph-row-kk { margin-left: auto; padding-left: 10px; color: var(--ink-light); font-size: 14px; white-space: nowrap; font-family: "Segoe UI", "Lucida Sans Unicode", "Noto Sans", sans-serif; }
.ph-chart-h { font-size: 16px; font-family: var(--round); margin: 22px 0 8px; }
.ph-chart { display: grid; gap: 6px; }
.ph-chart-row { display: grid; grid-template-columns: 120px 130px 1fr; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.ph-chart-row.done a { color: var(--ink-light); }
.ph-chart-kk { font-size: 18px; font-weight: 700; font-family: "Segoe UI", "Lucida Sans Unicode", "Noto Sans", sans-serif; }
.ph-chart-play { font-size: 15px; padding: 4px 10px; justify-self: start; }
.ph-chart-row a { font-size: 14.5px; }
@media (max-width: 600px) {
  .ph-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .ph-w { font-size: 18px; }
  .ph-key .ph-slow { margin-left: 0; }
  .ph-key-hint { flex: 0 0 100%; order: 5; }
  .ph-chart-row { grid-template-columns: auto 1fr; }
  .ph-chart-row a { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .ph-card, .ph-card:active { transition: none; transform: none; } }

/* ======== 方案與價格(pricing.html,2026-10) ========
   三個方案各一張平的卡片,規則、付款、聯絡是卡片外的一般段落。價格數字用圓體,表格數字靠右對齊。
   月繳/年繳等小字標籤用 --ink(--ink-light 在 --bg-soft 上只有 3.8:1,不到 4.5:1);文中連結加底線,不只靠顏色區分。 */
.pricing-plan { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 24px 28px 20px; margin: 18px 0; }
.pricing h2 { font-size: 20px; margin-bottom: 12px; }
.pricing-plan p, .pricing-info p { margin: 0 0 10px; }
.pricing-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 460px; margin: 0 0 16px; }
.pricing-opts .pricing-opt { display: flex; flex-direction: column; margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--bg-soft); line-height: 1.35; }
.pricing-opt span { font-size: 13.5px; color: var(--ink); }
.pricing-opt b { font-family: var(--round); font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pricing-opt small { font-family: var(--font); font-size: 15px; font-weight: 400; }
.pricing-table-wrap { overflow-x: auto; margin: 0 0 14px; }
.pricing-table { width: 100%; max-width: 460px; border-collapse: collapse; font-size: 15.5px; line-height: 1.5; }
.pricing-table caption { caption-side: top; text-align: left; font-size: 13.5px; color: var(--ink); padding-bottom: 4px; }
.pricing-table th, .pricing-table td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; white-space: nowrap; }
.pricing-table thead th { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.pricing-table tbody th { font-weight: 400; }
.pricing-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pricing-table td.num { font-family: var(--round); font-size: 17px; font-weight: 700; }
.pricing-table td.num small { font-family: var(--font); font-size: 14px; font-weight: 400; }
.pricing p, .pricing li { text-wrap: pretty; }
.pricing p a { text-decoration: underline; text-underline-offset: 2px; }
.pricing-list { margin: 0 0 10px; padding-left: 1.4em; }
.pricing-list li + li { margin-top: 4px; }
.pricing-info { margin: 30px 0 0; }
.pricing-info h2 { font-size: 18px; margin-bottom: 8px; }
@media (max-width: 600px) {
  .pricing-plan { padding: 18px 16px 14px; }
  .pricing h2 { font-size: 19px; }
  .pricing-info h2 { font-size: 17px; }
  .pricing-opts .pricing-opt { padding: 10px 12px; }
  .pricing-opt b { font-size: 23px; }
  .pricing-table { font-size: 15px; }
  .pricing-table td.num { font-size: 16px; }
  .pricing-table th, .pricing-table td { padding: 9px 6px; }
}

/* ======== 購買與付款結果(js/checkout.js、js/pay-result.js;PAID_UI 打開,或站長的 ?paytest=1 才出現) ========
   購買按鈕放在每個方案的價格下面;按下去是一個確認視窗:選項目、勾選同意、前往付款。
   選項用原生 radio,選中的那一列用主色框加淡底,跟註冊時選名額同一套語言。元件一律平的,不加厚底陰影 */
.topbar-inner > .brand + .profile-widget { margin-left: auto; }   /* 價格頁、付款結果頁沒有導覽列:頭像照樣靠右 */
.pricing-buy { margin: 0 0 16px; }
.pricing-buy-btn { min-height: 44px; padding: 0 22px; font-size: 15.5px; }
.pricing-buy-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pricing-test { border-style: dashed; }
.modal-buy { max-width: 400px; }
/* 老師方案的購買視窗比手機與 1280×720、1366×768 的筆電畫面高:外框可以捲動、從頂端排,
   標題、付款帳號、關閉鈕與最下面的條款連結才看得到(跟註冊視窗的 .auth-role 同一種做法) */
.modal-mask.buy-mask { overflow-y: auto; align-items: flex-start; }
.modal-mask.buy-mask > .modal { margin: auto; }
.buy-opts { border: 0; margin: 0; padding: 0; min-width: 0; }
.buy-legend { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.buy-opt-list { display: grid; gap: 8px; }
.buy-opt {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 15px; color: var(--ink); cursor: pointer;
}
.buy-opt input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--fill); cursor: pointer; }
.buy-opt input[hidden] { display: none; }
.buy-opt-name { flex: 1; min-width: 0; }
.buy-opt-amt { font-family: var(--round); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.buy-opt-amt small { margin-right: 2px; font-family: var(--font); font-size: 14px; font-weight: 400; color: var(--ink-soft); }
.buy-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.buy-opt:has(input[hidden]) { cursor: default; }
.buy-opt:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.buy-consent {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--bg-soft);
  font-size: 14.5px; line-height: 1.6; color: var(--ink); cursor: pointer;
}
.buy-consent input { flex: none; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--fill); cursor: pointer; }
.buy-consent:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.modal-buy .auth-fine { margin-top: 12px; text-align: center; color: var(--ink-soft); }
.modal-buy .auth-fine a { text-decoration: underline; text-underline-offset: 2px; }
/* 價格頁按鈕旁的一句說明(已經可以使用、班級提供、老師方案請聯絡站長);沒有按鈕時只有這一句 */
.pricing-buy-note { margin: 0 0 10px; font-size: 14.5px; line-height: 1.7; color: var(--ink-soft); text-wrap: pretty; }
.pricing-buy-note:last-child { margin-bottom: 0; }
/* 選項下面的起算說明、勾選框下面「怎樣算開始使用」。顏色用 --ink-soft:白底對比要到 4.5:1 */
.buy-note { margin: 10px 2px 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-soft); text-wrap: pretty; }
.buy-note[hidden] { display: none; }
.buy-def { margin: 6px 2px 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-soft); text-wrap: pretty; }
/* 送出中:按鈕維持主色、不淡掉(跟還沒勾選的停用狀態分得出來) */
.modal-buy[aria-busy="true"] .buy-submit { opacity: 1; cursor: progress; }
/* 送出中「正在前往付款頁」寫在按鈕上;提示區的同一句只給讀螢幕軟體,畫面上不重複 */
.auth-msg.buy-sending { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* 送出中焦點移到標題(讀螢幕軟體用),不畫框 */
.modal-buy .auth-h:focus { outline: none; }

.pay-result { margin: 8px 0 40px; padding: 28px 24px 22px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: center; }
.pay-h { font-size: 22px; margin-bottom: 10px; }
.pay-h:focus { outline: none; }   /* 有最後結果時程式把焦點移到標題(朗讀用),不畫框 */
.pay-result.is-ok .pay-h { color: var(--ok); }
.pay-result.is-bad .pay-h { color: var(--bad); }
.pay-line { margin: 0 0 6px; font-size: 15.5px; line-height: 1.7; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-wrap: pretty; }
.pay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.pay-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; font-size: 15.5px; text-decoration: none; }
.pay-btn:hover { text-decoration: none; }
.pay-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pay-order { margin: 18px 0 0; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .pay-result { padding: 22px 16px 18px; }
  .pay-actions { display: grid; }
}

/* ======== 付費牆與「我的」頁的方案(js/paywall.js,只有 PAID_UI 打開才會出現) ======== */
.modal-paywall { max-width: 360px; text-align: center; padding: 28px 24px 18px; }
.pw-icon { display: inline-flex; color: var(--primary); margin-bottom: 6px; }
.pw-h { font-size: 21px; }
.pw-line { margin: 6px 0 0; font-size: 15px; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.pw-actions { display: grid; gap: 10px; margin-top: 20px; }
.pw-btn { display: flex; align-items: center; justify-content: center; min-height: 44px; font-size: 15.5px; text-decoration: none; }
.pw-btn:hover { text-decoration: none; }
.pw-logout { justify-self: center; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; font: inherit; font-size: 14px; color: var(--ink-light); cursor: pointer; }
.pw-logout:hover { color: var(--ink); background: var(--bg-soft); }
.pw-actions a:focus-visible, .pw-logout:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.trial-note .auth-expired-login { text-decoration: none; }

.me-plan { font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.me-plan.is-expired { color: var(--bad); }
.me-plan-link { margin-left: 10px; font-weight: 700; }
.me-expand::after { content: ''; width: 8px; height: 8px; margin: -4px 4px 0 12px; border: solid #b4bcc4; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.me-expand[aria-expanded="true"]::after { transform: rotate(-135deg); margin-top: 4px; }
.me-static { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 16px; font-size: 16px; color: var(--ink); }
.me-static-val { color: var(--ink-light); font-variant-numeric: tabular-nums; white-space: nowrap; }
.me-bill { padding: 4px 16px 14px; border-top: 1px solid var(--line); background: var(--bg-soft); }
.me-bill-sec + .me-bill-sec { margin-top: 4px; }
.me-bill-h { margin: 10px 0 4px; font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.me-bill-list { list-style: none; margin: 0; padding: 0; }
.me-bill-list li { padding: 5px 0; font-size: 14.5px; line-height: 1.5; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.me-bill-list li + li { border-top: 1px dashed var(--line); }
.me-bill-list li.is-revoked { color: var(--ink-light); }
.me-bill-msg { margin: 10px 0 0; font-size: 14px; color: var(--ink-light); }
.me-bill-msg.bad { color: var(--bad); }
.me-bill-more { margin: 10px 0 0; font-size: 14px; }
.me-class-state { flex: none; font-size: 13px; color: var(--ok); white-space: nowrap; }
.me-class-state.is-off { color: var(--bad); }

.modal-trial { max-width: 380px; }
.modal-trial .auth-h { padding: 0 34px; }   /* 標題不跑到右上角的關閉鈕底下 */
.trial-who { text-align: center; font-size: 14px; color: var(--ink-soft); margin: 2px 0 14px; overflow-wrap: anywhere; }
.trial-seats { border: 0; margin: 0; padding: 0; min-width: 0; }
.trial-seats legend { padding: 0; margin-bottom: 5px; font-size: 13.5px; color: var(--ink-light); }
.trial-seat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trial-seat { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; font-size: 15.5px; font-weight: 700; color: var(--ink); cursor: pointer; }
.trial-seat input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.trial-seat:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); color: var(--primary-dark); }
.trial-seat:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.trial-cancel { min-height: 44px; }
.trial-code-box { display: grid; gap: 4px; margin: 4px 0 12px; padding: 14px 16px; border-radius: 12px; background: var(--bg-soft); text-align: center; }
.trial-code-label { font-size: 13.5px; color: var(--ink-light); }
.trial-class { margin: 0; font-size: 14.5px; color: var(--ink); overflow-wrap: anywhere; }
.trial-class:empty { display: none; }
.trial-code-note { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--ink); }
.trial-code-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.trial-code { font-family: var(--round); font-weight: 700; color: var(--ink); }
.trial-go { display: flex; align-items: center; justify-content: center; margin: 4px 0 10px; text-decoration: none; }
.trial-go:hover { text-decoration: none; }
.modal-trial .auth-fine { margin-top: 12px; text-align: center; }
.trial-go:focus-visible, .trial-copy:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.trial-fail { margin: 6px 0 16px; text-align: center; overflow-wrap: anywhere; }
.trial-again { margin-bottom: 10px; }
.modal-trial .auth-h:focus { outline: none; }   /* 自動開試用「開通中」把焦點放在標題(讓 Tab 留在視窗裡),標題不是按鈕,不畫框 */

/* 登入視窗裡出現身分選擇(PAID_UI 打開)時,選了老師會比畫面高:遮罩改成可以捲動,視窗夠矮時照舊置中。
   沒有身分選擇時這兩條都不成立,視窗跟以前一模一樣 */
.modal-mask:has(.auth-role) { overflow-y: auto; align-items: flex-start; }
.modal-mask:has(.auth-role) > .modal { margin: auto; }

/* ======== 註冊時選身分(js/profile.js rolePicker;PAID_UI 打開才出現) ========
   兩張選項卡用原生 radio(方向鍵可以換),選中的那張用主色框加淡底,跟試用視窗的名額選擇同一套語言 */
.auth-role { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 12px; }
.auth-role-legend { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.auth-role-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.auth-role-card {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  font-family: var(--round); font-size: 16px; font-weight: 700; color: var(--ink);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.auth-role-card input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.auth-role-card:hover { border-color: var(--primary); }
.auth-role-card:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); color: var(--primary-dark); box-shadow: inset 0 0 0 1px var(--primary); }
.auth-role-card:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.auth-teacher { display: grid; gap: 12px; padding: 14px 14px 12px; border-radius: 12px; background: var(--bg-soft); }
.auth-teacher[hidden] { display: none; }
.auth-seats { border: 0; margin: 0; padding: 0; min-width: 0; }
.auth-seats legend { padding: 0; margin-bottom: 5px; font-size: 13.5px; color: var(--ink-light); }
.auth-seat-list { display: grid; gap: 8px; }
.auth-seat {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 15px; color: var(--ink); cursor: pointer;
}
.auth-seat input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--fill); cursor: pointer; }
.auth-seat:has(input:checked) { border-color: var(--primary); }
.auth-seat-n { font-weight: 700; min-width: 3.6em; }
.auth-seat-p { margin-left: auto; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.auth-teacher .auth-input { background: #fff; }
.auth-plan { margin: 0; font-size: 13.5px; }

/* ======== 教師後台的班級區(js/admin-classes.js) ======== */
.ac-box { margin: 18px 0 20px; padding: 16px 18px 14px; }
.ac-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ac-h { font-size: 17px; }
.ac-add { min-height: 40px; }
.ac-msg { margin: 8px 0 0; font-size: 14px; color: var(--ink-light); overflow-wrap: anywhere; }
.ac-msg:empty { display: none; }
.ac-msg.ok { color: var(--ok); }
.ac-msg.bad { color: var(--bad); }
.ac-list { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.ac-list > li + li { border-top: 1px solid var(--line); }
.ac-empty { padding: 14px 16px; font-size: 14.5px; color: var(--ink-light); }
.ac-class { padding: 14px 16px 6px; }
.ac-top { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.ac-name { font-size: 16.5px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.ac-count { font-size: 14px; color: var(--ink-light); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-off { font-size: 13px; color: var(--bad); white-space: nowrap; }
.ac-code-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; }
.ac-code-label { font-size: 13.5px; color: var(--ink-light); }
.ac-code { font-family: var(--round); font-size: 21px; font-weight: 700; letter-spacing: .06em; color: var(--ink); font-variant-numeric: tabular-nums; }
.ac-class.is-off .ac-code { color: var(--ink-light); text-decoration: line-through; text-decoration-thickness: 1px; }
.ac-actions { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 6px 0 2px -8px; }
.ac-btn { min-height: 40px; padding: 0 8px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14px; color: var(--primary); cursor: pointer; }
.ac-btn:hover { background: var(--primary-tint); color: var(--primary-dark); }
.ac-btn:disabled { opacity: .45; cursor: default; }
.ac-btn:focus-visible, .ac-expand:focus-visible, .ac-add:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ac-code-line .ac-btn { min-height: 36px; }
.ac-expand { display: flex; align-items: center; width: calc(100% + 32px); min-height: 44px; margin: 4px -16px 0; padding: 0 16px; border: 0; border-top: 1px dashed var(--line); background: none; font: inherit; font-size: 14.5px; color: var(--ink); text-align: left; cursor: pointer; }
.ac-expand::after { content: ''; width: 8px; height: 8px; margin: -4px 4px 0 auto; border: solid #b4bcc4; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.ac-expand[aria-expanded="true"]::after { transform: rotate(-135deg); margin-top: 4px; }
.ac-expand:hover { color: var(--primary); }
.ac-members { list-style: none; margin: 0 -16px; padding: 0 16px 8px; background: var(--bg-soft); }
.ac-members[hidden] { display: none; }
.ac-member { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; }
.ac-member + .ac-member { border-top: 1px solid var(--line); }
.ac-members .ac-empty { padding: 10px 0; }
.ac-m-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.ac-m-name { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.ac-m-mail, .ac-m-date { font-size: 13px; color: var(--ink-light); overflow-wrap: anywhere; }
.ac-m-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-remove { flex: none; color: var(--bad); }
.ac-remove:hover { background: var(--bad-tint); color: var(--bad); }
.ac-plan { margin: 0 0 14px; padding: 0 0 14px; border-bottom: 1px solid var(--line); }
.ac-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-chip { padding: 4px 12px; border-radius: 999px; background: var(--bg-soft); font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-plan-line { margin: 8px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--ink); }
.ac-plan-line.is-bad { color: var(--bad); }
.ac-chips + .ac-plan-line { margin-top: 10px; }
.ac-plan > .ac-plan-line:first-child { margin-top: 0; }
.ac-trial-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.ac-trial-btn { min-height: 44px; }
.ac-trial-link { font-size: 14px; }
.ac-trial .ac-h { margin-bottom: 2px; }
.ac-dialog { max-width: 380px; }
.ac-dialog .ac-dialog-h { padding: 0 34px; overflow-wrap: anywhere; }
.ac-dialog-line { margin: 8px 0 0; font-size: 15px; line-height: 1.65; color: var(--ink); text-align: center; overflow-wrap: anywhere; }
.ac-dialog .auth-form { margin-top: 16px; }
.ac-dialog .ac-cancel { min-height: 44px; }
.ac-dialog .ac-danger { background: var(--bad); border-color: var(--bad); }
.ac-dialog .ac-danger:hover { background: #a93434; border-color: #a93434; }
@media (max-width: 560px) {
  .ac-box { padding: 14px 14px 12px; }
  .ac-class { padding: 12px 14px 4px; }
  .ac-expand { width: calc(100% + 28px); margin: 4px -14px 0; padding: 0 14px; }
  .ac-members { margin: 0 -14px; padding: 0 14px 8px; }
}

/* 掉落消除:進度與通關畫面(紅筆圈+螢光筆,沿用視覺系統) */
.hud-prog { font-weight: 700; font-variant-numeric: tabular-nums; }
.go-prog { font-size: 14.5px; color: var(--ink-light); margin: 0 0 12px; text-align: center; }
.round-clear { background: rgba(255, 255, 255, .97); }
.clear-mark { position: relative; width: 220px; height: 96px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.clear-ring { position: absolute; inset: 0; }
.clear-ring svg { width: 100%; height: 100%; overflow: visible; }
.clear-word { position: relative; z-index: 0; font-family: var(--round); font-weight: 900; font-size: 40px; letter-spacing: 6px; padding: 0 8px; }
.clear-word::before {
  content: ''; position: absolute; z-index: -1; left: 0; right: 0; top: 46%; bottom: 6%;
  background: var(--marker); border-radius: 44% 56% 50% 50% / 60% 44% 56% 40%; transform: rotate(-1.5deg);
}
.clear-stats { display: flex; gap: 26px; margin: 4px 0 16px; text-align: center; }
.clear-stats b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.clear-stats span { font-size: 13px; color: var(--ink-light); }
.clear-count { font-size: 13.5px; color: var(--ink-light); margin: 4px 0 10px; }
@media (max-width: 600px) {
  .clear-stats { gap: 16px; }
  .clear-stats b { font-size: 20px; }
  .game-hud { gap: 12px; }
}
.game-field.paused .fall-block { visibility: hidden; }
/* 結束與通關畫面:放得下時置中,放不下時從頂端開始可以捲 */
.game-over { justify-content: flex-start; }
.game-over > * { flex-shrink: 0; }
.game-over > :first-child { margin-top: auto; }
.game-over > :last-child { margin-bottom: auto; }
@media (max-width: 600px) {
  .game-over { padding: 14px 16px; }
  .round-clear .clear-mark { height: 76px; margin-bottom: 0; }
  .clear-stats { margin: 0 0 10px; }
  .miss-en { min-width: 96px; }
}
@media (prefers-reduced-motion: reduce) { .fall-block.boom { transition: none; } }

/* ======== 服務條款、隱私權政策、退款政策(terms、privacy、refund,2026-10-15) ======== */
.legal { margin: 30px 0 50px; line-height: 1.8; }
.legal h1 { font-size: 24px; margin-bottom: 4px; }
.legal h2 { font-size: 18px; margin: 28px 0 6px; }
.legal p + p, .legal p + ul, .legal ul + p { margin-top: 8px; }
.legal li + li { margin-top: 4px; }
.legal p a, .legal li a { text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.legal .result-note { margin: 4px 0 0; }
.legal .legal-back { margin-top: 30px; }
/* 條文式排版:條標題用 h3;款、目、編號用懸掛縮排,序號本身寫在文字裡,不另畫清單符號 */
.legal h3 { font-size: 16px; margin: 22px 0 6px; }
.legal h2 + h3 { margin-top: 12px; }
.legal p + ol, .legal ol + p { margin-top: 8px; }
.legal .legal-list { list-style: none; padding-left: 2em; }
.legal .legal-list > li { text-indent: -2em; }
.legal .legal-m { padding-left: 3em; }
.legal .legal-m > li { text-indent: -3em; }
.legal .legal-n { padding-left: 1.3em; }
.legal .legal-n > li { text-indent: -1.3em; }
.legal li > .legal-list { margin-top: 4px; }

/* ======== 小雞(js/pet-ui.js、js/pet-roam.js,2026-10-16) ========
   網站模式:首頁每日練習下面一張卡、「我的」頁一區。App 有分頁列時卡片藏起來,小雞改在分頁列上緣走。
   面板從底部滑上來(iOS、Android 底部面板的慣例)。按鈕照全站:平的、12px 圓角。 */
.pet-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 12px 24px 12px 12px;
}
.pet-card[hidden] { display: none; }
.daily-home + .pet-home { margin-top: 16px; }
.pet-home + .module-cards { margin-top: 22px; }
.pet-me { margin: 0 0 14px; border-radius: 12px; }
.pet-pic { grid-row: span 2; display: block; padding: 0; border: 0; border-radius: 12px; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pet-pic:hover { background: var(--bg-soft); }
.pet-pic:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pet-cv, .pet-big { display: block; }
.pet-cv { margin: -18px 0 -2px; }   /* 畫布上方留給跳起來的空間,平常是空的:往上疊進卡片的留白 */
.pet-main { min-width: 0; }
.pet-main h2 { font-size: 19px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-today { margin-top: 2px; font-size: 15px; font-variant-numeric: tabular-nums; }
.pet-today b { font-size: 17px; color: var(--ink); }
.pet-bar { display: block; height: 6px; margin: 4px 0 6px; max-width: 320px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; }
.pet-bar i { display: block; height: 100%; background: var(--fill); border-radius: 3px; }
.pet-bar.is-met i { background: var(--ok); }
.pet-streak { font-size: 14px; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.pet-card .pet-act { grid-row: span 2; }
.pet-more { grid-column: 1 / -1; }
.pet-more:empty, .pet-msg:empty { display: none; }
.pet-card .pet-msg { grid-column: 1 / -1; }
.pet-msg { margin-top: 6px; font-size: 14px; color: var(--ink-light); white-space: pre-line; }   /* 訊息分兩行:發生什麼、原因或怎麼辦 */
.pet-note { margin-top: 8px; font-size: 13.5px; color: var(--ink-light); white-space: pre-line; }
.pet-act .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 20px; font-size: 15.5px; white-space: nowrap; }
.pet-act .btn.primary { font-size: var(--fs-btn); }
.pet-act .btn:hover { text-decoration: none; }
.pet-act .btn[aria-disabled="true"] { opacity: .6; cursor: default; }
.pet-card .pet-act:empty { display: none; }
.pet-goal { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 12px; }
.pet-goal-l { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.pet-goal-note { flex-basis: 100%; font-size: 13.5px; color: var(--ink-light); }
.pet-seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); }
.pet-seg-b {
  min-height: 40px; min-width: 66px; padding: 0 10px; border: 0; border-radius: 10px; background: none;
  font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent;
}
.pet-seg-b[aria-pressed="true"] { background: #fff; color: var(--primary-dark); font-weight: 700; box-shadow: 0 1px 3px rgba(20, 30, 40, .16); }
.pet-seg-b:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.pet-seg-b:disabled { opacity: .5; cursor: default; }
@media (max-width: 560px) {
  .pet-card { grid-template-columns: auto minmax(0, 1fr); padding: 10px 16px 14px 8px; gap: 2px 12px; }
  .pet-card .pet-act { grid-row: auto; grid-column: 1 / -1; }
  .pet-card .pet-act .btn { width: 100%; margin-top: 6px; }
  .pet-pic { grid-row: auto; }
  .pet-more { padding-left: 8px; }
}

/* 餵食面板 */
.pet-mask {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(30, 40, 50, .45); transition: opacity .22s;
}
.pet-sheet {
  position: relative; width: 100%; max-width: 480px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 22px calc(20px + env(safe-area-inset-bottom)); background: #fff; border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 30px rgba(20, 30, 40, .22); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
/* 關到一半(淡出中)、剛打開還沒停好:不接受點按,點按落到後面(背景是 inert,等於沒點) */
.pet-mask.is-off { opacity: 0; pointer-events: none; }
.pet-mask.is-opening { pointer-events: none; }
.pet-mask.is-off .pet-sheet { transform: translateY(100%); }
.pet-sheet-top { display: flex; justify-content: center; height: 22px; padding-top: 8px; touch-action: none; cursor: grab; }
.pet-grip { display: block; width: 36px; height: 5px; border-radius: 3px; background: #d3d9df; }
.pet-sheet .modal-close { top: 10px; right: 10px; z-index: 2; }
.pet-sheet-head { position: relative; z-index: 1; touch-action: none; display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 44px; padding: 0 40px; }
.pet-sheet-head h2 { font-size: 20px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-h-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pet-pen { display: flex; flex: none; padding: 10px; border: 0; border-radius: 10px; background: none; color: var(--ink-light); cursor: pointer; }
.pet-pen:hover { background: var(--bg-soft); color: var(--ink); }
.pet-pen:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.pet-name-f { display: flex; gap: 8px; width: 100%; }
.pet-name-f .modal-input { min-width: 0; font-size: 16px; }
.pet-name-f .btn { flex: none; }
.pet-big { margin: -28px auto 0; }
.pet-sheet-body .pet-today { margin-top: 4px; font-size: 16px; text-align: center; }
.pet-sheet-body .pet-bar { margin: 6px auto 8px; height: 8px; border-radius: 4px; }
.pet-sheet-body .pet-streak { text-align: center; font-size: 15px; color: var(--ink); }
.pet-week { display: flex; justify-content: center; gap: 10px; margin: 10px 0 2px; }
.pet-day { display: grid; justify-items: center; gap: 2px; width: 28px; font-size: 12.5px; line-height: 1.3; color: var(--ink-light); }
.pet-dot { display: block; width: 14px; height: 14px; border: 1.5px solid #c5ccd3; border-radius: 50%; }
.pet-day.is-on .pet-dot { background: var(--fill); border-color: var(--fill); }
.pet-day.is-today { color: var(--ink); font-weight: 700; }
.pet-sheet-body .pet-act { margin-top: 14px; }
.pet-sheet-body .pet-act .btn { width: 100%; }
.pet-grow { margin-top: 12px; font-size: 14px; color: var(--ink-light); text-align: center; }
.pet-sheet-body .pet-goal { justify-content: center; padding-top: 12px; border-top: 1px solid var(--line); }
.pet-sheet-body .pet-goal-note, .pet-sheet-body .pet-note, .pet-sheet .pet-msg { text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .pet-mask, .pet-sheet { transition: none; }
}

/* App 分頁列上的小雞:腳直接踩在分頁列上緣,背景透明,沒有另外一條走道。
   這一層不接受點擊,只有小雞本身可以點;頁面底部多留小雞的高度,捲到最底時最後的內容和按鈕在小雞上面 */
.pet-roam { display: none; }
@media (max-width: 860px), (pointer: coarse) and (max-height: 500px) {
  html.is-app { --pet-h: 51px; }
  html.app-shell.has-tabbar .pet-card { display: none; }
  html.app-shell.has-tabbar .pet-roam {
    display: block; position: fixed; z-index: 91; pointer-events: none;
    left: 0; right: 0; padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
    bottom: calc(var(--app-tab-h) + env(safe-area-inset-bottom)); height: var(--pet-h);
  }
  html.app-shell.has-tabbar .pet-roam-lane { position: relative; height: 100%; }
  html.app-shell.app-kb .pet-roam { display: none; }
  html.app-shell.has-tabbar.has-pet { scroll-padding-bottom: calc(var(--app-tab-h) + var(--pet-h) + 8px); }
  html.app-shell.has-tabbar.has-pet body { padding-bottom: calc(var(--app-tab-h) + var(--pet-h) + env(safe-area-inset-bottom)); }
}
/* 大手機橫放:黏住的文章框、文法路線再扣掉小雞的高度 */
@media (min-width: 861px) and (pointer: coarse) and (max-height: 500px) {
  html.app-shell.has-tabbar.has-pet .passage-box, html.app-shell.has-tabbar.has-pet .passage-sticky-wrap {
    max-height: calc(100vh - 100px - var(--app-tab-h) - var(--pet-h) - env(safe-area-inset-bottom));
  }
  html.app-shell.has-tabbar.has-pet .passage-col .passage-box, html.app-shell.has-tabbar.has-pet .passage-sticky-wrap .passage-box { max-height: none; }
  html.app-shell.has-tabbar.has-pet .gx-pathwrap { max-height: calc(100vh - 110px - var(--app-tab-h) - var(--pet-h) - env(safe-area-inset-bottom)); }
}
.pet-roamer {
  position: absolute; left: 0; bottom: 0; width: 48px; height: 100%; padding: 0; border: 0; border-radius: 12px;
  background: none; pointer-events: auto; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.pet-roamer:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pet-roam-cv { position: absolute; left: 0; display: block; pointer-events: none; }
.pet-roam-cv.is-left { transform: scaleX(-1); }
@media print {
  .pet-roam, .pet-mask { display: none !important; }
  html.app-shell.has-tabbar.has-pet body { padding-bottom: 0 !important; }
}

/* ======== 小雞第二階段:hooks(js/pet-hook.js)開始 ======== */
/* 結束畫面「小黃拿到 1 份小番茄。」那一行。只在 PET_FOOD 打開時才產生 .pet-earn。
   等結果的時候(is-wait)先留一行的高度,字寫上去時下面的按鈕不會往下跳;
   留過高度、結果沒有字的改成 is-held,繼續留著那一行的高度,按鈕也不會往上跳。
   一開始就看得出沒有字、沒留高度的那一行收起來:看不見、不占位置,但留在讀螢幕的樹裡,寫字時 role=status 才念得到。 */
.pet-earn { margin: 12px 0 0; font-size: 15px; font-weight: 700; line-height: 1.6; min-height: 1.6em; color: var(--ink); }
.pet-earn:empty:not(.is-wait):not(.is-held) {
  position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
/* 放在一排按鈕、字數列裡時自己換一行 */
.drill-nav-btns > .pet-earn, .wc-bar > .pet-earn { flex-basis: 100%; margin-top: 2px; }
.drill-nav-btns:has(> .pet-earn:not(:empty)), .wc-bar:has(> .pet-earn:not(:empty)),
.drill-nav-btns:has(> .pet-earn.is-wait), .wc-bar:has(> .pet-earn.is-wait),
.drill-nav-btns:has(> .pet-earn.is-held), .wc-bar:has(> .pet-earn.is-held) { flex-wrap: wrap; }
.wc-bar > .pet-earn { text-align: right; font-size: 14px; }
/* 對話:放在最後聽的那一句下面;題庫:放在成績下面 */
.dlg-lines > .pet-earn { margin: 0; text-align: center; }
/* 播放全部把正在播的那一句捲到剛好露出(block: nearest),那一行就在它下面:捲的時候多留間距 14 加一行 24 再多一點 */
.dlg-line:has(+ .pet-earn) .dlg-bubble { scroll-margin-bottom: 56px; }
.tq-result + .pet-earn { margin: -8px 0 16px; }
/* 掉落通關的畫面:那一行空著時,按鈕那一排照原本置中。
   .game-over 是置中的直排,空的那一行會縮成 0 寬、量不到要留幾行;撐滿整排的寬,字照樣置中 */
.game-over > .pet-earn { align-self: stretch; text-align: center; }
.game-over > :nth-last-child(2):has(+ .pet-earn:empty:not(.is-wait):not(.is-held)) { margin-bottom: auto; }
@media print {
  .pet-earn { display: none; }
}
/* ======== 小雞第二階段:hooks 結束 ======== */

/* ======== 小雞第二階段:roam(js/pet-roam2.js)開始 ======== */
/* 整頁跑。每一條都掛在 html.pet-roam2 或 div.pet-roam2 底下,開關關著時不作用。
   外層不接受點擊,只有小雞按鈕能點;地面層 z-index 91(App 模式要在分頁列 90 上面),站點層 49(頂欄 50 下面)。
   網站模式的地面層也是 49:頂端導覽列的下拉選單、個人選單在頂欄 50 裡面,矮視窗時會長到視窗下緣,小雞不能蓋住它們。 */
/* 小雞的寬和框高:js/pet-roam2.js 照模式寫在 <html> 上(CFG.sizes:App、1023 以下 96×102,App 手機橫放 64×68,電腦版到處走照視窗寬:1440 以上 110×116、1344 以上 94×99、1328 以上 86×91、1312 以上 78×83、1296 以上 70×74、其他 62×66),這裡是 js 寫之前的預設。
   --pet2-tw、--pet2-th 是可以點的範圍(CFG.tap):只有畫出來的小雞那麼大,框上面留給跳起來的那一條透明的地方點得到底下的卡片 */
html.pet-roam2 { --pet2-w: 96px; --pet2-h: 102px; --pet2-tw: 69px; --pet2-th: 71px; }
div.pet-roam2 { display: block; left: 0; right: 0; pointer-events: none; }
div.pet-roam2[hidden], div.pet-roam2.is-off { display: none !important; }
div.pet-roam2.is-ground { position: fixed; z-index: 91; height: var(--pet2-h); }
div.pet-roam2.is-air { position: absolute; z-index: 49; top: 0; height: 0; }
/* 網站模式:地面是視窗下緣往上 4 px,兩側各留 16 px;頁面底部留小雞的高度,捲到最底時最後的內容在小雞上面 */
html.pet-roam2:not(.app-shell) div.pet-roam2 {
  padding: 0 calc(16px + env(safe-area-inset-right)) 0 calc(16px + env(safe-area-inset-left));
}
html.pet-roam2:not(.app-shell) div.pet-roam2.is-ground { bottom: calc(4px + var(--pet2-lift, 0px) + env(safe-area-inset-bottom)); z-index: 49; }   /* --pet2-lift:頁面比視窗矮時抬到頁尾下面那一條(js/pet-roam2.js) */
html.pet-roam2.has-pet:not(.app-shell) body { padding-bottom: calc(var(--pet2-h) + 8px + env(safe-area-inset-bottom)); }
html.pet-roam2.has-pet:not(.app-shell) { scroll-padding-bottom: calc(var(--pet2-h) + 12px); }
/* App 模式:腳踩分頁列上緣(跟 pet-roam.js 相同);分頁列藏起來的寬視窗不放 */
html.app-shell div.pet-roam2 { display: none; }
@media (max-width: 860px), (pointer: coarse) and (max-height: 500px) {
  html.app-shell.has-tabbar div.pet-roam2 { display: block; padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  html.app-shell.has-tabbar div.pet-roam2.is-ground { bottom: calc(var(--app-tab-h) + env(safe-area-inset-bottom)); }
  html.app-shell.app-kb div.pet-roam2 { display: none; }
  /* 「我的」那一區不再藏起來(只藏首頁那張),當餵食和走動開關的固定入口 */
  html.app-shell.has-tabbar.pet-roam2 .pet-card.pet-me:not([hidden]) { display: grid; }
  /* 分頁列那一套頁面底部留白、橫放時文章框扣掉的高度(--pet-h,第一階段 51 px)改成走動那隻的高度,最後的內容捲得到小雞上面 */
  html.app-shell.pet-roam2 { --pet-h: var(--pet2-h); }
}
/* 按鈕:腳底對齊框底、左右置中;畫布往回移到框的左上角,照舊佔整個框(跳起來畫在按鈕外面,那裡不接點擊) */
.pet-roam2-btn {
  position: absolute; left: calc((var(--pet2-w) - var(--pet2-tw)) / 2); top: calc(var(--pet2-h) - var(--pet2-th)); width: var(--pet2-tw); height: var(--pet2-th); padding: 0; border: 0; border-radius: 12px;
  background: none; pointer-events: auto; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  will-change: transform; opacity: 1; transition: opacity .2s;
}
.pet-roam2-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 飛行中、捲動中(停下 150 毫秒內)、別處按著手指時:點擊穿過小雞,落到底下的東西 */
div.pet-roam2.is-fly .pet-roam2-btn, div.pet-roam2.is-scroll .pet-roam2-btn, div.pet-roam2.is-pass .pet-roam2-btn { pointer-events: none; }
/* 電腦版到處走:走、跳、飛的時候點擊穿過,停著才點得到 */
div.pet-roam2.is-move .pet-roam2-btn { pointer-events: none; }
/* 有小雞的卡片在畫面上:原地淡出 0.2 秒 */
div.pet-roam2.is-faded .pet-roam2-btn { opacity: 0; pointer-events: none; }
/* 地面上腳下有內容(手機、App):一樣淡出;飛起來、站上站點時看得到 */
div.pet-roam2.is-covered.is-ground .pet-roam2-btn { opacity: 0; pointer-events: none; }
/* 剛放進頁面、第一次排好位置之前:看不到,也不做淡出(有小雞的卡片在畫面上時一開始就是淡出的) */
div.pet-roam2.is-init .pet-roam2-btn { opacity: 0; pointer-events: none; transition: none; }
/* 站在卡片上緣:可點範圍往上移 8 px,點卡片上緣不會點到小雞 */
.pet-roam2-btn.is-perch { margin-top: -8px; }
.pet-roam2-cv { position: absolute; left: calc((var(--pet2-tw) - var(--pet2-w)) / 2); top: calc(var(--pet2-th) - var(--pet2-h)); display: block; pointer-events: none; transform-origin: 50% 80%; }
.pet-roam2-btn.is-perch .pet-roam2-cv { top: calc(8px + var(--pet2-th) - var(--pet2-h)); }
/* 電腦版到處走(寬 1024 以上的網站模式,js 加 html.pet-roam2-wide):畫面上只留走動的那隻。
   首頁卡片、「我的」那一區的小雞藏起來(位置留著,版面不跳),畫一個空的窩;名字、今天的進度、餵食按鈕照舊,點窩一樣打開面板。
   藏著的小雞由 js/pet-ui.js 停住不畫;列印時卡片的小雞照常印出來(下面的 @media print,pet-ui.js 在 beforeprint 先畫一格) */
html.pet-roam2.pet-roam2-wide .pet-card .pet-cv { visibility: hidden; }
html.pet-roam2.pet-roam2-wide .pet-card .pet-pic {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40' fill='none' stroke='%23151515' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 17C6 31 18 37 32 37C46 37 58 31 59 17C50 12 14 12 5 17Z' fill='%23f2c46b'/%3E%3Cpath d='M10 17C18 13.5 46 13.5 54 17C46 20.5 18 20.5 10 17Z' fill='%23c98a1c' stroke-width='1.6'/%3E%3Cpath d='M10 24C18 27 26 28 34 27.5M30 31.5C38 31.5 46 29.5 53 25M15 30.5l7 2M3 13l7 3M55 14l7-3M23 12.5l-3-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 50% 78%; background-size: 64px 40px;
}
@media (prefers-reduced-motion: reduce) {
  .pet-roam2-btn { transition: none; }
}
@media print {
  div.pet-roam2 { display: none !important; }
  html.pet-roam2.has-pet:not(.app-shell) body { padding-bottom: 0 !important; }
  html.pet-roam2.pet-roam2-wide .pet-card .pet-cv { visibility: visible; }
  html.pet-roam2.pet-roam2-wide .pet-card .pet-pic { background-image: none; }
}
/* ======== 小雞第二階段:roam 結束 ======== */

/* ======== 小雞第二階段:ui(js/pet-ui.js)開始 ======== */
/* 餵食區(PET_FOOD 打開時才有這些元素):舞台、點心那一行、托盤、提示、沒有食物;走動開關(PET_ROAM_V2)。
   舞台上的位置跟 pet-ui.js 的 STAGE 對齊:小雞 160 px 往左讓出嘴前的位置,食物腳底跟小雞腳底同高,上面多留 32 px 給跳起來和愛心 */
.pet-stage { position: relative; z-index: 0; height: 191px; }
.pet-stage .pet-big { position: absolute; z-index: 1; top: 4px; left: calc(50% - 92px); margin: 0; transform-origin: 50% 90%; }
.pet-stage-food { position: absolute; z-index: 2; top: 126px; left: calc(50% + 36px); display: block; pointer-events: none; }
.pet-stage-food[hidden] { display: none; }
/* 最愛第一次吃到時的塗鴉愛心:一張畫布,位置和大小由 pet-ui.js 的 hearts() 設定 */
.pet-pop { position: absolute; z-index: 3; display: block; pointer-events: none; }
.pet-snack-line { margin-top: 2px; font-size: 14.5px; color: var(--ink-light); text-align: center; }
.pet-snack-line:empty { display: none; }
.pet-tray { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.pet-tray.is-ro { opacity: .45; }
.pet-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; min-height: 92px; padding: 8px 2px 7px;
  border: 1px solid transparent; border-radius: var(--radius); background: var(--bg-soft); color: var(--ink); font: inherit; line-height: 1.3;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
  transition: background .15s, border-color .15s, transform .1s;
}
.pet-tile-cv { display: block; width: 40px; height: 40px; margin-bottom: 4px; pointer-events: none; }
.pet-tile-n { font: 700 13.5px/1.3 var(--round); white-space: nowrap; }
.pet-tile-c { font-size: 12.5px; color: var(--ink-light); text-align: center; font-variant-numeric: tabular-nums; }
/* 存滿時「滿了」自己一行,5 欄的窄格子裡不會只剩一個字換行 */
.pet-tile-f { font-size: 11.5px; color: var(--ink-light); text-align: center; white-space: nowrap; }
.pet-tile-f:empty { display: none; }
.pet-tile:not([aria-disabled="true"]):hover { background: #fff; border-color: var(--line); }
.pet-tile:not([aria-disabled="true"]):active { transform: scale(.95); }
.pet-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pet-tile[aria-disabled="true"] { cursor: default; }
/* 0 份淡;今天的點心餵過了淡一點(比 0 份淡得少);今天還沒練習照平常的樣子 */
.pet-tile.is-empty .pet-tile-cv { opacity: .32; }
.pet-tile.is-empty .pet-tile-n, .pet-tile.is-empty .pet-tile-c { color: #a3abb3; }
.pet-tile.is-done .pet-tile-cv { opacity: .6; }
.pet-tile.is-done .pet-tile-c, .pet-tile.is-done .pet-tile-f { color: #8a939c; }
.pet-heart { position: absolute; top: 5px; right: 6px; width: 15px; height: 14px; pointer-events: none; }
.pet-heart svg { display: block; }
.pet-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* 預設放在左緣:pet-ui 量寬度時可用的寬是整個視窗,量到的是一行的寬,再移到格子上方(放在 50% 量會被擠成兩行) */
.pet-tip { position: fixed; z-index: 270; left: 8px; top: 16px; max-width: min(240px, calc(100vw - 16px)); text-wrap: balance; padding: 6px 10px; border-radius: 10px; background: #2b3036; color: #fff; font-size: 13px; line-height: 1.5; pointer-events: none; }
.pet-tile-fly { position: fixed; z-index: 260; left: 0; top: 0; pointer-events: none; will-change: transform; }
.pet-hint { margin-top: 10px; font-size: 13.5px; color: var(--ink-light); text-align: center; white-space: pre-line; }
.pet-hint:empty { display: none; }
.pet-empty { display: grid; gap: 10px; margin-top: 10px; }
.pet-empty p { font-size: 14.5px; text-align: center; text-wrap: balance; }
.pet-empty .pet-empty-t { font-size: var(--fs-md); font-weight: 700; color: var(--ink); }
.pet-empty .pet-empty-tag { justify-self: center; margin-top: -6px; padding: 2px 10px; border-radius: var(--r-full); background: var(--bg-soft); font-size: var(--fs-xs); color: var(--ink-soft); }
.pet-empty .btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; }
.pet-empty .btn:hover { text-decoration: none; }
/* 托盤下面原本的內容,用一條線隔開 */
.pet-stage ~ .pet-sheet-body { margin-top: 14px; padding-top: 6px; border-top: 1px solid var(--line); }
.pet-stage ~ .pet-msg ~ .pet-sheet-body { margin-top: 0; padding-top: 0; border-top: 0; }
/* 走動開關(role=switch) */
.pet-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.pet-switch-row > span { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.pet-switch { position: relative; flex: none; width: 50px; height: 30px; padding: 0; border: 0; border-radius: 15px; background: #8a939c; cursor: pointer; transition: background .15s; }
.pet-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(20, 30, 40, .25); transition: transform .15s; }
.pet-switch[aria-checked="true"] { background: var(--fill); }
.pet-switch[aria-checked="true"]::after { transform: translateX(20px); }
.pet-switch[aria-disabled="true"] { opacity: .6; cursor: default; }
.pet-switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 橫放(高度 500 以下):舞台 96 px,小雞在左、托盤在右 */
@media (orientation: landscape) and (max-height: 500px) {
  .pet-sheet:has(> .pet-stage) { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 16px; align-content: start; max-width: 720px; }
  .pet-sheet:has(> .pet-stage) > * { grid-column: 1 / -1; }
  .pet-sheet > .pet-stage { grid-column: 1; grid-row: 3; height: 95px; }
  .pet-sheet > .pet-snack-line { grid-column: 1; grid-row: 4 / span 2; align-self: start; }
  .pet-sheet > .pet-tray { grid-column: 2; grid-row: 3; margin-top: 4px; }
  .pet-sheet > .pet-hint { grid-column: 2; grid-row: 4; }
  .pet-sheet > .pet-empty { grid-column: 2; grid-row: 5; }
  .pet-stage .pet-big { top: -17px; left: calc(50% - 55px); }
  .pet-stage-food { top: 51px; left: calc(50% + 22px); }
  .pet-tile { min-height: 82px; padding-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .pet-tile, .pet-switch, .pet-switch::after { transition: none; }
  .pet-tile:not([aria-disabled="true"]):active { transform: none; }
}
@media print {
  .pet-tip, .pet-tile-fly { display: none !important; }
}
/* ======== 小雞第二階段:ui 結束 ======== */

/* ======== 題目更正紀錄頁(corrections.html、js/corrections.js) ======== */
.corr .corr-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 10px; }
.corr .chip { min-height: 36px; cursor: pointer; }
.corr .chip:focus-visible, .corr-search:focus-visible, .corr-group > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.corr-search { width: 100%; max-width: 320px; min-height: 44px; padding: 8px 12px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.corr-group { margin-top: 18px; }
.corr-group > summary { font-size: 18px; font-weight: 700; cursor: pointer; padding: 6px 0; }
.corr-table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin-top: 6px; }
.corr-table th, .corr-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.corr-table th { font-size: 12.5px; color: var(--ink-soft); font-weight: 700; }
.corr-table td:nth-child(1) { white-space: nowrap; }
.corr-table td:nth-child(2) { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.corr-table tr.is-target td { background: var(--highlight); }
.corr-msg { margin-top: 14px; color: var(--ink-soft); }
@media (max-width: 640px) {
  .corr-table thead { display: none; }
  .corr-table, .corr-table tbody, .corr-table tr, .corr-table td { display: block; width: 100%; }
  .corr-table tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-top: 10px; }
  .corr-table td { border: 0; padding: 2px 0; }
  .corr-table td::before { content: attr(data-label); display: inline-block; min-width: 3.5em; margin-right: 8px; font-size: 12.5px; color: var(--ink-soft); }
}

/* ======== 回報題目(js/report.js):詳解方塊底部的按鈕與視窗,選項列沿用 .buy-opt ======== */
.report-row { margin-top: 10px; text-align: right; }
.report-btn { min-height: 36px; padding: 4px 14px; font-size: 13.5px; font-weight: 400; color: var(--ink-soft); }
.report-btn:focus-visible, .modal-report .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.modal-report { max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-report .auth-h { padding: 0 34px; }
.modal-report .auth-h:focus { outline: none; }
.modal-report .rp-sub { text-align: center; margin-top: -4px; }
.modal-report .auth-fine + .auth-form { margin-top: 12px; }
.rp-note { min-height: 80px; resize: vertical; line-height: 1.6; }
.modal-report .rp-mail { display: flex; align-items: center; justify-content: center; margin-top: 10px; text-decoration: none; }
.modal-report .rp-addr { overflow-wrap: anywhere; user-select: all; }
.modal-report > .btn { margin-top: 8px; }
.modal-report > .auth-fine { margin-top: 8px; }
.hist-corr { font-size: 13.5px; margin-top: 8px; }
.hist-corr:empty { display: none; }
.hist-row > .hist-corr { padding: 0 14px 10px; margin-top: 0; }
.modal-report > .auth-fine { text-align: center; }
.modal-report > .btn:not(.auth-submit) { display: block; margin: 8px auto 0; }

/* ======== 教師後台:題目回報(js/admin-reports.js,只有站長) ======== */
.rpa-item { border-top: 1px solid var(--line); }
.rpa-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; width: 100%; min-height: 44px; padding: 8px 4px; border: 0; background: none; text-align: left; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.rpa-head:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rpa-id { font-weight: 700; overflow-wrap: anywhere; }
.rpa-count { font-weight: 700; color: var(--primary-dark); }
.rpa-types { color: var(--ink-soft); }
.rpa-date { margin-left: auto; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.rpa-body { padding: 4px 4px 14px; }
.rpa-who { list-style: none; font-size: 14px; }
.rpa-who li + li { margin-top: 6px; }
.rpa-note-text { color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.rpa-note { font-size: 14px; color: var(--ink-soft); }
.rpa-status { font-size: 13px; color: var(--bad); align-self: center; }
.rpa-q { margin-top: 10px; }
.rpa-opts { margin: 6px 0 0 1.4em; font-size: 14.5px; }
.rpa-opts .is-answer { font-weight: 700; color: var(--ok); }
.rpa-item.is-closed .rpa-id { color: var(--ink-soft); font-weight: 400; }

/* ======== 共用元件(js/ui.js)與新版導覽、首頁、分組頁 ========
   字級只用 --fs-xs 到 --fs-3xl 七級,另加實色主按鈕專用的 --fs-btn;圓角只用 --r-sm 到 --r-full 四級。一個畫面只有一顆實色主按鈕(.btn.primary)。
   動畫只動 transform 與 opacity;減少動態時全部拿掉。灰字一律用 --ink-soft(白底 5.8:1),--ink-light 在白底不到 4.5:1。
   舊樣式不刪,這一段用新類別蓋過;每條都掛在新類別或新結構底下,舊頁面的元素不會吃到。 */
:root {
  --fs-xs: 12px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 28px; --fs-3xl: 44px;
  --fs-btn: 19px;        /* 實色主按鈕:天藍底配白色粗體大字 */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-full: 999px;
  --ok-ink: #2b6b3c;     /* 綠底上的綠字 5.9:1 */
  --bad-ink: #a83232;    /* 紅底上的紅字 5.7:1 */
  --bad-dark: #a83232;
  --snack-tint: #fff6cc; /* 點心膠囊的淡黃底 */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- 文字按鈕:第二個動作(交卷、取消、回題庫) ---------- */
.btn-text {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-md); background: none;
  font-family: var(--round); font-size: var(--fs-md); font-weight: 700; line-height: 1.2; color: var(--primary);
  cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: transform .1s;
}
.btn-text:hover { background: var(--primary-tint); text-decoration: none; }
.btn-text:active { transform: scale(.97); }
.btn-text:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 新元件裡的按鈕:44 以上的觸控高度、鍵盤聚焦外框 */
.tile-go, .daily-go, .hero-cta .btn, .quiz-foot .btn, .result-card .btn, .ui-dialog .btn, .ui-empty .btn, .home-review {
  -webkit-tap-highlight-color: transparent;
}
.daily-go:focus-visible, .hero-cta .btn:focus-visible, .quiz-foot .btn:focus-visible, .result-card .btn:focus-visible,
.ui-dialog .btn:focus-visible, .ui-empty .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn.primary.is-danger { background: var(--bad); border-color: var(--bad); }
.btn.primary.is-danger:hover { background: var(--bad-dark); border-color: var(--bad-dark); }
.btn.primary.is-danger:focus-visible { outline-color: var(--bad); }

/* ---------- 頂欄:四個都是連結(.nav-btn 是 <a>),滑過展開分組選單,點下去到分組頁 ---------- */
.topnav a.nav-btn { display: inline-flex; align-items: center; }
.topnav a.nav-btn:hover { text-decoration: none; }
.topnav a.nav-btn:focus-visible, .topnav > a:focus-visible, .nav-menu a:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
@media (max-width: 860px) {
  /* 第一列品牌與頭像,第二列四個連結排一列,不出現下拉(觸控裝置點了直接到分組頁) */
  .topnav:has(> .nav-group > a.nav-btn) { flex-wrap: nowrap; gap: 4px; padding: 2px 0 6px; }
  .topnav:has(> .nav-group > a.nav-btn) > a, .topnav a.nav-btn {
    min-height: 44px; padding: 0 12px; font-size: 15px; border-radius: var(--r-md);
  }
  .topnav:has(> .nav-group > a.nav-btn) > a { display: inline-flex; align-items: center; }
  .topnav a.nav-btn::after { content: none; }
  .topnav a.nav-btn + .nav-menu { display: none; }
}
@media (max-width: 360px) {
  .topnav:has(> .nav-group > a.nav-btn) > a, .topnav a.nav-btn { padding: 0 8px; font-size: var(--fs-sm); }
}

/* ---------- 圖示磚 ----------
   一般磚(全站同一種長相):圖 64 在上、名稱 18、一行數字 14。手機 2 欄、600 以上 3 欄、900 以上 4 欄。
   有主打磚(.tile-featured)的格子(首頁三組目錄、分組頁)也是同一套,不分頁面另外覆寫:
   - 手機:主打磚是一張卡(圖 88 在左、文字在右、按鈕在下方整寬),其餘接成一個四角圓角的清單
     (每列圖 48 在左、名稱 18 與數字 14、最右一個 ›)
   - 600 到 1079:3 欄。主打磚橫跨整列,按鈕緊接在文字右邊(不推到最右);一般磚 3 塊一列
   - 1080 以上(內容欄滿寬 1040,跟頂欄同寬):5 欄。主打磚占 2 欄(圖 96 在左、文字、按鈕靠右),一般磚 3 塊各占 1 欄,一列四塊同高
   主打磚的按鈕:分組頁上它是唯一的實色主按鈕(.btn.primary);首頁的實色按鈕在首屏,目錄裡的主打磚用描邊(.btn) */
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
@media (min-width: 600px) { .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .tile-grid:not(:has(> .tile-featured)) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .tile-grid:has(> .tile-featured) { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.module-card.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff;
  color: var(--ink); font-family: inherit; text-decoration: none; box-shadow: none;
  transition: transform .15s var(--ease-out);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
/* 寫作練習的排字塊也叫 .tile(滑過變淡藍底):新磚滑過只換邊線色,底色維持白 */
.module-card.tile:hover { background: #fff; text-decoration: none; box-shadow: none; }
@media (hover: hover) {
  .module-card.tile:hover { z-index: 1; border-color: var(--primary); transform: translateY(-2px); }
}
.module-card.tile:active { transform: scale(.98); }
.module-card.tile:focus-visible { z-index: 1; outline: 2px solid var(--primary); outline-offset: 2px; }
.tile-art { display: block; flex: none; width: 64px !important; height: 64px !important; margin: 0 0 12px; }
.module-card.tile h2 { margin: 0; font-family: var(--round); font-size: var(--fs-lg); line-height: 1.35; }
.module-card.tile p { margin: 4px 0 0; font-size: var(--fs-sm); line-height: 1.4; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
/* 圖沒載到(或不認得的圖示):不留空位。磚改成名稱在上、數字在下、貼底對齊,高度降到 96 */
html:not(.doodle-ready) .tile-art, html:not(.doodle-ready) .daily-art, html:not(.doodle-ready) .home-review-art,
html:not(.doodle-ready) .tile-group-art, html:not(.doodle-ready) .hub-art, canvas.is-noart { display: none !important; }
html:not(.doodle-ready) .module-card.tile:not(.tile-featured), .module-card.tile:not(.tile-featured):has(> .tile-art.is-noart) {
  min-height: 96px; justify-content: flex-end;
}

/* 主打磚 */
.module-card.tile-featured {
  grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "art name" "art num" "go go"; align-items: center; column-gap: 16px;
  padding: 20px;
}
.tile-featured .tile-art { grid-area: art; width: 88px !important; height: 88px !important; margin: 0; }
.module-card.tile-featured h2 { grid-area: name; align-self: end; font-size: var(--fs-xl); }
.module-card.tile-featured p { grid-area: num; align-self: start; font-size: var(--fs-md); }
.tile-featured .tile-go {
  grid-area: go; display: flex; align-items: center; justify-content: center;
  min-height: 48px; margin-top: 16px; padding: 0 24px; border-radius: var(--r-md); white-space: nowrap;
}
.tile-featured .tile-go:not(.primary) { background: #fff; color: var(--primary); border-color: var(--line); font-size: var(--fs-md); }
@media (hover: hover) {
  .tile-featured:hover .tile-go.primary { background: var(--fill-dark); border-color: var(--fill-dark); }
  .tile-featured:hover .tile-go:not(.primary) { border-color: var(--primary); background: var(--primary-tint); }
}
html:not(.doodle-ready) .module-card.tile-featured, .module-card.tile-featured:has(> .tile-art.is-noart) {
  grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "num" "go";
}
@media (min-width: 600px) {
  .module-card.tile-featured {
    grid-template-columns: auto minmax(0, max-content) auto; grid-template-areas: "art name go" "art num go";
    justify-content: start; column-gap: 24px; padding: 24px;
  }
  .tile-featured .tile-go { margin: 0 0 0 8px; }
  html:not(.doodle-ready) .module-card.tile-featured, .module-card.tile-featured:has(> .tile-art.is-noart) {
    grid-template-columns: minmax(0, max-content) auto; grid-template-areas: "name go" "num go";
  }
}
@media (min-width: 1080px) {
  .module-card.tile-featured { grid-column: span 2; grid-template-columns: auto minmax(0, 1fr) auto; justify-content: stretch; column-gap: 20px; }
  .tile-featured .tile-art { width: 96px !important; height: 96px !important; }
  .tile-featured .tile-go { margin: 0; }
  html:not(.doodle-ready) .module-card.tile-featured, .module-card.tile-featured:has(> .tile-art.is-noart) { grid-template-columns: minmax(0, 1fr) auto; }
}

/* 手機:主打磚是卡,其餘接成一個清單。清單沒有外層元素:第一列與最後一列自己帶圓角,四角都是 16 */
@media (max-width: 599px) {
  .tile-grid:has(> .tile-featured) { display: flex; flex-direction: column; gap: 0; }
  .tile-grid > .tile-featured { margin-bottom: 12px; }
  .tile-grid:has(> .tile-featured) > .module-card.tile:not(.tile-featured) {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "art name go" "art num go"; align-items: center;
    min-height: 76px; margin-top: -1px; padding: 12px 16px; border-radius: 0;
  }
  .tile-grid:has(> .tile-featured) > .tile-featured + .module-card.tile { margin-top: 0; border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg); }
  .tile-grid:has(> .tile-featured) > .module-card.tile:not(.tile-featured):last-child { border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }
  .tile-grid:has(> .tile-featured) > .module-card.tile:not(.tile-featured) .tile-art { grid-area: art; width: 48px !important; height: 48px !important; margin: 0 14px 0 0; }
  .tile-grid:has(> .tile-featured) > .module-card.tile:not(.tile-featured) h2 { grid-area: name; align-self: end; }
  .tile-grid:has(> .tile-featured) > .module-card.tile:not(.tile-featured) p { grid-area: num; align-self: start; margin-top: 2px; }
  /* 沒有數字那一行(錯題本沒有待複習):名稱在列裡垂直置中,跟其他兩行字的列對齊 */
  .tile-grid:has(> .tile-featured) > .module-card.tile:not(.tile-featured):has(> p:empty) h2 { grid-row: 1 / span 2; align-self: center; }
  .tile-grid:has(> .tile-featured) > .module-card.tile:not(.tile-featured)::after {
    content: '›'; grid-area: go; justify-self: end; margin-left: 12px; font-size: 22px; line-height: 1; color: var(--ink-soft);
  }
  .tile-grid:has(> .tile-featured) > .module-card.tile:not(.tile-featured) > .tile-badge { position: static; grid-area: go; justify-self: end; margin-right: 24px; }
  html:not(.doodle-ready) .tile-grid:has(> .tile-featured) > .module-card.tile:not(.tile-featured) { min-height: 64px; }
  @media (hover: hover) { .tile-grid:has(> .tile-featured) > .module-card.tile:not(.tile-featured):hover { transform: none; } }
}

/* 右上角數字徽章(錯題本) */
.tile-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--r-full);
  background: var(--bad); color: #fff; font-size: var(--fs-xs); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
.module-card.tile > .tile-badge { position: absolute; top: 12px; right: 12px; }
/* 分組小標題:前面一個 24px 的分組圖示,把三組分開 */
.tile-group-h { display: flex; align-items: center; gap: 8px; margin: 28px 0 12px; font-family: var(--round); font-size: var(--fs-md); line-height: 1.4; }
.tile-group-art { display: block; flex: none; width: 24px; height: 24px; }
@media (min-width: 900px) { .tile-group-h { margin-top: 40px; } }
@media (prefers-reduced-motion: reduce) {
  .module-card.tile, .btn-text { transition: none; }
  .module-card.tile:hover, .module-card.tile:active { transform: none; }
}

/* ---------- 分組頁(日常學習、練練手感、刷刷題目):h1 左邊一個分組圖示,下面直接是磚,沒有說明句 ----------
   內容跟頂欄同一個容器(.container),磚的區域撐滿容器寬,左右緣對齊品牌字與頭像。
   頁首有圖示的 h1(分組頁、錯題本等):圖示在左,螢光筆只畫在字底下,不會伸到螢幕邊 */
.page-head:has(> .hub-art) { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.hub-art { display: block; flex: none; width: 40px; height: 40px; }
.hub .tile-grid { margin-bottom: 48px; }

/* ---------- 首頁 ---------- */
/* <html class="authed">:已登入(開機程式依本機登入紀錄先加,雲端確認後校正)。藏首屏與目錄,每日練習卡當主角 */
html.authed .home-dir { display: none; }
/* 已登入首屏精簡版:只留一行短大標題與鵜鶘,每日練習卡當主角。
   同頁只有一個 h1:未登入顯示搜尋用的 h1,已登入把它藏起來,改顯示 .home-short(role=heading aria-level=1,未登入時 display:none 不進無障礙樹)。
   搜尋引擎沒有登入紀錄,看到的版面與文字不變。 */
.home-short { display: none; }
html.authed .home-hero h1, html.authed .home-hero .hero-display, html.authed .home-hero .stats, html.authed .home-hero .hero-cta { display: none; }
html.authed .home-hero .home-short { display: block; grid-area: h1; align-self: center; margin: 0; font-family: var(--round); font-weight: 700; font-size: 40px; line-height: 1.2; letter-spacing: -.01em; word-break: keep-all; overflow-wrap: anywhere; }
html.authed .home-hero .hero-inner { grid-template-areas: "h1 chick"; padding-top: 16px; padding-bottom: 8px; column-gap: 32px; }
html.authed .home-hero .hero-chick.is-pelican { width: 140px !important; height: 131px !important; }
/* 未登入首屏。DOM 順序 h1、.stats、.hero-cta、角色(主角鵜鶘,載不到時退回小雞)。
   桌機:左欄 h1、主按鈕與文字連結、統計一排小字;鵜鶘 180 緊跟在左欄右邊(間距 48),垂直置中,不飄到畫面最右。
   手機:大標題與鵜鶘(120)並排,大標題垂直置中對鵜鶘身體;按鈕與統計在下面整寬 */
.home-hero .hero-inner {
  display: grid; grid-template-columns: minmax(0, max-content) auto; justify-content: start; column-gap: 48px;
  grid-template-areas: "disp chick" "h1 chick" "cta chick" "stats chick";
  padding-top: 48px; padding-bottom: 44px;
}
.home-hero .hero-display { grid-area: disp; margin: 0; font-family: var(--round); font-weight: 700; font-size: 72px; line-height: 1.12; letter-spacing: -.01em; color: var(--ink); word-break: keep-all; }
/* 搜尋用的 h1 字不動,樣式改成大標題下面的介紹句 */
.home-hero h1 { grid-area: h1; margin-top: 16px; font-size: 18px; font-weight: 400; line-height: 1.6; letter-spacing: 0; color: var(--ink-soft); }
.home-hero .hero-cta { grid-area: cta; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 28px; }
.hero-cta .btn.primary {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 36px; font-size: var(--fs-btn); border-radius: var(--r-md); text-decoration: none;
}
.home-hero .stats { grid-area: stats; flex-wrap: nowrap; gap: 4px 20px; margin-top: 20px; }
.home-hero .stat { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.home-hero .stat b { font-size: var(--fs-md); color: var(--ink); font-variant-numeric: tabular-nums; }
.home-hero .stat span { display: inline; font-size: var(--fs-sm); color: var(--ink-soft); }
.hero-chick { grid-area: chick; align-self: center; display: block; }
.hero-chick.is-pelican { width: 220px !important; height: 206px !important; }
@media (max-width: 1023px) and (min-width: 601px) {
  .home-hero .hero-display { font-size: 56px; }
  .home-hero h1 { font-size: 17px; }
  .hero-chick.is-pelican { width: 160px !important; height: 150px !important; }
}
@media (max-width: 600px) {
  .home-hero .hero-inner {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "disp chick" "h1 h1" "cta cta" "stats stats"; column-gap: 8px;
    padding-top: 28px; padding-bottom: 28px;
  }
  /* 大標題一行、跟鵜鶘並排:字級照可用寬算(5 個字;375 寬 43.8、360 寬 40.8,最大 44),不壓到鵜鶘;
     垂直置中對鵜鶘身體(gaze:書飄在畫布左上,身體在右下;身體外框上下緣的中點在畫布高 62.6% 處):
     margin-bottom = 身體中心到格子底(畫布 112 高:112 × 37.4% - 下方疊出去的 4 = 38)- 半行高 .56em */
  .home-hero .hero-display { font-size: min(44px, calc((100vw - 156px) / 5)); align-self: end; margin-bottom: calc(38px - .56em); }
  .home-hero h1 { font-size: 15px; margin-top: 12px; }
  /* 畫布上方留有跳起來的空間:往上疊,讓看得到的頭頂跟 h1 第一行對齊(下面一行是退回小雞時的大小) */
  .hero-chick { align-self: start; width: 88px !important; height: 103px !important; margin: -22px -6px -6px 0; }
  /* 鵜鶘(主角):畫布 300×280 的比例,比小雞寬;上方約 1/10、下方約 1/25 是空白 */
  /* 寬 92(高 86):h1 在 360 到 375 寬排回兩行(「衝衝英文：多益聽力、」「閱讀刷題與單字練習」);左右的空白往外疊 */
  .hero-chick.is-pelican { width: 120px !important; height: 112px !important; margin: -8px -4px -4px 0; }
  @media (max-width: 340px) {
    .hero-chick.is-pelican { width: 96px !important; height: 90px !important; }
    .home-hero .hero-display { font-size: calc((100vw - 132px) / 5); margin-bottom: calc(30px - .56em); }   /* 鵜鶘 96(高 90):320 寬 37.6;90 × 37.4% - 4 = 30 */
  }
  html.authed .home-hero .hero-inner { grid-template-areas: "h1 chick"; padding-top: 8px; padding-bottom: 0; }
  html.authed .home-hero .home-short { font-size: 28px; align-self: center; }
  html.authed .home-hero .hero-chick.is-pelican { width: 120px !important; height: 112px !important; margin: 0; }
  @media (max-width: 340px) { html.authed .home-hero .home-short { font-size: 25px; } html.authed .home-hero .hero-chick.is-pelican { width: 100px !important; height: 93px !important; } }
  .home-hero .hero-cta { margin-top: 20px; }
  .hero-cta .btn.primary { padding: 0 28px; }
  .home-hero .stats { gap: 12px; margin-top: 16px; }
  .home-hero .stat { gap: 4px; }
  .home-hero .stat span { font-size: var(--fs-xs); }
}

.home .home-grid { margin-top: 28px; }
.home .home-grid > .daily-home { margin-top: 0; }
html.authed .home .home-grid { margin-top: 24px; }
/* 每日練習卡與小雞卡用同一套內距:手機 20、600 以上 24 */
.home .daily-card { border-radius: var(--r-lg); padding: 20px 20px 20px; }
.home .daily-head h2 { font-size: var(--fs-xl); }
.home .daily-count { font-size: var(--fs-sm); color: var(--ink-soft); }
.daily-row.has-art { grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 6px; padding: 14px 0; }
.daily-row.has-art .daily-art { grid-row: span 2; align-self: center; }
.daily-row.has-art .daily-bar { grid-column: 2 / -1; }
/* 沒有圖示時名稱直接靠左,不留 40px 空位 */
html:not(.doodle-ready) .daily-row.has-art, .daily-row.has-art:has(> .is-noart) { grid-template-columns: minmax(0, 1fr) auto; }
html:not(.doodle-ready) .daily-row.has-art .daily-bar, .daily-row.has-art:has(> .is-noart) .daily-bar { grid-column: 1 / -1; }
.daily-art { display: block; width: 40px; height: 40px; }
.home .daily-st { color: var(--ink-soft); }
.home .daily-row.is-done .daily-st { color: var(--ok-ink); }
.daily-go {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 48px; margin-top: 16px; font-size: var(--fs-btn); border-radius: var(--r-md); text-decoration: none;
}
.daily-go:hover { text-decoration: none; }
/* 未登入:首屏已經有「開始練習」通往同一頁,卡片不再放按鈕(三列本身就是連結) */
html:not(.authed) .home .daily-go { display: none; }
html:not(.authed) .home .daily-card { padding-bottom: 8px; }
/* 全做完:不放按鈕,換成開心的鵜鶘與一行字 */
.daily-fin { display: none; }
.daily-card.is-done .daily-go { display: none; }
.daily-card.is-done .daily-fin { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.daily-fin canvas { display: block; margin: -16px 0 -6px; }
.daily-fin canvas.is-pelican { margin: -8px 0 -3px; }   /* 鵜鶘 84:畫布高 78 */
.daily-fin p { font-family: var(--round); font-size: var(--fs-lg); font-weight: 700; color: var(--ok-ink); }
/* 小雞卡:內距跟每日練習卡一樣;「餵牠」在內距之內、上方留 16。這一頁的實色按鈕只有每日練習那一顆,「餵牠」改描邊 */
.home .pet-home {
  grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; row-gap: 0;
  padding: 20px; border-radius: var(--r-lg);
}
.home .pet-home .pet-pic { grid-row: auto; align-self: center; }
.home .pet-home .pet-cv { width: 80px !important; height: 93px !important; margin: -12px 0 -4px; }
.home .pet-home .pet-act { grid-row: auto; grid-column: 1 / -1; margin-top: 16px; }
.home .pet-home .pet-act .btn { width: 100%; min-height: 44px; margin: 0; border-radius: var(--r-md); }
.home .pet-home .pet-more, .home .pet-home .pet-msg { padding-left: 0; }
.home .pet-home .btn.primary { background: #fff; color: var(--ink); border-color: var(--line); font-size: 15.5px; }
.home .pet-home .btn.primary:hover { color: var(--primary); border-color: var(--primary); background: #fff; }
.home .pet-home .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.home .pet-streak { color: var(--ink-soft); }
.home .daily-home + .pet-home { margin-top: 16px; }
html:not(.authed) .home .pet-home { display: none; }   /* 未登入時小雞在首屏 */
@media (min-width: 600px) {
  .home .daily-card { padding: 24px; }
  html:not(.authed) .home .daily-card { padding-bottom: 12px; }
  .home .pet-home { padding: 24px; }
}
/* 錯題本那一列:有待複習的錯題才出現 */
.home-review {
  display: flex; align-items: center; gap: 12px; min-height: 64px; margin-top: 16px; padding: 12px 20px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; color: var(--ink); text-decoration: none;
  transition: transform .15s var(--ease-out);
}
.home-review[hidden] { display: none; }
.home-review:hover { text-decoration: none; }
@media (hover: hover) { .home-review:hover { border-color: var(--primary); } }
.home-review:active { transform: scale(.98); }
.home-review:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.home-review-art { display: block; flex: none; width: 40px; height: 40px; }
.home-review-t { flex: 1; min-width: 0; font-family: var(--round); font-size: var(--fs-md); font-weight: 700; }
.home-review::after { content: '›'; font-size: 22px; line-height: 1; color: var(--ink-soft); }
@media (min-width: 600px) { .home-review { padding: 12px 24px; } }
/* 桌機:每日練習在左,小雞卡與錯題本在右(小雞卡由 js/pet-ui.js 插在每日練習卡後面,所以用格線排位置,不另包一層) */
@media (min-width: 900px) {
  html.authed .home-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); grid-auto-rows: min-content; gap: 16px 24px; align-items: start; }
  html.authed .home-grid > .daily-home { grid-column: 1; grid-row: 1 / span 3; }
  html.authed .home-grid > :not(.daily-home) { grid-column: 2; margin-top: 0; }
  html.authed .home .daily-home .daily-list { display: block; }
  html.authed .home .daily-home .daily-list li + li { border-top: 1px solid var(--line); }
}
/* 三組目錄(未登入) */
.home-dir { margin-top: 8px; }
.home-dir:last-of-type { margin-bottom: 48px; }
@media (prefers-reduced-motion: reduce) { .home-review { transition: none; } .home-review:active { transform: none; } }

/* ---------- 課程:今天的課卡(首頁 .home-grid 第一張、課程總覽頂端)與課程總覽的清單(js/lesson-home.js、js/lessons.js) ----------
   卡片排法照小雞卡:鵜鶘在左、字在右、按鈕整寬在下;內距手機 20、600 以上 24。編號是小字、堂名是標題。
   卡上有實色主按鈕時(.home-grid.lesson-go)每日練習卡的「開始」藏起來(三列本身就是連結,同未登入首頁的做法) */
.lsn-home { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 16px; padding: 20px; border-radius: var(--r-lg); }
.lsn-home-art { display: block; }
/* 鵜鶘 gaze 的墨跡貼近畫布右緣(書在左上):往左挪 4、右邊多留 6,墨跡到字的距離跟以前看書那隻差不多 */
.lsn-home-art.is-pelican[data-mascot="gaze"] { margin: 0 6px 0 -4px; }
.lsn-home-main { min-width: 0; }
.lsn-home-main:first-child { grid-column: 1 / -1; }
.lsn-home-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lsn-home .lsn-kicker { margin: 0; font-size: var(--fs-sm); color: var(--ink-light); }
.lsn-home-all { margin-left: auto; font-size: var(--fs-sm); color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lsn-home-all:hover { color: var(--primary); text-decoration: none; }
.lsn-home-all:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
@media (pointer: coarse) { .lsn-home-all { padding-top: 10px; padding-bottom: 10px; margin-top: -10px; margin-bottom: -10px; } }   /* 手指點的範圍至少 44 高,版面不變(同 .lsn-back) */
.lsn-home h2 { margin: 2px 0 0; font-family: var(--round); font-size: 20px; line-height: 1.35; overflow-wrap: anywhere; }
.lsn-home h2:focus { outline: none; }
.lsn-home .mock-tags { margin-top: 8px; }
.lsn-home-go {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 48px; margin-top: 16px; font-size: var(--fs-btn); border-radius: var(--r-md); text-decoration: none;
}
.lsn-home-go:hover { text-decoration: none; }
.lsn-home-go:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.lsn-home-act { grid-column: 1 / -1; margin-top: 12px; }
.lsn-home-note { margin: 0; font-size: var(--fs-sm); color: var(--ink-light); }
.lsn-home-retry { min-height: 44px; margin-top: 12px; padding: 0 20px; border-radius: var(--r-md); }
.home .lsn-home + .daily-home { margin-top: 16px; }
/* 獨立小檢核那一列(卡片最上面,一般清單列)與本週一列(主按鈕下面的一行小字,不可點;沒選每週堂數時接「設定堂數」):兩欄都佔滿 */
.lsn-solo { grid-column: 1 / -1; margin: 0 0 16px; }
.lsn-week { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; margin: 12px 0 0; font-size: var(--fs-sm); color: var(--ink-light); font-variant-numeric: tabular-nums; }
.lsn-week .btn-text { min-height: 44px; margin: -10px 0; padding: 0 8px; font-size: var(--fs-sm); }
.home .home-grid.lesson-go .daily-go { display: none; }
.home .home-grid.lesson-go > .daily-home { padding-bottom: 8px; }
@media (min-width: 600px) {
  .lsn-home { padding: 24px; }
  .home .home-grid.lesson-go > .daily-home { padding-bottom: 12px; }
}
@media (min-width: 900px) {
  /* 課卡比右邊的小雞卡矮時(明天開放、尚未開放)拉到同高、內容置中,課卡跟每日練習卡之間不空一段 */
  html.authed .home-grid.has-lesson > .lsn-home { grid-column: 1; grid-row: 1; align-self: stretch; align-content: center; }
  html.authed .home-grid.has-lesson > .daily-home { grid-row: 2 / span 3; margin-top: 0; }
}
/* 課程總覽:600 以下每列兩行(編號與狀態一行、堂名一行,最多兩行),600 以上一行、堂名超出用刪節號;列高至少 56 */
.lsn-tags { margin: 12px 0 0; }
#lsn-root > .lsn-home { margin-top: 16px; }
.lsn-list { margin-top: 16px; }
.lsn-list .lsn-row {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto 12px; grid-template-areas: "mark no st go" ". name name name";
  align-items: center; column-gap: 12px; row-gap: 2px; min-height: 56px; padding: 10px 16px; font-size: var(--fs-md);
}
.lsn-list a.lsn-row::after { grid-area: go; margin-left: 0; text-align: right; }
.lsn-mark { grid-area: mark; display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
.lsn-mark.is-done { color: var(--ok); }
.lsn-mark.is-done svg { display: block; }
.lsn-mark.is-doing::before, .lsn-mark.is-todo::before { content: ''; box-sizing: border-box; width: 10px; height: 10px; border-radius: 50%; }
.lsn-mark.is-doing::before { background: var(--primary); }
.lsn-mark.is-todo::before { border: 2px solid var(--ink-light); }
.lsn-row-no { grid-area: no; font-size: var(--fs-sm); font-weight: 700; }
.lsn-row-name { grid-area: name; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lsn-list .lsn-row-st { grid-area: st; margin-left: 0; font-size: var(--fs-sm); color: var(--ink-light); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lsn-row.is-off { color: var(--ink-light); }
.lsn-list a.lsn-row[aria-current] .lsn-row-no { color: var(--primary); }
@media (min-width: 600px) {
  .lsn-list .lsn-row { grid-template-columns: 16px auto minmax(0, 1fr) auto 12px; grid-template-areas: "mark no name st go"; }
  .lsn-row-name { display: block; white-space: nowrap; text-overflow: ellipsis; }
}

/* ---------- App 分頁列:圖示改成 canvas(DoodleArt),沒載到時只顯示文字,不留空框 ---------- */
.app-tab-art { display: none; }
@media (max-width: 860px), (pointer: coarse) and (max-height: 500px) {
  html.app-shell .app-tab { color: #5f6770; }
  html.app-shell .app-tab.on { color: var(--primary); font-weight: 700; }
  html.app-shell.doodle-ready .app-tab .app-tab-art { display: block; width: 26px; height: 26px; }
  html.app-shell:not(.doodle-ready) .app-tab span { font-size: 13px; }
  /* 頁尾最後一行跟分頁列之間留 24,連結底線不貼著分頁列 */
  html.app-shell.has-tabbar body { padding-bottom: calc(var(--app-tab-h) + env(safe-area-inset-bottom) + 24px); }
  html.app-shell.has-tabbar.has-pet body { padding-bottom: calc(var(--app-tab-h) + var(--pet-h) + env(safe-area-inset-bottom) + 24px); }
}

/* ---------- 專心模式(作答中):html.is-quiz ----------
   - 藏網頁頂欄的導覽與頭像(整個 .topbar-inner)、App 分頁列、走動的小雞;頂欄裡換成作答列 .quiz-bar。
   - 作答列放在原本的 .topbar 裡(js/ui.js):頂欄是 sticky,App 外殼裡頂欄的安全區照舊。
   - 付費牆與登入卡(html.app-gate、.pw-mask):App 外殼裡那兩種遮罩本來就讓開頂欄,頂欄疊在遮罩上面(app-gate 時頂欄的 z-index 210
     照舊,下面專心模式的頂欄規則避開 app-gate,不把它壓回 50),
     付費牆設 inert 時也跳過 .topbar,所以作答列的關閉鈕一直按得到,學生可以離開;分頁列藏起來了,遮罩改蓋到底。
     底部固定列(z-index 90)在遮罩(200)下面,被蓋住、按不到。網站模式的遮罩照舊蓋滿整頁。
   - body::after 是分頁列後面的白底墊片,跟分頁列一起藏;底部的留白改成底部固定列的高度(js 量好寫在 --quiz-foot-h)。
   - 鍵盤打開(App 外殼加 html.app-kb,一般網頁由 js/ui.js 加 html.ui-kb):底部固定列改回內容後面(js 把它放在 main 後面),不蓋住輸入框。 */
.quiz-bar, .quiz-foot { display: none; }
html.is-quiz .topbar-inner { display: none; }
html.is-quiz .topbar { position: sticky; top: 0; }
html.is-quiz:not(.app-gate) .topbar { z-index: 50; }
html.is-quiz .quiz-bar {
  display: flex; align-items: center; gap: 12px; height: 52px; max-width: 760px; margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
}
/* 右邊的「交卷」:灰字的文字按鈕,緊接在「3 / 10」後面 */
.quiz-side:empty { display: none; }
.quiz-side { display: flex; flex: none; margin-right: -8px; }
.quiz-bar.has-act .quiz-count { min-width: 0; }
/* 計數左邊的位置(f.slot):模擬考的倒數 */
.quiz-slot { display: flex; flex: none; align-items: center; }
.quiz-slot:empty { display: none; }
.quiz-act.btn-text { padding: 0 10px; font-size: var(--fs-sm); font-weight: 700; color: var(--primary); }
.quiz-act.btn-text:hover { color: var(--primary-dark); background: var(--primary-tint); }
.quiz-close {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: var(--r-md); background: none; color: var(--ink-soft); cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform .1s;
}
.quiz-close:hover { background: var(--bg-soft); color: var(--ink); }
.quiz-close:active { transform: scale(.94); }
.quiz-close:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.quiz-track { position: relative; flex: 1; height: 6px; border-radius: var(--r-full); background: var(--line); overflow: hidden; }
.quiz-fill { position: absolute; inset: 0; border-radius: var(--r-full); background: var(--fill); transform-origin: 0 50%; transform: scaleX(0); transition: transform .3s var(--ease-out); }
.quiz-count {
  flex: none; min-width: 52px; text-align: right; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
button.quiz-count { min-height: 44px; padding: 0 8px; margin-right: -8px; border: 0; border-radius: var(--r-md); background: none; font-family: inherit; cursor: pointer; }
button.quiz-count:hover { background: var(--bg-soft); color: var(--ink); }
button.quiz-count:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
/* 導覽與小雞都收起來 */
html.is-quiz.app-shell .app-tabbar, html.is-quiz .pet-roam, html.is-quiz div.pet-roam2 { display: none !important; }
html.is-quiz.app-shell.has-tabbar body::after { display: none; }
/* 底部留白:分頁列、小雞的留白都換成底部固定列(那幾條選擇器比較長,用 !important 一次蓋過) */
html.is-quiz body { padding-bottom: env(safe-area-inset-bottom) !important; }
html.is-quiz.has-quiz-foot body { padding-bottom: var(--quiz-foot-h, calc(76px + env(safe-area-inset-bottom))) !important; }
html.is-quiz { scroll-padding-top: 60px; scroll-padding-bottom: calc(var(--quiz-foot-h, 76px) + 12px); }
html.is-quiz.app-shell body[data-require-profile]:not([data-require-profile="on-action"]) .modal-mask,
html.is-quiz.app-shell .modal-mask.pw-mask { bottom: 0; }
/* 內容欄最寬 720 置中;作答中不畫題目外框,選項加高好按 */
html.is-quiz main.container, html.is-quiz main.container-narrow { max-width: 760px; }
/* 作答中頁尾不顯示(見「頁尾」那一段);main 撐到底部固定列上面,題目短時底部列前面是留白。
   flow-root:第一個區塊的上邊距留在 main 裡面,不從 main 頂端穿出去把整頁多推下去一截(不然題目短也能捲動十幾像素) */
html.is-quiz main { display: flow-root; min-height: calc(100vh - 53px - var(--quiz-foot-h, 76px)); }
/* 作答中沒有頁尾要藏,手機改用網址列展開時的視窗高(svh),網址列出現時題目短也不會多出一截能捲 */
@supports (min-height: 100svh) { html.is-quiz main { min-height: calc(100svh - 53px - var(--quiz-foot-h, 76px)); } }
html.is-quiz main .q-block { border: 0; padding: 24px 0 8px; margin-bottom: 0; background: none; }
html.is-quiz main .q-block .q-text { font-size: var(--fs-lg); line-height: 1.6; margin-bottom: 20px; }
@media (min-width: 600px) { html.is-quiz main .q-block .q-text { font-size: var(--fs-xl); margin-bottom: 24px; } }
html.is-quiz main .opts { gap: 10px; }
html.is-quiz main .opt { min-height: 52px; align-items: center; padding: 12px 16px; font-size: var(--fs-md); border-radius: var(--r-md); }
html.is-quiz main .opt .letter { margin-top: 0; width: 26px; height: 26px; font-size: var(--fs-sm); }
html.is-quiz main .opt:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
html.is-quiz main .explain { margin-top: 16px; padding: 14px 16px; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 15px; line-height: 1.7; }

/* 底部固定列 */
html.is-quiz .quiz-foot {
  display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #fff; border-top: 1px solid var(--line);
}
html.is-quiz .quiz-foot.is-empty { display: none; }
html.is-quiz.app-kb .quiz-foot, html.is-quiz.ui-kb .quiz-foot { position: static; padding-bottom: 12px; }
html.is-quiz.app-kb body, html.is-quiz.ui-kb body { padding-bottom: 0 !important; }
/* 兩種模式同一套對齊:內層最寬 720 置中(跟題目同寬);手機上文字按鈕在左、主按鈕撐滿剩下的寬度,
   600 以上主按鈕固定 240 靠右,文字按鈕(上一題)或回饋文字靠左 */
.quiz-foot-row { max-width: 720px; margin: 0 auto; }
.quiz-foot-in { display: flex; align-items: center; gap: 8px; }
.quiz-foot-in .btn.primary { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 48px; font-size: var(--fs-btn); border-radius: var(--r-md); }
.quiz-foot-in .btn-text { flex: none; padding: 0 16px; margin-left: -12px; font-size: var(--fs-sm); color: var(--ink-soft); }
.quiz-foot-in .btn-text:hover { color: var(--ink); background: var(--bg-soft); }
@media (min-width: 600px) {
  .quiz-foot-in .btn.primary { flex: none; width: 240px; margin-left: auto; }
}
/* 讀屏的播報區(role=status):一直在頁面上,視覺上藏起來 */
.quiz-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* 回饋條:淡綠或淡紅底,左邊圖示與字,右邊一顆跟著回饋顏色的實色按鈕(答對綠、答錯紅;仍然只有一顆實色按鈕) */
.quiz-fb { display: none; }
html.is-quiz .quiz-foot.is-fb { padding-top: 16px; border-top-color: transparent; animation: ui-rise .22s var(--ease-out); }
html.is-quiz .quiz-foot.is-ok { background: var(--ok-tint); }
html.is-quiz .quiz-foot.is-bad { background: var(--bad-tint); }
.quiz-foot.is-fb .quiz-foot-row { display: flex; flex-direction: column; gap: 12px; }
.quiz-foot.is-fb .quiz-fb { display: flex; align-items: center; gap: 10px; }
.quiz-foot.is-ok .btn.primary { background: var(--ok); border-color: var(--ok); }
.quiz-foot.is-ok .btn.primary:hover { background: var(--ok-ink); border-color: var(--ok-ink); }
.quiz-foot.is-ok .btn.primary:focus-visible { outline-color: var(--ok-ink); }
.quiz-foot.is-bad .btn.primary { background: var(--bad); border-color: var(--bad); }
.quiz-foot.is-bad .btn.primary:hover { background: var(--bad-dark); border-color: var(--bad-dark); }
.quiz-foot.is-bad .btn.primary:focus-visible { outline-color: var(--bad-ink); }
.quiz-fb-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: var(--r-full); background: #fff; }
.quiz-fb-icon:empty { display: none; }
.quiz-fb-words { min-width: 0; }
.quiz-fb-text { font-family: var(--round); font-size: var(--fs-lg); font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
/* 回饋下面一行小字(f.feedback 的 note,例如「已移出錯題本」);沒有字時不佔高度 */
.quiz-fb-note { margin: 2px 0 0; font-size: var(--fs-sm); line-height: 1.5; }
.quiz-fb-note:empty { display: none; }
.quiz-foot.is-ok .quiz-fb-icon, .quiz-foot.is-ok .quiz-fb-text, .quiz-foot.is-ok .quiz-fb-note { color: var(--ok-ink); }
.quiz-foot.is-bad .quiz-fb-icon, .quiz-foot.is-bad .quiz-fb-text, .quiz-foot.is-bad .quiz-fb-note { color: var(--bad-ink); }
@media (min-width: 600px) {
  .quiz-foot.is-fb .quiz-foot-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
  .quiz-foot.is-fb .quiz-fb { flex: 1; min-width: 0; }
  .quiz-foot.is-fb .quiz-foot-in { flex: none; }
}
@keyframes ui-rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .quiz-fill, .quiz-close { transition: none; }
  html.is-quiz .quiz-foot.is-fb { animation: none; }
}
@media print {
  .quiz-bar, .quiz-foot { display: none !important; }
  html.is-quiz .topbar-inner { display: flex; }
}

/* ---------- 結算卡 ----------
   置中直排,最寬 480,上下內距一樣 32(手機 24)。分數是整張卡最大的字(44)。
   角色畫布上下有空白(給跳躍與影子留的):用負的上下邊距抵掉,看得到的角色才跟卡片內距對齊。
   主角是鵜鶘(畫布 300×280,比較寬、上下空白比小雞少):手機 180、桌機 200、緊湊版 120,高度由 js/ui.js 照 metrics 算;
   .is-pelican 是 ui.js 畫鵜鶘時加的類別,載入失敗退回小雞時拿掉,小雞照原本的邊距。
   happy 進場跳一次(.is-hop):只動 transform,以腳底為基準,壓扁不超過 0.92。 */
.result-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  max-width: 480px; margin: 24px auto 0; padding: 32px 24px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff;
}
.result-chick { display: block; flex: none; margin: -41px auto -10px; }   /* 140:畫布高 163 */
@media (min-width: 900px) { .result-card:not(.is-compact) .result-chick { margin: -47px auto -11px; } }   /* 160:畫布高 187 */
.result-chick.is-pelican { margin: -17px auto -7px; }   /* 鵜鶘 180:畫布高 168 */
@media (min-width: 900px) { .result-card:not(.is-compact) .result-chick.is-pelican { margin: -19px auto -8px; } }   /* 鵜鶘 200:畫布高 187 */
canvas.is-hop { transform-origin: 50% 100%; animation: ui-hop .6s var(--ease-out) both; }
@keyframes ui-hop {
  0% { transform: none; }
  16% { transform: scale(1.08, .92); }
  42% { transform: translateY(-22px) scale(.96, 1.06); }
  58% { transform: translateY(-26px) scale(1, 1); }
  82% { transform: translateY(0) scale(1.06, .94); }
  100% { transform: none; }
}
.result-kicker { margin-top: 12px; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-soft); }
.result-card .result-score { margin: 2px 0 0; font-size: var(--fs-md); font-family: var(--round); font-weight: 700; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; }
.result-score:focus { outline: none; }
.result-score b { font-size: var(--fs-3xl); font-weight: 900; }
.result-of, .result-unit { font-size: var(--fs-xl); color: var(--ink-soft); }
.result-flag {
  display: inline-block; margin-left: 4px; padding: 2px 10px; vertical-align: 10px;
  border-radius: var(--r-full); background: var(--marker); font-size: var(--fs-xs); font-weight: 700; color: var(--ink); line-height: 1.6;
}
.result-stats { display: flex; justify-content: center; margin: 20px 0 0; padding: 0; width: 100%; }
.result-stat { display: flex; flex-direction: column-reverse; flex: 1; max-width: 140px; padding: 0 12px; }
.result-stat + .result-stat { border-left: 1px solid var(--line); }
.result-stat dd { margin: 0; font-family: var(--round); font-size: var(--fs-xl); font-weight: 700; color: var(--ink); line-height: 1.3; font-variant-numeric: tabular-nums; }
.result-stat dt { font-size: var(--fs-xs); color: var(--ink-soft); }
/* 點心列:掛勾寫的那行字放在這裡。
   - 拿到點心(食物圖畫上了,.has-food):淡黃膠囊高 48,左邊食物 56 冒出膠囊上下緣;分數到膠囊 24、膠囊到按鈕 24。
     膠囊用淡底(不用螢光筆黃),面積與顏色都不搶分數
   - 只有字(今天的點心拿滿了、存滿了等):14 灰字一行,沒有底色,上下各 8;不像在發獎勵
   - 沒拿到、也沒有字時不佔高度 */
.result-reward { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 0; }
.result-reward:not(.has-food):has(> .pet-earn:not(:empty)), .result-reward:not(.has-food):has(> .pet-earn.is-wait),
.result-reward:not(.has-food):has(> .pet-earn.is-held) {
  margin-top: 8px; padding: 8px 0;
}
.result-reward > .pet-earn { margin: 0; min-height: 0; font-size: var(--fs-sm); font-weight: 400; line-height: 1.5; color: var(--ink-soft); }
.result-reward.has-food {
  min-height: 48px; margin-top: 24px; padding: 0 20px 0 6px; border-radius: var(--r-full); background: var(--snack-tint);
}
.result-reward.has-food > .pet-earn { font-family: var(--round); font-size: var(--fs-md); font-weight: 700; color: var(--ink); }
.result-food { display: block; flex: none; margin: -12px 0 -4px; }
.result-reward:not(.has-food) > .result-food { display: none; }   /* 食物圖還沒畫上時不佔位 */
.result-actions { display: grid; justify-items: center; gap: 8px; width: 100%; margin-top: 28px; }
.result-reward.has-food + .result-actions { margin-top: 24px; }
.result-go {
  display: flex; align-items: center; justify-content: center; width: 100%; max-width: 320px;
  min-height: 48px; font-size: var(--fs-btn); border-radius: var(--r-md); text-decoration: none;
}
a.result-go:hover { text-decoration: none; }
.result-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 8px; }
/* 各練習頁原本也有 .result-note(14 灰、下邊距 18):這裡只管結算卡裡的那一行 */
.result-card .result-note { margin: 12px 0 0; font-size: var(--fs-xs); color: var(--ink-soft); }
/* 緊湊版:遊戲浮層裡用。小雞縮成 96,其他照一般版(分數 44、主按鈕整寬最寬 320);高度跟著內容走。
   最寬 400 置中:桌機的遊戲區很寬,卡片不跟著拉寬(一般版最寬 480,緊湊版比它窄) */
.result-card.is-compact { width: 100%; max-width: 400px; margin: auto; padding: 24px; border: 0; background: none; }   /* 外框是遊戲區本身 */
.result-card.is-compact .result-chick { margin: -28px auto -7px; }   /* 96:畫布高 112 */
.result-card.is-compact .result-chick.is-pelican { margin: -11px auto -5px; }   /* 鵜鶘 120:畫布高 112 */
.result-card.is-compact .result-kicker { margin-top: 8px; }
.result-card.is-compact .result-actions { margin-top: 24px; }
/* 內嵌版(opt.inline):放在頁面內容裡的小卡(課末小測、閱讀的題目做完)。不畫外框,上方一條分隔線跟內容隔開;
   角色跟緊湊版一樣小(鵜鶘 120)。置中;外層要靠左時在那一頁的段落把 align-items、text-align 改掉 */
.result-card.is-inline { max-width: 480px; margin: 32px auto 0; padding: 28px 0 8px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
.result-card.is-inline .result-chick { margin: -28px auto -7px; }
.result-card.is-inline .result-chick.is-pelican { margin: -11px auto -5px; }
.result-card.is-inline .result-kicker { margin-top: 8px; }
.result-card.is-inline .result-actions { margin-top: 20px; }
/* 閱讀:內嵌結算卡後面那一列「再做一次」跟卡片一樣置中(卡片的鵜鶘、分數、點心都置中) */
.result-card.is-inline + .drill-nav-btns { justify-content: center; margin-top: 16px; }
.result-card .result-actions:empty { display: none; }
/* 只有點心列(UI.rewardRow):對話、寫作。拿到點心時是膠囊,只有字時是一行灰字,都沒有時不佔高度 */
.ui-reward-row { display: flex; justify-content: center; }
.ui-reward-row > .result-reward.has-food { margin-top: 16px; }
@media (max-width: 600px) {
  .result-card { margin-top: 16px; padding: 24px 16px; }
}
@media (prefers-reduced-motion: reduce) { canvas.is-hop { animation: none; } }
@media print {
  .result-chick, .result-food, .result-actions { display: none; }
  .result-card { border: 0; }
}

/* 逐題收合:跟結算卡同寬(480)、同一條中線 */
.result-detail { max-width: 480px; margin: 32px auto 48px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-detail-sum {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 4px;
  font-family: var(--round); font-size: var(--fs-md); font-weight: 700; color: var(--ink);
  list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.result-detail-sum::-webkit-details-marker { display: none; }
.result-detail-sum::after {
  content: ''; flex: none; width: 9px; height: 9px; margin: 0 4px 4px 0;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
  transition: transform .2s var(--ease-out);
}
.result-detail[open] > .result-detail-sum::after { transform: translateY(3px) rotate(225deg); }
.result-detail-t { flex: 1; min-width: 0; }
.result-detail-bad { font-size: var(--fs-sm); color: var(--bad-ink); }
.result-detail-sum:hover { color: var(--primary); }
.result-detail-sum:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
.result-detail-body { padding: 4px 0 16px; }
@media (prefers-reduced-motion: reduce) { .result-detail-sum::after { transition: none; } }
@media print { .result-detail-body { display: block; } }

/* ---------- 空狀態:角色一張、一行字、一個出口 ----------
   鵜鶘畫布 130(高 121);畫布上方空白往上疊。退回小雞時 136(睡覺的小雞看得到的部分約 92 寬),上方 1/3 是空的。圖到字 16、字到按鈕 20 */
.ui-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 16px 64px; }
.ui-empty-art { display: block; margin: -44px 0 6px; }
.ui-empty-art.is-pelican { margin: -12px 0 10px; }
.ui-empty-art.is-pelican[data-pose="gaze"] { margin: -11px 0 14px; }   /* gaze 的腳貼近畫布底:下面多留 4,墨跡到字約 14(同以前看書那隻) */
.ui-empty-text { margin: 0; font-size: var(--fs-md); color: var(--ink-soft); }
.ui-empty-go { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 20px; padding: 0 24px; border-radius: var(--r-md); text-decoration: none; }
.ui-empty-go:hover { text-decoration: none; }
.ui-empty-go.primary { min-height: 48px; padding: 0 32px; }
/* 出口下面一排文字連結(links)、再下面呼叫端放的節點(extra) */
.ui-empty-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 8px; margin-top: 8px; }
.ui-empty-extra { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; margin-top: 16px; }
.ui-empty-extra:empty { display: none; }
/* 共用元件沒載到(js/common.js uiReady):main 最前面一塊,說發生什麼加兩個出口 */
.ui-missing { margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.ui-missing p { margin: 0 0 12px; font-weight: 700; }
.ui-missing-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.ui-missing-acts .btn { min-height: 44px; }
html.no-ui .home-hero .hero-pic { display: none; }
/* 沒有開 JavaScript:由 JS 畫內容的頁面在 main 最前面說一聲 */
.noscript-msg { margin: 24px 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); font-weight: 700; }
/* 跳到內容(js/common.js 加):平常藏起來,鍵盤聚焦時出現在左上角 */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 300; padding: 10px 16px; border-radius: var(--r-sm); background: #fff; color: var(--primary-dark); font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.skip-link:focus { top: 8px; }
main:focus { outline: none; }

/* ---------- 確認與輸入視窗(沿用 .modal-mask、.modal) ---------- */
/* 強制登入頁的遮罩規則會讓開頂欄與分頁列;這兩個視窗一律蓋滿整頁,疊在所有東西上面 */
.modal-mask.ui-mask { inset: 0 !important; z-index: 220; align-items: center; animation: ui-fade .16s ease-out; }
.ui-dialog { position: relative; max-width: 400px; padding: 24px 24px 16px; border-radius: var(--r-lg); animation: ui-rise .2s var(--ease-out); }
.ui-dialog-h { font-size: var(--fs-lg); line-height: 1.5; color: var(--ink); }
.ui-dialog-body { margin-top: 8px; font-size: var(--fs-sm); line-height: 1.7; color: var(--ink-soft); }
.ui-dialog-field { margin-top: 16px; }
.ui-dialog-input { display: block; width: 100%; min-height: 44px; font-size: var(--fs-md); border-radius: var(--r-sm); }
.ui-dialog-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.ui-dialog-hint { margin: 6px 0 0; font-size: var(--fs-xs); color: var(--ink-soft); }
.ui-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 24px; }
.ui-dialog-actions .btn, .ui-dialog-actions .btn-text { white-space: nowrap; }   /* 同 .modal-row:按鈕字不折行,窄螢幕排不下就整顆換到下一行 */
.ui-dialog-actions .btn.primary { min-height: 44px; min-width: 88px; padding: 0 20px; font-size: var(--fs-btn); border-radius: var(--r-md); }
.ui-dialog-actions .btn-text { color: var(--ink-soft); }
.ui-dialog-actions .btn-text:hover { color: var(--ink); background: var(--bg-soft); }
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal-mask.ui-mask, .ui-dialog { animation: none; } }

/* ---------- 面板(UI.sheet,從作答列點開的題號面板):手機從底部升起,600 以上置中 ---------- */
.modal-mask.ui-sheet-mask { align-items: flex-end; padding: 0; }
.modal-mask.ui-sheet-mask > .modal { margin: 0; }
.ui-sheet {
  max-width: none; max-height: 80vh; overflow-y: auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); border-radius: var(--r-lg) var(--r-lg) 0 0;
  animation: ui-rise .2s var(--ease-out);
}
.ui-sheet-head { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.ui-sheet .ui-sheet-h { font-family: var(--round); font-size: var(--fs-lg); line-height: 1.4; }
.ui-sheet-note { flex: 1; font-size: var(--fs-sm); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ui-sheet-h + .ui-sheet-close { margin-left: auto; }
.ui-sheet-close.btn-text { min-height: 44px; padding: 0 12px; margin-right: -12px; color: var(--ink-soft); }
.ui-sheet-close.btn-text:hover { color: var(--ink); background: var(--bg-soft); }
@media (min-width: 600px) {
  .modal-mask.ui-sheet-mask { align-items: center; padding: 20px; }
  .ui-sheet { max-width: 480px; padding: 20px 24px 24px; border-radius: var(--r-lg); }
}
@media (prefers-reduced-motion: reduce) { .ui-sheet { animation: none; } }

/* ---------------- 各頁面的補充樣式：每一段的規則加在自己的標記下面 ---------------- */

/* ==== 導覽與分組頁 ==== */

/* ---- */


/* ==== 首頁、我的、價格 ==== */
/* 首頁:錯題本那一列只給已登入的人(未登入時錯題本在目錄裡) */
html:not(.authed) .home-review { display: none; }
.home-review .tile-badge:empty { display: none; }
/* 首屏小雞外面包一層 div(data-nosnippet 只能放在 div、span、section):格線位置跟著外層 */
.home-hero .hero-pic { grid-area: chick; align-self: center; }
@media (max-width: 600px) { .home-hero .hero-pic { align-self: start; } }

/* 我的:帳號動作的結果一行(發生什麼、第二行原因);沒有字時不佔位 */
.me-msg { margin: 12px 0 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-soft); }
.me-msg.bad { color: var(--bad); }
.me-msg:empty { display: none; }
/* 未登入時這一頁的實色按鈕是「登入」,小雞卡的「餵牠」改描邊 */
html:not(.authed) .pet-me .pet-open.btn.primary { background: #fff; color: var(--ink); border-color: var(--line); font-size: 15.5px; }
html:not(.authed) .pet-me .pet-open.btn.primary:hover { color: var(--primary); border-color: var(--primary); background: #fff; }

/* 價格:價格前面的幣別小一號;學生方案包含的練習一項一行,前面一個勾,窄螢幕兩欄 */
.pricing-opt b small, .pricing-table td.num small { margin-right: 2px; color: var(--ink-soft); }
.pricing-check { list-style: none; padding-left: 0; display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: 6px 32px; margin: 0 0 14px; }
.pricing-check li + li { margin-top: 0; }
.pricing-check li { position: relative; padding-left: 24px; }
.pricing-check li::before {
  content: ''; position: absolute; left: 3px; top: .45em; width: 11px; height: 6px;
  border-left: 2px solid var(--primary); border-bottom: 2px solid var(--primary); transform: rotate(-45deg);
}
@media (min-width: 600px) { .pricing-check { grid-template-columns: repeat(3, minmax(0, max-content)); } }
/* ---- */


/* ==== 題庫與錯題本 ==== */

/* 題庫首頁:Part 列右邊的已作答數字、兩個開始鈕的上方間距 */
.cfg-done { font-size: var(--fs-xs); color: var(--ink-soft); }
.practice-start, .listen-start { margin-top: 14px; }
.practice-panel .ui-empty { padding: 8px 0 4px; }

/* 錯題本清單頁首:圖示、標題、「← 回題庫刷題」同一列,放不下時連結換到下一行 */
.page-head.wb-top { flex-wrap: wrap; row-gap: 2px; }
.wb-back { margin-left: auto; font-size: var(--fs-sm); }
@media (max-width: 600px) { .wb-back { margin-left: 52px; flex-basis: 100%; } }

/* 結算卡下面的逐題解析:題組的文章與題目上下排,跟卡片同寬 */
.result-detail-body .q-block { margin-top: 18px; }
.result-detail-body .q-block:first-child { margin-top: 4px; }
.result-detail-body .set-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; margin: 18px 0 0; }
.result-detail-body .set-layout:first-child { margin-top: 4px; }

/* 專心模式的題組(Part 6、7):文章與題目左右排,欄位放寬,跟作答列之間留一點空 */
html.is-quiz main .set-layout { margin-top: 16px; }
@media (min-width: 900px) {
  html.is-quiz main.container:has(.set-layout) { max-width: 1040px; }
  /* 作答列與底部列跟兩欄內容同寬:關閉鈕對齊文章欄左緣、「交卷」「下一題」對齊題目欄右緣 */
  html.is-quiz:has(main.container .set-layout) .quiz-bar { max-width: 1040px; padding-left: 20px; padding-right: 20px; }
  html.is-quiz:has(main.container .set-layout) .quiz-foot-row { max-width: 1000px; }
}

/* ---- */


/* ==== 模擬考與程度檢測 ==== */

/* 開始前:三張規模卡(模擬考)與一張說明卡(程度檢測),只有數字標籤加開始鈕 */
.mock-sizes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0 8px; }
.mock-sizes .part-card { display: flex; flex-direction: column; padding: 24px; border-radius: var(--r-lg); }
.mock-sizes .part-card h3 { margin: 0; font-family: var(--round); font-size: var(--fs-xl); line-height: 1.3; }
.mock-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.part-card p.mock-tags { margin: 12px 0 0; }
.mock-tag { padding: 2px 12px; border-radius: var(--r-full); background: var(--bg-soft); font-size: var(--fs-sm); line-height: 1.7; color: var(--ink-soft); white-space: nowrap; }
.mock-sizes .cfg-row { margin-top: auto; padding-top: 24px; }
.mock-sizes .cfg-row .btn { min-height: 48px; padding: 0 28px; font-size: var(--fs-md); border-radius: var(--r-md); }
.mock-sizes .cfg-row .btn.primary { font-size: var(--fs-btn); }
@media (max-width: 960px) { .mock-sizes { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .mock-sizes .cfg-row .btn { width: 100%; } }
.diag-intro { display: flex; flex-direction: column; align-items: flex-start; max-width: 480px; padding: 24px; border-radius: var(--r-lg); margin: 24px 0 48px; }
.diag-intro .mock-tags { margin: 0; }
.diag-intro .btn { min-height: 48px; margin-top: 24px; padding: 0 32px; font-size: var(--fs-md); border-radius: var(--r-md); }
.diag-intro .btn.primary { font-size: var(--fs-btn); }
@media (max-width: 600px) { .diag-intro { max-width: none; } .diag-intro .btn { width: 100%; } }

/* 作答中:倒數放在作答列、緊鄰進度 */
.quiz-bar .mock-timer { flex: none; margin: 0; font-family: var(--round); font-size: var(--fs-md); font-weight: 700; color: var(--primary-dark); }
.quiz-bar .mock-timer.low { color: var(--bad-ink); }
html.is-quiz .mock-timer:empty { display: none; }
.mock-gap-no { margin-bottom: 12px; font-family: var(--round); font-size: var(--fs-md); font-weight: 700; color: var(--ink-soft); }
html.is-quiz #mock-root .player { margin: 4px 0 8px; }
html.is-quiz #mock-root .player-btn { min-height: 44px; padding: 0 24px; border-radius: var(--r-md); font-size: var(--fs-md); }
html.is-quiz #mock-root .letter-row { gap: 12px; margin: 12px 0 0; }
html.is-quiz #mock-root .letter-big { min-height: 52px; border-radius: var(--r-md); }
/* 篇章題:專心模式的欄寬只有 720,左右兩欄太擠,改成上下排 */
html.is-quiz #mock-root .set-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
html.is-quiz #mock-root .passage-sticky-wrap { position: static; max-height: none; }

/* 題號面板(UI.sheet 加 .mock-panel):面板本身是共用元件,這裡只排題號格 */
.mock-panel-group { margin-top: 16px; }
.mock-panel-label { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-soft); }
.mock-panel .q-nav { gap: 8px; margin: 8px 0 0; }
.mock-panel .q-nav button { width: 44px; height: 44px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.mock-panel .q-nav button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mock-panel .q-nav button.ans { font-weight: 700; }

/* 結果:卡片下面的小字提示與逐題收合 */
.mock-after { max-width: 480px; margin: 16px auto 0; text-align: center; }
.mock-after .mock-wb-note p { margin: 0; font-size: var(--fs-sm); line-height: 1.7; color: var(--ink-light); }
.mock-after .mock-unsaved { margin-top: 0; text-align: left; }
.mock-after .mock-unsaved p { margin: 4px 0 12px; }
.mock-unsaved p.mock-unsaved-fine { margin-top: -8px; font-size: var(--fs-xs); color: var(--ink-soft); }
.mock-after .mock-unsaved .btn { min-height: 44px; padding: 0 20px; border-radius: var(--r-md); }
#mock-root .result-detail, #diag-root .result-detail { max-width: 720px; }
.diag-levels { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; margin: 16px 0 0; font-size: var(--fs-sm); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
#diag-root .page-head + .result-card { margin-top: 8px; }
#diag-root .ui-empty { padding: 8px 16px 24px; }
@media print { .diag-levels { margin-top: 8px; } #diag-root .result-card { margin-top: 0; padding: 0; } }

/* ---- */


/* ==== 每日練習 ==== */
/* 每日練習(js/daily-ui.js)與錯題本(js/review.js)。首頁那張每日練習卡的樣式在前面「首頁」那一段 */
.daily-sr, .rv-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* daily.html 總覽:頁首(圖示、標題、1 / 3)加同一張卡 */
.page-head:has(> .hub-art) .daily-count { margin-left: auto; font-size: var(--fs-md); font-weight: 700; color: var(--ink-soft); }
#daily-root .daily-card { margin-top: 0; padding: 4px 20px 20px; border-radius: var(--r-lg); }
#daily-root .daily-st { color: var(--ink-soft); }
#daily-root .daily-row.is-done .daily-st { color: var(--ok-ink); }
@media (min-width: 600px) { #daily-root .daily-card { padding: 8px 24px 24px; } }

/* 作答中:題目上面一個小標籤講這是哪一項 */
.daily-tags { display: flex; align-items: center; gap: 8px; margin-top: 20px; }
.daily-part {
  display: inline-block; margin: 0; padding: 4px 12px; border-radius: var(--r-full);
  background: var(--bg-soft); color: var(--ink-soft); font-family: var(--round); font-size: var(--fs-sm); font-weight: 700; line-height: 1.5;
}
html.is-quiz .daily-tags + .q-block { padding-top: 16px; }
.daily-sub { margin: 0; font-size: var(--fs-md); color: var(--ink-soft); }
.player-note { display: inline-flex; flex-direction: column; }
.player-sub { font-size: var(--fs-xs); }
html.is-quiz main .write-area { font-size: var(--fs-md); }

/* 錯題本:有待複習的題是一個大數字加一顆主按鈕 */
.review-todo { display: flex; flex-direction: column; align-items: center; gap: 20px; margin: 8px 0 0; padding: 28px 20px; border-radius: var(--r-lg); text-align: center; }
.review-todo:hover { border-color: var(--line); box-shadow: none; }
.review-todo .review-todo-t { margin: 0; font-family: var(--round); font-size: var(--fs-lg); font-weight: 700; color: var(--ink-soft); }
.review-todo-t b { margin: 0 2px; font-size: var(--fs-3xl); line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.review-todo-more { display: block; margin-top: 4px; font-size: var(--fs-sm); font-weight: 500; }
.review-todo .btn.primary { width: 100%; max-width: 320px; min-height: 48px; border-radius: var(--r-md); font-size: var(--fs-btn); }
@media (min-width: 600px) { .review-todo { padding: 36px 24px; } }
/* 其他待複習:整列可點的清單,名稱、數字、右箭頭 */
.rv-group-h { margin: 28px 0 8px; font-size: var(--fs-md); font-weight: 700; color: var(--ink-soft); }
.rv-list { margin: 0 0 48px; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; overflow: hidden; }
.rv-list li + li { border-top: 1px solid var(--line); }
.rv-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px; color: var(--ink); text-decoration: none; }
.rv-row:hover { text-decoration: none; background: var(--bg-soft); }
.rv-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.rv-name { flex: 1; min-width: 0; font-family: var(--round); font-size: var(--fs-md); font-weight: 700; }
.rv-num { font-size: var(--fs-sm); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.rv-row::after { content: '›'; font-size: 22px; line-height: 1; color: var(--ink-soft); }

/* ---- */


/* ==== 單字與不規則動詞 ==== */
/* 單字首頁:玩法磚(選一個)、選項與唯一的主按鈕、片語特訓入口。磚上只有圖、名稱、一行數字 */
.tile-grid.vg-games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .tile-grid.vg-games { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.module-card.tile.vg-tile { width: 100%; font: inherit; text-align: left; cursor: pointer; appearance: none; }
.vg-art { display: block; flex: none; width: 64px; height: 64px; margin: 0 0 12px; }
.vg-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.vg-tile-name { font-family: var(--round); font-size: var(--fs-lg); font-weight: 700; line-height: 1.35; color: var(--ink); }
.vg-tile-num { margin-top: 4px; font-size: var(--fs-sm); line-height: 1.4; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.module-card.tile.vg-tile.on, .module-card.tile.vg-tile.on:hover { border-color: var(--primary); background: var(--primary-tint); box-shadow: inset 0 0 0 1px var(--primary); }
.module-card.tile.vg-tile.is-blocked .vg-art { opacity: .45; }
.vg-play { margin-bottom: 8px; }
.vg-start { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.vg-opts { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 220px; min-width: 0; }
.vg-opts .cfg-select { flex: 1 1 130px; min-height: 44px; font-size: var(--fs-md); }
.btn.primary.vg-go { flex: 1 1 100%; display: flex; align-items: center; justify-content: center; min-height: 48px; font-size: var(--fs-btn); border-radius: var(--r-md); }
@media (min-width: 600px) { .btn.primary.vg-go { flex: 0 0 240px; margin-left: auto; } }
.module-card.tile.vg-phrase-tile {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "art name go" "art num go";
  align-items: center; column-gap: 14px; margin-top: 24px; padding: 12px 16px; min-height: 76px;
}
.vg-phrase-tile .vg-art { grid-area: art; width: 48px; height: 48px; margin: 0; }
.vg-phrase-tile .vg-tile-name { grid-area: name; align-self: end; }
.vg-phrase-tile .vg-tile-num { grid-area: num; align-self: start; margin-top: 2px; }
.vg-phrase-tile::after { content: '›'; grid-area: go; font-size: 22px; line-height: 1; color: var(--ink-soft); }
.vg-play + .vg-phrase-tile, .vg-phrase-tile + .exercise-head { margin-top: 32px; }

/* 題目上方的小標籤(單字選擇題、記憶吐司、片語特訓、動詞測驗) */
.vg-tag { display: inline-block; margin: 0 0 12px; padding: 4px 10px; border-radius: var(--r-sm); background: var(--bg-soft); color: var(--ink-soft); font-size: var(--fs-sm); line-height: 1.4; }
html.is-quiz .vg-tag + .q-text, html.is-quiz .vg-tag + .toast-stem, html.is-quiz .vg-tag + .vb-stem { margin-top: 0; }
html.is-quiz main .toast-stem { font-size: var(--fs-2xl); margin-bottom: 8px; }
html.is-quiz main .vb-stem { margin-bottom: 4px; }

/* 記憶吐司考題:答完後選項下面的「下一題」。手機整寬,桌機固定寬靠右 */
.vg-next-row { display: flex; margin-top: 16px; }
.vg-next-row .btn.primary { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 48px; font-size: var(--fs-btn); border-radius: var(--r-md); }
@media (min-width: 600px) { .vg-next-row { justify-content: flex-end; } .vg-next-row .btn.primary { flex: 0 0 240px; } }

/* 遊戲進行中(藏導覽):標題列與 HUD 往上靠一點,不留原本頂欄的空 */
html.is-quiz main .drill-top { margin-top: 8px; }
html.is-quiz main .game-hud { margin: 8px 0; }

/* 掉落消除的結束浮層:一張緊湊的結算卡。遊戲區跟著內容長高,不在裡面捲 */
.game-field:has(> .game-over) { height: auto; min-height: 430px; overflow: visible; }
.game-field > .game-over { position: relative; inset: auto; min-height: 430px; padding: 8px 16px 16px; border-radius: var(--r-lg); }
.game-over .result-card.is-compact { margin: 0 auto; padding: 16px 8px; }
.game-over .result-detail { width: 100%; max-width: 400px; margin: 0 auto 8px; }
.game-over .miss-list, .game-over .vq-list { margin-top: 0; }
.game-over .clear-mark { margin: 4px 0 -4px; width: 200px; height: 80px; }
.game-over .clear-word { font-size: 34px; }
.game-over .result-detail-body .vq-item { padding: 6px 4px; }
.game-over .result-detail-body .vq-item b { min-width: 110px; }

/* 逐字清單在結算卡下面的收合裡 */
.result-detail-body .vq-list { margin: 0; }
.result-detail-body .vq-item { text-align: left; }

/* 掉落消除結束後:標題列、HUD 與輸入框收起來,只留結算卡 */
.drill-top:has(+ .game-hud + .game-field > .game-over), .game-hud:has(+ .game-field > .game-over),
.game-field:has(> .game-over) ~ .game-input-row { display: none; }
.game-field:has(> .game-over) { margin-top: 12px; }

/* 動詞表。測驗進行中(專心模式)不顯示文法頁的章節導覽 */
.vb-bar .btn.primary:disabled { opacity: .5; cursor: not-allowed; }
html.vb-quizzing .gx-rail { display: none; }
/* 章節導覽收起來時(作答中與結算畫面)內容欄置中 */
html.vb-quizzing .gx-layout { display: block; }
html.vb-quizzing .gx-col { margin-inline: auto; }

/* ---- */


/* ==== 文法、自然發音、聽力訓練 ==== */

/* 文法與自然發音:清單只放課名的主題,課內標題下面一行副題;同章主題重複的幾課在清單裡多一行副題分辨 */
.gx-sub { margin: 0 0 20px; font-size: var(--fs-sm); line-height: 1.5; color: var(--ink-soft); }
.drill-top:has(+ .gx-sub) { margin-bottom: 6px; }
/* 文法與自然發音的清單頁、單課頁:標題放在路徑前面(手機先看到標題、圓圈排在下面);電腦版標題在右欄上方,路徑佔左欄兩列。
   標題跟清單頁同一個 h1(字級、螢光筆),副題是淡色小字 */
.gx-layout.has-head { grid-template-rows: auto 1fr; row-gap: 0; }
.gx-layout.has-head > .gx-head { grid-column: 2; grid-row: 1; min-width: 0; max-width: 770px; }
.gx-layout.has-head > .gx-rail { grid-column: 1; grid-row: 1 / span 2; }
.gx-layout.has-head > .gx-col { grid-column: 2; grid-row: 2; }
.gx-head .drill-top { margin-top: 34px; }
.gx-head .drill-top h1 { font-size: 26px; display: inline-block; position: relative; z-index: 0; }
.gx-head .drill-top h1::before {
  content: ''; position: absolute; z-index: -1;
  left: -8px; right: -10px; top: 46%; bottom: 3%;
  background: var(--marker);
  border-radius: 40% 60% 55% 45% / 60% 50% 50% 40%;
  transform: rotate(-1.2deg);
}
@media (max-width: 860px) {
  .gx-head .drill-top { margin-top: 26px; }
  .gx-head .drill-top h1 { font-size: 22px; }
  .gx-head .gx-sub { margin-bottom: 10px; }
  .gx-head .page-head { margin-bottom: 10px; }
  .gx-layout.has-head > .gx-rail { padding-top: 0; margin-bottom: 12px; }
}
.gx-unit-row .t .gx-dup { display: block; margin-top: 2px; font-size: var(--fs-xs); line-height: 1.4; color: var(--ink-soft); }

/* 12 時態總整理:左上角標出兩個軸(橫排是時間,直排是面向),說明只留一句操作指示 */
.tn-howto { margin: 2px 0 0; font-size: var(--fs-sm); line-height: 1.5; color: var(--ink-soft); }
.tn-corner { display: flex; flex-direction: column; justify-content: space-between; padding: 4px 10px 0 0; font-size: var(--fs-xs); line-height: 1.35; color: var(--ink-soft); }
.tn-corner .tn-axis-t { align-self: flex-end; }
.tn-corner .tn-axis-a { align-self: flex-start; }
@media (max-width: 600px) {
  .tn-corner { padding: 0; align-items: center; }
  .tn-corner .tn-axis-t, .tn-corner .tn-axis-a { align-self: center; }
}

/* 聽力訓練首頁:級別一排小圓鈕,四個入口是名稱加一行數字 */
.ear-levels { margin: 4px 0 18px; }
.ear-levels .chip { min-height: 36px; padding: 4px 16px; font-size: var(--fs-sm); cursor: pointer; }
.ear-tiles { margin-bottom: 48px; }
@media (min-width: 600px) and (max-width: 899px) { .ear-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.module-card.tile.ear-tile { min-height: 112px; justify-content: flex-start; }
.module-card.tile.ear-tile p { margin-bottom: 16px; }
.ear-bar { display: block; width: 100%; height: 6px; margin-top: auto; border-radius: var(--r-full); background: var(--line); overflow: hidden; }
.ear-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ok); }
.module-card.tile.ear-tile.is-off { opacity: .55; cursor: default; }
/* 寫作三個級別:手機一欄(名稱較長),600 以上三欄 */
.tile-grid.wr-tiles { grid-template-columns: 1fr; }
@media (min-width: 600px) { .tile-grid.wr-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.module-card.tile.ear-tile.is-off:hover { border-color: var(--line); transform: none; }
/* 入口磚的圖示(聽力四個入口、寫作三個級別共用):跟單字玩法磚一樣放在名稱上方,52px;圖沒載到時不留空位 */
.ear-art { display: block; flex: none; width: 52px; height: 52px; margin: 0 0 10px; }
html:not(.doodle-ready) .ear-art { display: none !important; }

/* 聽力訓練作答(專心模式) */
html.is-quiz #ear-root .drill-top { margin: 14px 0 0; }
html.is-quiz #ear-root .drill-top h1 { font-size: var(--fs-md); color: var(--ink-soft); }
html.is-quiz #ear-root .q-block { padding-top: 12px; }
.ear-lv { margin-left: 10px; font-size: var(--fs-sm); font-weight: 400; color: var(--ink-soft); }
.ear-lv::before { content: '· '; }
html.is-quiz #ear-root .player { gap: 12px; margin: 4px 0 8px; flex-wrap: wrap; }
html.is-quiz #ear-root .player-btn { min-height: 48px; padding: 0 24px; font-size: var(--fs-md); border-radius: var(--r-md); }
html.is-quiz #ear-root .player-btn.primary { font-size: var(--fs-btn); }
html.is-quiz #ear-root .shadow-stage { border-radius: var(--r-md); }
html.is-quiz #ear-root .pair-row { gap: 12px; }
html.is-quiz #ear-root .pair-btn { min-height: 64px; border-radius: var(--r-md); }
html.is-quiz #ear-root .write-area { font-size: 16px; min-height: 96px; }
.ear-hit { font-weight: 700; color: var(--ink-soft); font-size: var(--fs-sm); }
.ear-hit + .dict-diff { margin-top: 4px; }

/* ---- */


/* ==== 閱讀、對話、寫作 ==== */

/* 寫作首頁三個級別:手機一欄時圖示放左邊(名稱、單元數在右),磚不會因為圖示變高 */
@media (max-width: 599px) {
  .wr-tiles .module-card.tile.ear-tile { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "art name" "art num" "bar bar"; column-gap: 14px; align-items: center; min-height: 0; }
  .wr-tiles .ear-art { grid-area: art; margin: 0; }
  .wr-tiles .ear-tile h2 { grid-area: name; align-self: end; }
  .wr-tiles .module-card.tile.ear-tile p { grid-area: num; align-self: start; margin: 2px 0 0; }
  .wr-tiles .ear-bar { grid-area: bar; margin-top: 12px; }
}
.result-card.tq-result { font-size: inherit; font-weight: inherit; }
.tq-submit { align-items: center; }
.tq-left { font-size: var(--fs-sm); color: var(--ink-soft); }
.dlg-msg-2 { display: block; color: var(--ink-soft); }

/* ---- */


/* ==== 學習記錄、能力分析、帳號周邊 ==== */

/* 兩行訊息:程式用換行字元把「發生什麼」和「怎麼辦」分成兩行,這裡讓換行顯示出來 */
.auth-msg, .me-class-msg, .me-bill-msg, .trial-fail, .trial-code-note, .pw-msg, .corr-msg, .buy-note, .pricing-buy-note,
.modal-report .auth-fine, .reset-msg, .auth-note { white-space: pre-line; }

/* 付費牆遮罩:登出失敗的訊息 */
.pw-msg { margin: 12px 0 0; font-size: var(--fs-sm); color: var(--bad-ink); text-align: center; }
.pw-msg:empty { display: none; }

/* 標題前的圖示:學習記錄、能力分析 */
.page-head:has(> .hub-art) + .ui-empty { padding-top: 24px; }

/* 能力分析 */
.an-tags { margin: 8px 0 18px; }
.an-tag { display: inline-block; padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--r-full); background: var(--bg-soft); font-size: var(--fs-xs); color: var(--ink-soft); }
.an-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.an-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.verdict-pill.an-swatch { display: inline-block; width: 22px; height: 10px; padding: 0; border-radius: var(--r-full); }
.verdict-pill.an-swatch.weak { background: var(--bad); }
.verdict-pill.an-swatch.mid { background: var(--hint-orange); }
.verdict-pill.an-swatch.good { background: var(--ok); }
#analysis-root .ui-empty { padding-bottom: 32px; }

/* 教師後台:學生列的展開箭頭與最後同步時間 */
.ad-sync { display: block; margin-top: 2px; font-size: var(--fs-xs); font-weight: 400; color: var(--ink-light); }
.ad-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
table.cat-table th.ad-caret-th, table.cat-table td.ad-caret-td { width: 44px; padding: 0; text-align: center; }
/* 手機上表格可以左右捲:箭頭那一欄固定在右邊,不用捲就看得到 */
table.cat-table th.ad-caret-th, table.cat-table td.ad-caret-td { position: sticky; right: 0; background: #fff; box-shadow: -8px 0 8px -8px rgba(0,0,0,.12); }
.ad-caret { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; }
.ad-caret:hover { background: var(--bg-soft); }
.ad-caret:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
/* 展開列(預估、舊檢測、上課紀錄與備註):表格比畫面寬、可以左右捲時,展開的內容不跟著表格一樣寬,停在畫面左邊、字在畫面寬度內換行 */
.adm-detail { overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .adm-detail { position: sticky; left: 0; max-width: calc(100vw - 60px); }
}
.ad-caret-ico { width: 8px; height: 8px; border-right: 2px solid var(--ink-light); border-bottom: 2px solid var(--ink-light); transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
tr.is-open .ad-caret-ico { transform: translateY(2px) rotate(-135deg); }
.ad-picks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ad-picks:empty { display: none; }
.ad-line { display: block; }
.ui-empty .ac-msg { margin: 0; text-align: center; }
@media (prefers-reduced-motion: reduce) { .ad-caret-ico { transition: none; } }

/* ---- */

/* ==== 收尾:題組文章、作答列題號 ==== */
/* 手機(860 以下文章與題目上下排):專心模式裡題組的文章區最高佔可視高度的一半,在框裡捲動,題目留在下面看得到 */
@media (max-width: 860px) {
  html.is-quiz main .set-layout .passage-sticky-wrap,
  html.is-quiz #mock-root .set-layout .passage-sticky-wrap {
    position: relative; top: auto; max-height: 50vh; max-height: 50dvh; overflow-y: auto; overscroll-behavior: contain;
    border-radius: var(--radius);
  }
}
/* 電腦版(文章與題目左右排):有底部列時文章框的高度扣掉底部列,捲到最後一行也看得到 */
@media (min-width: 861px) {
  html.is-quiz.has-quiz-foot main .set-layout .passage-sticky-wrap { max-height: calc(100vh - 88px - var(--quiz-foot-h, 76px)); }
}
/* 作答列右邊可以點開題號面板的「3 / 75」(模擬考、程度檢測):淡底膠囊加向下的小箭頭,看得出是按鈕 */
html.is-quiz .quiz-bar button.quiz-count {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; padding: 0 12px;
  border-radius: var(--r-full); background: var(--bg-soft); color: var(--ink);
}
html.is-quiz .quiz-bar button.quiz-count::after {
  content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
html.is-quiz .quiz-bar button.quiz-count:hover { background: var(--line); }
/* 很窄的手機(320 到 360):計時器、題號鈕、交卷擠在同一列時,間距縮小,進度條留得下來 */
@media (max-width: 360px) {
  html.is-quiz .quiz-bar { gap: 6px; }
  html.is-quiz .quiz-bar button.quiz-count { gap: 4px; padding: 0 8px; }
  .quiz-act.btn-text { padding: 0 6px; }
}
/* 錯題本磚沒有待複習時數字那一行是空的:不佔高度 */
.module-card.tile p:empty { display: none; }
/* 寫作首頁:標題(左邊有圖示)下面一行標籤 */
.wr-home-tag { margin: -12px 0 0; color: var(--ink-light); font-size: var(--fs-sm); }
html:not(.authed) .wr-home-tag { display: none; }   /* 訪客沒有自動儲存也沒有老師:不顯示 */

/* ---- */

/* 觸控裝置的點擊範圍至少 44×44(滑鼠不影響):頂欄品牌與頭像、頭像選單、頁尾連結、練習設定的按鈕與下拉、每日目標、聽寫播放與速度、回報題目、解析裡獨立一行的連結 */
@media (pointer: coarse) {
  .brand, .profile-btn { min-height: 44px; }
  .pm-item { min-height: 44px; }
  .foot-links { row-gap: 0; }
  .foot-links a { display: inline-flex; align-items: center; min-height: 44px; }
  .foot-about { margin-top: 0; }
  .foot-about > summary { min-height: 44px; }
  .practice-panel .btn, .practice-panel .cfg-select, .review-row .btn { min-height: 44px; }
  .practice-panel a.btn, .review-row a.btn { display: inline-flex; align-items: center; justify-content: center; }
  .cfg-part-check { min-height: 44px; }
  .pet-seg-b { min-height: 44px; }
  .player .btn, .player .speed-sel, .report-btn { min-height: 44px; }
  .tr > a:only-child { display: inline-flex; align-items: center; min-height: 44px; }
}
/* 欄位旁的「選填」小標籤(題目回報的補充說明) */
.auth-opt { margin-left: 4px; padding: 1px 8px; border-radius: var(--r-full); background: var(--bg-soft); font-size: var(--fs-xs); font-weight: 400; color: var(--ink-soft); }
/* 404:空狀態的樣子,文字是 h1(頁面唯一的標題) */
.nf-empty h1.ui-empty-text { font-size: var(--fs-xl); font-family: var(--round); color: var(--ink); }

/* ==== 新用戶設定起始程度(start.html、首頁的卡、我的頁學習設定) ====
   一頁一個問題:頁首左邊返回、右邊第幾題;選項是整張可點的卡片(外觀同 .auth-role-card)。
   一個畫面只有一顆實色主按鈕(天藍底白字,字級 --fs-btn),其他動作是文字按鈕(.btn-text);手機上按鈕列固定在下方。
   App 外殼裡用外殼的返回鍵,這裡的返回鈕藏起來(不出現兩個返回)。螢光筆只用在 h1。 */
.ob-root { padding-bottom: 8px; }
.ob-head { display: flex; justify-content: space-between; align-items: center; max-width: 520px; min-height: 44px; margin-top: 18px; }   /* 跟選項同寬:第幾題對齊選項右緣 */
.ob-head + .page-head { margin-top: 10px; }
.ob-progress { font-size: var(--fs-sm); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ob-back {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -10px;
  border: 0; border-radius: var(--r-md); background: none; color: var(--ink); cursor: pointer;
}
.ob-back:hover { background: var(--bg-soft); }
.ob-back:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
html.app-shell .ob-back { visibility: hidden; }
/* S0:標題在左、鵜鶘緊跟在右邊(同首頁首屏的排法,不飄到畫面最右);手機鵜鶘縮到 96 寬 */
.ob-start { display: flex; align-items: center; gap: 16px 48px; }
.ob-start .page-head { flex: 0 1 auto; min-width: 0; }
.ob-start-art { display: block; flex: none; }
.ob-start-art.is-pelican[data-mascot="gaze"] { margin-left: 9px; }   /* gaze 的書在畫布左上、墨跡比較靠左:多留 9,墨跡到標題的距離跟以前差不多 */
@media (max-width: 600px) {
  .ob-start { align-items: flex-start; gap: 8px; }
  .ob-start-art { width: 80px !important; height: 93px !important; margin: 18px -6px -6px 0; }   /* 退回小雞時 */
  .ob-start-art.is-pelican { width: 96px !important; height: 90px !important; margin: 26px -6px -4px 0; }
  .ob-start-art.is-pelican[data-mascot="gaze"] { margin-left: 6px; }
}
.ob-choices { display: grid; gap: 10px; margin: 18px 0; max-width: 520px; }
/* 選項的外觀同 .auth-role-card,但不能共用那條規則:.auth-role-card 是 label 包 input(選定靠 :has(input:checked)),
   這裡是 button[role=radio](點了就前進,選定靠 aria-checked) */
.ob-choice {
  display: flex; align-items: center; width: 100%; min-height: 56px; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; color: var(--ink);
  font-family: var(--round); font-size: var(--fs-md); font-weight: 700; text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ob-choice:hover { border-color: var(--primary); }
.ob-choice[aria-checked="true"] { border-color: var(--primary); background: var(--primary-tint); color: var(--primary-dark); box-shadow: inset 0 0 0 1px var(--primary); }
.ob-choice:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ob-field, .ob-form { max-width: 520px; margin: 18px 0 6px; }
.ob-form { display: grid; gap: 14px; }
.ob-score { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ob-score.is-one { grid-template-columns: 1fr; max-width: 254px; }
.ob-switch { margin: -4px 0 0; }
.ob-switch .btn-text { margin-left: -12px; font-size: var(--fs-sm); }
.ob-foot { margin-top: 28px; }
.ob-foot a { margin-left: 6px; }
.ob-nowrap { white-space: nowrap; }
.ob-line { display: block; }   /* 視窗內文分行(帳號已有學習設定:帳號的設定、剛才的答案各一行) */
.ob-loading { margin-top: 30px; }   /* 等雲端、算級別:一行小字,同文法查表頁的「載入中…」 */
/* S4:同檢測頁的開始頁(.diag-intro 卡片、兩個小標籤、卡片裡的實色主按鈕),下面接文字按鈕 */
.ob-intro-note { margin: 12px 0 0; font-size: var(--fs-sm); line-height: 1.7; color: var(--ink-soft); }   /* 作答方式:跟檢測頁開始頁的 .pl-rule 一樣的行距 */
.ob-intro-note + .ob-intro-note { margin-top: 2px; }
.ob-intro .auth-msg:not(:empty) { margin-top: 12px; }
.ob-intro-more { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 12px 0 0 -12px; }
.ob-intro-more .btn-text .ob-date { margin-left: 2px; }
/* 按鈕列:實色主按鈕一顆,後面是文字按鈕 */
.ob-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 24px 0 40px; }
.ob-actions .btn.primary {
  display: inline-flex; align-items: center; justify-content: center; min-width: 200px; min-height: 48px; padding: 0 32px;
  font-size: var(--fs-btn); border-radius: var(--r-md); text-decoration: none;
}
.ob-actions .btn.primary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ob-date, .me-row-val { font-size: 13px; font-weight: 400; color: var(--ink-soft); }
.me-row-val { margin-left: auto; padding-left: 12px; overflow-wrap: anywhere; }
/* S8:結算卡(UI.result)的標題是一句話不是分數,字級降到 --fs-2xl;兩科級別放在統計列 */
.ob-result .result-score b { font-size: var(--fs-2xl); }
.ob-mine { max-width: 480px; margin: 8px auto 40px; }
.ob-mine .me-list { margin-bottom: 0; }
.ob-root > .auth-msg { max-width: 480px; margin: 12px auto 0; text-align: center; }
.ob-auth-back { margin-top: 18px; text-align: center; }
.ob-join-auth { margin-top: 24px; }
/* S8b 改級別(UI.sheet):兩組四選一,下面一顆「套用」 */
.ob-level-set { margin-top: 16px; }
.ob-level-set + .ob-level-set { margin-top: 14px; }
.ob-level-legend { font-size: var(--fs-sm); color: var(--ink-soft); padding: 0; margin-bottom: 8px; }
.ob-level-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ob-gap { margin-top: 10px; }
.ob-gap:empty { display: none; }
.ob-sheet-actions { margin-top: 20px; }
.ob-sheet-actions .btn.primary {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px;
  font-size: var(--fs-btn); border-radius: var(--r-md);
}
.ob-sheet-actions .btn.primary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 860px) {
  .ob-actions {
    position: sticky; bottom: 0; z-index: 5; display: grid; justify-items: center; gap: 4px; margin: 22px 0 24px;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: #fff;
    /* 白底往左右延伸到整個畫面寬(只畫陰影,不佔版面、不會出現橫向捲動),兩側不露出底下捲動的內容 */
    box-shadow: 0 0 0 100vmax #fff; clip-path: inset(0 -100vmax);
  }
  .ob-actions .btn.primary { width: 100%; min-width: 0; }
}
@media (max-width: 600px) {
  .ob-level-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ob-intro-more { flex-direction: column; align-self: stretch; margin-left: 0; }   /* 卡片裡的主按鈕在手機佔滿寬:文字按鈕置中排在下面 */
}
@media (max-width: 359px) {
  .ob-score { grid-template-columns: 1fr; }
}
/* 首頁的卡(index.html #onboard-home):每日練習卡後面,桌機在右欄;按鈕是描邊鈕與文字按鈕 */
.ob-home[hidden] { display: none; }
.home .ob-home { margin-top: 16px; }
.home .ob-home + .pet-home { margin-top: 16px; }   /* 小雞卡原本接在每日練習卡後面(.daily-home + .pet-home),現在接在這張卡後面 */
.ob-home h2 { font-size: var(--fs-lg); margin: 0; }
.ob-home-sub { margin: 6px 0 0; color: var(--ink-soft); font-size: var(--fs-sm); }
.ob-home-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.ob-home-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: var(--r-md); text-decoration: none; }
.ob-home-actions .btn:hover { text-decoration: none; }
.ob-home-actions .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 600px) {
  .ob-home-actions .btn { flex: 1 1 100%; min-height: 48px; }
  .ob-home-actions .btn-text { margin: 0 auto; }
}
