:root {
  color-scheme: light;
  --ink: #0f172a;
  --muted: #64748b;
  --subtle: #94a3b8;
  --line: #e2e8f0;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --page: #f3f6fb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-line: #bfdbfe;
  --warning: #b7791f;
  --danger: #b65a4f;
  --success: #15803d;
  --focus: 0 0 0 3px rgba(37, 99, 235, 0.14);
  --shadow: 0 14px 30px rgba(15, 23, 42, 0.075);
  --shadow-soft: 0 7px 18px rgba(15, 23, 42, 0.045);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #ffffff 0%, var(--page) 42%, #eef3fb 100%);
  color: var(--ink);
  font-family: Aptos, "Segoe UI Variable", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(37, 99, 235, 0.18);
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform 150ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: default;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  z-index: 20;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(1360px, calc(100% - 32px));
  min-height: 74px;
  margin: 14px auto 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 9px 22px rgba(15, 23, 42, 0.055);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  min-width: 232px;
  color: inherit;
  border-radius: var(--radius);
  padding: 4px;
  text-decoration: none;
  transition: background 180ms ease, transform 150ms ease;
}

.brand:hover,
.brand:focus-visible {
  background: rgba(239, 246, 255, 0.9);
  outline: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.14);
}

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

.brand span {
  min-width: 0;
}

.brand strong {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-item {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #334155;
  padding: 0 14px;
  font-weight: 600;
  text-align: left;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-dark);
  outline: none;
}

.nav-item.is-active {
  background: linear-gradient(180deg, #3478ff 0%, var(--accent) 100%);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.nav-item.is-active::after,
.nav-marker,
.nav-copy small {
  display: none;
}

.nav-copy {
  display: block;
  min-width: 0;
}

.nav-copy span {
  display: block;
  font-weight: 500;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
}

.header-actions .secondary-button {
  min-height: 38px;
}

.main-content {
  width: min(1260px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 34px;
}

.topbar,
.tool-header,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin: 8px 0 24px;
}

body[data-route="home"] .topbar {
  display: none;
}

.topbar h1,
.section-heading h2,
.tool-header h2,
.two-column h2 {
  margin: 0;
  letter-spacing: 0;
  font-family: Aptos, "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
}

.topbar h1 {
  font-size: 2.78rem;
  line-height: 1.06;
  font-weight: 500;
}

.eyebrow {
  display: block;
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 18px;
}

.notice,
.section-block,
.quiz-panel,
.answer-panel,
.source-card,
.test-status,
.stat-card,
.intro-hero,
.intro-card {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(203, 213, 225, 0.86);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.intro-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 22px;
  align-items: stretch;
  padding: 28px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 58%, rgba(239, 246, 255, 0.9) 100%);
}

.intro-copy {
  display: grid;
  align-content: center;
  gap: 16px;
  min-height: 330px;
}

.intro-copy h2 {
  max-width: 760px;
  margin: 0;
  font-family: Aptos, "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(2.2rem, 4.6vw, 4.8rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: 0;
}

.intro-copy p:not(.eyebrow) {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.intro-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  background:
    linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
}

.intro-panel div {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid rgba(191, 219, 254, 0.78);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: none;
}

.intro-panel span,
.intro-panel small {
  color: var(--muted);
}

.intro-panel strong {
  color: var(--accent-dark);
  font-size: 2.2rem;
  font-weight: 500;
  line-height: 1;
}

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

.intro-card {
  padding: 18px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.intro-card:hover,
.category-card:hover,
.stat-card:hover,
.source-card:hover {
  border-color: var(--accent-line);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  transform: translateY(-1px);
}

.intro-card > span {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}

.intro-card h3 {
  margin: 8px 0 6px;
  font-size: 1.08rem;
  font-weight: 600;
}

.intro-card p {
  margin: 0;
  color: var(--muted);
}

.notice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 15px 16px;
  border-left: 4px solid var(--accent);
}

.notice strong,
.feedback strong {
  font-weight: 600;
}

.notice span {
  color: var(--muted);
}

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

.stat-card {
  min-height: 128px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
}

.stat-card strong {
  font-size: 1.92rem;
  line-height: 1;
  font-family: Aptos, "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
}

.stat-card span {
  color: var(--muted);
}

.section-block {
  padding: 22px;
}

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

.category-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.category-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.category-card h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.25;
}

.category-card p {
  margin: 0;
  color: var(--muted);
}

.weight-badge {
  align-self: flex-start;
  min-width: 54px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
}

.mini-bar,
.linear-progress {
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf2;
}

.mini-bar {
  height: 8px;
}

.linear-progress {
  height: 10px;
}

.mini-bar span,
.linear-progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 180ms ease;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
}

.clean-list {
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--muted);
}

.clean-list li + li {
  margin-top: 8px;
}

.progress-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  text-align: center;
}

.readiness-ring {
  width: 128px;
  height: 128px;
  margin: 10px auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) var(--score, 0%), #e2e8f0 0);
}

.readiness-ring span {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #fff;
  font-size: 1.4rem;
  font-family: Aptos, "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
}

.progress-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.control-row,
.top-actions,
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

select {
  min-width: 190px;
  min-height: 43px;
  appearance: none;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #475569 50%),
    linear-gradient(135deg, #475569 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  color: var(--ink);
  padding: 0 40px 0 12px;
  font-weight: 500;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

select:hover {
  border-color: #93c5fd;
}

select:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--focus);
  outline: none;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 0 10px 2px 0;
  letter-spacing: 0;
  text-transform: none;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 43px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 500;
}

.primary-button {
  background: linear-gradient(180deg, #3478ff 0%, var(--accent) 100%);
  color: #fff;
  padding: 0 16px;
  box-shadow: 0 7px 14px rgba(37, 99, 235, 0.14);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: linear-gradient(180deg, #2563eb 0%, var(--accent-dark) 100%);
  box-shadow: 0 9px 18px rgba(37, 99, 235, 0.18);
}

.secondary-button {
  background: #ffffff;
  color: var(--ink);
  border-color: #cbd5e1;
  padding: 0 14px;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
}

.language-button {
  min-width: 96px;
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.mobile-language-toggle {
  display: none;
}

.mobile-header-actions {
  display: none;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 43px;
  background: #fff;
  color: var(--ink);
  border-color: #cbd5e1;
}

.icon-button:hover,
.icon-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.card-stage {
  perspective: 1300px;
}

.study-card {
  position: relative;
  min-height: 360px;
  transform-style: preserve-3d;
  transition: transform 250ms ease;
  border-radius: var(--radius);
  outline: none;
}

.study-card.is-flipped {
  transform: rotateY(180deg);
}

.study-card:focus-visible {
  box-shadow: var(--focus);
}

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-height: 360px;
  padding: 34px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backface-visibility: hidden;
  box-shadow: var(--shadow);
}

.card-back {
  transform: rotateY(180deg);
  background: #fbfdff;
}

.card-label {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
}

.study-card h3 {
  max-width: 820px;
  margin: 0;
  font-family: Aptos, "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 1.52rem;
  font-weight: 500;
  line-height: 1.3;
}

.study-card p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.study-card small {
  color: var(--muted);
  font-weight: 500;
}

.toolbar {
  justify-content: center;
}

.tool-note {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

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

.quiz-panel,
.answer-panel {
  padding: 20px;
}

.question-count {
  color: var(--muted);
  font-weight: 600;
}

.quiz-panel h3 {
  margin: 8px 0 16px;
  font-family: Aptos, "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 1.22rem;
  font-weight: 500;
  line-height: 1.3;
}

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

.choice-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-weight: 500;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 150ms ease;
}

.choice-button:hover,
.choice-button:focus-visible {
  border-color: var(--accent);
  background: #fbfdff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
  outline: none;
}

.choice-button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice-button.is-correct {
  border-color: var(--success);
  background: #f0fdf4;
}

.choice-button.is-wrong {
  border-color: var(--danger);
  background: #fff1f2;
}

.choice-button:disabled {
  color: var(--ink);
  opacity: 1;
}

.choice-letter {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #eef2f7;
  font-weight: 600;
}

.feedback {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fbfdff;
}

.feedback.is-correct {
  border-color: rgba(21, 128, 61, 0.26);
  background: linear-gradient(180deg, #f0fdf4, #ffffff);
}

.feedback.is-wrong {
  border-color: rgba(182, 90, 79, 0.28);
  background: linear-gradient(180deg, #fff7f7, #ffffff);
}

.feedback strong {
  display: block;
  margin-bottom: 4px;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.source-pill {
  align-self: center;
  width: fit-content;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
}

.session-stats {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
}

.session-stat {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.full-width {
  width: 100%;
}

.empty-state {
  margin: 0;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  background: #f8fafc;
  color: var(--muted);
}

.test-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.test-status div {
  padding: 16px;
  background: #fff;
}

.test-status strong {
  display: block;
  font-size: 1.35rem;
  font-family: Aptos, "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
}

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

.result-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.result-card strong {
  display: block;
  font-size: 1.5rem;
  font-family: Aptos, "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
}

.review-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.review-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.review-item h4 {
  margin: 0 0 6px;
}

.review-item p {
  margin: 4px 0;
  color: var(--muted);
}

.source-list {
  display: grid;
  gap: 12px;
}

.source-card {
  padding: 16px;
}

.source-card h3 {
  margin: 0 0 6px;
}

.source-card p {
  margin: 0 0 8px;
  color: var(--muted);
}

.source-card a {
  color: var(--accent-dark);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.legal-block {
  display: grid;
  gap: 12px;
}

.legal-block h3 {
  margin: 8px 0 0;
}

.legal-block p {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 2px 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer a {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 1120px) {
  .sidebar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .brand {
    min-width: 220px;
  }

  .nav-list {
    order: 3;
    width: 100%;
  }
}

@media (max-width: 860px) {
  .sidebar {
    top: 0;
    width: 100%;
    margin: 0;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .main-content {
    width: min(100% - 28px, 1260px);
    padding-top: 22px;
  }

  .stats-grid,
  .category-grid,
  .quiz-layout,
  .two-column,
  .intro-hero,
  .intro-grid {
    grid-template-columns: 1fr;
  }

  .intro-copy {
    min-height: auto;
  }

  .top-actions {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  body {
    background: #f4f7fb;
  }

  .topbar,
  .tool-header,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 7px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
  }

  .topbar h1 {
    font-size: 2rem;
    line-height: 1.08;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    width: auto;
    gap: 9px;
  }

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

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

  .brand small {
    font-size: 0.72rem;
  }

  .mobile-header-actions {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
  }

  .mobile-language-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    min-height: 34px;
    padding: 0 10px;
    color: transparent;
    font-size: 0;
    font-weight: 700;
  }

  .mobile-language-toggle::after {
    content: "ES / EN";
    color: var(--accent-dark);
    font-size: 0.82rem;
    letter-spacing: 0;
    white-space: nowrap;
  }

  .mobile-reset-button {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    width: 34px;
    min-height: 34px;
    padding: 0;
    border-color: #dbe4f0;
    background: #ffffff;
    color: var(--accent-dark);
    font-size: 1.05rem;
    font-weight: 700;
  }

  .header-actions {
    display: none;
  }

  .nav-list {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    gap: 6px;
    width: calc(100% + 20px);
    margin: 0 -10px;
    padding: 0 10px 3px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border-color: #dbe4f0;
    background: #ffffff;
    box-shadow: none;
    font-size: 0.88rem;
  }

  .main-content {
    width: 100%;
    padding: 14px 12px 28px;
  }

  .topbar {
    margin: 4px 0 14px;
  }

  .top-actions {
    display: flex;
    align-items: stretch;
    width: 100%;
  }

  .sidebar .header-actions {
    display: none;
  }

  .desktop-language-toggle {
    display: none;
  }

  .top-actions button,
  .intro-actions button,
  .quiz-actions button {
    width: 100%;
  }

  .notice {
    grid-template-columns: 1fr;
    padding: 13px 14px;
  }

  .section-block,
  .quiz-panel,
  .answer-panel,
  .source-card {
    padding: 16px;
  }

  .intro-hero {
    gap: 16px;
    padding: 18px;
  }

  .intro-copy {
    gap: 12px;
  }

  .intro-copy h2 {
    font-size: 2.2rem;
    line-height: 1.06;
  }

  .intro-copy p:not(.eyebrow) {
    font-size: 0.98rem;
  }

  .intro-panel {
    padding: 10px;
  }

  .intro-panel div {
    padding: 12px;
  }

  .intro-panel strong {
    font-size: 1.8rem;
  }

  .intro-card {
    padding: 16px;
  }

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

  .stat-card {
    min-height: 116px;
    padding: 15px;
  }

  .stat-card strong {
    font-size: 1.55rem;
  }

  .category-top,
  .session-stat,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .weight-badge {
    min-width: 0;
  }

  .study-card,
  .card-face {
    min-height: 330px;
  }

  .card-face {
    padding: 18px;
  }

  .study-card h3 {
    font-size: 1.18rem;
    line-height: 1.32;
  }

  .study-card p {
    font-size: 0.96rem;
  }

  .toolbar,
  .control-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .toolbar button,
  .toolbar .icon-button,
  .control-row button,
  .control-row label,
  .control-row select {
    width: 100%;
  }

  .toggle {
    padding-top: 0;
  }

  select {
    min-width: 0;
    width: 100%;
  }

  .answer-panel {
    order: 0;
  }

  .choice-button {
    min-height: 48px;
    align-items: flex-start;
    padding: 11px;
  }

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

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

  .test-status div {
    padding: 12px 10px;
  }

  .test-status strong {
    font-size: 1.08rem;
  }

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

@media (max-width: 430px) {
  .top-actions,
  .stats-grid,
  .quiz-actions,
  .test-status {
    grid-template-columns: 1fr;
  }

  .intro-copy h2 {
    font-size: 1.95rem;
  }

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