/* =====================================================
   統測英文衝刺站 — Styles
   ===================================================== */
:root {
  --header: #1f3b73;
  --header-dark: #162b55;
  --accent: #f6c445;
  --accent-ink: #3b2d00;
  --ink: #1b2a44;
  --ink-soft: #4a5a78;
  --line: #203a6e;
  --card: #ffffff;
  --bg: #f4f6fb;
  --bg-soft: #e9eef8;
  --tab-bg: #dfe7f5;
  --dark-card: #0f1e3d;
  --dark-card-2: #152a52;
  --ok: #2e9e5b;
  --bad: #d6453d;
  --warn: #e39b17;
  --radius: 22px;
  --shadow: 0 8px 22px rgba(20, 40, 80, .10);
  --sticker: 4px 4px 0 var(--line);
  --pastel-1: #ffe3ec; --pastel-2: #fff4cc; --pastel-3: #dff6e8; --pastel-4: #e3ecff;
  --font-body: 'LXGW WenKai TC', 'Patrick Hand', 'Noto Sans TC', sans-serif;
  --font-en: 'Patrick Hand', 'LXGW WenKai TC', cursive;
}
body[data-font="clean"] {
  --font-body: 'Noto Sans TC', 'Nunito', system-ui, sans-serif;
  --font-en: 'Nunito', 'Noto Sans TC', sans-serif;
}
body[data-theme="forest"] {
  --header: #1f4d3a; --header-dark: #143527; --accent: #f2d388; --line: #1f4d3a;
  --ink: #16302a; --ink-soft: #46625a; --bg: #f3f7f4; --bg-soft: #e5efe9; --tab-bg: #dbe8df;
  --dark-card: #0f2a20; --dark-card-2: #143c2e;
}
body[data-theme="plum"] {
  --header: #4b2353; --header-dark: #33173a; --accent: #ffd27a; --line: #4b2353;
  --ink: #2c1a30; --ink-soft: #5f4a66; --bg: #f8f4fa; --bg-soft: #efe6f2; --tab-bg: #e6d9ea;
  --dark-card: #2a1430; --dark-card-2: #3b1d44;
}
body[data-theme="sakura"] {
  --header: #e26a9a; --header-dark: #c04b7b; --accent: #fff0a6; --accent-ink: #5a3a00; --line: #e26a9a;
  --ink: #4a2438; --ink-soft: #8a5a70; --bg: #fff5f9; --bg-soft: #ffe4ee; --tab-bg: #ffd6e5;
  --dark-card: #b8457a; --dark-card-2: #e26a9a;
}
body[data-theme="mint"] {
  --header: #2f9e8f; --header-dark: #227a6e; --accent: #ffe08a; --accent-ink: #4a3a00; --line: #2f9e8f;
  --ink: #163d38; --ink-soft: #4e7a73; --bg: #f1fbf8; --bg-soft: #d9f3ec; --tab-bg: #cdeee5;
  --dark-card: #1f6f64; --dark-card-2: #2f9e8f;
}
body[data-theme="sunset"] {
  --header: #b84a2c; --header-dark: #8f3620; --accent: #ffe27a; --line: #b84a2c;
  --ink: #3a1d12; --ink-soft: #6e4a3c; --bg: #fff7f2; --bg-soft: #ffeadc; --tab-bg: #fbdccb;
  --dark-card: #4a1f10; --dark-card-2: #6a2d18;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.55;
}
button, select, input, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--header); }
h1, h2, h3 { line-height: 1.25; }
.en { font-family: var(--font-en); }

/* ---------- Header ---------- */
.site-header {
  background: var(--header);
  background-image: radial-gradient(rgba(255,255,255,.14) 2px, transparent 2.5px);
  background-size: 22px 22px;
  color: #fff;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand-title {
  margin: 0;
  font-size: 30px;
  letter-spacing: 2px;
  color: var(--accent);
  font-weight: 700;
}
.brand-sub { margin: 4px 0 0; font-size: 14px; opacity: .9; }
.header-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ctrl select {
  background: var(--header-dark);
  color: #fff;
  border: 2px solid rgba(255,255,255,.45);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
}

/* ---------- Tabs ---------- */
.tabs {
  background: var(--header);
  padding: 0 20px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 4px solid var(--header-dark);
}
.tab {
  background: var(--tab-bg);
  color: var(--ink);
  border: 2px solid var(--header-dark);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  padding: 9px 18px 7px;
  cursor: pointer;
  display: flex; gap: 8px; align-items: center;
  font-weight: 600;
  transition: background .15s, transform .15s;
  margin-top: 6px;
}
.tab:hover { background: #fff; }
.tab.active { background: #fff; transform: translateY(2px); }
.tab-icon { font-size: 16px; }

/* ---------- Layout ---------- */
.page-wrap { max-width: 1400px; margin: 0 auto; padding: 16px 16px 40px; }
.section-title { margin: 28px 0 4px; font-size: 22px; font-weight: 700; display: inline-block; text-decoration: underline wavy var(--accent); text-decoration-thickness: 3px; text-underline-offset: 6px; }
.section-title + .section-sub { margin-top: 6px; }
.section-sub { margin: 0 0 14px; color: var(--ink-soft); font-size: 15px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------- Banner ---------- */
.banner {
  position: relative;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #d6e1e9;
  box-shadow: var(--sticker);
}
.banner picture { display: block; }
.banner-img { display: block; width: 100%; height: auto; }

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.stat-card {
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 20px;
  padding: 12px 16px;
  box-shadow: var(--sticker);
  position: relative;
}
.stat-card:nth-child(1) { background: var(--pastel-4); } .stat-card:nth-child(2) { background: var(--pastel-2); }
.stat-card:nth-child(3) { background: var(--pastel-3); } .stat-card:nth-child(4) { background: var(--pastel-1); }

.stat-card .k { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.stat-card .v { font-size: 30px; font-weight: 700; margin: 2px 0; }
.stat-card .s { font-size: 13px; color: var(--ink-soft); }

/* ---------- Bookmark ribbons (裝飾書籤) ---------- */
.ribbon {
  position: absolute; top: -3px; right: 16px;
  width: 38px; height: 54px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 8px;
  font-size: 20px; font-weight: 800; line-height: 1;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  box-shadow: 0 3px 0 rgba(0,0,0,.12);
  z-index: 1; pointer-events: none;
}
.ribbon-l { right: auto; left: 16px; }
.ribbon-new { background: #cfe0ff; } .ribbon-info { background: #9dbbff; } .ribbon-warn { background: #ffd76b; } .ribbon-ok { background: #9fe3b6; }
.stat-card .ribbon { font-size: 22px; height: 56px; }
.service-card .ribbon { background: #fff; color: var(--header); border: 2px solid var(--line); border-top: none; font-size: 16px; padding-top: 10px; height: 46px; width: 32px; }
.bookmark-card { position: relative; padding-top: 22px; background: #fffdf5; border-style: dashed; }
.bookmark-card .ribbon { right: 22px; }
.bm-group { margin: 6px 0 10px; }
.bm-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.bm-tag {
  background: var(--pastel-2); border: 2px solid var(--line); border-radius: 12px 12px 12px 4px;
  padding: 4px 12px; font-size: 15px; cursor: pointer; display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.3;
  box-shadow: 2px 2px 0 var(--line); color: var(--ink);
}
button.bm-tag:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--line); }
.bm-tag.word { background: var(--pastel-4); font-weight: 700; color: var(--header); }
.bm-tag small { font-family: var(--font-body); font-weight: 400; font-size: 12px; color: var(--ink-soft); }
.btn.bm-btn { background: #fff; color: var(--ink-soft); border: 2px solid var(--bg-soft); box-shadow: 0 3px 0 var(--bg-soft); }
.btn.bm-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 3px 0 rgba(0,0,0,.2); }
.bm-star, .flash-bm { background: none; border: none; cursor: pointer; font-size: 20px; filter: grayscale(1) opacity(.45); transition: transform .15s, filter .15s; padding: 2px 4px; }
.bm-star.on, .flash-bm.on { filter: none; transform: scale(1.15); }
.bm-star:hover, .flash-bm:hover { filter: none; }
.bm-cell { width: 36px; padding-right: 0 !important; }
.flash-bm { position: absolute; top: 10px; right: 14px; font-size: 26px; z-index: 2; }

/* ---------- Service cards ---------- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.service-card {
  position: relative;
  background: var(--pastel-4);
  color: var(--ink);
  border-radius: 24px;
  overflow: visible;
  min-height: 190px;
  padding: 26px 22px;
  cursor: pointer;
  border: 3px solid var(--line);
  box-shadow: var(--sticker);
  transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
}
.service-card:nth-child(2) { background: var(--pastel-1); } .service-card:nth-child(3) { background: var(--pastel-2); } .service-card:nth-child(4) { background: var(--pastel-3); }
.service-card:hover { transform: translate(-2px, -3px) rotate(-1deg); box-shadow: 7px 7px 0 var(--line); }
.service-card .icon { font-size: 40px; margin-bottom: 8px; width: 72px; height: 72px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; border: 3px solid var(--line); }
.service-card h3 { margin: 0 0 6px; font-size: 22px; }
.service-card p { margin: 0; font-size: 15px; color: var(--ink-soft); }
.service-card .deco {
  position: absolute; inset: 0; border-radius: 20px; opacity: .5; pointer-events: none;
  background-image: radial-gradient(#fff 3px, transparent 3.5px);
  background-size: 26px 26px;
}

/* ---------- Generic cards & buttons ---------- */
.card {
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--sticker);
}
.card + .card { margin-top: 14px; }
.btn {
  background: var(--header);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 4px 0 rgba(0,0,0,.22);
  transition: filter .15s, transform .1s, box-shadow .1s;
  display: inline-flex; align-items: center; gap: 6px;
}
a.btn { text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.22); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: #fff; color: var(--header); border: 2px solid var(--header); box-shadow: 0 3px 0 var(--header); }
.btn.danger { background: var(--bad); }
.btn.ok { background: var(--ok); }
.btn.sm { padding: 5px 12px; font-size: 14px; box-shadow: 0 3px 0 rgba(0,0,0,.2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--bg-soft); color: var(--ink-soft); font-size: 13px; margin-right: 4px;
}
.chip.ok { background: #d9f3e3; color: #1d6b3c; }
.chip.warn { background: #fff0cc; color: #7a5300; }
.chip.bad { background: #ffe0dd; color: #8a241f; }
.chip.info { background: #dde8ff; color: #1d3b8a; }

input[type=text], input[type=date], input[type=number], input[type=password], textarea, select.input {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid var(--bg-soft);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--header); }
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 4px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Lists ---------- */
.list { display: grid; gap: 10px; }
.list-item {
  background: var(--card);
  border: 2px solid var(--bg-soft);
  border-left: 8px solid var(--header);
  border-radius: 18px;
  padding: 12px 16px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  transition: border-color .15s;
}
.list-item:hover { border-color: var(--header); }
.list-item .title { font-weight: 700; font-size: 18px; }
.list-item .meta { font-size: 13px; color: var(--ink-soft); }
.list-item .grow { flex: 1; min-width: 200px; }

/* ---------- Article ---------- */
.passage {
  font-family: var(--font-en);
  font-size: 19px;
  line-height: 1.85;
  white-space: pre-wrap;
  background: #fffdf5;
  border: 3px dashed var(--accent);
  border-radius: 18px;
  padding: 18px 22px;
}
.passage.clean { font-family: 'Nunito', 'Noto Sans TC', sans-serif; }
.question { margin-top: 18px; padding: 14px 16px; border-radius: 18px; background: var(--bg-soft); }
.question .q { font-weight: 700; margin-bottom: 8px; }
.option {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 12px; border-radius: 14px; background: #fff; margin: 6px 0;
  cursor: pointer; border: 2px solid transparent; transition: border-color .1s;
}
.option:hover { border-color: var(--header); }
.option.selected { border-color: var(--header); background: #eef3ff; }
.option.correct { border-color: var(--ok); background: #e3f6ea; }
.option.wrong { border-color: var(--bad); background: #ffe6e3; }
.option .letter {
  flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--header); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
.explain { margin-top: 8px; padding: 10px 12px; border-left: 4px solid var(--accent); background: #fff8df; border-radius: 6px; font-size: 15px; }
.score-banner {
  margin-top: 16px; padding: 16px; border-radius: 20px; text-align: center;
  background: linear-gradient(135deg, var(--header), var(--header-dark)); color: #fff;
}
.score-banner .big { font-size: 40px; font-weight: 800; }

/* ---------- Flashcards ---------- */
.flash-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.flash-card {
  width: min(640px, 100%);
  height: 320px;
  perspective: 1200px;
  cursor: pointer;
}
.flash-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .5s;
  transform-style: preserve-3d;
}
.flash-card.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: 28px;
  border: 3px solid var(--header);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 24px; text-align: center;
  box-shadow: var(--shadow);
}
.flash-front { background: #fff; background-image: radial-gradient(var(--bg-soft) 3px, transparent 3.5px); background-size: 28px 28px; box-shadow: var(--sticker); }
.flash-back { background: linear-gradient(160deg, var(--dark-card-2), var(--dark-card)); color: #fff; transform: rotateY(180deg); box-shadow: var(--sticker); }
.flash-word { font-family: var(--font-en); font-size: 54px; font-weight: 800; color: var(--header); }
.flash-pos { font-size: 16px; color: var(--ink-soft); margin-top: 6px; }
.flash-zh { font-size: 34px; font-weight: 700; }
.flash-syn { margin-top: 10px; font-family: var(--font-en); font-size: 18px; color: var(--accent); font-weight: 700; }
.vocab-table td.syn { font-size: 14px; color: var(--ink-soft); min-width: 120px; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; margin: 12px 0; gap: 6px; }
.pg-btn { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 999px; border: 2px solid var(--bg-soft); background: #fff; color: var(--header); font: 800 15px 'Nunito', var(--font-body); cursor: pointer; box-shadow: 0 2px 0 var(--bg-soft); }
.pg-btn:hover:not(:disabled) { border-color: var(--header); }
.pg-btn.on { background: var(--header); border-color: var(--header); color: #fff; box-shadow: 0 3px 0 var(--header-dark); }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-gap { color: var(--ink-soft); padding: 0 2px; font-weight: 800; }
.pager .pager-sel { margin-left: 8px; }
.pager-sel { width: auto; max-width: 260px; padding: 5px 8px; font-size: 14px; }
@media (max-width: 520px) { .pg-btn { min-width: 32px; height: 32px; padding: 0 7px; font-size: 14px; } .pager .pager-sel { margin: 6px 0 0; max-width: 100%; flex-basis: 100%; } }
.flash-example { margin-top: 12px; font-family: var(--font-en); font-size: 18px; opacity: .92; line-height: 1.6; }
.flash-example b { color: var(--accent); }
.flash-hint { position: absolute; bottom: 10px; right: 16px; font-size: 13px; opacity: .6; }
.flash-box { position: absolute; top: 10px; left: 16px; font-size: 13px; }
.flash-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.flash-actions .btn { padding: 12px 30px; font-size: 18px; box-shadow: 0 5px 0 rgba(0,0,0,.22); }
.progress-bar { width: min(640px, 100%); height: 14px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; border: 2px solid var(--line); }
.progress-bar > div { height: 100%; background: var(--accent); transition: width .3s; }

/* ---------- Quiz (vocab) ---------- */
.quiz-word { font-family: var(--font-en); font-size: 44px; font-weight: 800; color: var(--header); text-align: center; margin: 10px 0 18px; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 760px; margin: 0 auto; }
@media (max-width: 600px) { .quiz-options { grid-template-columns: 1fr; } }
.quiz-opt { padding: 14px 16px; border-radius: 16px; background: #fff; border: 2px solid var(--bg-soft); cursor: pointer; font-size: 18px; text-align: left; box-shadow: 0 3px 0 var(--bg-soft); }
.quiz-opt:hover { border-color: var(--header); }
.quiz-opt.correct { border-color: var(--ok); background: #e3f6ea; }
.quiz-opt.wrong { border-color: var(--bad); background: #ffe6e3; }
.spell-input { font-family: var(--font-en); font-size: 28px; text-align: center; max-width: 420px; margin: 0 auto; display: block; letter-spacing: 2px; }

/* ---------- Table ---------- */
table.vocab-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 16px; overflow: hidden; border: 2px solid var(--bg-soft); }
.vocab-table th, .vocab-table td { padding: 9px 12px; border-bottom: 1px solid var(--bg-soft); text-align: left; vertical-align: top; }
.vocab-table th { background: var(--bg-soft); font-size: 14px; color: var(--ink-soft); }
.vocab-table td.word { font-family: var(--font-en); font-weight: 800; font-size: 19px; color: var(--header); white-space: nowrap; }
.vocab-table td.example { font-family: var(--font-en); color: var(--ink-soft); font-size: 15px; }
.vocab-table tr:hover td { background: #fbfcff; }

/* ---------- Progress ---------- */
.bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.bar-row .lbl { width: 120px; font-size: 14px; color: var(--ink-soft); }
.bar-row .bar { flex: 1; height: 14px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar-row .bar > div { height: 100%; }
.bar-row .num { width: 50px; text-align: right; font-size: 14px; }
.heat { display: flex; gap: 4px; flex-wrap: wrap; }
.heat span { width: 14px; height: 14px; border-radius: 3px; background: var(--bg-soft); display: inline-block; }
.heat span.l1 { background: #cfe4c9; } .heat span.l2 { background: #8fc77f; } .heat span.l3 { background: #4e9e3c; } .heat span.l4 { background: #2b6e1e; }

/* ---------- Teacher panel ---------- */
.teacher-only { display: none; }
body.teacher .teacher-only { display: initial; }
body.teacher .teacher-only.block { display: block; }
body.teacher .teacher-only.flex { display: flex; }
.teacher-banner {
  background: var(--accent); color: var(--accent-ink);
  border-radius: 8px; padding: 6px 14px; font-size: 14px; display: inline-block; margin-bottom: 10px;
}
.q-editor { border: 2px solid var(--bg-soft); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fafbfe; }
.q-editor .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 700px) { .q-editor .opts { grid-template-columns: 1fr; } }
.q-editor .opt-row { display: flex; gap: 6px; align-items: center; }
.q-editor .opt-row input[type=radio] { accent-color: var(--ok); width: 18px; height: 18px; }

/* ---------- Exam chip in header ---------- */
.exam-chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.45); border-radius: 999px; padding: 4px 6px 4px 12px; color: #fff; font-size: 14px; cursor: pointer; }
.exam-chip { position: relative; font-family: inherit; padding-left: 5px; }
.exam-chip:hover { background: rgba(255,255,255,.2); }
.exam-chip-days { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 2px 10px; font-weight: 800; font-size: 14px; }
.exam-chip.soon .exam-chip-days { background: #ff8a80; color: #4a0e0e; }

/* ---------- Mini calendar icon in the chip ---------- */
.mini-cal { display: inline-flex; flex-direction: column; width: 30px; height: 32px; border-radius: 7px; overflow: hidden; border: 2px solid #0f1e3d; background: #fff; box-shadow: 0 2px 0 rgba(0,0,0,.25); position: relative; flex: 0 0 auto; }
.mini-cal::before, .mini-cal::after { content: ''; position: absolute; top: -3px; width: 4px; height: 7px; border-radius: 2px; background: #0f1e3d; }
.mini-cal::before { left: 6px; } .mini-cal::after { right: 6px; }
.mini-cal b { background: #ff6b81; color: #fff; font: 800 8px/11px 'Nunito', sans-serif; text-align: center; letter-spacing: .5px; }
.mini-cal i { flex: 1; color: #1f3b73; font: 800 15px/19px 'Nunito', sans-serif; font-style: normal; text-align: center; }

/* ---------- Cute calendar popover ---------- */
.cal-pop { position: fixed; z-index: 60; background: #fffdf5; border: 3px solid var(--line); border-radius: 24px; box-shadow: var(--sticker), 0 18px 40px rgba(15,30,61,.25); padding: 22px 14px 12px; color: var(--ink); }
.cal-rings { position: absolute; top: -12px; left: 0; right: 0; display: flex; justify-content: space-around; pointer-events: none; }
.cal-rings i { width: 12px; height: 24px; border-radius: 6px; background: #0f1e3d; border: 3px solid #fffdf5; }
.cal-head { display: flex; align-items: center; gap: 4px; background: var(--pastel-1); border-radius: 16px; padding: 6px; }
.cal-head button { border: none; background: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 18px; font-weight: 800; color: var(--header); cursor: pointer; box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.cal-head button:hover { background: var(--accent); }
.cal-title { flex: 1; text-align: center; font-weight: 800; font-size: 18px; }
.cal-year { color: var(--ink-soft); }
.cal-sub { text-align: center; font-size: 13px; color: var(--ink-soft); margin: 8px 0 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 800; color: var(--ink-soft); padding: 4px 0; }
.cal-wd.is-weekend, .cal-cell.is-weekend { color: #d6456b; }
.cal-cell { position: relative; aspect-ratio: 1; border: none; background: transparent; border-radius: 50%; font: 700 15px 'Nunito', var(--font-body); color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.cal-cell.empty { cursor: default; }
.cal-cell:hover:not(:disabled) { background: var(--bg-soft); transform: scale(1.08); }
.cal-cell.is-between { background: var(--pastel-2); }
.cal-cell.is-today { outline: 2px dashed var(--header); outline-offset: -2px; }
.cal-cell.is-exam { background: #ff6b81; color: #fff; box-shadow: 0 3px 0 #c2405a; }
.cal-cell.is-past { color: #c3c9d6; cursor: not-allowed; }
.cal-star { position: absolute; top: -9px; right: -6px; font-size: 13px; }
.cal-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; font-size: 12px; color: var(--ink-soft); }
.cal-foot .btn { margin-left: auto; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.lg-today { outline: 2px dashed var(--header); outline-offset: -2px; }
.lg-exam { background: #ff6b81; }
.lg-between { background: var(--pastel-2); border: 1px solid #e8d48a; }

/* ---------- World map ---------- */
.map-card { position: relative; background: linear-gradient(160deg, #3a8fd0, #1d5f9e); color: #fff; border: 3px solid var(--line); border-radius: var(--radius); padding: 18px 18px 10px; box-shadow: var(--sticker); overflow: hidden; }
.map-card h3 { margin: 0; font-size: 22px; }
.map-card p { margin: 4px 0 8px; opacity: .85; font-size: 14px; }
.map-card svg { width: 100%; height: auto; display: block; }
.map-card .map-count { position: absolute; right: 18px; top: 16px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 4px 14px; font-weight: 800; font-size: 15px; }
.map-pin-label { font-family: 'Nunito', sans-serif; font-size: 18px; font-weight: 800; fill: #fff; paint-order: stroke; stroke: #0f1e3d; stroke-width: 4px; }
.map-pin-label.mobile-only { display: none; }
@media (max-width: 600px) {
  .map-pin-label.desk-only { display: none; }
  .map-pin-label.mobile-only { display: inline; font-size: 52px; stroke-width: 10px; }
}

/* ---------- Auth ---------- */
.auth-btn { background: var(--accent); color: var(--accent-ink); border: 2px solid var(--accent); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 700; box-shadow: 0 3px 0 rgba(0,0,0,.2); }
.auth-btn.logged { background: var(--header-dark); color: #fff; border-color: rgba(255,255,255,.45); }
.modal { position: fixed; inset: 0; background: rgba(20, 30, 60, .55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-card { background: #fff; border: 3px solid var(--line); border-radius: 24px; padding: 22px 22px 18px; width: min(420px, 100%); position: relative; box-shadow: var(--sticker); max-height: 92vh; overflow: auto; }
.modal-close { position: absolute; right: 12px; top: 10px; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink-soft); }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--bg-soft); border-radius: 999px; padding: 4px; }
.auth-tab { flex: 1; border: none; background: transparent; border-radius: 999px; padding: 8px; cursor: pointer; font-weight: 700; color: var(--ink-soft); }
.auth-tab.active { background: var(--header); color: #fff; }
.modal.login-mode .register-only { display: none; }
.gate { text-align: center; padding: 40px 20px; }
.gate .big-icon { font-size: 60px; }
.cloud-badge { font-size: 12px; background: #dde8ff; color: #1d3b8a; border-radius: 999px; padding: 2px 8px; }

/* ---------- Reading contents ---------- */
.read-toc { margin-bottom: 8px; }
.read-group { margin-top: 18px; scroll-margin-top: 12px; }
.read-group-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 19px; margin: 0 0 10px; }
.read-progress { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.read-progress .bar { width: 120px; height: 10px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; display: inline-block; border: 1px solid #d4dbea; }
.read-progress .bar i { display: block; height: 100%; background: var(--ok); }
.read-check { flex: 0 0 34px; height: 34px; border-radius: 50%; border: 3px dashed #c9d2e3; display: inline-flex; align-items: center; justify-content: center; font: 900 20px 'Nunito', sans-serif; color: #fff; }
.read-item.is-done { border-left-color: var(--ok); }
.read-item.is-done .read-check { background: var(--ok); border: 3px solid #1f7a45; box-shadow: 0 3px 0 #1f7a45; }

/* ---------- News ---------- */
.news-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 10px; }
.news-card { background: var(--card); border: 3px solid var(--line); border-radius: 20px; padding: 14px 16px; box-shadow: var(--sticker); display: flex; flex-direction: column; gap: 6px; }
.news-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.news-src { font: 800 12px 'Nunito', sans-serif; color: #fff; background: var(--header); padding: 3px 10px; border-radius: 999px; letter-spacing: .5px; }
.news-src.cnn { background: #cc0000; } .news-src.bbc { background: #1a1a1a; } .news-src.npr { background: #2d6cdf; }
.news-src.guardian { background: #052962; } .news-src.taipei { background: #2e9e5b; }
.news-title { margin: 2px 0; font-size: 19px; line-height: 1.35; }
.news-title a { color: var(--ink); text-decoration: none; }
.news-title a:hover { color: var(--header); text-decoration: underline; }
.news-title .nw { text-decoration: underline wavy var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; cursor: help; }
.news-sum { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.5; flex: 1; }
.news-empty { border-style: dashed; }
/* news lessons + study notes */
.lesson-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lw { background: linear-gradient(transparent 58%, color-mix(in srgb, var(--accent) 70%, transparent) 58%); font-weight: 700; cursor: help; }
.lp { border-bottom: 2px dashed var(--header); cursor: help; }
.ai-chip { background: var(--pastel-2); }
.news-card.has-article { background: linear-gradient(180deg, var(--pastel-2), var(--card) 110px); }
.news-title-btn { all: unset; cursor: pointer; color: var(--ink); }
.news-title-btn:hover, .news-title-btn:focus-visible { color: var(--header); text-decoration: underline; }
.news-title-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.news-title-zh { margin: -2px 0 0; color: var(--ink-soft); font-size: 15px; }
.news-nolesson { margin: 0 0 10px; }
.news-reader { display: flex; flex-direction: column; gap: 10px; max-width: 860px; margin: 0 auto; }
.reader-title { margin: 4px 0 0; font-size: 24px; line-height: 1.3; }
.reader-title-zh { margin: 0; color: var(--ink-soft); font-size: 16px; }
.reader-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; margin-left: auto; }
.seg-btn { font: inherit; font-size: 14px; padding: 5px 12px; border: 0; background: var(--card); color: var(--ink); cursor: pointer; }
.seg-btn + .seg-btn { border-left: 2px solid var(--line); }
.seg-btn.on { background: var(--header); color: #fff; }
.reader-body { display: flex; flex-direction: column; gap: 12px; }
.rp { background: var(--bg-soft); border-radius: 14px; padding: 12px 16px; }
.rp-en { margin: 0; font-size: 17px; line-height: 1.75; }
.rp-zh { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed color-mix(in srgb, var(--line) 30%, transparent); color: var(--ink-soft); font-size: 16px; line-height: 1.7; }
.rp-say { float: right; margin: 0 0 4px 8px; border: 2px solid var(--line); background: var(--card); border-radius: 999px; width: 32px; height: 32px; font-size: 14px; cursor: pointer; }
.reader-note { margin: 0; }
.reader-nav { max-width: 860px; }
.lesson-box { border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; background: var(--card); }
.lesson-box h4 { margin: 0 0 6px; font-size: 16px; }
.lesson-box ul, .study-sec ul { list-style: none; margin: 0; padding: 0; }
.lesson-box li, .study-sec li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; padding: 5px 0; border-bottom: 1px dashed color-mix(in srgb, var(--line) 25%, transparent); }
.lesson-box li:last-child, .study-sec li:last-child { border-bottom: 0; }
.lb-grammar { grid-column: 1 / -1; }
.lw-word, .lp-word { font-weight: 800; }
.lp-word { color: var(--header); }
.lw-zh { color: var(--ink-soft); flex: 1; min-width: 6em; }
.gram-item { padding: 6px 0; }
.gram-item + .gram-item { border-top: 1px dashed color-mix(in srgb, var(--line) 25%, transparent); }
.gram-item p { margin: 3px 0; }
.gram-ex { font-style: italic; color: var(--ink); background: var(--bg-soft); border-radius: 10px; padding: 6px 10px; }
.gram-ex .gram-focus, .gram-ex mark { background: color-mix(in srgb, var(--accent) 75%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; font-style: normal; font-weight: 700; }
.btn.save-word { min-width: 34px; padding: 2px 8px; font-size: 16px; line-height: 1.3; background: var(--card); color: var(--ink); }
.btn.save-word.on { background: var(--accent); color: var(--accent-ink); }
.study-panel { border-top: 2px dashed color-mix(in srgb, var(--line) 35%, transparent); margin-top: 4px; padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.study-sec > b { display: block; margin-bottom: 2px; }
.study-foot { margin: 0; }
.news-card.open { grid-column: 1 / -1; }
@media (max-width: 640px) { .lesson-grid { grid-template-columns: 1fr; } .reader-title { font-size: 21px; } .rp { padding: 10px 12px; } .rp-en { font-size: 16px; } .seg { margin-left: 0; } }
.cur-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cur-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 18px; border: 2px solid var(--line); background: var(--pastel-4); color: var(--ink); text-decoration: none; box-shadow: 3px 3px 0 var(--line); }
.cur-card:nth-child(2) { background: var(--pastel-1); } .cur-card:nth-child(3) { background: var(--pastel-2); } .cur-card:nth-child(4) { background: var(--pastel-3); }
.cur-card:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
.cur-card span { font-size: 14px; color: var(--ink-soft); }
@media (max-width: 520px) { .news-list { grid-template-columns: 1fr; } }

/* ---------- Sentence of the day ---------- */
.daily-card { position: relative; margin-top: 14px; background: #fffdf2; background-image: radial-gradient(var(--pastel-2) 3px, transparent 3.5px); background-size: 26px 26px; }
.daily-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); letter-spacing: .5px; }
.daily-en { font-family: var(--font-en); font-size: 26px; line-height: 1.4; margin: 6px 56px 4px 0; color: var(--ink); }
.daily-en b { color: var(--header); text-decoration: underline wavy var(--accent); text-decoration-thickness: 2px; text-underline-offset: 5px; cursor: help; }
.daily-src { font-size: 14px; color: var(--ink-soft); font-style: italic; }
.daily-zh { margin-top: 6px; font-size: 16px; color: var(--ink-soft); }
@media (max-width: 520px) { .daily-en { font-size: 21px; margin-right: 34px; } }

/* ---------- Exam time plan ---------- */
.timeplan { padding-bottom: 14px; }
.tp-bar { display: flex; height: 34px; border-radius: 999px; overflow: hidden; border: 3px solid var(--line); margin-top: 10px; }
.tp-seg { display: flex; align-items: center; justify-content: center; color: #1b2a44; font-weight: 800; font-size: 14px; border-right: 2px solid rgba(255,255,255,.7); min-width: 0; }
.tp-seg:last-child { border-right: none; }
.tp-marks { position: relative; height: 50px; }
.tp-mark:nth-child(2) span { top: 27px; }
.tp-mark { position: absolute; top: 0; height: 100%; border-left: 2px dashed var(--line); }
.tp-mark span { position: absolute; top: 8px; left: 6px; white-space: nowrap; font-size: 12px; color: var(--ink-soft); background: var(--card); padding: 0 4px; border-radius: 6px; }
.tp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.tp-leg { display: inline-flex; align-items: center; gap: 6px; }
.tp-leg i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; border: 1px solid rgba(0,0,0,.15); }
.tp-tips { margin: 10px 0 8px; padding-left: 20px; font-size: 15px; color: var(--ink); }
.tp-tips li { margin: 2px 0; }
.score-banner .pace { margin-top: 6px; display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 15px; }
.score-banner .pace.ok { background: #d9f3e3; color: #1d6b3c; }
.score-banner .pace.slow { background: #fff0cc; color: #7a5300; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; border: 2px solid #fff; left: 50%; transform: translateX(-50%) translateY(30px);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 999px;
  opacity: 0; transition: all .25s; pointer-events: none; z-index: 99; font-size: 15px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Footer ---------- */
.site-footer { text-align: center; padding: 20px; color: var(--ink-soft); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .site-header { padding: 10px 14px; gap: 8px; }
  .brand-title { font-size: 22px; letter-spacing: 1px; }
  .brand-sub { display: none; }
  .header-controls { gap: 6px; }
  .ctrl select, .auth-btn { padding: 4px 8px; font-size: 14px; }
  .exam-chip { font-size: 13px; padding: 3px 4px 3px 6px; order: -1; width: 100%; justify-content: space-between; }
  .exam-chip-date { flex: 1; text-align: left; }
  .header-controls { width: 100%; }
  .ctrl select { font-size: 13px; padding: 4px 4px; max-width: 108px; }
  .auth-btn { margin-left: auto; font-size: 13px; padding: 4px 10px; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .map-card .map-count { position: static; display: inline-block; margin-bottom: 6px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 0 10px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px 6px; font-size: 15px; }
  .banner-img { height: 190px; object-fit: cover; object-position: 50% 100%; }
      .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 10px 12px; } .stat-card .v { font-size: 26px; }
  .ribbon { width: 30px; height: 44px; font-size: 16px; padding-top: 6px; right: 10px; } .ribbon-l { left: 10px; }
  .stat-card .ribbon { font-size: 17px; height: 46px; }
  .service-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .service-card { min-height: 150px; padding: 18px 12px; } .service-card h3 { font-size: 18px; } .service-card p { font-size: 13px; } .service-card .icon { font-size: 30px; }
  .page-wrap { padding: 12px 12px 30px; }
  .card { padding: 14px 14px; }
  .passage { font-size: 17px; padding: 14px; }
  .list-item { padding: 10px 12px; }
}
@media (max-width: 520px) {
  .site-header { padding: 12px 14px; }
  .tabs { padding: 0 8px; }
  .tab { padding: 8px 10px 6px; font-size: 14px; }
  .flash-card { height: 280px; }
  .flash-word { font-size: 40px; }
}
@media (max-width: 520px) { .tp-seg { font-size: 12px; } .tp-mark span { font-size: 11px; } }

/* progress report PDF (rendered off-screen, then turned into a PDF) */
.pdf-stage { position: fixed; left: -10000px; top: 0; width: 700px; background: #fff; }
.pdf-report { width: 700px; box-sizing: border-box; padding: 8px 6px; background: #fff; color: #1b2a44; font-family: 'Noto Sans TC', 'Nunito', sans-serif; font-size: 13px; line-height: 1.55; }
.pdf-report .en { font-family: 'Nunito', 'Noto Sans TC', sans-serif; }
.pdf-report h2 { font-size: 16px; margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #1f3b73; color: #1f3b73; }
.pr-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 4px solid #1f3b73; padding-bottom: 10px; }
.pr-title { font-size: 24px; font-weight: 700; color: #1f3b73; }
.pr-sub { color: #4a5a78; margin-top: 2px; }
.pr-exam { text-align: right; color: #4a5a78; }
.pr-exam b { color: #b84a2c; font-size: 16px; }
.pr-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.pr-stat { border: 1.5px solid #c9d3e6; border-radius: 10px; padding: 8px 10px; background: #f6f8fc; }
.pr-k { font-size: 11px; color: #4a5a78; font-weight: 700; }
.pr-v { font-size: 19px; font-weight: 700; color: #1f3b73; }
.pr-s { font-size: 11px; color: #4a5a78; }
.pr-bars { display: flex; gap: 6px; align-items: flex-end; height: 92px; padding: 4px 0; }
.pr-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.pr-fill { width: 70%; background: #f6c445; border-radius: 4px 4px 0 0; min-height: 2px; }
.pr-n { font-size: 10px; height: 13px; color: #1f3b73; }
.pr-d { font-size: 10px; color: #4a5a78; }
.pr-table { width: 100%; border-collapse: collapse; }
.pr-table th, .pr-table td { border-bottom: 1px solid #dfe5f0; padding: 5px 6px; text-align: left; font-size: 12px; }
.pr-table th { background: #f0f3fa; color: #1f3b73; }
.pr-item { border-left: 4px solid #c0392b; background: #fbf6f5; padding: 6px 10px; margin: 6px 0; border-radius: 0 8px 8px 0; }
.pr-meta { font-size: 11px; color: #4a5a78; }
.pr-bad { color: #c0392b; font-weight: 700; }
.pr-ok { color: #2e8b57; font-weight: 700; }
.pr-words { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 12px; }
.pr-none { color: #4a5a78; }
.pr-foot { margin-top: 18px; font-size: 11px; color: #8a96ad; text-align: center; }
.report-card { border-style: dashed; }

/* phrases tab */
.phr-cats { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
.phr-cat { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; box-shadow: 2px 2px 0 var(--line); max-width: 220px; text-align: left; }
.phr-cat span { font-size: 12px; color: var(--ink-soft); }
.phr-cat.on { background: var(--accent); color: var(--accent-ink); }
.phr-cat.on span { color: var(--accent-ink); }
.phr-tools .seg { margin-left: 0; }
.phr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 8px; }
.phr-card { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: 3px 3px 0 var(--line); }
.phr-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.phr-word { font-size: 18px; font-weight: 800; color: var(--header); }
.phr-zh { font-size: 16px; }
.phr-ex { background: var(--bg-soft); border-radius: 10px; padding: 6px 10px; font-size: 15px; line-height: 1.55; }
.phr-acts { margin-top: auto; }
@media (max-width: 520px) { .phr-grid { grid-template-columns: 1fr; } }

/* reading translation + translation practice */
.passage-zh { white-space: normal; display: flex; flex-direction: column; gap: 10px; }
.passage-zh .rp { background: transparent; padding: 0; }
.passage-zh .rp-en { font-size: inherit; line-height: 1.8; }
.tr-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.tr-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 2px solid color-mix(in srgb, var(--line) 25%, transparent); background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.tr-row:hover { border-color: var(--line); }
.tr-zh { flex: 1; }
.tr-mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--bg-soft); color: var(--ink-soft); font-weight: 800; }
.tr-mark.ok { background: #d8f3e2; color: #1f7a45; }
.tr-mark.bad { background: #fbe0dd; color: #b03a2e; }
.tr-card { display: flex; flex-direction: column; gap: 12px; }
.tr-q { font-size: 22px; font-weight: 700; line-height: 1.5; }
.tr-hint .chip { margin: 2px; }
.tr-input { width: 100%; box-sizing: border-box; font-size: 18px; line-height: 1.6; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--ink); resize: vertical; }
.tr-input[readonly] { background: var(--bg-soft); }
.tr-result { display: flex; flex-direction: column; gap: 10px; }
.tr-keys { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tr-model { background: #eef8f1; border: 2px solid #9fd3b0; border-radius: 14px; padding: 10px 14px; }
.tr-model p { margin: 4px 0 8px; font-size: 17px; }
.tr-point { background: var(--bg-soft); border-radius: 12px; padding: 8px 12px; }
@media (max-width: 520px) { .tr-q { font-size: 19px; } }

/* multiple choice + cloze */
.mc-card { display: flex; flex-direction: column; gap: 12px; }
.mc-q { font-size: 19px; line-height: 1.7; }
.mc-blank { display: inline-block; min-width: 80px; border-bottom: 2px solid var(--ink); margin: 0 4px; vertical-align: baseline; }
.mc-opts { display: flex; flex-direction: column; gap: 8px; }
.mc-opts .option { cursor: pointer; }
.cz-passage { white-space: normal; line-height: 2.1; }
.cz-blank { display: inline-block; min-width: 70px; padding: 0 6px; margin: 0 2px; border-bottom: 2px solid var(--ink); border-radius: 4px 4px 0 0; }
.cz-blank b { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; background: var(--header); color: #fff; font-size: 12px; }
.cz-blank.filled { background: var(--bg-soft); }
.cz-blank.ok { background: #d8f3e2; } .cz-blank.bad { background: #fbe0dd; }
.row-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.cz-zh { background: var(--bg-soft); border-radius: 12px; padding: 8px 12px; }
.cz-zh summary { cursor: pointer; font-weight: 700; }
.mc-review { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 520px) { .mc-q { font-size: 17px; } .row-opts { grid-template-columns: 1fr 1fr; } }

/* word bank on phones: one card per word instead of a wide table (no sideways scrolling) */
.wb-table .wb-lbl { display: none; }
@media (max-width: 640px) {
  table.wb-table { border: 0; background: transparent; }
  .wb-table thead { display: none; }
  .wb-table, .wb-table tbody { display: block; }
  .wb-table tr { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "word pos bm" "zh zh zh" "syn syn syn" "ex ex ex" "unit unit box" "acts acts acts";
    column-gap: 8px; background: var(--card); border: 2px solid var(--bg-soft); border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; }
  .wb-table tr:hover td:not(.example) { background: transparent; }
  .wb-table tr:hover td.example { background: var(--bg-soft); }
  .wb-table td { display: block; padding: 2px 0; border: 0; }
  .wb-table td.teacher-only { display: none; }
  body.teacher .wb-table td.teacher-only { display: block; }
  .wb-table td.bm-cell { grid-area: bm; }
  .wb-table td.word { grid-area: word; white-space: normal; }
  .wb-table td.word .small { display: inline; margin-left: 4px; }
  .wb-table td.pos { grid-area: pos; align-self: center; color: var(--ink-soft); font-size: 14px; }
  .wb-table td.zh { grid-area: zh; font-size: 17px; font-weight: 700; color: var(--ink); }
  .wb-table td.syn { grid-area: syn; min-width: 0; }
  .wb-table .wb-lbl { display: inline; }
  .wb-table td.example { grid-area: ex; background: var(--bg-soft); border-radius: 10px; padding: 6px 10px; margin-top: 4px; }
  .wb-table td.example:empty, .wb-table td.syn:empty { display: none; }
  .wb-table td.unit { grid-area: unit; align-self: center; margin-top: 4px; }
  .wb-table td.box { grid-area: box; margin-top: 4px; }
  .wb-table td.acts { grid-area: acts; margin-top: 6px; }
  .wb-table tr.wb-edit { display: flex !important; flex-direction: column; gap: 6px; }
  .wb-table tr.wb-edit td { display: block; }
}

/* ---- City cards: tap a city on the world map ---- */
.map-city { cursor: pointer; outline: none; }
.map-city:focus-visible circle:last-of-type, .map-city:focus-visible polygon { stroke: var(--accent); stroke-width: 4; }
.map-pulse { transform-box: fill-box; transform-origin: center; animation: mapPulse 2.6s ease-out infinite; }
@keyframes mapPulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(3.2); opacity: 0; } }
.city-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 8px; }
.city-hint { width: 100%; font-size: 14px; opacity: .92; }
.city-chip { font: inherit; font-size: 15px; font-weight: 700; color: #fff; background: rgba(255, 255, 255, .14); border: 2px solid rgba(255, 255, 255, .6); border-radius: 999px; padding: 6px 13px; cursor: pointer; min-height: 40px; }
.city-chip:hover, .city-chip:focus-visible { background: rgba(255, 255, 255, .3); outline: none; }
.city-chip.done { background: #fff; color: #1d5f9e; border-color: #fff; }
.city-modal { align-items: flex-start; overflow-y: auto; }
body.city-open { overflow: hidden; }
.city-sheet { position: relative; width: min(780px, 100%); margin: auto; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; background: var(--card); color: var(--ink); border: 3px solid var(--line); border-radius: 24px; box-shadow: var(--sticker); animation: cityIn .28s ease-out; }
@keyframes cityIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.city-close { position: absolute; right: 12px; top: 12px; z-index: 2; width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--line); background: #fff; color: var(--ink); font-size: 18px; cursor: pointer; box-shadow: 2px 2px 0 var(--line); }
.city-hero img { display: block; width: 100%; height: auto; aspect-ratio: 800 / 340; background: #dfe6ee; border-radius: 21px 21px 0 0; border-bottom: 3px solid var(--line); }
.city-head { padding: 14px 22px 0; }
.city-head h2 { margin: 0; font-size: 28px; line-height: 1.2; }
.city-head h2 .en { font-family: var(--font-en); font-size: 20px; color: var(--ink-soft); }
.city-sub, .city-clock { color: var(--ink-soft); font-size: 15px; margin-top: 2px; }
.city-body { padding: 4px 22px 24px; }
.city-body h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 24px 0 10px; font-size: 19px; }
.city-tools { margin: 10px 0 4px; }
.city-tools .seg { margin-left: 0; }
.city-intro { font-size: 18px; line-height: 1.6; margin: 12px 0 6px; }
.city-zh { color: var(--ink-soft); }
.speak-btn { border: 0; background: none; cursor: pointer; font-size: 18px; padding: 2px 4px; line-height: 1; flex: none; }
.city-phrases, .city-dialogue { display: grid; gap: 8px; }
.city-phrase, .city-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--bg-soft); border-radius: 14px; background: var(--bg); }
.city-phrase .scene { font-size: 22px; line-height: 1.2; flex: none; }
.city-phrase .en, .city-line .en { font-size: 17px; }
.city-line b { flex: none; min-width: 56px; color: var(--header); font-size: 14px; padding-top: 3px; }
.city-line.me { background: var(--pastel-4); border-color: #c9d8ff; }
.city-line.me b { color: #1d3b8a; }
.city-signbox { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.city-sign { min-width: 220px; max-width: 100%; padding: 14px 18px; border-radius: 10px; font-family: 'Nunito', system-ui, sans-serif; font-weight: 800; text-align: center; letter-spacing: .02em; box-shadow: 3px 3px 0 rgba(0, 0, 0, .25); }
.city-sign .main { font-size: 20px; text-transform: none; }
.city-sign .sub { font-size: 14px; font-weight: 700; opacity: .92; margin-top: 4px; }
.sign-underground { background: #fff; color: #1b2335; border: 5px solid #2d4b85; }
.sign-underground .main { color: #c8463b; }
.sign-station { background: #2d4b85; color: #fff; border: 3px solid #1b2335; }
.sign-road { background: #2f6b3a; color: #fff; border: 3px solid #fff; outline: 3px solid #2f6b3a; }
.sign-shop { background: #f7f3ea; color: #3a2a26; border: 3px dashed #b65b40; }
.sign-park { background: #6f5137; color: #fbf3df; border: 3px solid #4a3524; }
.sign-airport { background: #1b2335; color: #f6c445; border: 3px solid #f6c445; }
.sign-notice { background: #fff; color: #1b2335; border: 4px solid #c8463b; }
.sign-museum { background: #f3ebdb; color: #2f3d57; border: 3px double #2f3d57; }
.city-signbox .grow { min-width: 220px; }
.city-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.city-word { border: 2px solid var(--bg-soft); border-radius: 14px; padding: 10px 12px; background: var(--card); }
.city-word .row { gap: 6px; flex-wrap: nowrap; }
.city-word b.en { font-size: 18px; }
.city-note { margin-top: 20px; padding: 12px 16px; border-radius: 14px; background: var(--pastel-2); border: 2px dashed #e3c35f; }
.city-note p { margin: 6px 0 0; }
.city-q { margin-bottom: 14px; }
.city-q > .en { font-size: 17px; margin-bottom: 6px; }
.city-opts { display: grid; gap: 6px; }
.city-opt { font: inherit; text-align: left; padding: 9px 12px; border-radius: 12px; border: 2px solid var(--bg-soft); background: var(--card); color: var(--ink); cursor: pointer; }
.city-opt:hover:not([disabled]) { border-color: var(--line); }
.city-opt[disabled] { cursor: default; }
.city-opt.right { background: #d9f3e3; border-color: var(--ok); color: #1d6b3c; font-weight: 700; }
.city-opt.wrong { background: #ffe0dd; border-color: var(--bad); color: #8a241f; }
.city-explain { margin-top: 6px; color: var(--ink-soft); }
.city-link { width: 100%; font: inherit; text-align: left; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .map-pulse { animation: none; opacity: 0; } .city-sheet { animation: none; } }
@media (max-width: 640px) {
  .city-modal { padding: 0; }
  .city-sheet { width: 100%; min-height: 100vh; min-height: 100dvh; max-height: 100vh; max-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .city-hero img { border-radius: 0; }
  .city-head, .city-body { padding-left: 16px; padding-right: 16px; }
  .city-head h2 { font-size: 24px; }
  .city-close { top: calc(10px + env(safe-area-inset-top, 0px)); }
  .city-chip { font-size: 14px; padding: 6px 11px; }
}
