:root {
  --red: #c8102e;
  --red-soft: #fde8eb;
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f4efe8;
  --text: #1f1b24;
  --muted: #6b6474;
  --border: #e7e0d6;
  --read: #2563eb;
  --read-soft: #e6eeff;
  --write: #c2410c;
  --write-soft: #ffeedd;
  --speak: #059669;
  --speak-soft: #dcf7ec;
  --words: #7c3aed;
  --words-soft: #efe7ff;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --gold: #d97706;
  --shadow: 0 1px 2px rgba(30, 20, 10, .06), 0 6px 20px rgba(30, 20, 10, .06);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red-soft: #3b1219;
    --bg: #15131a;
    --surface: #1f1c25;
    --surface-2: #29252f;
    --text: #f2eef6;
    --muted: #a69fb0;
    --border: #36313e;
    --read: #7aa2ff;
    --read-soft: #1c2742;
    --write: #fb923c;
    --write-soft: #3a2414;
    --speak: #34d399;
    --speak-soft: #12302a;
    --words: #b794ff;
    --words-soft: #2a1f42;
    --ok: #4ade80;
    --ok-soft: #133323;
    --bad: #f87171;
    --bad-soft: #3a1717;
    --gold: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --red-soft: #3b1219;
    --bg: #15131a;
    --surface: #1f1c25;
    --surface-2: #29252f;
    --text: #f2eef6;
    --muted: #a69fb0;
    --border: #36313e;
    --read: #7aa2ff;
    --read-soft: #1c2742;
    --write: #fb923c;
    --write-soft: #3a2414;
    --speak: #34d399;
    --speak-soft: #12302a;
    --words: #b794ff;
    --words-soft: #2a1f42;
    --ok: #4ade80;
    --ok-soft: #133323;
    --bad: #f87171;
    --bad-soft: #3a1717;
    --gold: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.55;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 900; }
h2 { font-size: 1.3rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 800; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: max(10px, env(safe-area-inset-top, 0px)) !important;
  padding-left: max(20px, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(20px, env(safe-area-inset-right, 0px)) !important;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; text-decoration: none; font-size: 1.1rem; white-space: nowrap; }
.flag {
  width: 30px; height: 22px; border-radius: 5px; background: var(--red); position: relative; overflow: hidden; flex: none;
}
.flag::before, .flag::after { content: ""; position: absolute; background: #fff; }
.flag::before { left: 9px; top: 0; bottom: 0; width: 4px; }
.flag::after { top: 9px; left: 0; right: 0; height: 4px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  text-decoration: none; padding: 8px 12px; border-radius: 12px; font-weight: 700; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--surface); box-shadow: var(--shadow); }
.stats { display: flex; gap: 8px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-weight: 800; font-size: .9rem; white-space: nowrap;
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .brand { flex: 1; }
  .nav { order: 3; flex-basis: 100%; justify-content: space-between; }
  .nav a { padding: 6px 8px; font-size: .92rem; }
}
@media (max-width: 420px) {
  .nav a span { display: none; }
  .nav a { font-size: 1.3rem; flex: 1; text-align: center; }
}

main:focus, main:focus-visible { outline: none; }
main { max-width: 1120px; margin: 0 auto; padding: 24px 20px 80px; outline: none; }
@media (max-width: 760px) { main { padding: 16px 16px 80px; } }

/* Cards & layout */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.back { display: inline-block; margin-bottom: 12px; text-decoration: none; font-weight: 700; color: var(--muted); }
.back:hover { color: var(--text); }

.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  background: linear-gradient(135deg, var(--red) 0%, #e2475f 100%); color: #fff;
  border-radius: 24px; padding: 28px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.hero h1 { color: #fff; }
.hero p { color: rgba(255, 255, 255, .9); }
.hero .pill { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .25); color: #fff; }
@media (max-width: 640px) { .hero { grid-template-columns: 1fr; padding: 22px; } }

.ring { width: 120px; height: 120px; position: relative; z-index: 1; }
.ring svg { transform: rotate(-90deg); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 900; line-height: 1.1; }
.ring .lbl small { display: block; font-weight: 700; font-size: .75rem; opacity: .85; }

.task {
  display: block; text-decoration: none; border-radius: var(--radius); padding: 22px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
  position: relative; overflow: hidden;
}
.task:hover { transform: translateY(-3px); }
.task .emoji { font-size: 2.2rem; display: block; margin-bottom: 6px; }
.task.read { background: var(--read-soft); border-color: transparent; }
.task.write { background: var(--write-soft); border-color: transparent; }
.task.speak { background: var(--speak-soft); border-color: transparent; }
.task.words { background: var(--words-soft); border-color: transparent; }
.task.read h2 { color: var(--read); }
.task.write h2 { color: var(--write); }
.task.speak h2 { color: var(--speak); }
.task.words h2 { color: var(--words); }

.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--red); transition: width .4s ease; }
.task.read .bar > i { background: var(--read); }
.task.write .bar > i { background: var(--write); }
.task.speak .bar > i { background: var(--speak); }
.task.words .bar > i { background: var(--words); }
.task .bar { background: rgba(127, 127, 127, .18); }

.list-item {
  display: flex; align-items: center; gap: 14px; text-decoration: none; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.list-item:hover { transform: translateX(3px); }
.list-item .ico { font-size: 1.6rem; flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta b { display: block; }
.score-badge { font-weight: 900; padding: 4px 10px; border-radius: 10px; background: var(--surface-2); white-space: nowrap; }
.score-badge.full { background: var(--ok-soft); color: var(--ok); }

.tag {
  display: inline-block; font-size: .75rem; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.tag.real { background: var(--red-soft); color: var(--red); }
.stars { color: var(--gold); letter-spacing: 1px; }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.badge {
  text-align: center; padding: 12px 8px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--border);
  font-size: .82rem; font-weight: 700;
}
.badge .b-ico { font-size: 1.8rem; display: block; filter: grayscale(1); opacity: .35; }
.badge.got { border-style: solid; border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); }
.badge.got .b-ico { filter: none; opacity: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 14px; border: 0; cursor: pointer; font-weight: 800;
  background: var(--red); color: #fff; text-decoration: none; box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
  transition: transform .08s ease, box-shadow .08s ease, opacity .15s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 2px 0 var(--border); }
.btn.read { background: var(--read); }
.btn.write { background: var(--write); }
.btn.speak { background: var(--speak); }
.btn.words { background: var(--words); }
.btn.sm { padding: 7px 12px; font-size: .9rem; border-radius: 11px; }
.btn.rec { background: var(--bad); }
.btn.rec.on { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .5); } 50% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); } }
:focus-visible { outline: 3px solid var(--read); outline-offset: 2px; }

/* Reading */
.reader { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.reader .text { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
@media (max-width: 900px) {
  .reader { grid-template-columns: 1fr; }
  .reader .text { position: static; max-height: none; }
}
.reader.solo { grid-template-columns: 1fr; max-width: 820px; }
.reader.solo .text { position: static; max-height: none; }
.bankbox { position: sticky; top: 70px; z-index: 2; margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--surface); border: 2px solid var(--read-soft); box-shadow: var(--shadow); }
.bankbox .bank, .bankbox .sentence-bank { margin-top: 6px; }
@media (max-width: 760px) { .bankbox { top: 104px; } .bankbox.sentences { position: static; } .bankbox .sentence-bank { font-size: .85rem; gap: 3px; } .bankbox .sentence-bank div { padding: 3px 8px; } }
.text p { margin-bottom: 1em; }
.instruction { background: var(--read-soft); border-radius: 14px; padding: 12px 16px; font-weight: 600; }
.note { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-size: .9rem; color: var(--muted); }
.sec-h { margin: 18px 0 10px; color: var(--read); }
.mini-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.mini-card { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: .92rem; line-height: 1.5; }
.mini-card h4 { margin: 0 0 2px; font-size: 1rem; font-weight: 900; }
.mini-card .sub { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.mini-card .facts { margin-top: 6px; font-weight: 800; font-size: .82rem; }

.q { padding: 16px 0; border-top: 1px solid var(--border); }
.q:first-child { border-top: 0; padding-top: 0; }
.q .qtext { font-weight: 700; margin-bottom: 10px; }
.q .num { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 8px; background: var(--read-soft); color: var(--read); font-weight: 900; font-size: .85rem; margin-right: 6px; }
.choices { display: grid; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--border); background: var(--surface); font-weight: 600; text-align: left; width: 100%;
}
.choice:hover { border-color: var(--read); }
.choice.sel { border-color: var(--read); background: var(--read-soft); }
.choice.ok { border-color: var(--ok); background: var(--ok-soft); }
.choice.bad { border-color: var(--bad); background: var(--bad-soft); }
.choice .key { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-weight: 900; flex: none; font-size: .85rem; }
.tf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tf .choice { justify-content: center; text-align: center; font-size: .9rem; padding: 10px 6px; }

select.gap, .match select, input.short {
  border: 2px solid var(--border); border-radius: 10px; padding: 4px 8px; background: var(--surface); font-weight: 700;
}
select.gap { margin: 0 2px; min-width: 70px; }
select.gap:focus, .match select:focus, input.short:focus { border-color: var(--read); outline: none; }
select.gap.ok, .match select.ok, input.short.ok { border-color: var(--ok); background: var(--ok-soft); }
select.gap.bad, .match select.bad, input.short.bad { border-color: var(--bad); background: var(--bad-soft); }
.gap-label { font-size: .72rem; font-weight: 900; color: var(--muted); vertical-align: super; }
.example-fill { display: inline-block; padding: 1px 8px; border-radius: 8px; background: var(--surface-2); font-weight: 800; text-decoration: underline; }
input.short { width: 100%; padding: 10px 12px; }
.match { display: grid; gap: 10px; }
.match .mrow { display: grid; grid-template-columns: 1fr 90px; gap: 10px; align-items: center; }
.match select { padding: 8px; width: 100%; }
.bank { display: flex; flex-wrap: wrap; gap: 6px; }
.bank span { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-weight: 700; font-size: .9rem; }
.bank.used span.used { opacity: .35; text-decoration: line-through; }
.sentence-bank { display: grid; gap: 6px; font-size: .95rem; }
.sentence-bank div { padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.sentence-bank b { margin-right: 6px; }
.fb { margin-top: 6px; font-size: .9rem; font-weight: 700; }
.fb.ok { color: var(--ok); }
.fb.bad { color: var(--bad); }

.result {
  text-align: center; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--gold);
}
.result .big { font-size: 2.6rem; font-weight: 900; }

.timer { font-variant-numeric: tabular-nums; font-weight: 900; }
.timer.low { color: var(--bad); }

/* Writing */
.writer { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .writer { grid-template-columns: 1fr; } }
textarea.editor {
  width: 100%; min-height: 360px; resize: vertical; border: 2px solid var(--border); border-radius: 14px; padding: 16px;
  background: var(--surface); line-height: 1.7; font-size: 1.02rem;
}
textarea.editor:focus { outline: none; border-color: var(--write); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checks li { display: flex; gap: 8px; align-items: flex-start; font-size: .94rem; }
.checks li .i { flex: none; width: 22px; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer;
  font-size: .88rem; font-weight: 700;
}
.chip:hover { border-color: var(--write); }
.chip.on { background: var(--write-soft); border-color: var(--write); color: var(--write); }
label.tick { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 4px 0; }
label.tick input { width: 20px; height: 20px; accent-color: var(--write); margin-top: 3px; flex: none; }
.wordbar { position: relative; height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.wordbar .zone { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ok) 25%, transparent); }
.wordbar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--write); border-radius: inherit; transition: width .25s; }
.model { white-space: pre-wrap; background: var(--surface-2); border-radius: 14px; padding: 16px; font-size: .97rem; }
.rubric { display: grid; gap: 10px; }
.rubric .rrow { display: grid; grid-template-columns: minmax(130px, 1fr) 2fr; gap: 10px; align-items: center; }
@media (max-width: 560px) { .rubric .rrow { grid-template-columns: 1fr; gap: 4px; } }
.seg { display: flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--surface); padding: 7px 4px; cursor: pointer; font-size: .8rem; font-weight: 700; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--write); color: #fff; }
.grade { font-size: 3rem; font-weight: 900; color: var(--write); line-height: 1; }

/* Speaking */
.stage { text-align: center; padding: 28px 20px; }
.clock { font-size: clamp(3rem, 12vw, 5.5rem); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; margin: 10px 0; }
.phase { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--speak-soft); color: var(--speak); font-weight: 900; text-transform: uppercase; letter-spacing: .05em; font-size: .8rem; }
.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.steps span { padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.steps span.on { background: var(--speak); color: #fff; }
.steps span.done { background: var(--speak-soft); color: var(--speak); }
.bubble { max-width: 560px; margin: 0 auto; padding: 16px 20px; border-radius: 20px 20px 20px 6px; background: var(--speak-soft); font-size: 1.15rem; font-weight: 700; text-align: left; }
.bubble.me { border-radius: 20px 20px 6px 20px; background: var(--surface-2); margin-left: auto; font-weight: 600; }
.transcript { min-height: 70px; text-align: left; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-size: .95rem; }
.transcript i { color: var(--muted); }
.points-list { text-align: left; max-width: 560px; margin: 0 auto; padding-left: 1.2em; }
.points-list li { margin: 6px 0; font-weight: 600; }
.wheel { font-size: 1.5rem; font-weight: 900; min-height: 2.2em; display: grid; place-items: center; }
.wheel.spin { animation: wob .12s infinite; color: var(--speak); }
@keyframes wob { 50% { transform: scale(1.06); } }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper button { width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 900; }
.dots { display: flex; gap: 6px; justify-content: center; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2); }
.dots i.on { background: var(--speak); }
.rate { display: flex; gap: 6px; justify-content: center; }
.rate button { font-size: 1.8rem; background: none; border: 0; cursor: pointer; filter: grayscale(1); opacity: .4; transition: transform .1s; }
.rate button.on { filter: none; opacity: 1; transform: scale(1.1); }

/* Words game */
.word-big { font-size: clamp(2rem, 8vw, 3.2rem); font-weight: 900; margin: 18px 0; color: var(--words); }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 620px; margin: 0 auto; }
@media (max-width: 480px) { .answers { grid-template-columns: 1fr; } }
.answers .choice { justify-content: center; text-align: center; min-height: 56px; }
.answers .choice:hover { border-color: var(--words); }
.combo { font-weight: 900; color: var(--gold); min-height: 1.5em; }

/* Toasts & confetti */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: max-content; max-width: calc(100% - 32px); }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-weight: 800; box-shadow: var(--shadow);
  animation: toastIn .3s ease, toastOut .4s ease 2.6s forwards; text-align: center;
}
.toast.gold { background: var(--gold); color: #1f1300; }
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(16px); opacity: 0; } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; width: 100%; height: 100%; }

/* Install (PWA) */
.install-help { margin-top: 12px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); font-size: .95rem; }
.install-help ol { margin: 6px 0 0; padding-left: 1.3em; }
.start-install { display: flex; justify-content: center; margin-top: 18px; }
#toasts { bottom: max(18px, env(safe-area-inset-bottom, 0px)); }

/* Start screen: choose exam */
body.starting .nav, body.starting #topstats { display: none; }
body.starting .tr-toggle { margin-left: auto; }
.start { max-width: 960px; margin: 0 auto; padding-block: 24px; }
.start-head { text-align: center; margin-bottom: 28px; }
.start-head h1 { text-wrap: balance; margin-top: 14px; }
.flag.big { display: inline-block; width: 66px; height: 48px; border-radius: 10px; }
.flag.big::before { left: 20px; width: 9px; }
.flag.big::after { top: 20px; height: 9px; }
.exam-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.exam-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer;
  padding: 22px; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.exam-card:hover, .exam-card:focus-visible { transform: translateY(-4px); border-color: var(--red); }
.exam-card .ec-top { display: flex; justify-content: space-between; align-items: center; }
.exam-card .ec-ico { font-size: 2rem; }
.exam-card .ec-cefr { font-size: .78rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--red-soft); color: var(--red); }
.exam-card .ec-name { font-size: 2.4rem; font-weight: 900; line-height: 1; margin-top: 6px; }
.exam-card .ec-full { font-weight: 800; }
.exam-card .ec-tag { color: var(--muted); font-size: .94rem; flex: 1; }
.exam-card .bar { margin-top: 10px; }
.exam-card .ec-prog { font-size: .82rem; color: var(--muted); }
.exam-card.pd1 .ec-name { color: var(--speak); }
.exam-card.pd2 .ec-name { color: var(--read); }
.exam-card.pd3 .ec-name { color: var(--words); }
.exam-card.pd1 .bar > i { background: var(--speak); }
.exam-card.pd2 .bar > i { background: var(--read); }
.exam-card.pd3 .bar > i { background: var(--words); }
.start-foot { text-align: center; margin-top: 22px; }

/* Exam switcher (PD1 / PD2 / PD3) */
.examsw { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); padding: 2px; gap: 2px; }
.examsw button {
  border: 0; background: transparent; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  font-weight: 800; font-size: .85rem; color: var(--muted);
}
.examsw button[aria-pressed="true"] { background: var(--red); color: #fff; }
.examsw button:hover:not([aria-pressed="true"]) { color: var(--text); background: var(--surface-2); }
.examsw.big { margin-top: 12px; background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); }
.examsw.big button { font-size: 1rem; padding: 6px 16px; color: #fff; }
.examsw.big button[aria-pressed="true"] { background: #fff; color: var(--red); }
.examsw.big button:hover:not([aria-pressed="true"]) { background: rgba(255, 255, 255, .2); color: #fff; }
main > .examsw.big { background: var(--surface); border-color: var(--border); }
main > .examsw.big button { color: var(--muted); }
main > .examsw.big button[aria-pressed="true"] { background: var(--red); color: #fff; }
h1 .tag { vertical-align: middle; font-size: .8rem; }
@media (max-width: 760px) { .stats .examsw button { padding: 3px 7px; font-size: .8rem; } }

/* Hover translation */
#tr-tip {
  position: fixed; z-index: 70; pointer-events: none; max-width: min(320px, calc(100vw - 16px));
  background: var(--text); color: var(--bg); padding: 7px 12px; border-radius: 12px; box-shadow: var(--shadow);
  font-size: .9rem; line-height: 1.35; display: flex; flex-direction: column; gap: 1px;
}
#tr-tip b { font-weight: 900; color: var(--gold); }
#tr-tip[hidden], #tr-mark[hidden] { display: none; }
#tr-mark {
  position: fixed; z-index: 69; pointer-events: none; border-radius: 5px;
  background: color-mix(in srgb, var(--gold) 28%, transparent);
}
.tr-toggle { cursor: pointer; }
.tr-toggle[aria-pressed="false"] { opacity: .6; }
@media (max-width: 760px) { .tr-label { display: none; } .tr-toggle { padding: 4px 8px; } }

details.info summary { cursor: pointer; font-weight: 800; }
details.info[open] summary { margin-bottom: 10px; }
table.simple { border-collapse: collapse; width: 100%; font-size: .92rem; }
table.simple td, table.simple th { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
