:root {
  color-scheme: light;
  --ink: #10242d;
  --muted: #687985;
  --panel: #ffffff;
  --soft: #f4f8fa;
  --line: #dce7eb;
  --line-strong: #bfd2d8;
  --teal: #007784;
  --teal-dark: #005f6b;
  --blue: #226fd1;
  --amber: #f2a51a;
  --red: #df4a4a;
  --green: #1d9c74;
  --shadow: 0 16px 44px rgba(17, 54, 66, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #f6f9fb;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(0, 119, 132, 0.06), transparent 34%),
    #f6f9fb;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

button,
select {
  border-radius: var(--radius);
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 100vw;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: rgba(255, 255, 255, 0.86);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 30px rgba(16, 36, 45, 0.04);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-flag {
  display: grid;
  width: 34px;
  height: 23px;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(16, 36, 45, 0.14);
}

.brand-flag span:nth-child(1) { background: #111; }
.brand-flag span:nth-child(2) { background: #dd2830; }
.brand-flag span:nth-child(3) { background: #f4c744; }

.brand strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.side-nav {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.side-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #31444d;
  font-weight: 780;
  text-align: left;
  overflow-wrap: anywhere;
}

.side-nav button span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: var(--teal);
  background: #e6f4f6;
  font-size: 12px;
  font-weight: 900;
}

.side-nav button.active,
.side-nav button:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  box-shadow: 0 12px 26px rgba(0, 119, 132, 0.18);
}

.side-nav button.active span,
.side-nav button:hover span {
  color: var(--teal-dark);
  background: #fff;
}

.side-meter {
  margin-top: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.side-meter p,
.side-meter small {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.side-meter strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
}

.mini-bar {
  height: 8px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 99px;
  background: #dfe9ed;
}

.mini-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--teal);
  transition: width 220ms ease;
}

.workspace {
  min-width: 0;
  padding: 22px 24px 32px;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding-bottom: 18px;
  min-width: 0;
  max-width: 100%;
}

.topbar h1,
.panel-heading h2,
.module-roadmap h2,
.home-hero h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar > div:first-child,
.panel-heading > div:first-child {
  min-width: 0;
}

.topbar h1 {
  font-size: 30px;
  line-height: 1.2;
}

.topbar p,
.panel-heading p,
.module-roadmap p,
.home-hero p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.65;
  max-width: 100%;
  overflow-wrap: anywhere;
}

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

.level-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--teal);
  font-weight: 850;
  white-space: nowrap;
}

.status-pill.local {
  color: var(--amber);
}

.control-strip {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(150px, 0.8fr) minmax(140px, 0.7fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  min-width: 0;
}

.control-strip label {
  display: grid;
  gap: 7px;
  color: #40515a;
  font-size: 13px;
  font-weight: 800;
  min-width: 0;
}

.control-strip select,
.pattern-select {
  min-height: 42px;
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  outline: none;
}

.primary-action,
.panel-actions button,
.panel-heading > button,
.check-one,
.vocab-action {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--teal);
  font-weight: 850;
}

.primary-action {
  min-width: 138px;
  padding: 0 18px;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  box-shadow: 0 12px 26px rgba(0, 119, 132, 0.18);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.main-grid.home-mode {
  grid-template-columns: minmax(0, 1fr);
}

.main-grid.home-mode .inspector {
  display: none;
}

.content-panel,
.inspector-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.content-panel {
  display: none;
  min-width: 0;
  max-width: 100%;
  padding: 18px;
}

.content-panel.panel-active {
  display: block;
}

.home-panel {
  min-height: 520px;
}

.home-summary {
  display: grid;
  gap: 16px;
}

.home-hero {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid rgba(0, 119, 132, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(0, 119, 132, 0.1), rgba(34, 111, 209, 0.06)),
    #f8fbfc;
}

.home-hero h3 {
  max-width: 760px;
  font-size: 28px;
  line-height: 1.25;
}

.home-hero .level-chip {
  width: fit-content;
}

.exam-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.exam-stat-row span {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--muted);
  font-size: 14px;
}

.exam-stat-row strong {
  color: var(--ink);
  font-size: 16px;
}

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

.exam-section-card {
  display: grid;
  gap: 12px;
  min-height: 310px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  border-top: 4px solid var(--teal);
}

.exam-section-card.listening {
  border-top-color: var(--blue);
}

.exam-section-card.writing {
  border-top-color: var(--amber);
}

.exam-section-card.speaking {
  border-top-color: var(--green);
}

.exam-section-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.exam-section-head > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: #e6f4f6;
  color: var(--teal);
  font-weight: 900;
}

.exam-section-card.listening .exam-section-head > span {
  background: rgba(34, 111, 209, 0.1);
  color: var(--blue);
}

.exam-section-card.writing .exam-section-head > span {
  background: rgba(242, 165, 26, 0.14);
  color: #996100;
}

.exam-section-card.speaking .exam-section-head > span {
  background: rgba(29, 156, 116, 0.1);
  color: var(--green);
}

.exam-section-head strong {
  display: block;
  font-size: 19px;
  line-height: 1.3;
}

.exam-section-head small,
.exam-section-card p,
.prep-strip p {
  color: var(--muted);
  line-height: 1.5;
}

.exam-section-card p,
.prep-strip p {
  margin: 0;
}

.exam-section-card ul {
  margin: 0;
  padding-left: 20px;
  color: #40515a;
  line-height: 1.65;
}

.exam-section-card button,
.prep-strip button {
  align-self: end;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--teal);
  font-weight: 850;
}

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

.prep-strip article {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.prep-strip strong {
  font-size: 17px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-actions button,
.panel-heading > button,
.check-one,
.vocab-action {
  padding: 0 12px;
}

.part-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.part-tabs button {
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: #40515a;
  font-weight: 840;
}

.part-tabs button.active {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.part-tabs button.generated:not(.active) {
  border-color: rgba(32, 134, 132, 0.45);
  background: #edf8f6;
  color: var(--teal);
}

.loading-state {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
}

.reading-progress-panel {
  width: min(560px, 100%);
  display: grid;
  gap: 12px;
}

.reading-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.reading-progress-head p,
.reading-progress-head strong {
  margin: 0;
}

.reading-progress-head strong {
  color: var(--teal);
  font-size: 18px;
}

.reading-progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #dfe9ed;
}

.reading-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 260ms ease;
}

.reading-progress-parts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.reading-progress-parts span {
  min-height: 48px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.reading-progress-parts small {
  font-size: 11px;
  font-weight: 800;
}

.reading-progress-parts span.active {
  border-color: var(--teal);
  color: var(--teal);
  background: #edf8f6;
}

.reading-progress-parts span.done {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #dce8ec;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.exercise-stack {
  display: grid;
  gap: 18px;
}

.empty-workbench {
  grid-column: 1 / -1;
  display: grid;
  place-items: start;
  gap: 8px;
  min-height: 180px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--soft);
}

.empty-workbench h3,
.empty-workbench p {
  margin: 0;
}

.empty-workbench p {
  color: var(--muted);
  line-height: 1.6;
}

.reading-part {
  scroll-margin-top: 22px;
  display: grid;
  gap: 16px;
}

.part-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: #eff7f8;
}

.part-header h3 {
  margin: 0;
  font-size: 21px;
}

.part-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.time-badge {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: #fff;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.text-block,
.article,
.ad-list,
.comment-list,
.question-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.text-block,
.article {
  padding: 18px;
}

.text-block h4,
.article h4,
.question-block h4,
.inspector-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.text-block p,
.article p,
.ad-card p,
.comment-card p {
  margin: 0;
  line-height: 1.78;
}

.text-block p + p,
.article p + p {
  margin-top: 14px;
}

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

.situation-list,
.ad-list,
.comment-list,
.question-list {
  display: grid;
  gap: 10px;
}

.situation-list {
  margin-bottom: 12px;
}

.situation-row,
.ad-card,
.comment-card,
.question-block {
  padding: 14px;
}

.situation-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.num-chip,
.ad-key {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: #fff;
  background: var(--teal);
  font-weight: 900;
}

.ad-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
}

.ad-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.ad-card h4,
.comment-card h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.comment-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
}

.comment-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.question-block {
  display: grid;
  gap: 11px;
}

.question-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 790;
  line-height: 1.5;
}

.question-title span {
  flex: 0 0 auto;
}

.choice-set {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.choice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  cursor: pointer;
}

.choice-row input {
  accent-color: var(--teal);
}

.choice-row.correct {
  border-color: rgba(29, 156, 116, 0.5);
  background: rgba(29, 156, 116, 0.09);
}

.choice-row.wrong {
  border-color: rgba(223, 74, 74, 0.45);
  background: rgba(223, 74, 74, 0.08);
}

.result-hint {
  display: none;
  padding: 10px;
  border-radius: var(--radius);
  background: #fff7e6;
  color: #6c4a06;
  line-height: 1.55;
  font-size: 14px;
}

.submitted .result-hint {
  display: block;
}

.inspector {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.inspector-card {
  padding: 16px;
}

.score-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.score-ring {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  align-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: conic-gradient(var(--teal) 0deg, #dce8ec 0deg);
}

.score-ring strong {
  font-size: 24px;
  line-height: 1;
}

.score-ring span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.score-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.score-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.part-progress,
.result-list {
  display: grid;
  gap: 8px;
}

.progress-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  color: #40515a;
  font-size: 13px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #dfe9ed;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.result-item {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 13px;
  line-height: 1.45;
}

.result-item strong {
  color: var(--red);
}

.result-item.correct strong {
  color: var(--green);
}

.empty-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

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

.vocab-card,
.pattern-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.vocab-card.mastered {
  border-color: rgba(29, 156, 116, 0.4);
  background: rgba(29, 156, 116, 0.06);
}

.vocab-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.vocab-card p,
.pattern-card p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.65;
}

.vocab-action {
  width: 100%;
}

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

.pattern-card {
  display: grid;
  gap: 10px;
}

.pattern-result {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.pattern-card.correct {
  border-color: rgba(29, 156, 116, 0.45);
}

.pattern-card.wrong {
  border-color: rgba(223, 74, 74, 0.45);
}

.module-roadmap {
  padding: 24px;
}

.roadmap-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.roadmap-grid span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--teal);
  font-weight: 800;
}

.module-workbench {
  display: none;
}

.module-status {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.module-status.error {
  border-color: rgba(223, 74, 74, 0.4);
  background: rgba(223, 74, 74, 0.08);
  color: #8f2727;
}

.module-stack,
.feedback-grid,
.criteria-grid {
  display: grid;
  gap: 12px;
}

.task-card,
.feedback-card,
.criteria-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.task-card {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

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

.task-head h3,
.feedback-card h3,
.grade-summary h3 {
  margin: 0 0 5px;
  font-size: 18px;
}

.task-head p,
.feedback-card p,
.grade-summary p,
.task-situation,
.task-tip {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.prompt-box,
.transcript-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  line-height: 1.7;
}

.prompt-box p,
.transcript-box p {
  margin: 0 0 8px;
}

.bullet-list {
  margin: 0;
  padding-left: 20px;
  color: #40515a;
  line-height: 1.7;
}

.free-response {
  display: grid;
  gap: 7px;
  color: #40515a;
  font-size: 13px;
  font-weight: 800;
}

.free-response textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  outline: none;
  line-height: 1.65;
}

.free-response textarea:focus,
.control-strip select:focus,
.pattern-select:focus {
  border-color: rgba(0, 119, 132, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 119, 132, 0.08);
}

.slide-grid,
.split-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.slide-card,
.split-list > div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.slide-card span,
.split-list p {
  color: var(--muted);
  line-height: 1.55;
}

.split-list h4,
.split-list p {
  margin: 0;
}

.module-audio {
  width: 100%;
  margin: 12px 0;
}

.audio-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(130px, auto);
  align-items: center;
  gap: 10px;
}

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

.audio-row span {
  color: var(--muted);
  font-size: 13px;
}

.listening-step-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--soft);
}

.listening-step-card h3,
.listening-step-card p {
  margin: 0;
}

.listening-step-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}

.listening-step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.listening-step-meta span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

.listening-next-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compact-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grade-output {
  margin-top: 14px;
}

.grade-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.small-ring {
  width: 72px;
  height: 72px;
}

.small-ring strong {
  font-size: 21px;
}

.criteria-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.criteria-grid article {
  display: grid;
  gap: 5px;
}

.criteria-grid strong {
  color: var(--teal);
}

.criteria-grid span {
  font-weight: 900;
}

.criteria-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

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

.feedback-card details {
  margin-top: 8px;
}

.feedback-card summary {
  color: var(--teal);
  cursor: pointer;
  font-weight: 850;
}

.answer-correct {
  border-color: rgba(29, 156, 116, 0.45);
}

.answer-wrong {
  border-color: rgba(223, 74, 74, 0.45);
}

.answer-correct .result-hint,
.answer-wrong .result-hint {
  display: block;
}

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

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .side-meter {
    display: none;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .inspector {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .workspace {
    padding: 16px;
    width: 100%;
    max-width: 100vw;
  }

  .topbar,
  .panel-heading,
  .score-card {
    flex-direction: column;
    align-items: stretch;
  }

  .status-cluster {
    justify-content: flex-start;
  }

  .level-chip,
  .status-pill {
    max-width: 100%;
    white-space: normal;
  }

  .control-strip,
  .article-grid,
  .ad-list,
  .comment-list,
  .vocab-grid,
  .pattern-list,
  .exam-stat-row,
  .exam-section-grid,
  .prep-strip,
  .inspector,
  .slide-grid,
  .split-list,
  .criteria-grid,
  .feedback-grid,
  .audio-row {
    grid-template-columns: 1fr;
  }

  .part-tabs,
  .reading-progress-parts,
  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: calc(100vw - 40px);
  }

  .side-nav button {
    gap: 8px;
    padding: 0 8px;
    width: 100%;
  }

  .choice-set {
    grid-template-columns: 1fr;
  }

  .panel-actions {
    justify-content: stretch;
  }

  .panel-actions button,
  .primary-action {
    width: 100%;
  }

  .task-head,
  .grade-summary {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 520px) {
  .sidebar {
    padding: 16px 24px 16px 16px;
  }

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

  .part-tabs {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 25px;
  }
}
