/* ===== S2 Summer Revision — iPad friendly ===== */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html { font-size:17px; }
body {
  font-family: -apple-system, "PingFang HK", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:#f2f5fa; color:#1c2333; min-height:100vh;
}
#app { max-width:960px; margin:0 auto; padding:0 16px 60px; }

/* topbar */
.topbar { display:flex; justify-content:space-between; align-items:center; padding:14px 4px; position:sticky; top:0; background:rgba(242,245,250,.94); backdrop-filter:blur(8px); z-index:10; }
.brand { font-weight:800; font-size:1.15rem; cursor:pointer; }
nav { display:flex; gap:8px; }
.navbtn { border:none; background:#fff; padding:10px 16px; border-radius:12px; font-size:.95rem; font-weight:600; color:#444; box-shadow:0 1px 3px rgba(0,0,0,.07); cursor:pointer; transition:transform .12s, box-shadow .15s; }
.navbtn:active { transform:scale(.95); }
.navbtn.active { background:linear-gradient(120deg,#2f6bff,#7a5cff); color:#fff; box-shadow:0 3px 10px rgba(47,107,255,.3); }
.badge { background:#ff5252; color:#fff; border-radius:10px; padding:1px 7px; font-size:.75rem; margin-left:2px; }

.view { display:none; animation:fade .25s; }
.view.show, .view.active { display:block; }
@keyframes fade { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }

/* hero */
.hero { display:flex; justify-content:space-between; align-items:center; gap:16px; background:linear-gradient(120deg,#2f6bff,#7a5cff); color:#fff; border-radius:20px; padding:26px 28px; margin-top:8px; }
.hero h1 { font-size:1.6rem; margin-bottom:6px; }
.hero p { opacity:.9; }
.streak-card { text-align:center; background:rgba(255,255,255,.16); border-radius:16px; padding:12px 22px; min-width:120px; }
.streak-num { font-size:2.2rem; font-weight:800; }
.streak-label { font-size:.8rem; opacity:.9; }

.daily-card { background:#fff; border-radius:16px; padding:18px 22px; margin:16px 0; box-shadow:0 2px 8px rgba(20,40,90,.06); display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; }

/* encouragement card (single child: Cheal 刘俊辰) */
.encourage-card { margin:16px 0; }
.enc-card { display:flex; gap:16px; align-items:center; background:linear-gradient(120deg,#ff8a5c,#ff5c8a); color:#fff; border-radius:18px; padding:20px 22px; box-shadow:0 4px 14px rgba(255,92,138,.25); }
.enc-avatar { font-size:2.6rem; line-height:1; flex-shrink:0; filter:drop-shadow(0 2px 4px rgba(0,0,0,.15)); }
.enc-main { flex:1; min-width:0; }
.enc-hi { font-size:1.1rem; font-weight:800; margin-bottom:6px; }
.enc-msg { font-size:1.02rem; opacity:.98; line-height:1.5; }
.enc-praise { font-size:.9rem; margin-top:8px; opacity:.95; }
.enc-tip { font-size:.85rem; margin-top:8px; opacity:.92; border-top:1px solid rgba(255,255,255,.28); padding-top:8px; }

.sec-title { margin:20px 0 12px; font-size:1.2rem; }

/* subject grid */
.subject-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }
.subject-card { background:#fff; border-radius:18px; padding:20px; cursor:pointer; box-shadow:0 2px 8px rgba(20,40,90,.06); transition:transform .12s; border-left:6px solid var(--c,#2f6bff); }
.subject-card:active { transform:scale(.97); }
.subject-card .s-top { display:flex; justify-content:space-between; align-items:center; }
.subject-card h3 { font-size:1.1rem; }
.subject-card .s-en { color:#8b93a7; font-size:.82rem; margin-top:2px; }
.s-icon { font-size:1.8rem; }
.mastery-wrap { margin-top:14px; background:#eef1f7; border-radius:8px; height:10px; overflow:hidden; }
.mastery-bar { height:100%; border-radius:8px; background:var(--c,#2f6bff); transition:width .4s; }
.mastery-txt { font-size:.8rem; color:#667; margin-top:6px; display:flex; justify-content:space-between; }

/* buttons */
.btn { border:none; border-radius:14px; padding:14px 26px; font-size:1.02rem; font-weight:700; cursor:pointer; background:#2f6bff; color:#fff; box-shadow:0 3px 10px rgba(47,107,255,.3); }
.btn.ghost { background:#fff; color:#2f6bff; border:2px solid #2f6bff; box-shadow:none; }
.btn.big { width:100%; padding:17px; font-size:1.1rem; margin-top:10px; }
.btn.locked { opacity:.55; cursor:not-allowed; filter:grayscale(.3); }
.btn:active { transform:scale(.97); }
.back { border:none; background:#fff; border-radius:12px; padding:10px 18px; margin:14px 0; font-size:.95rem; font-weight:600; cursor:pointer; box-shadow:0 1px 3px rgba(0,0,0,.08); }
.back.small { margin:0; }

/* subject detail */
.sd-head { background:#fff; border-radius:18px; padding:24px; margin-bottom:14px; border-left:6px solid var(--c); }
.sd-head h1 { font-size:1.5rem; }
.topic-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(290px,1fr)); gap:10px; margin-top:14px; }
.topic-item { background:#fff; border-radius:14px; padding:14px 16px; display:flex; justify-content:space-between; align-items:center; box-shadow:0 1px 4px rgba(20,40,90,.05); }
.topic-item .t-name { font-size:.95rem; font-weight:600; }
.pill { font-size:.78rem; padding:4px 10px; border-radius:20px; font-weight:700; }
.pill.good { background:#e3f7e9; color:#1d9e50; }
.pill.mid { background:#fff3dc; color:#c98a00; }
.pill.bad { background:#ffe5e5; color:#e03131; }
.pill.new { background:#eef1f7; color:#778; }

/* quiz */
.quiz-head { display:flex; align-items:center; gap:14px; padding:14px 0; }
.progress-wrap { flex:1; height:12px; background:#e4e9f2; border-radius:8px; overflow:hidden; }
.progress-bar { height:100%; background:linear-gradient(90deg,#2f6bff,#7a5cff); width:0; border-radius:8px; transition:width .3s; }
.quiz-count { font-weight:700; color:#556; }
.q-card { background:#fff; border-radius:20px; padding:26px; box-shadow:0 3px 12px rgba(20,40,90,.07); border-left:6px solid #2f6bff; }
.q-card.tier-F { background:#f6f7f9; border-left-color:#adb5bd; }
.q-card.tier-S { background:#f2f7ff; border-left-color:#1971c2; }
.q-card.tier-E { background:#fff5ec; border-left-color:#e8590c; }
.q-meta { display:flex; gap:8px; margin-bottom:14px; flex-wrap:wrap; }
.tag { font-size:.76rem; background:#eef3ff; color:#2f6bff; padding:4px 10px; border-radius:16px; font-weight:600; }
.tag.diff { background:#f6eeff; color:#8a4bff; }
.tier-chip { font-weight:700; }
.tier-chip.tier-F { background:#e9ecef; color:#495057; }
.tier-chip.tier-S { background:#e7f0ff; color:#1971c2; }
.tier-chip.tier-E { background:#ffe8d6; color:#e8590c; }
.q-text { font-size:1.18rem; line-height:1.65; margin-bottom:20px; font-weight:600; }
.passage { font-weight:400; font-size:1rem; background:#f7f9fc; border-left:4px solid #cfd8ea; padding:14px 16px; border-radius:10px; margin-bottom:18px; line-height:1.85; color:#33405a; white-space:pre-wrap; max-height:320px; overflow:auto; }
.q-text .passage { display:block; font-weight:400; font-size:1rem; background:#f7f9fc; border-left:4px solid #cfd8ea; padding:12px 14px; border-radius:8px; margin-bottom:12px; line-height:1.8; }
.opts { display:grid; gap:12px; }
.opt { text-align:left; border:2px solid #e4e9f2; background:#fbfcfe; border-radius:14px; padding:16px 18px; font-size:1.05rem; cursor:pointer; display:flex; gap:12px; align-items:flex-start; line-height:1.5; }
.opt .ol { font-weight:800; color:#2f6bff; min-width:24px; }
.opt.sel { border-color:#2f6bff; background:#eef3ff; }
.opt.right { border-color:#2bb673; background:#e8f9f0; }
.opt.wrongopt { border-color:#ff6b6b; background:#ffefef; }
.opt:disabled { cursor:default; }
.explain { margin-top:18px; border-radius:14px; padding:16px 18px; line-height:1.7; font-size:.98rem; display:none; }
.explain.show { display:block; animation:fade .3s; }
.explain.ok { background:#e8f9f0; border:1px solid #bfe9d2; }
.explain.no { background:#fff4f4; border:1px solid #ffd4d4; }
.quiz-actions { margin-top:18px; display:flex; justify-content:flex-end; gap:10px; }

/* result */
.result-hero { text-align:center; background:#fff; border-radius:20px; padding:36px 24px; margin-top:20px; box-shadow:0 3px 12px rgba(20,40,90,.07); }
.score-big { font-size:3.4rem; font-weight:800; }
.score-big.good { color:#1d9e50; } .score-big.mid { color:#c98a00; } .score-big.bad { color:#e03131; }
.result-msg { font-size:1.1rem; margin:8px 0 4px; }
.result-detail { background:#fff; border-radius:16px; padding:20px; margin-top:14px; box-shadow:0 2px 8px rgba(20,40,90,.05); }
.rd-row { display:flex; justify-content:space-between; padding:10px 4px; border-bottom:1px solid #f0f2f7; font-size:.96rem; }
.rd-row:last-child { border:none; }

/* wrong book */
.wrong-item { background:#fff; border-radius:14px; padding:18px; margin:10px 0; box-shadow:0 1px 4px rgba(20,40,90,.05); }
.wrong-item .wq { font-weight:600; line-height:1.6; margin:6px 0; }
.wrong-item .wa { font-size:.92rem; color:#1d9e50; margin-top:6px; }
.wrong-item .we { font-size:.88rem; color:#667; margin-top:4px; line-height:1.6; }
.wrong-tags { display:flex; gap:6px; flex-wrap:wrap; }

/* stats */
.stat-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:12px; margin:14px 0; }
.stat-card { background:#fff; border-radius:16px; padding:18px; text-align:center; box-shadow:0 1px 4px rgba(20,40,90,.05); }
.stat-card .num { font-size:1.9rem; font-weight:800; color:#2f6bff; }
.stat-card .lbl { font-size:.85rem; color:#778; margin-top:4px; }
.bar-row { display:flex; align-items:center; gap:10px; margin:8px 0; }
.bar-row .bl { width:170px; font-size:.88rem; font-weight:600; text-align:right; }
.bar-row .bwrap { flex:1; background:#eef1f7; height:16px; border-radius:8px; overflow:hidden; }
.bar-row .bfill { height:100%; border-radius:8px; }
.bar-row .bv { width:52px; font-size:.85rem; color:#556; }
.muted { color:#8b93a7; font-size:.92rem; margin:8px 0 14px; }
.panel { background:#fff; border-radius:16px; padding:20px; margin:12px 0; box-shadow:0 2px 8px rgba(20,40,90,.05); }
.panel h3 { margin-bottom:10px; }
.empty { text-align:center; color:#99a; padding:50px 0; font-size:1rem; }

/* 手機/平板自適應規則已統一移到檔案最尾嘅 @media (max-width:768px) / (max-width:480px) */

/* student bar + sync + parent */
.student-bar{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:10px; font-size:.95rem; }
.student-bar label{ color:#9aa6bd; }
.student-bar input{ background:#1a2030; color:#e8edf5; border:1px solid #2a3245; border-radius:9px; padding:7px 10px; font-size:.95rem; width:120px; }
.sync-status{ font-size:.82rem; color:#9aa6bd; }
.parent-bar{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:6px 0 4px; }
.parent-bar .btn.ghost.small{ width:auto; padding:9px 14px; font-size:.9rem; margin-top:0; }

/* quiz timer */
.quiz-timer{ font-weight:700; color:#2f6bff; background:#eef3ff; border-radius:10px; padding:6px 12px; font-variant-numeric:tabular-nums; min-width:66px; text-align:center; }
.quiz-head{ flex-wrap:wrap; }
/* favourites star */
.star{ border:none; background:transparent; font-size:1.4rem; cursor:pointer; color:#f5a623; line-height:1; margin-left:auto; padding:2px 6px; }
.star:active{ transform:scale(1.18); }

/* ===== knowledge notes page ===== */
.notes-tabs{ display:flex; gap:10px; margin:10px 0 16px; }
.ntab{ border:none; background:#fff; padding:10px 22px; border-radius:12px; font-weight:700; font-size:1rem; cursor:pointer; box-shadow:0 1px 3px rgba(0,0,0,.07); color:#556; }
.ntab.on{ background:linear-gradient(120deg,#2f6bff,#7a5cff); color:#fff; box-shadow:0 3px 10px rgba(47,107,255,.3); }
.nsubj{ background:#fff; border-radius:16px; margin:12px 0; box-shadow:0 2px 8px rgba(20,40,90,.06); overflow:hidden; border-left:6px solid var(--c); }
.nsubj-h{ display:flex; align-items:center; gap:12px; padding:15px 18px; cursor:pointer; user-select:none; -webkit-user-select:none; }
.nsubj-ic{ width:38px; height:38px; border-radius:10px; color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:1.1rem; flex:0 0 auto; }
.nsubj-name{ font-weight:800; font-size:1.1rem; }
.nsubj-en{ color:#8b93a7; font-size:.82rem; }
.nsubj-toggle{ margin-left:auto; color:#99a; font-size:1.2rem; transition:transform .2s; }
.nsubj.collapsed .nsubj-toggle{ transform:rotate(-90deg); }
.nsubj-body{ padding:2px 18px 16px; }
.nsubj.collapsed .nsubj-body{ display:none; }
.ntopic{ margin:12px 0; }
.ntopic-h{ font-weight:700; font-size:1rem; color:#2f3a52; margin:10px 0 4px; padding:6px 10px; border-left:4px solid var(--c); background:linear-gradient(90deg, color-mix(in srgb, var(--c) 9%, #fff), #fff); border-radius:0 8px 8px 0; }
.nitems{ margin:4px 0 6px 4px; padding-left:22px; }
.nitems li{ line-height:1.7; font-size:.94rem; color:#44506a; margin:3px 0; }
.nitems li::marker{ color:var(--c); }

/* knowledge example questions */
.nex{ margin:10px 0 4px; }
.nex-toggle{ border:1px dashed var(--c); background:#f5f8ff; color:var(--c); border-radius:10px; padding:8px 14px; font-weight:700; font-size:.9rem; cursor:pointer; transition:.15s; }
.nex-toggle.open{ background:var(--c); color:#fff; border-style:solid; }
.nex-toggle:active{ transform:scale(.97); }
.nex-body{ display:none; margin-top:8px; }
.nex-body.open{ display:block; animation:fade .25s; }
.nex-ex{ background:#f7f9ff; border-left:3px solid var(--c); border-radius:8px; padding:10px 12px; margin:8px 0; }
.nex-q{ font-weight:600; color:#2f3a52; line-height:1.6; }
.nex-ansbtn{ margin-top:7px; border:none; background:#eef1f7; color:#556; border-radius:8px; padding:5px 13px; font-size:.82rem; cursor:pointer; font-weight:700; transition:.15s; }
.nex-ansbtn.open{ background:#e3f7e9; color:#1d9e50; }
.nex-ansbtn:active{ transform:scale(.96); }
.nex-a{ display:none; margin-top:7px; color:#1d9e50; font-size:.92rem; line-height:1.65; font-weight:600; background:#eefaf2; border-radius:8px; padding:8px 11px; }
.nex-a.open{ display:block; animation:fade .25s; }

/* ===== knowledge-point cards (wrong questions / results) ===== */
.kp-card{ margin-top:14px; border:1px solid #d8e2ff; border-left:4px solid #2f6bff; background:#f7faff; border-radius:12px; padding:12px 14px; }
.kp-head{ font-weight:700; color:#1f3a8a; font-size:.95rem; margin-bottom:6px; }
.kp-items{ margin:6px 0 0; padding-left:20px; }
.kp-items li{ font-size:.88rem; color:#33405a; line-height:1.6; margin:3px 0; }
.kp-toggle{ margin-top:10px; border:1px dashed #2f6bff; background:#eef3ff; color:#2f6bff; border-radius:10px; padding:7px 13px; font-weight:700; font-size:.86rem; cursor:pointer; transition:.15s; }
.kp-toggle.open{ background:#2f6bff; color:#fff; border-style:solid; }
.kp-toggle:active{ transform:scale(.97); }
.kp-body{ display:none; margin-top:8px; }
.kp-body.open{ display:block; animation:fade .25s; }

/* ===== print / PDF export of wrong book ===== */
#printRoot{ display:none; }
@media print {
  body{ background:#fff !important; color:#111; }
  #app, .topbar, nav, .back{ display:none !important; }
  #printRoot{ display:block !important; }
  .pr-head h1{ font-size:21px; margin-bottom:4px; }
  .pr-head p{ font-size:12px; color:#555; margin-bottom:14px; }
  .pr-sub{ font-size:15px; margin:16px 0 6px; border-bottom:2px solid #333; padding-bottom:4px; }
  .pr-item{ border:1px solid #ccc; border-radius:6px; padding:10px 14px; margin:8px 0; page-break-inside:avoid; }
  .pr-q{ font-weight:700; margin-bottom:6px; font-size:13px; }
  .pr-o{ padding:3px 0; font-size:12.5px; }
  .pr-correct{ color:#1d9e50; font-weight:700; }
  .pr-e{ font-size:11.5px; color:#555; margin-top:5px; }
  .pr-empty{ font-size:13px; }
  @page{ margin:14mm; }
}

/* ===== Band1 F2 redesign: home modules, subject 4-block, tiers, tags ===== */
.dash-strip{ display:block; margin:14px 0; }
.dash-cap{ font-size:.85rem; color:#3b5bdb; background:#eef3ff; border:1px solid #d9e2ff; border-radius:10px; padding:9px 12px; margin-bottom:10px; }
.dash-row{ display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
.dash-item{ background:linear-gradient(135deg,#3b5bdb,#7048e8); color:#fff; border-radius:14px; padding:14px 12px; box-shadow:0 6px 18px rgba(60,80,200,.18); text-align:center; }
.dash-item .dn{ font-size:26px; font-weight:800; line-height:1; }
.dash-item .dl{ font-size:11.5px; opacity:.92; margin-top:6px; }
.daily-lens{ display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.daily-lens .lbtn{ padding:9px 12px; font-size:.88rem; }
.tools-row{ display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:10px; }
.tool-card{ display:flex; flex-direction:column; gap:4px; background:linear-gradient(135deg,#eef3ff,#f7f0ff); border:1px solid #d9e2ff; border-radius:12px; padding:14px 16px; text-decoration:none; color:#222; font-weight:700; cursor:pointer; }
.tool-card span{ font-weight:400; font-size:12.5px; color:#667; }
.tool-card:active{ transform:scale(.98); }

.tier-legend{ background:#fff; border:1px solid #e6e9f2; border-radius:14px; padding:14px 16px; margin:6px 0 14px; box-shadow:0 4px 14px rgba(20,30,80,.05); }
.tl-title{ font-weight:800; margin-bottom:10px; color:#222; }
.tl-row{ display:flex; gap:12px; align-items:flex-start; padding:8px 0; border-top:1px dashed #eef; }
.tl-badge{ flex:0 0 auto; color:#fff; font-weight:700; border-radius:8px; padding:6px 10px; font-size:13px; }

.mod{ background:#fff; border:1px solid #e6e9f2; border-radius:14px; margin:10px 0; overflow:hidden; box-shadow:0 4px 14px rgba(20,30,80,.05); }
.mod-head{ cursor:pointer; padding:14px 16px; font-weight:700; color:#222; background:linear-gradient(135deg,#f1f4ff,#faf0ff); }
.mod-body{ padding:12px 16px; display:block; }
.mod.collapsed .mod-body{ display:none; }
.uc-sub{ margin-bottom:12px; }
.uc-sub-h{ font-weight:700; color:#333; margin-bottom:6px; }
.uc-list{ display:flex; flex-wrap:wrap; gap:8px; }
.uc-item{ display:inline-flex; align-items:center; gap:6px; background:#f3f5fb; border:1px solid #e2e6f0; border-radius:9px; padding:6px 10px; font-size:13px; cursor:pointer; }
.uc-item.done{ background:#e3f7e9; border-color:#b2e2c0; color:#1d7a40; text-decoration:line-through; }
.uc-row{ display:flex; align-items:center; gap:6px; margin:5px 0; }
.uc-lec{ border:none; background:#eef3ff; color:#2f6bff; border-radius:8px; padding:4px 9px; cursor:pointer; font-size:.78rem; white-space:nowrap; }
.uc-lec:hover{ background:#dde6ff; }
.ded-list{ margin:0; padding-left:18px; }
.ded-list li{ margin:6px 0; font-size:13.5px; color:#444; }
.set-body{ display:block; }
.set-row{ display:flex; align-items:center; flex-wrap:wrap; gap:10px; padding:9px 0; border-top:1px dashed #eef; }
.set-row:first-child{ border-top:none; }
.set-label{ font-weight:600; color:#333; min-width:200px; }
.ded-prev{ flex-basis:100%; margin-top:6px; background:#fff7f7; border:1px solid #ffd6d6; border-radius:10px; padding:8px 12px; }
/* toggle switch */
.switch{ position:relative; display:inline-block; width:46px; height:26px; }
.switch input{ opacity:0; width:0; height:0; }
.slider{ position:absolute; cursor:pointer; inset:0; background:#cfd6e6; border-radius:26px; transition:.2s; }
.slider:before{ content:""; position:absolute; height:20px; width:20px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.2s; }
.switch input:checked + .slider{ background:#2f9e44; }
.switch input:checked + .slider:before{ transform:translateX(20px); }
.ded-area{ color:#c92a2a; }

/* subject 4-block */
.sd-actions{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:12px; }
.len-pick{ display:inline-flex; align-items:center; gap:6px; background:#f3f5fb; border-radius:10px; padding:4px 8px; }
.lbtn{ border:1px solid #d7dded; background:#fff; border-radius:8px; padding:6px 10px; font-size:13px; cursor:pointer; }
.lbtn.on{ background:#3b5bdb; color:#fff; border-color:#3b5bdb; }
.sd-block{ background:#fff; border:1px solid #e6e9f2; border-radius:14px; padding:16px 18px; margin:14px 0; box-shadow:0 4px 14px rgba(20,30,80,.05); }
.sd-h{ font-size:17px; margin:0 0 12px; color:#222; border-left:5px solid #3b5bdb; padding-left:10px; }
.sd-notes{ max-height:none; overflow:visible; }
.sn-level{ font-weight:800; color:#5b6b8c; margin:10px 0 6px; }
.formula{ font-family:ui-monospace,Menlo,Consolas,monospace; font-weight:700; color:#1d4ed8; background:#eef2ff; padding:1px 5px; border-radius:5px; }
.lec-card{ background:#fff; border:1px solid #eceefb; border-left:4px solid #7048e8; border-radius:12px; padding:14px 16px; margin:12px 0; scroll-margin-top:84px; }
.lec-card.flash{ animation: lecflash 1.3s ease; }
@keyframes lecflash{ 0%{ background:#fff7d6; } 100%{ background:#fff; } }
.lec-cap{ color:#777; font-size:13px; margin-bottom:10px; }
.lec-warn-i{ color:#c92a2a; font-weight:700; }
.lec-h{ font-weight:800; color:#2b2b4a; margin-bottom:6px; font-size:15px; }
.lec-def{ color:#333; margin-bottom:6px; line-height:1.6; }
.lec-steps{ margin:6px 0 6px 18px; color:#444; }
.lec-steps li{ margin:4px 0; line-height:1.55; }
.lec-warn{ background:#fff0f0; border:1px solid #ffc9c9; color:#c92a2a; font-weight:600; border-radius:10px; padding:8px 12px; margin-top:8px; line-height:1.5; }

.writing-box{ background:#fbfcff; border:1px solid #e3e8f5; border-radius:10px; padding:12px 14px; }
.w-title{ font-weight:700; color:#333; margin-bottom:8px; }
.w-point{ padding:6px 0; border-top:1px dashed #eef; font-size:14px; color:#333; }
.w-point:first-child{ border-top:none; }
.w-example{ background:#1f2540; color:#e8ecff; border-radius:8px; padding:12px 14px; margin-top:10px; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:13px; white-space:pre-wrap; line-height:1.5; }

.tier-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
@media(max-width:680px){ .tier-grid{ grid-template-columns:1fr; } }
.tier-card{ border:1px solid #e6e9f2; border-top:4px solid var(--tc,#3b5bdb); border-radius:12px; padding:14px; background:#fff; }
.tier-name{ font-weight:800; color:#222; }
.tier-meta{ font-size:12.5px; color:#888; margin:4px 0 8px; }
.tier-desc{ font-size:13px; color:#555; margin-bottom:12px; min-height:54px; }

.rem-list{ margin:0; padding-left:20px; }
.rem-list li{ margin:7px 0; font-size:14px; color:#444; }

/* wrong-book tags */
.wrong-top{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.review-flow{ background:linear-gradient(135deg,#fff8e6,#fff3dc); border:1px solid #ffe0a3; border-radius:12px; padding:12px 16px; margin-bottom:12px; }
.rf-title{ font-weight:800; color:#b6770a; margin-bottom:6px; }
.rf-steps{ margin:4px 0 0; padding-left:20px; }
.rf-steps li{ font-size:13.5px; color:#7a5a18; margin:3px 0; }
.wtag-summary{ background:#f3f5fb; border-radius:10px; padding:8px 12px; margin-bottom:12px; font-size:13.5px; color:#444; }
.wpie-wrap{ background:#fff; border:1px solid #e6e9f2; border-radius:12px; padding:12px 14px; margin-bottom:14px; box-shadow:0 4px 14px rgba(20,30,80,.05); }
.wpie-title{ font-weight:700; color:#333; margin-bottom:8px; }
.wpie-flex{ display:flex; align-items:center; gap:18px; flex-wrap:wrap; }
.wpie-legend{ display:flex; flex-direction:column; gap:6px; }
.wpie-lg{ display:flex; align-items:center; gap:7px; font-size:13px; color:#444; }
.wpie-lg i{ width:13px; height:13px; border-radius:3px; display:inline-block; }
.wpie-lg b{ color:#222; }
.wtags{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.wtag{ border:1px solid #d7dded; background:#fff; border-radius:20px; padding:5px 12px; font-size:12.5px; cursor:pointer; color:#555; transition:.15s; }
.wtag.on{ color:#fff; }
.wtags-pick{ margin-top:12px; padding-top:10px; border-top:1px dashed #e6e9f2; display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.wtags-pick .wtag{ background:#fff; }

/* ===== 主觀答題訓練 ⑤ block ===== */
.subj-list{ display:flex; flex-direction:column; gap:14px; margin-top:8px; }
.subj-card{ background:#fbfcff; border:1px solid #e3e8f5; border-left:5px solid #6741d9; border-radius:12px; padding:14px 16px; }
.subj-h{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:8px; }
.subj-type{ background:#6741d9; color:#fff; font-size:.74rem; font-weight:700; padding:3px 9px; border-radius:20px; white-space:nowrap; }
.subj-unit{ font-size:.82rem; color:#666; }
.subj-q{ font-size:.96rem; line-height:1.6; color:#222; white-space:pre-wrap; }
.subj-toggle{ margin-top:10px; }
.subj-model{ margin-top:12px; padding:12px 14px; background:#f3f0ff; border:1px dashed #c9b8ff; border-radius:10px; font-size:.92rem; line-height:1.65; color:#2b2147; white-space:pre-wrap; }
.subj-model code.formula{ background:#e9e2ff; color:#4c2a9b; }

/* ===== Mobile / phone adaptation (must stay at end to override base rules) ===== */
@media (max-width:768px){
  /* 頂欄：品牌在上、導航橫向滑動，避免 5 個按鈕擠爆 */
  .topbar{ flex-direction:column; align-items:stretch; gap:8px; padding:10px 2px; }
  .brand{ font-size:1rem; }
  nav{ overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
  nav::-webkit-scrollbar{ display:none; }
  .navbtn{ flex:0 0 auto; }
  /* 首頁 hero 直排、學生欄佔滿寬 */
  .hero{ flex-direction:column; text-align:center; padding:20px 18px; gap:12px; }
  .hero h1{ font-size:1.35rem; }
  .streak-card{ min-width:0; width:100%; }
  .student-bar{ width:100%; }
  .student-bar input{ flex:1; width:auto; min-width:0; }
  /* 數據條 / 每日練習 / 統計卡 改兩欄或直排 */
  .dash-row{ grid-template-columns:repeat(2,1fr); }
  .daily-lens{ flex-direction:column; }
  .daily-lens .lbtn{ flex:1 1 auto; width:100%; text-align:center; }
  .stat-cards{ grid-template-columns:repeat(2,1fr); }
  /* 答題卡 padding 收細、動作按鈕全寬好點 */
  .q-card{ padding:20px 16px; }
  .quiz-actions{ justify-content:stretch; }
  .quiz-actions .btn, .quiz-actions button{ width:100%; }
  /* 成績頁 */
  .result-hero{ padding:28px 18px; }
  .score-big{ font-size:2.8rem; }
  /* 個人化設定：標籤與開關直排 */
  .set-row{ flex-direction:column; align-items:flex-start; gap:6px; }
  .set-label{ min-width:0; }
  /* 各卡片 padding 收細 */
  .sd-head{ padding:18px 16px; }
  .subject-card{ padding:16px; }
  .subject-card h3{ font-size:1rem; }
  .panel, .mod-body, .lec-card{ padding:14px; }
  .topic-list{ grid-template-columns:1fr; }
  .tools-row{ grid-template-columns:1fr; }
  .tier-grid{ grid-template-columns:1fr; }
}
@media (max-width:480px){
  html{ font-size:16px; }
  #app{ padding:0 12px 48px; }
  .brand{ display:none; }
  .hero h1{ font-size:1.18rem; }
  .hero p{ font-size:.88rem; }
  .dash-item .dn{ font-size:22px; }
  .dash-item .dl{ font-size:11px; }
  .q-text{ font-size:1.06rem; }
  .opt{ padding:14px 14px; font-size:1rem; }
  .sec-title{ font-size:1.08rem; }
  .result-hero{ padding:22px 14px; }
  .score-big{ font-size:2.3rem; }
  .bar-row .bl{ width:92px; font-size:.76rem; }
  .navbtn{ padding:8px 11px; font-size:.82rem; }
  .enc-card{ flex-direction:column; text-align:center; }
  .subj-q{ font-size:.92rem; }
  .subj-unit{ font-size:.78rem; }
  .subj-card{ padding:12px; }
  .subj-model{ font-size:.88rem; padding:10px 12px; }
}

/* ===== 主觀題：答題框架提示 + AI 判分 ===== */
.subj-tools{ display:flex; gap:8px; margin:8px 0 }
.subj-framework{ background:#f3f7ff; border-left:4px solid #7a5cff; border-radius:8px; padding:10px 14px; margin:6px 0 10px }
.fw-title{ font-weight:700; color:#7a5cff; margin-bottom:4px }
.fw-list{ margin:4px 0 0; padding-left:20px; font-size:.88rem; line-height:1.5; color:#33405a }
.subj-input{ width:100%; min-height:96px; padding:12px; border:1.5px solid #d8dee9; border-radius:12px; font-size:.95rem; line-height:1.6; font-family:inherit; resize:vertical; box-sizing:border-box; margin:6px 0 }
.subj-input:focus{ outline:none; border-color:#2f6bff }
.subj-gradebox{ margin:6px 0 }
.subj-actions{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-top:4px }
.subj-hint{ font-size:.76rem; color:#9aa4b2 }
.grade-loading{ color:#2f6bff; padding:8px 0; font-size:.9rem }
.grade-err{ color:#e03131; padding:8px 0; font-size:.9rem }
.grade-result{ display:flex; gap:14px; background:#f8faff; border:1px solid #e2ecff; border-radius:14px; padding:14px; margin-top:8px; align-items:flex-start }
.grade-score{ flex:0 0 96px; text-align:center; border-radius:12px; padding:10px 6px; color:#fff }
.grade-score.g-correct{ background:#2f9e44 }
.grade-score.g-partial{ background:#1971c2 }
.grade-score.g-incorrect{ background:#e03131 }
.gs-num{ font-size:2rem; font-weight:800; line-height:1 }
.gs-num small{ font-size:.95rem; font-weight:600 }
.gs-pct{ font-size:.8rem; opacity:.95 }
.gs-verdict{ font-size:.82rem; font-weight:700; margin-top:2px }
.grade-detail{ flex:1; font-size:.9rem; line-height:1.5 }
.grade-feedback{ margin-bottom:6px; color:#33405a }
.grade-missing{ margin:4px 0 }
.grade-missing b{ color:#c0392b }
.grade-missing ul{ margin:3px 0 0; padding-left:20px }
.grade-tip{ background:#fff8e6; border-left:4px solid #f0a500; border-radius:8px; padding:8px 10px; margin:6px 0; color:#7a5b00 }
.grade-note{ font-size:.76rem; color:#c98a00; margin-top:4px }
.grade-showmodel{ margin-top:8px }
@media(max-width:560px){
  .grade-result{ flex-direction:column }
  .grade-score{ flex:0 0 auto; width:100% }
}
/* ===== 大文章閱讀理解 passage reader ===== */
.passage-list{ display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:12px; margin-top:8px }
.passage-card{ background:#fbfcff; border:1px solid #e3e8f5; border-left:5px solid #6741d9; border-radius:12px; padding:12px 14px; cursor:pointer; transition:.15s }
.passage-card:hover{ box-shadow:0 6px 18px rgba(103,65,217,.12); transform:translateY(-1px) }
.pc-head{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:4px }
.pc-topic{ font-weight:700; color:#3b2c78; font-size:.95rem }
.pc-genre{ font-size:.74rem; background:#efeaff; color:#6741d9; border-radius:6px; padding:1px 8px }
.pc-meta{ font-size:.82rem; color:#778; margin-top:2px }
.pc-done{ margin-left:6px; color:#2f9e44; font-weight:600 }
#view-passage{ max-width:860px; margin:0 auto; padding:16px }
.passage-head{ display:flex; flex-direction:column; gap:4px; margin-bottom:12px }
.passage-head h2{ font-size:1.2rem; color:#3b2c78; margin:4px 0 0 }
.p-meta{ font-size:.84rem; color:#778 }
.p-progress{ font-size:.82rem; color:#1971c2; font-weight:600 }
.passage-text{ font-size:1.02rem; line-height:1.9; background:#f7f9fc; border-left:4px solid #cfd8ea; padding:16px 18px; border-radius:10px; margin-bottom:18px; color:#33405a; white-space:pre-wrap; max-height:340px; overflow:auto }
.p-questions{ display:flex; flex-direction:column; gap:16px }
.pq{ background:#fff; border:1px solid #e6e9f2; border-radius:12px; padding:14px 16px; box-shadow:0 3px 10px rgba(20,40,90,.05) }
.pq-q{ font-size:.98rem; font-weight:600; line-height:1.6; margin-bottom:10px; color:#222 }
.pq-opts{ display:flex; flex-direction:column; gap:8px }
.pq-opt{ text-align:left; border:2px solid #e4e9f2; background:#fbfcfe; border-radius:12px; padding:12px 14px; font-size:.96rem; cursor:pointer; line-height:1.5; color:#222; font-family:inherit }
.pq-opt:hover:not(:disabled){ border-color:#b9c6ff }
.pq-opt:disabled{ cursor:default }
.pq-opt.correctopt{ border-color:#2bb673; background:#e8f9f0 }
.pq-opt.wrongopt{ border-color:#ff6b6b; background:#ffefef }
.pq-fb{ margin-top:8px }
.pq-fb-in{ font-weight:700; font-size:.9rem; padding:4px 0 }
.pq-fb-in.ok{ color:#2f9e44 }
.pq-fb-in.no{ color:#e03131 }
.pq-e{ font-size:.86rem; color:#556; line-height:1.5; padding:4px 0 }
.p-foot{ margin:18px 0 8px; text-align:center }
.p-result{ background:#eef7ee; border:1px solid #bfe3bf; border-radius:12px; padding:14px; text-align:center; color:#256029; font-size:.96rem; margin-top:14px }

/* ===== DSE 知識點章節渲染樣式 ===== */
.nchapter{ margin:6px 0 4px; color:#33405a; line-height:1.75; font-size:.95rem; }
.nchapter h3{ font-size:1.05rem; font-weight:800; color:#2b2b4a; margin:14px 0 6px; }
.nchapter h4{ font-size:.98rem; font-weight:700; color:#3b3b66; margin:10px 0 4px; }
.nchapter p{ margin:7px 0; }
.nchapter ul, .nchapter ol{ margin:7px 0; padding-left:22px; }
.nchapter li{ margin:4px 0; line-height:1.7; }
.nchapter blockquote{ background:#f7f9ff; border-left:4px solid var(--c,#2f6bff); border-radius:0 10px 10px 0; padding:10px 14px; margin:10px 0; color:#44506a; }
.nchapter pre.ncode{ background:#1f2540; color:#e8ecff; border-radius:10px; padding:12px 14px; margin:10px 0; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:.86rem; white-space:pre-wrap; line-height:1.5; overflow-x:auto; }
.nchapter code.formula{ font-family:ui-monospace,Menlo,Consolas,monospace; font-weight:700; color:#1d4ed8; background:#eef2ff; padding:1px 5px; border-radius:5px; }
.nchapter table.ntable{ width:100%; border-collapse:collapse; margin:10px 0; font-size:.88rem; overflow:hidden; border-radius:10px; box-shadow:0 1px 4px rgba(20,40,90,.06); }
.nchapter table.ntable th{ background:#eef3ff; color:#2f3a52; font-weight:700; padding:8px 10px; text-align:left; border:1px solid #e2e8f5; }
.nchapter table.ntable td{ padding:7px 10px; border:1px solid #eef1f7; color:#44506a; }
.nchapter table.ntable tr:nth-child(even) td{ background:#fafbff; }

/* ===== Hilary DSE 重编版：多题型 UI（依 app.js 新引擎補齊） ===== */

/* 免責聲明 banner */
.disclaimer{ background:#fff7e6; border:1px solid #ffe0a3; border-left:4px solid #f0a500; border-radius:12px; padding:12px 16px; margin:14px 0; font-size:.9rem; line-height:1.65; color:#7a5b00; }
.disclaimer b{ color:#8a5a00; }

/* 題目徽章 + 題頭 */
.qbadges{ display:flex; gap:7px; flex-wrap:wrap; align-items:center; }
.qb{ font-size:.74rem; font-weight:700; background:#eef3ff; color:#2f3a52; border-radius:12px; padding:3px 10px; white-space:nowrap; }
.qhead{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:10px; }
.favbtn{ border:none; background:#fff; border:1px solid #e4e9f2; border-radius:12px; font-size:1.3rem; cursor:pointer; color:#f5a623; width:42px; height:42px; flex:0 0 auto; line-height:1; box-shadow:0 1px 3px rgba(0,0,0,.06); }
.favbtn:active{ transform:scale(.94); }

/* 題目標題（仿 reading 時 q 不顯示，由 passage 承載） */
.qtitle{ font-size:1.12rem; line-height:1.65; margin-bottom:16px; font-weight:600; color:#1c2333; }

/* 子題 / item 容器 */
.item{ margin:14px 0; padding:14px 16px; background:#fbfcfe; border:1px solid #e7ecf5; border-radius:14px; }
.iprompt{ font-size:1.02rem; font-weight:600; line-height:1.6; margin-bottom:12px; color:#2b3247; }

/* 答題引導 / 參考答案盒 */
.iguide{ margin-top:12px; }
.gbox{ background:#f3f7ff; border-left:4px solid #7a5cff; border-radius:10px; padding:12px 14px; font-size:.95rem; line-height:1.7; color:#33405a; }
.gbox b{ color:#5b3db8; }
.showans{ border:none; background:#fff; color:#5f3dc4; border:1.5px dashed #b9a6ff; border-radius:12px; padding:11px 18px; font-size:.95rem; font-weight:700; cursor:pointer; transition:.15s; margin-top:6px; }
.showans:active{ transform:scale(.97); }
.showans:hover{ background:#f6f2ff; }

/* 選擇項批改高亮（app.js 加 .correct/.wrong） */
.opt.correct{ border-color:#2bb673; background:#e8f9f0; }
.opt.wrong{ border-color:#ff6b6b; background:#ffefef; }

/* 答題動作區 */
.qactions{ display:flex; gap:12px; margin-top:22px; }
.btn.primary{ background:linear-gradient(120deg,#2f6bff,#7a5cff); color:#fff; border:none; }
.btn.small{ padding:10px 18px; font-size:.92rem; }
.mini-btns{ display:flex; gap:10px; flex-wrap:wrap; margin-top:12px; }

/* 成績卡 */
.result-card{ text-align:center; background:#fff; border-radius:20px; padding:32px 24px; margin-top:18px; box-shadow:0 3px 12px rgba(20,40,90,.07); }
.result-card h1{ font-size:1.5rem; margin-bottom:14px; color:#2b3247; }
.score{ font-size:2.4rem; font-weight:800; color:#2f6bff; }
.score span{ font-size:1rem; font-weight:600; color:#778; margin-left:6px; }
.scorebar{ height:14px; background:#e4e9f2; border-radius:8px; overflow:hidden; margin:16px 0; }
.scorebar div{ height:100%; background:linear-gradient(90deg,#2f9e44,#51cf66); border-radius:8px; transition:width .6s; }
.result-btns{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; margin-top:14px; }

/* 題目回顧 */
.review{ display:flex; flex-direction:column; gap:14px; }
.rev-item{ background:#fff; border:1px solid #e6e9f2; border-radius:14px; padding:18px 20px; box-shadow:0 2px 8px rgba(20,40,90,.05); }
.rev-q{ font-weight:600; font-size:1rem; line-height:1.6; margin:6px 0; color:#2b3247; }
.rev-a{ font-size:.95rem; color:#1d9e50; margin:4px 0; line-height:1.6; font-weight:600; }
.rev-e{ font-size:.9rem; color:#556; line-height:1.65; }

/* 學習報告：六科卡片 */
.stat-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:12px; margin:14px 0; }
.sc-ic{ width:46px; height:46px; border-radius:14px; color:#fff; display:flex; align-items:center; justify-content:center; font-size:1.4rem; font-weight:800; margin-bottom:8px; }
.sc-ic.big{ width:64px; height:64px; border-radius:18px; font-size:2rem; }
.sc-name{ font-weight:800; font-size:1.1rem; color:#222; }
.sc-en{ font-size:.82rem; color:#8b93a7; }
.sc-count{ font-size:.85rem; color:#667; margin-top:2px; }
.sc-m{ font-size:1.8rem; font-weight:800; color:#2f6bff; margin:4px 0; }
.sc-bar{ height:8px; background:#eef1f7; border-radius:6px; overflow:hidden; }
.sc-bar div{ height:100%; border-radius:6px; background:var(--c,#2f6bff); }
.sc-sub{ font-size:.8rem; color:#778; margin-top:6px; }

/* 模擬考卡片 */
.mock-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; margin-top:8px; }
.mock-card{ background:linear-gradient(135deg,#fff,#f5f0ff); border:1px solid #e2d8ff; border-radius:16px; padding:20px; cursor:pointer; box-shadow:0 3px 10px rgba(103,65,217,.08); transition:transform .12s; }
.mock-card:active{ transform:scale(.98); }
.mock-name{ font-weight:800; font-size:1.15rem; color:#3b2c78; }
.mock-desc{ font-size:.9rem; color:#556; margin:6px 0; line-height:1.5; }
.mock-meta{ font-size:.82rem; color:#8b93a7; font-weight:600; }
.mock-sub{ margin-top:18px; }
.mock-sub-h{ display:flex; align-items:center; gap:10px; font-weight:800; font-size:1.1rem; color:#2a2350; margin:6px 0 2px; }
.mock-sub-h .sc-ic{ width:34px; height:34px; border-radius:10px; color:#fff; display:inline-flex; align-items:center; justify-content:center; font-size:1.1rem; box-shadow:0 2px 6px rgba(0,0,0,.12); }

/* 科目詳情：模塊分組 + 快捷 */
.mod-list{ display:flex; flex-direction:column; gap:10px; }
.mod-row{ display:flex; align-items:center; gap:12px; background:#fff; border:1px solid #e6e9f2; border-radius:12px; padding:14px 16px; cursor:pointer; box-shadow:0 1px 4px rgba(20,40,90,.05); transition:transform .1s; }
.mod-row:active{ transform:scale(.99); }
.mod-name{ font-weight:700; flex:1; min-width:0; font-size:.98rem; }
.mod-n{ font-size:.85rem; color:#2f6bff; font-weight:700; white-space:nowrap; }
.mod-tiers{ font-size:.8rem; color:#8b93a7; white-space:nowrap; }
.sub-head{ display:flex; gap:16px; align-items:center; background:#fff; border-radius:18px; padding:22px; margin-bottom:14px; box-shadow:0 2px 8px rgba(20,40,90,.06); border-left:6px solid var(--c); }
.sub-head h1{ font-size:1.5rem; color:#222; }
.quick-btns{ display:flex; gap:10px; flex-wrap:wrap; margin-top:12px; }

/* ===== 重编版組件 · 手機適配（追加） ===== */
@media (max-width:768px){
  .qactions{ flex-direction:column; }
  .qactions .btn{ width:100%; }
  .result-btns{ flex-direction:column; }
  .result-btns .btn{ width:100%; }
  .stat-grid{ grid-template-columns:repeat(2,1fr); }
  .mock-grid{ grid-template-columns:1fr; }
  .sub-head{ flex-direction:column; text-align:center; padding:18px; }
  .quick-btns .btn{ flex:1 1 auto; }
}
@media (max-width:480px){
  .qtitle{ font-size:1.02rem; }
  .item{ padding:12px; }
  .score{ font-size:2rem; }
  .stat-grid{ grid-template-columns:repeat(2,1fr); }
}

/* ===== 真題庫（HKEAA 官方公開資源） ===== */
.papers-list{ display:flex; flex-direction:column; gap:8px; padding:10px 14px; }
.paper-item{ display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:10px 12px; border:1px solid #e2e2e2; border-radius:10px; background:#fff; flex-wrap:wrap; }
.paper-item:hover{ border-color:#b3d4f5; background:#f7fbff; }
.paper-title{ font-weight:600; color:#222; flex:1 1 240px; font-size:0.95rem; }
.paper-meta{ color:#888; font-size:0.82rem; min-width:120px; }
.paper-actions a{ white-space:nowrap; }
.paper-year{ display:inline-block; background:#1971c2; color:#fff; border-radius:6px;
  padding:1px 8px; font-size:0.78rem; font-weight:700; margin-right:6px; }
.paper-mod{ display:inline-block; background:#e8590c; color:#fff; border-radius:6px;
  padding:1px 8px; font-size:0.78rem; font-weight:700; margin-right:6px; }

/* ============ 真題瀏覽 Past Papers Viewer ============ */
.real-sub{ display:flex; flex-direction:column; gap:2px; }
.sc-ic{ width:46px; height:46px; border-radius:12px; color:#fff; display:flex; align-items:center; justify-content:center; font-size:1.4rem; margin-bottom:8px; }
.sc-ic.big{ width:58px; height:58px; font-size:1.8rem; border-radius:14px; }
.sc-name{ font-size:1.15rem; font-weight:800; color:#1f2a44; }
.sc-en{ color:#8b93a7; font-size:.82rem; }
.sc-count{ margin-top:6px; font-size:.82rem; color:#5b657a; }
.sub-head{ display:flex; align-items:center; gap:16px; margin:6px 0 14px; }
.sub-head h2{ font-size:1.4rem; margin:0; color:#1f2a44; }
.quick-btns{ display:flex; gap:10px; margin:6px 0 16px; flex-wrap:wrap; }
.year-list{ display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:14px; }
.year-card{ background:#fff; border-radius:16px; padding:16px 18px; box-shadow:0 2px 8px rgba(20,40,90,.06); border-left:5px solid #2f6bff; }
.yc-year{ font-size:1.1rem; font-weight:800; color:#1f2a44; margin-bottom:10px; }
.yc-files{ display:flex; flex-direction:column; gap:8px; }
.file-row{ display:flex; align-items:center; gap:10px; }
.fr-label{ flex:1; font-size:.95rem; font-weight:600; color:#2a3450; }
.fr-label.ans{ color:#2f9e44; }
.fr-label.q{ color:#1971c2; }
.viewer{ background:#eef1f7; border-radius:16px; overflow:hidden; margin-top:8px; }
.vbar{ display:flex; align-items:center; gap:12px; padding:10px 14px; background:#fff; border-bottom:1px solid #e3e8f2; flex-wrap:wrap; }
.vtitle{ font-weight:700; color:#1f2a44; flex:1; min-width:140px; }
.vtools{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.iconbtn{ border:none; background:#f0f3fa; color:#2f6bff; width:34px; height:34px; border-radius:9px; font-size:1.1rem; font-weight:800; cursor:pointer; }
.iconbtn:active{ transform:scale(.93); }
.vscale{ font-size:.85rem; color:#5b657a; min-width:42px; text-align:center; }
.vpage{ font-size:.9rem; color:#1f2a44; font-weight:700; min-width:54px; text-align:center; }
.vsep{ width:1px; height:22px; background:#dde3ee; }
.vjump{ width:62px; padding:6px 8px; border:1px solid #dde3ee; border-radius:8px; font-size:.9rem; }
.vloading{ text-align:center; color:#8b93a7; padding:30px; font-size:.95rem; }
.vscroll{ max-height:74vh; overflow:auto; padding:18px; display:flex; justify-content:center; background:#525659; }
.vscroll canvas{ background:#fff; box-shadow:0 4px 18px rgba(0,0,0,.35); max-width:100%; }
@media (max-width:600px){
  .vbar{ gap:8px; padding:8px; }
  .vtitle{ font-size:.95rem; flex-basis:100%; }
  .vscroll{ max-height:68vh; padding:10px; }
}

/* ============ 真題瀏覽 增強 ============ */
.vbody{ position:relative; }
.sc-src{ display:flex; gap:6px; margin-top:6px; flex-wrap:wrap; }
.srcbadge{ font-size:.72rem; padding:2px 8px; border-radius:999px; background:#eef1f7; color:#5b657a; font-weight:700; }
.srcbadge.src-hkeaa{ background:#fff3e0; color:#b26a00; }
.srcbadge.src-third{ background:#e7f0ff; color:#2f6bff; }
.yc-year .srcbadge{ margin-left:8px; vertical-align:middle; font-size:.72rem; }
.vbody{ display:flex; align-items:stretch; background:#eef1f7; }
.vthumbs{ width:128px; flex:0 0 128px; background:#dfe4ee; overflow:auto; max-height:74vh; padding:8px; display:flex; flex-direction:column; gap:8px; }
.vthumbs-h{ font-size:.78rem; color:#5b657a; font-weight:700; padding:2px 2px 6px; position:sticky; top:0; background:#dfe4ee; }
.vthumb{ background:#fff; border-radius:8px; overflow:hidden; cursor:pointer; border:2px solid transparent; box-shadow:0 1px 3px rgba(0,0,0,.12); }
.vthumb.active{ border-color:#2f6bff; }
.vthumb-n{ font-size:.72rem; color:#5b657a; text-align:center; padding:2px 0; }
.vthumb canvas{ display:block; width:100%; }
.vmain{ flex:1; min-width:0; position:relative; }
.vscroll.single{ max-height:74vh; overflow:auto; padding:18px; display:flex; justify-content:center; background:#525659; }
.vscroll.scrollmode{ max-height:74vh; overflow:auto; padding:14px; display:flex; flex-direction:column; align-items:center; gap:14px; background:#525659; }
.vscroll.scrollmode .scrollpage{ background:#fff; box-shadow:0 4px 18px rgba(0,0,0,.35); max-width:100%; }
.vpair{ display:inline-flex; border:1px solid #cfd8ea; border-radius:9px; overflow:hidden; }
.pbtn{ border:none; background:#f0f3fa; color:#5b657a; padding:6px 10px; font-size:.82rem; font-weight:700; cursor:pointer; }
.pbtn.on{ background:#2f9e44; color:#fff; }
.pbtn.off{ background:#f0f3fa; color:#5b657a; }
@media (max-width:600px){
  .vbody{ flex-direction:column; }
  .vthumbs{ width:100%; flex:0 0 auto; max-height:130px; flex-direction:row; padding:6px; }
  .vthumbs-h{ display:none; }
  .vthumb{ flex:0 0 84px; }
  .vscroll.single,.vscroll.scrollmode{ max-height:66vh; padding:8px; }
}
.real-fav-bar{ margin:0 0 14px; }
.favdot{ color:#f0a500; font-size:1.05rem; margin-left:6px; }
#realFavBtn.favon{ color:#f0a500; background:#fff3e0; }

/* 單頁容器 + 文本層（可選中 / 搜尋高亮） */
.pgwrap{ position:relative; display:inline-block; box-shadow:0 4px 18px rgba(0,0,0,.35); }
.vscroll.single{ justify-content:flex-start; }
.textLayer{ position:absolute; left:0; top:0; right:0; bottom:0; overflow:hidden; line-height:1; }
.textLayer > span{ color:transparent; position:absolute; white-space:pre; transform-origin:0 0; cursor:text; }
.textLayer .hl{ background:rgba(255,213,0,.92); border-radius:2px; }
/* 卷內搜尋 */
.vsearch{ width:118px; padding:6px 8px; border:1px solid #dde3ee; border-radius:8px; font-size:.85rem; }
.vsearch-res{ position:absolute; top:58px; right:14px; width:300px; max-height:62vh; overflow:auto; background:#fff; border:1px solid #dde3ee; border-radius:12px; box-shadow:0 10px 34px rgba(0,0,0,.2); z-index:40; display:none; padding:8px; }
.vsearch-h{ font-size:.8rem; color:#5b657a; font-weight:700; padding:4px 6px 6px; }
.vsearch-item{ display:block; width:100%; text-align:left; border:none; background:#f7f9fc; border-radius:8px; padding:8px 10px; margin:4px 0; font-size:.82rem; color:#2a3450; cursor:pointer; line-height:1.4; }
.vsearch-item:hover{ background:#eaf1ff; }
.vsearch-empty{ font-size:.85rem; color:#8b93a7; padding:10px 6px; }
/* 試卷 + 答案並排對照 */
.vcompare{ flex:1; min-width:0; display:flex; gap:10px; background:#eef1f7; padding:10px; overflow:auto; }
.vc-pane{ flex:1; min-width:0; display:flex; flex-direction:column; background:#525659; border-radius:10px; overflow:hidden; }
.vc-head{ background:#fff; color:#1f2a44; font-weight:800; font-size:.85rem; padding:6px 10px; text-align:center; }
.vc-pane .vscroll{ max-height:70vh; padding:12px; display:flex; justify-content:center; }
.iconbtn.on{ background:#2f6bff; color:#fff; }
@media (max-width:600px){
  .vbody{ flex-direction:column; }
  .vthumbs{ width:100%; flex:0 0 auto; max-height:120px; flex-direction:row; padding:6px; }
  .vthumbs-h{ display:none; }
  .vthumb{ flex:0 0 84px; }
  .vscroll.single,.vscroll.scrollmode{ max-height:64vh; padding:8px; }
  .vcompare{ flex-direction:column; }
  .vc-pane .vscroll{ max-height:46vh; }
  .vsearch{ width:88px; }
  .vsearch-res{ left:10px; right:10px; width:auto; }
  .vtitle{ font-size:.95rem; flex-basis:100%; }
  .vbar{ gap:6px; padding:8px; }
}
