:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --topbar-bg: rgba(246, 248, 251, 0.94);
  --panel: #ffffff;
  --panel-soft: #eef3f1;
  --control: #ffffff;
  --control-soft: #fbfcfd;
  --paper: #fcfcfa;
  --paper-soft: #fffdf7;
  --paper-card: #ffffff;
  --paper-line: #cfd6dd;
  --paper-rule: #d6dce3;
  --paper-row: #eef2f6;
  --ink: #20252d;
  --muted: #687483;
  --ad-text: #3a4250;
  --line: #d9e0e7;
  --green: #2f7d6b;
  --green-weak: #dfeee9;
  --blue: #315f96;
  --blue-weak: #e2e9f5;
  --red: #b6473b;
  --red-weak: #f6dfdc;
  --gold: #b47b20;
  --gold-weak: #f4ead8;
  --meter-bg: #e6ebf0;
  --nav-count-bg: rgba(0, 0, 0, 0.08);
  --on-accent: #ffffff;
  --toast-bg: #20252d;
  --toast-ink: #ffffff;
  --shadow: 0 16px 45px rgba(33, 46, 68, 0.1);
  --radius: 8px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101721;
  --topbar-bg: rgba(16, 23, 33, 0.92);
  --panel: #17212d;
  --panel-soft: #1e2c38;
  --control: #111b27;
  --control-soft: #1b2633;
  --paper: #18222d;
  --paper-soft: #151f2b;
  --paper-card: #1d2936;
  --paper-line: #344556;
  --paper-rule: #3a4d5f;
  --paper-row: rgba(255, 255, 255, 0.045);
  --ink: #eef3f7;
  --muted: #a5b4c2;
  --ad-text: #d9e2ea;
  --line: #314154;
  --green: #68c8ad;
  --green-weak: rgba(104, 200, 173, 0.16);
  --blue: #8eb9ed;
  --blue-weak: rgba(142, 185, 237, 0.16);
  --red: #f08a7e;
  --red-weak: rgba(240, 138, 126, 0.16);
  --gold: #e7bc74;
  --gold-weak: rgba(231, 188, 116, 0.16);
  --meter-bg: #253343;
  --nav-count-bg: rgba(255, 255, 255, 0.14);
  --toast-bg: #edf4f7;
  --toast-ink: #111923;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color 160ms ease, color 160ms ease;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea,
audio {
  max-width: 100%;
}

a {
  color: var(--blue);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 12px clamp(16px, 3vw, 36px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--green);
  color: var(--on-accent);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.select-label {
  color: var(--muted);
  font-size: 0.8rem;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
  color: var(--ink);
}

input,
textarea {
  accent-color: var(--green);
}

select,
input {
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  width: 100%;
  min-height: 128px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
}

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 13px;
  cursor: pointer;
  color: var(--on-accent);
  background: var(--blue);
}

button:hover {
  filter: brightness(0.96);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ghost-btn {
  background: var(--control);
  color: var(--ink);
  border-color: var(--line);
}

.exam-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 180px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 102px;
  background: var(--control);
  color: var(--ink);
  border-color: var(--line);
}

.theme-toggle-track {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.theme-toggle-knob {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  transform: translateY(-50%);
  transition: transform 160ms ease, background-color 160ms ease;
}

:root[data-theme="dark"] .theme-toggle-knob {
  transform: translate(16px, -50%);
}

.theme-toggle-text {
  font-size: 0.88rem;
  font-weight: 700;
}

.danger-btn {
  background: var(--red);
}

.shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 24px;
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 36px) 48px;
}

.side-panel {
  position: sticky;
  top: 98px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.score-panel,
.mini-note,
.task,
.official-panel,
.source-panel,
.writing-panel,
.speaking-panel,
.overview-strip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.score-panel,
.mini-note {
  padding: 16px;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#scoreValue {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
  letter-spacing: 0;
}

.meter {
  height: 9px;
  margin: 12px 0;
  overflow: hidden;
  background: var(--meter-bg);
  border-radius: 999px;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 180ms ease;
}

.score-panel p,
.mini-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.section-nav {
  display: grid;
  gap: 8px;
}

.section-nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: var(--control);
  color: var(--ink);
  border-color: var(--line);
  text-align: left;
}

.section-nav button.active {
  color: var(--on-accent);
  background: var(--green);
  border-color: var(--green);
}

.nav-count {
  display: inline-flex;
  min-width: 28px;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--nav-count-bg);
  font-size: 0.76rem;
  font-weight: 700;
}

.workspace {
  min-width: 0;
}

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.page-head p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.timer {
  min-width: 86px;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1.1rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.exam-card {
  min-height: 178px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.exam-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-weak), var(--shadow);
}

.exam-card h2 {
  margin: 8px 0;
  font-size: 1.08rem;
  line-height: 1.25;
}

.exam-card p,
.muted {
  color: var(--muted);
}

.exam-card p {
  margin: 0;
  line-height: 1.45;
}

.tag-row,
.action-row,
.choice-row,
.status-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-weak);
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 700;
}

.tag.green {
  background: var(--green-weak);
  color: var(--green);
}

.tag.gold {
  background: var(--gold-weak);
  color: var(--gold);
}

.overview-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 18px;
  align-items: stretch;
  margin: 18px 0;
  padding: 16px;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.skill {
  min-height: 110px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control-soft);
}

.skill strong,
.mini-note strong {
  display: block;
  margin-bottom: 4px;
}

.skill p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.visual-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 170px;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(47, 125, 107, 0.92), rgba(49, 95, 150, 0.9)),
    url("assets/img/official/page-01.png") center / cover no-repeat;
  color: var(--on-accent);
}

.visual-panel span {
  z-index: 1;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.task-image {
  display: block;
  width: 100%;
  max-width: 760px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sheet {
  margin: 12px 0;
  padding: 16px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sheet-title {
  margin-bottom: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: var(--muted);
}

.sheet--paper {
  background: var(--paper);
}

.sheet-ads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.ad {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 210px;
  padding: 22px 20px 18px;
  background: var(--paper-card);
  border: 1px solid var(--paper-line);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(33, 46, 68, 0.07);
  overflow: hidden;
}

.ad-num {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 15px 0 14px 0;
  background: #5b6573;
  color: var(--on-accent);
  font-size: 0.9rem;
  font-weight: 800;
}

.ad-main {
  flex: 1;
}

.ad-title {
  margin: 4px 0 6px;
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.ad-sub {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.ad-line {
  margin: 6px 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ad-text);
}

.ad-line strong {
  color: var(--ink);
}

.ad-foot {
  margin: 14px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--paper-rule);
  color: var(--muted);
  font-size: 0.85rem;
}

/* per-ad "newspaper" character */
.ad--logo {
  text-align: center;
  align-items: center;
}

.ad--logo .ad-title {
  margin-top: 8px;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.ad--logo .ad-title::after {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: var(--paper-rule);
}

.ad--logo .ad-foot {
  width: 100%;
  text-align: center;
}

.ad--classified {
  background:
    repeating-linear-gradient(0deg, var(--paper-card), var(--paper-card) 27px, var(--paper-row) 27px, var(--paper-row) 28px);
}

.ad--classified .ad-title {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ad--contact .ad-title {
  font-size: 1.5rem;
  color: var(--green);
}

.ad--contact .ad-foot {
  font-weight: 700;
  color: var(--ink);
}

.ad--list .ad-line {
  padding-left: 2px;
}

.sheet-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tile {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0;
  aspect-ratio: 4 / 3;
  background: var(--paper-card);
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(33, 46, 68, 0.06);
  color: var(--green);
  overflow: hidden;
}

.tile-no {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border-radius: 11px 0 10px 0;
  background: #5b6573;
  color: var(--on-accent);
  font-size: 0.85rem;
  font-weight: 800;
}

.tile-ico svg {
  width: 68px;
  height: 68px;
}

.tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 720px) {
  .sheet-tiles {
    grid-template-columns: 1fr 1fr;
  }

  .sheet-ads {
    grid-template-columns: 1fr;
  }
}

.field-group small.field-solution {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--green);
}

.field-group.field-ok input {
  border-color: var(--green);
  background: var(--green-weak);
}

.field-group.field-bad input {
  border-color: var(--red);
  background: var(--red-weak);
}

.task,
.writing-panel,
.speaking-panel,
.official-panel,
.source-panel {
  margin-bottom: 16px;
  padding: 18px;
}

.task-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.task h2,
.writing-panel h2,
.speaking-panel h2,
.official-panel h2,
.source-panel h2 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.28;
}

.instructions {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.options-box,
.prompt-box,
.model-box,
.transcript-box {
  margin: 12px 0;
  padding: 14px;
  background: var(--control-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.options-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.options-list li {
  min-height: 64px;
  padding: 10px;
  background: var(--control);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.4;
}

.question-list {
  display: grid;
  gap: 10px;
}

.question {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.question:first-child {
  border-top: 0;
}

.question p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.question select {
  width: 100%;
}

.radio-group {
  display: grid;
  gap: 8px;
}

.radio-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
}

.feedback {
  grid-column: 1 / -1;
  padding: 9px 10px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.feedback.ok {
  background: var(--green-weak);
  color: var(--green);
}

.feedback.bad {
  background: var(--red-weak);
  color: var(--red);
}

.audio-panel {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.audio-panel audio {
  width: 100%;
}

.transcript-box {
  white-space: pre-wrap;
  line-height: 1.55;
}

.writing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-group {
  display: grid;
  gap: 6px;
}

.field-group.full {
  grid-column: 1 / -1;
}

.field-group label,
.check-row {
  color: var(--ink);
  font-weight: 700;
}

.check-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
}

.word-count {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
}

.speaking-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.speaking-card {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control-soft);
}

.speaking-card strong {
  display: block;
  margin-bottom: 6px;
}

.recording-player {
  display: none;
  width: 100%;
  margin-top: 10px;
}

.picture-prompt {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  max-width: 420px;
  margin: 12px 0;
}

.picture-prompt span {
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  font-weight: 700;
}

.official-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
}

.pdf-frame {
  width: 100%;
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.audio-list {
  display: grid;
  gap: 14px;
}

.source-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.source-list li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control-soft);
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  transform: translateX(-50%) translateY(120%);
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--toast-bg);
  color: var(--toast-ink);
  box-shadow: var(--shadow);
  transition: transform 180ms ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
    grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1fr);
  }

  .section-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mini-note {
    grid-column: 1 / -1;
  }

  .overview-grid,
  .skill-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .official-grid,
  .overview-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-head,
  .question,
  .side-panel,
  .writing-grid,
  .speaking-cards {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
  }

  .select-label,
  .top-actions select,
  .exam-badge {
    grid-column: 1 / -1;
  }

  .top-actions button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }

  .section-nav,
  .overview-grid,
  .skill-grid,
  .options-list {
    grid-template-columns: 1fr;
  }

  .page-head {
    display: grid;
  }

  .timer-box {
    justify-content: space-between;
  }

  .picture-prompt {
    grid-template-columns: 1fr;
  }
}

@media print {
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #ffffff;
    --panel: #ffffff;
    --panel-soft: #eef3f1;
    --control: #ffffff;
    --control-soft: #fbfcfd;
    --paper: #fcfcfa;
    --paper-soft: #fffdf7;
    --paper-card: #ffffff;
    --paper-line: #cfd6dd;
    --paper-rule: #d6dce3;
    --paper-row: #eef2f6;
    --ink: #20252d;
    --muted: #687483;
    --ad-text: #3a4250;
    --line: #d9e0e7;
    --shadow: none;
  }

  .topbar,
  .side-panel,
  .timer-box,
  .action-row,
  audio,
  .toast {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .shell {
    display: block;
    padding: 0;
  }

  .task,
  .writing-panel,
  .speaking-panel,
  .official-panel,
  .source-panel {
    box-shadow: none;
    break-inside: avoid;
  }
}

/* ---- AI speaking tutor ---------------------------------------------------- */
.ai-tutor {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.ai-tutor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.ai-tutor-head strong {
  color: var(--gold);
}

.ai-tutor-current {
  margin-top: 10px;
}

.ai-current-label {
  margin: 0 0 2px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.ai-current-card {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.ai-current-done {
  margin: 0 0 8px;
  color: var(--green);
}

.ai-tutor-status {
  margin-top: 10px;
  font-size: 0.92rem;
  color: var(--muted);
}

.ai-tutor-status.error {
  color: var(--red);
}

.ai-tutor-result {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.ai-block {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.ai-block-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.ai-block-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.ai-block-head .ai-block-label {
  margin-bottom: 0;
}

.ai-block p {
  margin: 0;
  line-height: 1.45;
}

.ai-block ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.45;
}

.ai-corrected {
  border-left: 3px solid var(--green);
}

.ai-mistakes {
  border-left: 3px solid var(--gold);
}

/* ---- AI writing checker (Schreiben Aufgabe 2) ----- */
.ai-writing {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.ai-writing-status {
  margin-top: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

.ai-writing-status.error {
  color: var(--red);
}

.ai-writing-result {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.ai-writing-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.ai-writing-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.ai-writing-item.ai-ok {
  border-left: 3px solid var(--green);
}

.ai-writing-item.ai-missing {
  border-left: 3px solid var(--red);
}

.ai-writing-icon {
  font-weight: 700;
  width: 1em;
}

.ai-writing-item.ai-ok .ai-writing-icon {
  color: var(--green);
}

.ai-writing-item.ai-missing .ai-writing-icon {
  color: var(--red);
}

.ai-writing-overall {
  margin: 0;
  color: var(--ink);
}

.ai-writing-score {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
}

.ai-writing-score.low {
  border-left-color: var(--red);
}

.ai-writing-score strong {
  font-size: 1.4rem;
  color: var(--ink);
}

/* ---- Sprechen exam mode + per-card score list ---- */
.exam-mode-hint {
  margin: 10px 0 4px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  border: 1px dashed var(--line);
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.exam-mode-count {
  color: var(--muted);
}
.exam-mode-count.is-ready {
  color: var(--green);
  font-weight: 600;
}

.speaking-card.selectable {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.speaking-card.selectable input[type="checkbox"] {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.speaking-card.selectable.is-selected {
  border-color: var(--green);
  background: var(--green-weak);
}

.speaking-score-cards {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}

.speaking-score-cards li {
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  line-height: 1.35;
}

/* ---- Vocabulary: top-bar button + toggle ----- */
.vocab-btn .vocab-count {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--green);
  color: var(--on-accent);
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 1.4em;
  text-align: center;
}

.translate-toggle.is-on {
  background: var(--green);
  color: var(--on-accent);
  border-color: var(--green);
}

body.translate-mode #app {
  cursor: help;
}

/* ---- Translation popover ----- */
.translate-popover {
  position: fixed;
  z-index: 1000;
  min-width: 240px;
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
}

.translate-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.translate-word {
  color: var(--green);
  font-size: 1.05rem;
}

.translate-close {
  background: transparent;
  border: 0;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}

.translate-en {
  margin: 0 0 6px;
  color: var(--ink);
}

.translate-examples {
  margin: 0 0 6px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.translate-examples li + li {
  margin-top: 2px;
}

.translate-status {
  margin-top: 6px;
  font-size: 0.85rem;
}

.speaker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-left: 4px;
  padding: 2px 4px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
}

.speaker-btn:hover,
.speaker-btn:focus-visible {
  color: var(--green);
  background: var(--panel-soft);
  outline: none;
}

.link-btn {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--green);
  text-decoration: underline;
  font: inherit;
}

/* ---- Vocab modal ----- */
.vocab-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 45, 0.45);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.vocab-modal {
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(560px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vocab-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.vocab-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--line);
}

.vocab-tab {
  background: transparent;
  border: 0;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  border-bottom: 2px solid transparent;
}

.vocab-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--green);
}

.vocab-modal-body {
  padding: 16px 18px;
  overflow: auto;
}

/* ---- Flashcards ----- */
.flash-progress {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.flash-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 18px;
  background: var(--panel-soft);
  text-align: center;
  cursor: pointer;
  user-select: none;
  min-height: 140px;
}

.flash-word {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--green);
}

.flash-en {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.flash-examples {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: left;
  line-height: 1.4;
}

.flash-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.flash-actions button {
  flex: 1;
}

.flash-again { border-left: 3px solid var(--red); }
.flash-good  { border-left: 3px solid var(--gold); }
.flash-easy  { border-left: 3px solid var(--green); }

.flash-done {
  margin: 0 0 10px;
  color: var(--green);
  font-weight: 600;
}

/* ---- Alle Wörter list ----- */
.vocab-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.vocab-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}
