:root {
  --ink: #08202e;
  --muted: #41504a;
  --line: #9c833d;
  --panel: #fff3c8;
  --surface: #ead69a;
  --space: #031522;
  --space-soft: #08283a;
  --cream: #ffe5a9;
  --teal: #197b78;
  --teal-dark: #0f5552;
  --gold: #d29a32;
  --blue: #247a8a;
  --violet: #6e8e3d;
  --red: #b34b36;
  --green: #73aa44;
  --shadow: 0 18px 0 rgba(3, 21, 34, 0.12), 0 28px 50px rgba(3, 21, 34, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 241, 191, 0.75) 0 1px, transparent 2px),
    radial-gradient(circle at 80% 2%, rgba(134, 99, 34, 0.18), transparent 28%),
    linear-gradient(135deg, #f5df9f, #dfc27a);
  font-family: "Arial Narrow", "Roboto Condensed", Arial, Helvetica, sans-serif;
}

body,
button,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  border: 10px solid var(--cream);
  box-shadow: inset 0 0 0 2px #5f5a2d, inset 0 0 0 5px #d0b564;
}

.sidebar {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 219, 131, 0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 42%, rgba(255, 229, 169, 0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 36% 72%, rgba(255, 229, 169, 0.75) 0 1px, transparent 2px),
    linear-gradient(160deg, #041624, #09283a 58%, #051620);
  color: #f7e6b8;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 3px solid var(--line);
}

.brand {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 2px solid var(--cream);
  background: var(--green);
  color: var(--space);
  font-family: Impact, "Arial Black", sans-serif;
  font-weight: 900;
  letter-spacing: 1px;
  border-radius: 2px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.28);
}

.eyebrow,
.sidebar-label,
.small-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.6px;
  line-height: 1.4;
  text-transform: uppercase;
}

.sidebar .eyebrow,
.sidebar-label {
  color: #86b950;
}

.panel .eyebrow,
.exam-toolbar .eyebrow,
.section-title .eyebrow,
.small-note {
  color: #3e4d35;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--cream);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 8px;
  color: var(--cream);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.24);
}

h3 {
  margin-bottom: 0;
  color: var(--ink);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-tabs {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.language-tabs {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.language-tabs a {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 229, 169, 0.38);
  border-radius: 2px;
  color: #f3dca4;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.language-tabs a.active,
.language-tabs a:hover {
  color: var(--space);
  background: var(--cream);
}

.nav-button,
.primary-button,
.secondary-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.nav-button {
  min-height: 44px;
  text-align: left;
  color: #f5dfad;
  background: rgba(255, 229, 169, 0.04);
  border: 1px solid rgba(255, 229, 169, 0.16);
  border-radius: 2px;
  padding: 0 12px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.nav-button.active,
.nav-button:hover {
  color: var(--space);
  background: var(--green);
  border-color: var(--cream);
}

.sidebar-panel {
  position: relative;
  z-index: 1;
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.login-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

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

.auth-tabs button {
  min-height: 32px;
  border: 1px solid rgba(255, 229, 169, 0.38);
  border-radius: 2px;
  color: var(--cream);
  background: rgba(18, 51, 67, 0.72);
  font-size: 11px;
  font-weight: 900;
}

.auth-tabs button.active,
.auth-tabs button:hover {
  color: var(--space);
  background: var(--green);
  border-color: var(--cream);
}

select,
.login-panel input {
  min-height: 44px;
  width: 100%;
  border: 1px solid rgba(255, 229, 169, 0.4);
  border-radius: 2px;
  color: var(--cream);
  background: #123343;
  padding: 0 10px;
  font-weight: 800;
}

.login-panel input::placeholder {
  color: rgba(255, 229, 169, 0.66);
}

.login-panel .compact-button {
  color: var(--space);
  background: var(--cream);
  border-radius: 2px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.22);
}

.login-status {
  margin: 0;
  color: #f3dca4;
  font-size: 12px;
  line-height: 1.45;
}

.main {
  min-width: 0;
  padding: 28px;
  background:
    radial-gradient(circle at 8% 11%, rgba(3, 21, 34, 0.05) 0 1px, transparent 2px),
    radial-gradient(circle at 95% 15%, rgba(3, 21, 34, 0.06) 0 1px, transparent 2px),
    linear-gradient(180deg, rgba(255, 240, 197, 0.72), rgba(246, 224, 165, 0.62));
}

.topbar,
.hero-panel,
.panel,
.exam-toolbar {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.34), transparent 0 16%),
    linear-gradient(180deg, #fff6d5, #f3d88e);
  border: 2px solid #6f6130;
  border-radius: 2px;
  box-shadow: var(--shadow);
}

.topbar {
  background:
    radial-gradient(circle at 18% 32%, rgba(255, 229, 169, 0.75) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 18%, rgba(255, 229, 169, 0.65) 0 1px, transparent 2px),
    linear-gradient(135deg, #061b2b, #092e41);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 20px;
  margin-bottom: 20px;
  color: var(--cream);
}

.topbar .eyebrow {
  color: var(--green);
}

.topbar h2 {
  margin-bottom: 0;
}

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

.metric {
  min-width: 108px;
  border: 1px solid rgba(255, 229, 169, 0.42);
  border-radius: 2px;
  background: rgba(255, 229, 169, 0.14);
  padding: 10px;
}

.metric span {
  display: block;
  color: #9cc65b;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 4px;
  color: var(--cream);
  font-size: 18px;
}

.timer strong {
  color: var(--gold);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  gap: 24px;
  align-items: stretch;
  padding: 24px;
  overflow: hidden;
  min-height: 370px;
  background:
    radial-gradient(circle at 13% 24%, rgba(255, 229, 169, 0.92) 0 1px, transparent 2px),
    radial-gradient(circle at 37% 35%, rgba(255, 229, 169, 0.86) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 13%, rgba(255, 229, 169, 0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 84% 54%, rgba(255, 229, 169, 0.7) 0 1px, transparent 2px),
    linear-gradient(150deg, #031522, #08293a 55%, #041723);
  border: 6px solid var(--cream);
  outline: 2px solid #5f5a2d;
  outline-offset: 4px;
}

.hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.hero-copy p {
  max-width: 700px;
  color: #f6dca7;
  line-height: 1.6;
  font-size: 17px;
}

.hero-copy .eyebrow {
  color: var(--green);
}

.hero-copy h2 {
  max-width: 900px;
  font-size: clamp(42px, 7vw, 92px);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 2px;
  padding: 0 16px;
  border: 2px solid var(--space);
  font-weight: 900;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.24);
}

.primary-button {
  background: var(--green);
  color: var(--space);
}

.primary-button:hover {
  background: var(--cream);
}

.secondary-button {
  background: var(--cream);
  color: var(--space);
}

.text-button {
  color: #7c5313;
  background: transparent;
  font-weight: 900;
  text-transform: uppercase;
}

.exam-card {
  position: relative;
  z-index: 1;
  min-height: 220px;
  border-radius: 2px;
  padding: 18px;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 229, 169, 0.8) 0 1px, transparent 2px),
    linear-gradient(145deg, rgba(255, 243, 200, 0.98), rgba(236, 197, 111, 0.94));
  border: 2px solid var(--cream);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.22);
}

.card-header,
.section-title,
.exam-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.section-title > span {
  color: #071f2d;
  font-weight: 900;
}

.panel h3,
.exam-toolbar h3,
.section-title h3 {
  color: #071f2d;
}

.card-header span {
  color: #35692c;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.card-header strong {
  color: #0a2c35;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 34px;
}

.progress-track {
  height: 10px;
  background: rgba(8, 32, 46, 0.16);
  border-radius: 999px;
  overflow: hidden;
  margin: 22px 0 8px;
}

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

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.75fr);
  gap: 20px;
  margin-top: 20px;
}

.panel,
.exam-toolbar {
  padding: 20px;
}

.topic-list,
.attempt-list,
.library-list,
.question-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.topic-item,
.attempt-item,
.library-item,
.question-card,
.topic-score-card {
  border: 2px solid rgba(92, 78, 33, 0.72);
  border-radius: 2px;
  background:
    linear-gradient(180deg, #fff8df, #fceab6);
  padding: 16px;
}

.topic-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.topic-item strong,
.attempt-item strong,
.library-item strong {
  display: block;
  margin-bottom: 4px;
  color: #071f2d;
  font-weight: 900;
}

.topic-item span,
.attempt-item span,
.library-item span {
  color: #31423d;
  font-size: 13px;
  line-height: 1.5;
}

.pill {
  align-self: start;
  border-radius: 2px;
  background: var(--space);
  color: #ffdc76;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid #ffdc76;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.16);
}

.topic-item .pill {
  color: #ffeaa8;
}

.exam-toolbar {
  margin-bottom: 16px;
}

.question-card fieldset {
  border: 0;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.question-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #577a30;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.question-card legend {
  padding: 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.45;
}

.study-text {
  min-width: 0;
  display: grid;
  gap: 4px;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.study-text span {
  display: block;
}

.option-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  border: 2px solid rgba(138, 121, 58, 0.5);
  border-radius: 2px;
  padding: 10px;
  cursor: pointer;
}

.option-row:hover {
  border-color: var(--green);
  background: #fff8df;
}

.option-row.correct {
  border-color: rgba(31, 138, 76, 0.55);
  background: rgba(31, 138, 76, 0.08);
}

.option-row.incorrect {
  border-color: rgba(179, 52, 47, 0.55);
  background: rgba(179, 52, 47, 0.08);
}

.explanation {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

#reviewView {
  max-width: 760px;
  margin: 0 auto;
}

#reviewView > .section-title {
  margin-bottom: 14px;
}

.review-summary {
  margin-top: 28px;
  border: 1px solid #d7dee9;
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(90deg, #edf6ff, #f7f4ff);
  padding: 18px 24px;
  box-shadow: 0 18px 44px rgba(20, 35, 52, 0.09);
}

.report-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 154px;
  gap: 30px;
  align-items: start;
  margin-top: 16px;
  padding: 32px 34px 24px;
  border: 1px solid #d7dce4;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  color: #132331;
  box-shadow: 0 18px 38px rgba(20, 35, 52, 0.12), 0 2px 0 rgba(255, 255, 255, 0.85) inset;
}

.report-main {
  min-width: 0;
}

.report-card h3 {
  margin-bottom: 8px;
  color: #102436;
  font-size: 25px;
  letter-spacing: 0;
}

.report-card p {
  max-width: 680px;
  color: #4c5d6b;
  line-height: 1.75;
  margin-bottom: 0;
}

.report-card-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.report-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 14px;
  border: 1px solid rgba(57, 131, 238, 0.18);
  border-radius: 999px;
  background: #eef7ff;
  color: #2d63d8;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.report-subtitle {
  color: #26384b;
  font-weight: 900;
}

.report-badge.is-fail {
  background: #fff3e3;
  border-color: rgba(220, 151, 41, 0.24);
  color: #9b6414;
}

.report-meta {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 8px 0 18px;
  border-radius: 999px;
  background: #f3f7ff;
  color: #27354c;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.report-copy {
  margin-bottom: 0;
}

.compact-button {
  min-height: 34px;
  border: 1px solid rgba(127, 146, 164, 0.34);
  border-radius: 10px;
  background: #ffffff;
  color: #182b3d;
  padding: 0 13px;
  box-shadow: 0 8px 18px rgba(23, 33, 43, 0.1);
}

.score-ring {
  width: 152px;
  height: 152px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#3b82f6 var(--score-angle), #edf2f7 0);
  box-shadow: 0 20px 38px rgba(20, 35, 52, 0.16);
}

.score-ring-inner {
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(127, 146, 164, 0.16);
}

.score-ring strong {
  display: block;
  color: #2f6fe6;
  font-size: 46px;
  line-height: 1;
}

.score-ring span {
  color: #6f7f91;
  font-size: 14px;
  font-weight: 800;
}

.bar-chart {
  grid-column: 1 / -1;
  margin: 30px -8px 0;
  padding: 24px 28px 16px;
  border: 1px solid #dce2ea;
  border-radius: 18px;
  background: #ffffff;
}

.bar-chart > strong {
  display: block;
  margin-bottom: 18px;
  color: #1d3042;
}

.bar-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 44px;
  gap: 14px;
  align-items: center;
  margin: 15px 0;
}

.bar-label,
.bar-value {
  color: #4b5e71;
  font-size: 12px;
  font-weight: 800;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #f0f3f8;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.bar-fill.level-1 {
  background: var(--red);
}

.bar-fill.level-2 {
  background: var(--gold);
}

.bar-fill.level-3 {
  background: var(--teal);
}

.bar-fill.level-4 {
  background: var(--green);
}

.bar-chart .bar-row:nth-of-type(4n + 1) .bar-fill {
  background: #3b82f6;
}

.bar-chart .bar-row:nth-of-type(4n + 2) .bar-fill {
  background: #14b8a6;
}

.bar-chart .bar-row:nth-of-type(4n + 3) .bar-fill {
  background: #f59e0b;
}

.bar-chart .bar-row:nth-of-type(4n + 4) .bar-fill {
  background: #8b5cf6;
}

.detail-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #172b3f;
}

.detail-heading strong {
  font-size: 16px;
}

.detail-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #3857f4;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(56, 87, 244, 0.28);
}

.topic-report {
  display: grid;
  gap: 14px;
  margin-top: 0;
  border: 1px solid #d7dee9;
  border-top: 0;
  border-radius: 0 0 24px 24px;
  background: #f1f7ff;
  padding: 18px 20px 22px;
  box-shadow: 0 18px 44px rgba(20, 35, 52, 0.09);
}

.topic-score-card {
  border: 1px solid #dbe6f4;
  border-radius: 12px;
  background: #eef6ff;
  padding: 17px 18px;
}

.topic-score-card.level-strong {
  background: #edf9f4;
}

.topic-score-card.level-developing {
  background: #f6f8ff;
}

.topic-score-card.level-weak {
  background: #eef6ff;
}

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

.topic-score-head strong {
  display: block;
  color: #102436;
  font-size: 15px;
}

.topic-score-head span {
  border: 1px solid rgba(127, 146, 164, 0.22);
  border-radius: 999px;
  background: #ffffff;
  color: #102436;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.topic-score-card p {
  margin: 13px 0 0;
  color: #3e5264;
  line-height: 1.65;
  font-size: 13px;
}

.topic-score-card .bar-fill {
  background: #2f80ed;
}

.library-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.library-item a {
  color: #6b4a12;
  font-weight: 900;
  text-decoration: none;
}

.empty-state {
  color: var(--muted);
  border: 2px dashed rgba(138, 121, 58, 0.52);
  border-radius: 2px;
  padding: 18px;
  background: rgba(255, 244, 207, 0.7);
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) body {
  font-size: 17px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) :is(.eyebrow, .sidebar-label, .small-note) {
  font-size: 13px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) h1 {
  font-size: 23px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) h2 {
  font-size: 45px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) h3 {
  font-size: 25px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) .language-tabs a {
  font-size: 14px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) :is(.metric span, .login-status, .report-badge, .report-meta, .bar-label, .bar-value, .topic-score-head span) {
  font-size: 13px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) .metric strong {
  font-size: 19px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) .hero-copy p {
  font-size: 18px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) .hero-copy h2 {
  font-size: clamp(43px, 7vw, 93px);
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) .card-header strong {
  font-size: 35px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) :is(.topic-item span, .attempt-item span, .library-item span, .question-title, .topic-score-card p) {
  font-size: 14px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) .pill {
  font-size: 13px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) .report-card h3 {
  font-size: 26px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) .score-ring strong {
  font-size: 47px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) .score-ring span {
  font-size: 15px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) :is(.detail-heading strong, .detail-icon) {
  font-size: 17px;
}

:where(html[lang="zh-Hant"], html[lang="zh-cn"]) .topic-score-head strong {
  font-size: 16px;
}

@media (max-width: 940px) {
  body {
    background:
      radial-gradient(circle at 12% 18%, rgba(255, 241, 191, 0.75) 0 1px, transparent 2px),
      linear-gradient(135deg, #f5df9f, #dfc27a);
  }

  .app-shell {
    grid-template-columns: 1fr;
    border-width: 6px;
  }

  .sidebar {
    position: static;
    padding: 18px;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(280px, 1fr);
    gap: 16px;
    border-right: 0;
    border-bottom: 3px solid var(--line);
  }

  .nav-tabs {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    order: 4;
  }

  .nav-button {
    text-align: center;
    padding: 0 8px;
  }

  .language-tabs {
    align-self: start;
  }

  .login-panel,
  .sidebar-panel {
    margin-top: 0;
  }

  .topbar,
  .hero-panel,
  .content-grid {
    grid-template-columns: 1fr;
  }

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

  .hero-panel {
    min-height: 0;
    padding: 22px;
  }

  .hero-copy h2 {
    font-size: clamp(38px, 8vw, 68px);
  }

  .exam-card {
    min-height: 0;
  }

  .report-card {
    grid-template-columns: minmax(0, 1fr) 138px;
  }

  .score-ring {
    width: 138px;
    height: 138px;
  }

  .score-ring-inner {
    width: 114px;
    height: 114px;
  }
}

@media (max-width: 620px) {
  body {
    background: linear-gradient(180deg, #f5df9f, #dfc27a);
  }

  .app-shell {
    min-height: 100svh;
    display: block;
    border-width: 0;
    box-shadow: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    border-bottom-width: 2px;
  }

  .brand {
    grid-template-columns: 42px 1fr;
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  h1 {
    font-size: 18px;
  }

  h2 {
    font-size: 34px;
    line-height: 1;
  }

  h3 {
    font-size: 21px;
  }

  .main {
    padding: 14px;
  }

  .status-grid,
  .review-summary,
  .report-card {
    grid-template-columns: 1fr;
  }

  .topbar,
  .hero-panel,
  .panel,
  .exam-toolbar {
    box-shadow: 6px 8px 0 rgba(3, 21, 34, 0.12), 0 18px 34px rgba(3, 21, 34, 0.16);
  }

  .topbar {
    gap: 14px;
    padding: 16px;
    margin-bottom: 14px;
  }

  .status-grid {
    gap: 8px;
  }

  .metric {
    min-width: 0;
    padding: 9px 10px;
  }

  .hero-panel {
    padding: 18px;
    border-width: 4px;
    outline-offset: 2px;
  }

  .hero-copy h2,
  :where(html[lang="zh-Hant"], html[lang="zh-cn"]) .hero-copy h2 {
    font-size: 36px;
    line-height: 1.03;
  }

  .hero-copy p {
    font-size: 15px;
    line-height: 1.55;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
  }

  .panel,
  .exam-toolbar {
    padding: 16px;
  }

  .topic-item {
    grid-template-columns: 1fr;
  }

  .pill {
    justify-self: start;
  }

  .question-card,
  .topic-item,
  .attempt-item,
  .library-item,
  .topic-score-card {
    padding: 14px;
  }

  .question-title {
    display: grid;
    gap: 4px;
  }

  .option-row {
    grid-template-columns: 22px minmax(0, 1fr);
    padding: 12px 10px;
    min-height: 46px;
  }

  .report-card {
    padding: 24px 20px;
  }

  .score-ring {
    justify-self: start;
  }

  .bar-chart {
    margin: 22px 0 0;
    padding: 18px;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-button {
    min-height: 42px;
    font-size: 12px;
    letter-spacing: 0.2px;
    white-space: normal;
  }

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

  .language-tabs a {
    min-height: 38px;
  }

  select,
  .login-panel input {
    min-height: 46px;
  }

  .card-header,
  .section-title,
  .report-card-top,
  .exam-toolbar,
  .library-item {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 380px) {
  .main {
    padding: 10px;
  }

  .sidebar {
    padding: 12px;
  }

  .hero-copy h2,
  :where(html[lang="zh-Hant"], html[lang="zh-cn"]) .hero-copy h2 {
    font-size: 31px;
  }

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