:root {
  --bg: #f5f3ee;
  --panel: #ffffff;
  --panel-2: #faf8f4;
  --ink: #1c2333;
  --ink-2: #4a5268;
  --ink-3: #7a8197;
  --line: #e4e0d6;
  --brand: #1f3a5f;
  --sp: #d9603b;
  --li: #1f8a7e;
  --rd: #3a6ea5;
  --gv: #7d5bb8;
  --wr: #c88a1e;
  --ok: #1f9d55;
  --bad: #d64545;
  --warn: #c98a12;
  --shadow: 0 1px 2px rgba(20, 25, 40, .06), 0 6px 20px rgba(20, 25, 40, .06);
  --radius: 14px;
  --hl: #ffe08a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c; --panel: #1b1f29; --panel-2: #222734; --ink: #eef0f5; --ink-2: #b9bfcd; --ink-3: #8a91a3;
    --line: #2e3443; --brand: #9cc3ff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --hl: #6b5512;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151c; --panel: #1b1f29; --panel-2: #222734; --ink: #eef0f5; --ink-2: #b9bfcd; --ink-3: #8a91a3;
  --line: #2e3443; --brand: #9cc3ff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --hl: #6b5512;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
button { font: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
.muted { color: var(--ink-3); }
.small { font-size: .86rem; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 58px;
}
.logo { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.logo b { background: var(--brand); color: var(--panel); border-radius: 7px; padding: 1px 7px; font-size: .9rem; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 7px 12px; border-radius: 9px; white-space: nowrap; font-size: .94rem; }
.nav a:hover { background: var(--panel-2); }
.nav a.on { background: var(--ink); color: var(--panel); }

main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 80px; }

/* ---------- generic ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.stack > * + * { margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); }
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); padding: 9px 15px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .94rem; line-height: 1.2;
  transition: transform .06s, background .15s, border-color .15s; text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.btn.sp { background: var(--sp); color: #fff; border-color: var(--sp); }
.btn.rec { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.big { padding: 13px 22px; font-size: 1.02rem; border-radius: 12px; }
.btn .ic { font-size: 1.05em; }
select, input[type=text], input[type=search], textarea {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
textarea { width: 100%; min-height: 160px; resize: vertical; line-height: 1.6; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-bottom: 26px; }
.hero .card { padding: 26px; }
.hero h1 { font-size: 2rem; }
.skill-card { position: relative; overflow: hidden; text-decoration: none; color: inherit; display: block; transition: transform .12s; }
.skill-card:hover { transform: translateY(-2px); }
.skill-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--c); }
.skill-card .big-n { font-size: 2.1rem; font-weight: 800; color: var(--c); line-height: 1; }
.skill-card .parts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.c-sp { --c: var(--sp); } .c-li { --c: var(--li); } .c-rd { --c: var(--rd); } .c-gv { --c: var(--gv); } .c-wr { --c: var(--wr); }
.exam-tile { display: flex; gap: 14px; align-items: flex-start; }
.exam-tile .dot { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--c); color: #fff; font-size: 1.3rem; flex: none; }

/* ---------- part tabs / filter ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 16px; }
.tabs a { text-decoration: none; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink-2); background: var(--panel); font-weight: 600; font-size: .92rem; }
.tabs a.on { background: var(--c, var(--ink)); color: #fff; border-color: transparent; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }

/* ---------- task list cards ---------- */
.tcard { cursor: pointer; padding: 0; overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.tcard .thumbs { display: flex; height: 150px; background: var(--panel-2); }
.tcard .thumbs img { flex: 1; min-width: 0; object-fit: cover; height: 100%; }
.tcard .thumbs .noimg { flex: 1; display: grid; place-items: center; color: var(--ink-3); font-size: .85rem; }
.tcard .body { padding: 12px 14px; }
.tcard .q1 { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcard .done { position: absolute; top: 8px; right: 8px; }
.tcard { position: relative; }
.qlist-item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.qlist-item:hover { background: var(--panel-2); }
.qlist-item:last-child { border-bottom: 0; }
.qlist-item .n { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: .8rem; color: var(--ink-3); flex: none; }

/* ---------- speaking task ---------- */
.task { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.task.noimg { grid-template-columns: minmax(0, 1fr); max-width: 900px; margin: 0 auto; }
.stage { position: sticky; top: 74px; }
.pics { display: grid; gap: 10px; }
.pics.two { grid-template-columns: 1fr 1fr; }
.pic {
  position: relative; border-radius: var(--radius); overflow: hidden; background: #0d1018; box-shadow: var(--shadow);
  aspect-ratio: 4 / 3; display: grid; place-items: center;
}
.pics.two .pic { aspect-ratio: 3 / 4; }
.pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pic .lbl { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.6); color: #fff; padding: 2px 10px; border-radius: 8px; font-size: .8rem; font-weight: 700; }
.pic .zoom { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 8px; padding: 5px 9px; cursor: pointer; }
.pic .imgerr { color: #ccd; text-align: center; padding: 20px; font-size: .9rem; }
.subtitle {
  position: absolute; left: 12px; right: 12px; bottom: 12px; background: rgba(8, 10, 16, .82); color: #fff; border-radius: 12px;
  padding: 12px 16px; font-size: 1.15rem; line-height: 1.5; opacity: 0; transform: translateY(8px); transition: .25s; pointer-events: none;
  backdrop-filter: blur(4px); max-height: 60%; overflow: hidden;
}
.subtitle.show { opacity: 1; transform: none; }
.subtitle .kw { color: rgba(255,255,255,.62); transition: color .1s; }
.subtitle .karaoke .kw.past { color: #fff; }
.subtitle .karaoke .kw.on { color: #111; background: #ffd25e; }
.subtitle .kw.on { color: #111; background: #ffd25e; border-radius: 4px; padding: 0 2px; }
.pics.two + .subtitle-wide { position: relative; }
.prompt-board {
  position: relative; border-radius: var(--radius); background: linear-gradient(135deg, var(--ink) 0%, #2b3a55 100%); color: #fff;
  padding: 28px 30px 96px; min-height: 230px; box-shadow: var(--shadow); overflow: hidden;
}
.prompt-board .pq { font-size: 1.5rem; font-weight: 700; line-height: 1.35; }
.prompt-board ol { margin: 6px 0 0 1.1em; padding: 0; font-size: 1.22rem; font-weight: 600; }
.prompt-board ol li + li { margin-top: 8px; }
.prompt-board .subtitle { bottom: 14px; }

.qcard { border-left: 4px solid var(--line); }
.qcard.cur { border-left-color: var(--sp); }
.qcard .qtext { font-size: 1.12rem; font-weight: 650; margin-bottom: 10px; }
.qcard .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sample { margin-top: 12px; background: var(--panel-2); border-radius: 10px; padding: 12px 14px; border: 1px dashed var(--line); }
.sample .karaoke { max-height: 260px; overflow: auto; white-space: pre-wrap; }
.karaoke .kw { border-radius: 3px; transition: background .1s; cursor: pointer; }
.karaoke .kw.on { background: var(--hl); }
.karaoke .kw.past { color: var(--ink); }
.sample .head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: .84rem; color: var(--ink-3); font-weight: 600; }

/* recorder */
.recbox { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--panel-2); }
.recbox .live { min-height: 52px; font-size: 1.02rem; }
.recbox .live .int { color: var(--ink-3); }
.ring { --p: 1; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--rc, var(--bad)) calc(var(--p) * 360deg), var(--line) 0); }
.ring > span { width: 60px; height: 60px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.ring.big { width: 120px; height: 120px; }
.ring.big > span { width: 100px; height: 100px; font-size: 1.6rem; }
.level { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; width: 140px; }
.level > i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s; }
.dotrec { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: pulse 1s infinite; display: inline-block; }
@keyframes pulse { 50% { opacity: .25; } }

/* score card */
.score { margin-top: 12px; border-radius: 12px; border: 1px solid var(--line); padding: 16px; background: var(--panel); }
.score .top { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.score .total { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.score .total small { font-size: 1rem; color: var(--ink-3); font-weight: 600; }
.bars { display: grid; gap: 7px; margin: 14px 0 6px; }
.bar { display: grid; grid-template-columns: 150px 1fr 44px; gap: 10px; align-items: center; font-size: .9rem; }
.bar .tr { height: 9px; background: var(--line); border-radius: 5px; overflow: hidden; }
.bar .tr > i { display: block; height: 100%; border-radius: 5px; }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }
.transcript { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.transcript mark { background: color-mix(in srgb, var(--bad) 22%, transparent); color: inherit; border-bottom: 2px solid var(--bad); border-radius: 2px; }
.errs { margin: 6px 0 0; padding-left: 1.1em; }
.errs li { margin: 3px 0; }
.fb { margin: 6px 0 0; padding-left: 1.1em; }
.align .w { padding: 1px 3px; border-radius: 4px; margin: 1px; display: inline-block; cursor: pointer; }
.align .w.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); }
.align .w.no { background: color-mix(in srgb, var(--bad) 22%, transparent); text-decoration: underline wavy var(--bad); }
.note { font-size: .8rem; color: var(--ink-3); margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }

/* ---------- objective questions ---------- */
.mcq { margin: 10px 0; }
.mcq .opt {
  display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px 14px; margin: 6px 0; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--ink);
}
.mcq .opt:hover { border-color: var(--ink-3); }
.mcq .opt .k { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); font-weight: 700; font-size: .8rem; flex: none; }
.mcq .opt.sel { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.mcq .opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--panel)); }
.mcq .opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--panel)); }
.explain { background: var(--panel-2); border-radius: 10px; padding: 10px 14px; margin-top: 8px; font-size: .94rem; white-space: pre-wrap; }
.passage { white-space: pre-wrap; background: var(--panel-2); border-radius: 12px; padding: 16px 18px; font-size: 1.04rem; line-height: 1.75; }
.passage .gap { display: inline-block; min-width: 70px; border-bottom: 2px solid var(--rd); text-align: center; font-weight: 700; color: var(--rd); padding: 0 4px; }
.match-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(180px, 2fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.match-row select { width: 100%; }
.mark-ok { color: var(--ok); font-weight: 700; } .mark-bad { color: var(--bad); font-weight: 700; }
.order-list { list-style: none; padding: 0; margin: 0; }
.order-list li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; margin: 6px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.order-list li .n { font-weight: 800; color: var(--rd); width: 22px; }
.order-list li .t { flex: 1; }
.order-list li.right { border-color: var(--ok); } .order-list li.wrong { border-color: var(--bad); }
audio { width: 100%; max-width: 520px; }
.people { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.people .p { background: var(--panel-2); border-radius: 12px; padding: 12px 14px; }
.people .p b { color: var(--rd); }

/* ---------- exam ---------- */
.exam-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.exam-head .ptitle { font-weight: 800; font-size: 1.15rem; }
.steps { display: flex; gap: 4px; }
.steps i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--sp); } .steps i.done { background: color-mix(in srgb, var(--sp) 45%, var(--line)); }
.status { font-weight: 700; display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.clock { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.2rem; padding: 4px 12px; border-radius: 10px; background: var(--ink); color: var(--panel); }
.clock.low { background: var(--bad); color: #fff; }
.qnav { display: flex; flex-wrap: wrap; gap: 5px; }
.qnav button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; color: var(--ink); }
.qnav button.ans { background: var(--ink); color: var(--panel); }
.qnav button.cur { box-shadow: 0 0 0 2px var(--sp); }
.result-big { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.result-big .num { font-size: 3.3rem; font-weight: 800; line-height: 1; }
.result-big .lvl { font-size: 1.4rem; font-weight: 800; padding: 6px 16px; border-radius: 12px; background: var(--ink); color: var(--panel); }
details.ans { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--panel); margin: 8px 0; }
details.ans summary { cursor: pointer; font-weight: 600; }

table.hist { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.hist th, table.hist td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.hist th { color: var(--ink-3); font-weight: 600; }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 100; display: grid; place-items: center; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--panel); padding: 10px 18px; border-radius: 10px; opacity: 0; transition: .25s; z-index: 200; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
.banner { border-radius: 12px; padding: 12px 16px; background: color-mix(in srgb, var(--warn) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); margin-bottom: 16px; font-size: .93rem; }
.spin { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--sp); border-radius: 50%; animation: sp 0.8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .task { grid-template-columns: 1fr; }
  .stage { position: static; }
  .bar { grid-template-columns: 110px 1fr 40px; }
}
@media (max-width: 600px) {
  main { padding: 16px 16px 60px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .pics.two { grid-template-columns: 1fr; }
  .pics.two .pic { aspect-ratio: 4 / 3; }
  .subtitle { font-size: 1rem; }
  .prompt-board .pq { font-size: 1.2rem; }
  .match-row { grid-template-columns: 1fr; }
}

/* tagged model answers */
.karaoke.tagged { white-space: normal; }
.kpara { margin: 0 0 12px; line-height: 1.7; }
.kpara:last-child { margin-bottom: 0; }
.ktag { display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .02em; padding: 1px 8px; margin-right: 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--sp) 14%, var(--panel)); color: var(--sp); border: 1px solid color-mix(in srgb, var(--sp) 35%, transparent); vertical-align: 1px; }
.ktag[data-t="E"] { color: #2a7fbf; background: color-mix(in srgb, #2a7fbf 12%, var(--panel)); border-color: color-mix(in srgb, #2a7fbf 35%, transparent); }
.ktag[data-t="F"] { color: #b0558c; background: color-mix(in srgb, #b0558c 12%, var(--panel)); border-color: color-mix(in srgb, #b0558c 35%, transparent); }
.ktag[data-t="O"] { color: var(--li); background: color-mix(in srgb, var(--li) 12%, var(--panel)); border-color: color-mix(in srgb, var(--li) 35%, transparent); }
.sample .karaoke { max-height: 340px; }
ul.moves { list-style: none; padding: 0; margin: 6px 0 10px; }
ul.moves li { display: grid; grid-template-columns: 22px 1fr; gap: 0 6px; padding: 4px 0; font-size: .92rem; }
ul.moves li .mk { font-weight: 800; }
ul.moves li.ok .mk { color: var(--ok); } ul.moves li.no .mk { color: var(--bad); }
ul.moves li .small { grid-column: 2; }

details.oldsample { margin-top: 8px; }
details.oldsample summary { cursor: pointer; }

/* top countdown bar */
#topTimer { position: fixed; left: 0; right: 0; top: 58px; z-index: 40; transform: translateY(-120%); opacity: 0; transition: .2s; pointer-events: none; }
#topTimer.show { transform: none; opacity: 1; }
#topTimer .tt-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 8px 20px;
  background: var(--ink); color: var(--panel); box-shadow: 0 6px 18px rgba(0,0,0,.18); border-radius: 0 0 14px 14px; }
#topTimer .tt-lbl { font-weight: 700; white-space: nowrap; }
#topTimer .tt-track { flex: 1; height: 8px; border-radius: 4px; background: rgba(255,255,255,.2); overflow: hidden; }
#topTimer .tt-track i { display: block; height: 100%; background: var(--bad); transition: width .2s linear; }
#topTimer.prep .tt-track i { background: var(--wr); }
#topTimer .tt-time { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }
body.has-timer main { padding-top: 76px; }
.recbox .ring { display: none; }
.task.noimg .stage { position: static; }
@media (max-width: 600px) { #topTimer .tt-time { font-size: 1.3rem; } #topTimer .tt-in { padding: 6px 12px; } }

/* writing analysis */
.wa { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.wa h4 { margin: 0 0 8px; font-size: 1rem; }
.wa-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wa-tenses { margin: 6px 0 10px; font-size: .9rem; }
.chip { display: inline-block; font-size: .74rem; font-weight: 600; padding: 1px 8px; border-radius: 6px; margin: 2px 4px 2px 0; border: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.chip.t { color: var(--gv); border-color: color-mix(in srgb, var(--gv) 35%, transparent); }
.chip.ty-s { color: var(--ink-2); } .chip.ty-c { color: var(--li); border-color: color-mix(in srgb, var(--li) 40%, transparent); }
.chip.ty-x { color: var(--rd); border-color: color-mix(in srgb, var(--rd) 40%, transparent); } .chip.ty-cx { color: var(--sp); border-color: color-mix(in srgb, var(--sp) 40%, transparent); }
.wa-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 8px 0 12px; }
.wa-table th, .wa-table td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
.wa-table th { color: var(--ink-3); font-weight: 600; font-size: .8rem; }
.wa-table td:nth-child(2) { min-width: 240px; }
.wa-table ul.errs { margin: 0; padding-left: 1em; }
.sp-bad { text-decoration: underline wavy var(--bad); text-underline-offset: 3px; color: var(--bad); font-weight: 600; }

/* vocabulary */
.vcard { margin-bottom: 10px; padding: 14px 18px; }
.vhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vterm { font-size: 1.15rem; font-weight: 800; color: var(--gv); }
.vbase { color: var(--ink-3); font-weight: 600; }
.vvi { font-weight: 600; margin-top: 4px; }
.vex { margin-top: 6px; font-size: 1rem; }
.vexvi { color: var(--ink-3); font-size: .92rem; font-style: italic; }
mark.vhl { background: color-mix(in srgb, var(--gv) 18%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; font-weight: 600; }
.chip.vt { font-size: .7rem; }
.chip.vt-S { color: var(--sp); } .chip.vt-W { color: var(--wr); } .chip.vt-F { color: var(--rd); } .chip.vt-I { color: var(--li); }
.fc { text-align: center; padding: 28px 22px; max-width: 760px; margin: 0 auto; }
.fc-term { font-size: 1.9rem; font-weight: 800; color: var(--gv); margin: 14px 0 8px; }
.fc-back { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.wframe { background: color-mix(in srgb, var(--wr) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--wr) 30%, transparent); border-radius: 12px; padding: 10px 14px; font-size: .92rem; }
.wframe b { color: var(--wr); }

/* ---------- phones ---------- */
.menu-btn { display: none; margin-left: auto; font-size: 1.5rem; line-height: 1; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; color: var(--ink); cursor: pointer; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; height: auto; min-height: 56px; padding-top: env(safe-area-inset-top); }
  .menu-btn { display: block; }
  .nav { display: none; order: 3; width: 100%; flex-direction: column; gap: 2px; padding: 4px 0 10px; overflow: visible; }
  body.nav-open .nav { display: flex; }
  .nav a { padding: 11px 12px; font-size: 1rem; border-radius: 10px; }
  #topTimer { top: 56px; }
  .btn { min-height: 42px; }
  .btn.small, .btn.ghost.small { min-height: 38px; min-width: 38px; padding: 6px 10px; }
  select, input[type=text], input[type=search], textarea { font-size: 16px; } /* tránh iPhone tự phóng to khi gõ */
  .chip, .pill { font-size: .78rem; }
  .qcard .acts .btn { flex: 1 1 calc(50% - 8px); }
  .subtitle { font-size: .98rem; padding: 10px 12px; }
  .score .total { font-size: 1.8rem; }
  .bar { grid-template-columns: 92px 1fr 34px; font-size: .84rem; }
  .wa-table { font-size: .84rem; }
  .wa-table td:nth-child(2) { min-width: 180px; }
  .exam-head { position: sticky; top: 56px; }
  main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) { .logo span { display: none; } }

/* admin */
.stat-n { font-size: 2rem; font-weight: 800; line-height: 1.1; margin: 4px 0; font-variant-numeric: tabular-nums; }
.vb-wrap { display: grid; grid-template-columns: 28px 1fr; gap: 6px; height: 150px; margin: 8px 0 4px; }
.vb-axis { display: flex; flex-direction: column; justify-content: space-between; text-align: right; }
.vbars { display: flex; align-items: flex-end; gap: 2px; height: 100%; border-bottom: 1px solid var(--line); }
.vbars .vb { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.vbars .vb i { display: block; width: 100%; min-height: 1px; background: var(--li); border-radius: 4px 4px 0 0; }
.vbars .vb:hover i { background: var(--rd); }
.pbar { display: grid; grid-template-columns: 1fr 40px; align-items: center; gap: 8px; }
.pbar i { display: block; height: 8px; border-radius: 4px; background: var(--li); max-width: 100%; }
.utable td, .utable th { white-space: nowrap; }
.utable tr.locked td { opacity: .6; }
