:root {
  /* 配色：老師指定的 5 個色號 #E0EBF7 #9BB3D6 #B1CFE7 #AAC7E9 #9AB4DE
     這幾個顏色都偏淺，所以按鈕上的字用深藍（--on-primary），標題與連結用加深的藍（--green-d）以維持可讀性 */
  --green: #9AB4DE;      /* 主色：按鈕、播放鍵、進度條 */
  --green-h: #AAC7E9;    /* 滑過按鈕 */
  --green-2: #9BB3D6;    /* 選取中的外框 */
  --green-3: #B1CFE7;    /* 柔和強調 */
  --green-l: #E0EBF7;    /* 淺底色、標籤 */
  --green-ll: #F0F5FB;   /* 更淺的底色 */
  --green-d: #3F5E91;    /* 文字強調、連結（由色系加深，確保看得清楚） */
  --on-primary: #1D2F4F; /* 主色上的文字 */
  --ink: #1f2a37; --ink-2: #56657a; --line: #D3E1F1; --bg: #F7FAFD; --card: #fff;
  --red: #d2574b; --red-l: #fbecea; --amber: #c98a1b; --amber-l: #fdf4e3;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(63,94,145,.08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif; line-height: 1.6; }
a { color: var(--green-d); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 28px; height: 28px; border-radius: 8px; background: var(--green); color: var(--on-primary); font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
.top .sp { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: .9rem; color: var(--ink-2); text-decoration: none; }
.chip:hover { border-color: var(--green); color: var(--green-d); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--green); background: var(--green); color: var(--on-primary);
  padding: 9px 18px; border-radius: 8px; font-weight: 600; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--green-h); border-color: var(--green-h); }
.btn.ghost { background: #fff; color: var(--green-d); }
.btn.ghost:hover { background: var(--green-ll); }
.btn.danger { background: #fff; color: var(--red); border-color: #e9b7b1; }
.btn.danger:hover { background: var(--red-l); }
.btn.sm { padding: 5px 12px; font-size: .88rem; font-weight: 500; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--green); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: #fff; color: var(--green-d); padding: 5px 14px; font-size: .9rem; }
.seg button.on { background: var(--green); color: var(--on-primary); font-weight: 600; }

/* page heading */
.crumb { margin: 20px 0 4px; font-size: .9rem; color: var(--ink-2); }
.crumb a { text-decoration: none; }
h1.title { margin: 4px 0 20px; font-size: 1.9rem; font-weight: 500; color: var(--green-d); }
h1.title small { font-size: 1rem; color: var(--ink-2); margin-right: 8px; }

/* tabs */
.tabs { display: flex; justify-content: center; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 22px; font-size: 1.2rem; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--green); }

/* unit grid */
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 8px 0 40px; }
.unit { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .15s; }
.unit:hover { border-color: var(--green); transform: translateY(-2px); }
.unit .no { font-size: .8rem; color: var(--green-d); font-weight: 600; letter-spacing: .05em; }
.unit .nm { font-size: 1.15rem; font-weight: 600; }
.unit .ct { font-size: .82rem; color: var(--ink-2); }

/* activity grid */
.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.act { background: none; border: 0; padding: 8px 4px 12px; text-align: center; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.act .ic { width: 128px; height: 128px; border-radius: 50%; background: #fff; border: 2px solid var(--green-l); display: grid; place-items: center;
  position: relative; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s, transform .15s, background .15s; }
.act:hover .ic { border-color: var(--green); background: var(--green-ll); transform: translateY(-3px); box-shadow: 0 8px 22px rgba(63,94,145,.2); }
.act:focus-visible { outline: none; }
.act:focus-visible .ic { outline: 3px solid var(--green); outline-offset: 3px; }
.act svg { width: 70px; height: 70px; }
.act .badge { top: 2px; right: auto; left: calc(50% + 34px); }
.act .nm { font-size: 1.2rem; margin-top: 4px; }
.act .n { font-size: .82rem; color: var(--ink-2); }
.act.off { opacity: .4; pointer-events: none; }
.act.off .ic { box-shadow: none; }
.badge { position: absolute; top: 14px; right: 16px; font-size: .72rem; padding: 2px 8px; border-radius: 999px; }
.badge.score { background: var(--green-l); color: var(--green-d); }
.badge.prac { background: var(--amber-l); color: var(--amber); }
.acts-h { font-size: 1rem; color: var(--ink-2); margin: 26px 0 10px; font-weight: 500; }

/* vocab */
.vbar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; font-size: .92rem; }
.vlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 40px; }
.vcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.vcard .w { font-size: 1.45rem; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vcard .py { color: var(--green-d); font-size: .95rem; }
.vcard .m { margin-top: 4px; }
.vcard .lv { margin-left: auto; font-size: .72rem; font-weight: 500; border-radius: 999px; padding: 1px 8px; }
.vcard .lv0 { background: var(--amber-l); color: var(--amber); }
.vcard .lv1 { background: var(--green-l); color: var(--green-d); }
.vcard[hidden] { display: none; }
.vcard .pos { font-size: .75rem; color: var(--ink-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font-weight: 400; }
.vcard .ex { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: .95rem; }
.vcard .exz { color: var(--ink-2); font-size: .88rem; }
.hide-zh .zh { visibility: hidden; }
.hide-py .py { display: none; }
.play { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--green); color: var(--on-primary); display: inline-grid; place-items: center; flex: none; }
.play:hover { background: var(--green-h); }
.play svg { width: 14px; height: 14px; }
.play.sm { width: 28px; height: 28px; }
.play.sm svg { width: 11px; height: 11px; }
.vcard .exl + .exl { margin-top: 6px; }

/* quiz */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--ink-2); font-size: .92rem; flex-wrap: wrap; }
.bar { height: 6px; background: var(--green-l); border-radius: 99px; overflow: hidden; margin-bottom: 20px; }
.bar i { display: block; height: 100%; background: var(--green); transition: width .25s; }
.stem { font-size: 1.35rem; line-height: 1.8; white-space: pre-line; margin: 6px 0 18px; }
.blurtxt { color: transparent; text-shadow: 0 0 10px rgba(0,0,0,.4); user-select: none; }
.stem.hidden { color: transparent; text-shadow: 0 0 12px rgba(0,0,0,.35); user-select: none; }
.bigplay { display: flex; align-items: center; gap: 10px 12px; margin-bottom: 14px; flex-wrap: wrap; }
.bigplay .play + .muted { margin-right: 10px; }
.bigplay .play { width: 56px; height: 56px; }
.bigplay .play svg { width: 22px; height: 22px; }
.note { font-size: .88rem; color: var(--amber); background: var(--amber-l); border-radius: 8px; padding: 6px 12px; display: inline-block; margin-bottom: 12px; }
.qimg { max-width: 100%; max-height: 360px; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 16px; display: block; }
.opts { display: grid; gap: 10px; }
.opts.imgs { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 12px 16px; font-size: 1.15rem; transition: border-color .12s, background .12s; }
.opt:hover { border-color: var(--green); }
.opt.sel { border-color: var(--green-2); background: var(--green-l); }
.opt .k { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: .95rem; color: var(--ink-2); background: #fff; }
.opt.sel .k { background: var(--green); color: var(--on-primary); border-color: var(--green-2); font-weight: 700; }
.opt img { max-width: 100%; max-height: 140px; border-radius: 6px; display: block; }
.opts.imgs .opt { flex-direction: column; align-items: center; text-align: center; }
.qnav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.dots button { min-width: 32px; padding: 0 6px; height: 32px; border-radius: 6px; border: 1px solid var(--line); background: #fff; font-size: .85rem; }
.dots button.done { background: var(--green-l); border-color: var(--green-l); }
.dots button.cur { border-color: var(--green-d); border-width: 2px; }
.warn { color: var(--red); font-size: .92rem; margin-top: 10px; }

/* result */
.result { text-align: center; padding: 30px 20px; }
.ring { width: 150px; height: 150px; margin: 0 auto 10px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.2rem; color: var(--green-d); }
.review { margin-top: 10px; }
.ritem { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; background: #fff; }
.ritem.bad { border-left: 4px solid var(--red); }
.ritem.good { border-left: 4px solid var(--green); }
.ritem .s { white-space: pre-line; margin-bottom: 6px; }
.ritem .o { font-size: .95rem; padding: 2px 0; color: var(--ink-2); }
.ritem .o.ans { color: var(--green-d); font-weight: 600; }
.ritem .o.wrong { color: var(--red); text-decoration: line-through; }

/* practice */
.rec { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.recdot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
audio { max-width: 100%; }

/* forms / tables */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-size: .9rem; color: var(--ink-2); }
.field input, .field select, .field textarea, .inp { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: #fff; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus { outline: 2px solid var(--green-l); border-color: var(--green); }
.gate { max-width: 420px; margin: 50px auto; }
table.t { width: 100%; border-collapse: collapse; background: #fff; font-size: .92rem; }
table.t th, table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { background: var(--green-ll); font-weight: 600; color: var(--ink-2); white-space: nowrap; position: sticky; top: 0; }
table.t tr:hover td { background: var(--green-ll); }
.tscroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.muted { color: var(--ink-2); }
.center { text-align: center; }
.empty { text-align: center; color: var(--ink-2); padding: 40px 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100; font-size: .95rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

@media (max-width: 600px) {
  h1.title { font-size: 1.5rem; }
  .tabs button { font-size: 1.05rem; padding: 8px 12px; }
  .panel { padding: 16px; }
  .stem { font-size: 1.2rem; }
  .act .ic { width: 96px; height: 96px; }
  .act svg { width: 52px; height: 52px; }
  .act .badge { left: calc(50% + 24px); }
  .acts { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .vlist { grid-template-columns: 1fr; }
}

/* 浮水印 */
body::after { content: "ChouInn"; position: fixed; right: 14px; bottom: 10px; z-index: 60; pointer-events: none;
  font-size: 12px; letter-spacing: .08em; color: var(--ink-2); opacity: .45; font-style: italic; }
@media print { body::after { position: absolute; } }

/* 頁尾：資料來源 */
.site-foot { border-top: 1px solid var(--line); margin-top: 48px; padding: 18px 0 44px; font-size: .82rem; color: var(--ink-2); line-height: 1.7; }
.site-foot a { color: var(--green-d); }

/* 口說錄音 */
.recstat { border-radius: 10px; padding: 10px 14px; margin: 4px 0 6px; font-size: .95rem; }
.recstat.pending { background: var(--amber-l); color: #8a5d10; }
.recstat.graded { background: #e8f6ee; color: #1f6b43; }
.recstat .cm { margin-top: 4px; color: var(--ink); }
.okmsg { color: #1f7a4c; font-weight: 600; }
.dots button.graded { background: #d6f0e1; border-color: #d6f0e1; }

/* 題庫題號 */
.bankno { display: inline-block; background: var(--green-l); color: var(--green-d); font-weight: 700; border-radius: 6px; padding: 2px 10px; font-size: .95rem; }
.ritem .bankno { font-size: .85rem; padding: 1px 8px; margin-bottom: 4px; }

/* 個資告知 */
.privacy-box { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--green-ll); padding: 12px 14px; font-size: .9rem; line-height: 1.75; }
