
:root {
  --bg: #07101f;
  --surface: #0d182b;
  --surface-2: #13213a;
  --surface-3: #192a46;
  --border: #243754;
  --text: #eef5ff;
  --muted: #91a4bd;
  --primary: #39a9ff;
  --primary-strong: #138de9;
  --primary-soft: rgba(57, 169, 255, .14);
  --success: #31c48d;
  --success-soft: rgba(49, 196, 141, .13);
  --danger: #ff6b7a;
  --danger-soft: rgba(255, 107, 122, .13);
  --warning: #f6c453;
  --warning-soft: rgba(246, 196, 83, .13);
  --shadow: 0 20px 45px rgba(0, 0, 0, .24);
  --radius: 16px;
  --sidebar-width: 248px;
}

html[data-theme="light"] {
  --bg: #f3f7fc;
  --surface: #ffffff;
  --surface-2: #f7faff;
  --surface-3: #edf4fc;
  --border: #d9e4f1;
  --text: #14243a;
  --muted: #60748d;
  --primary-soft: rgba(19, 141, 233, .10);
  --success-soft: rgba(49, 196, 141, .11);
  --danger-soft: rgba(255, 107, 122, .11);
  --warning-soft: rgba(246, 196, 83, .14);
  --shadow: 0 16px 36px rgba(33, 56, 84, .10);
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 0%, rgba(57, 169, 255, .10), transparent 28rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }

button { color: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(57, 169, 255, .35);
  outline-offset: 2px;
}

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

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 22px 16px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), #6f71ff);
  box-shadow: 0 12px 28px rgba(57, 169, 255, .24);
  font-size: 15px;
  font-weight: 900;
}

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

.brand strong { font-size: 17px; }

.brand span { color: var(--muted); font-size: 12px; }

.nav { display: grid; gap: 5px; }

.nav-item {
  display: flex;
  min-height: 45px;
  align-items: center;
  gap: 11px;
  padding: 0 13px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: .18s ease;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(100deg, var(--primary-strong), #4978ef);
  box-shadow: 0 12px 25px rgba(19, 141, 233, .20);
}

.nav-icon {
  display: grid;
  width: 22px;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.sidebar-footer p {
  margin: 4px 4px 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.main-column {
  display: flex;
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(18px, 3vw, 38px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px);
}

.global-search {
  display: flex;
  width: min(620px, 100%);
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}

.global-search span { color: var(--muted); font-size: 18px; }

.global-search input {
  width: 100%;
  border: 0;
  color: var(--text);
  background: transparent;
  outline: 0;
}

.global-search input::placeholder { color: var(--muted); }

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}

.icon-button,
.avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  cursor: pointer;
}

.icon-button:hover { background: var(--surface-2); }

.avatar {
  border: 0;
  color: white;
  background: linear-gradient(145deg, #4978ef, #7d68ff);
  font-size: 12px;
  font-weight: 900;
}

#app {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  flex: 1;
  padding: 32px clamp(18px, 3vw, 42px) 44px;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 3vw, 42px);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

.page-footer a { text-decoration: none; }

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

.page-heading h1 {
  margin: 0 0 6px;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.18;
}

.page-heading p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, .72fr);
  gap: 28px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 85% 20%, rgba(74, 121, 239, .23), transparent 18rem),
    linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
}

.hero::after {
  position: absolute;
  right: -70px;
  bottom: -90px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(57,169,255,.18);
  border-radius: 50%;
  content: "";
}

.hero h1 {
  max-width: 760px;
  margin: 0 0 14px;
  font-size: clamp(30px, 4.6vw, 55px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.hero p {
  max-width: 700px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  transition: .18s ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(100deg, var(--primary-strong), #4978ef);
  box-shadow: 0 10px 22px rgba(19, 141, 233, .22);
}

.primary-button:hover { transform: translateY(-1px); filter: brightness(1.08); }

.secondary-button {
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.secondary-button:hover,
.ghost-button:hover { background: var(--surface-3); }

.danger-button {
  color: #fff;
  background: #d94c5b;
}

.ghost-button {
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
}

.full { width: 100%; }

.file-button {
  display: grid;
  place-items: center;
}

.file-button input { display: none; }

.hero-score {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(7, 16, 31, .26);
}

.score-ring {
  --value: 0;
  position: relative;
  display: grid;
  width: 150px;
  height: 150px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--value) * 1%), var(--surface-3) 0);
}

.score-ring::before {
  position: absolute;
  width: 116px;
  height: 116px;
  border-radius: inherit;
  background: var(--surface);
  content: "";
}

.score-ring strong,
.score-ring span {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
}

.score-ring strong { font-size: 29px; }

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

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

.stat-card,
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(0,0,0,.06);
}

.stat-card { padding: 18px; }

.stat-card .stat-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.stat-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
}

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

.section {
  margin-top: 28px;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-header h2 { margin: 0; font-size: 19px; }

.section-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

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

.category-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: .18s ease;
}

.category-card:hover {
  border-color: rgba(57,169,255,.55);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.category-card h3 { margin: 0 0 6px; font-size: 15px; }

.category-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.progress-track {
  height: 7px;
  margin: 14px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #7d68ff);
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
  gap: 18px;
}

.setup-card { padding: 22px; }

.setup-card h2 { margin: 0 0 5px; }

.setup-card > p { margin: 0 0 20px; color: var(--muted); }

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

.field {
  display: grid;
  gap: 7px;
}

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

.field span { color: var(--muted); font-size: 11px; font-weight: 700; }

.field select,
.field input {
  min-height: 43px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-2);
  outline: 0;
}

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

.info-list li {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.info-list b { color: var(--primary); }

.session-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
}

.question-card { overflow: hidden; }

.question-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 10px;
  font-weight: 800;
}

.badge.warning { color: var(--warning); background: var(--warning-soft); }

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

.bookmark-button {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 22px;
}

.bookmark-button.active { color: var(--warning); }

.question-content { padding: clamp(20px, 3vw, 34px); }

.question-content h2 {
  margin: 0 0 23px;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.42;
}

.question-image {
  display: block;
  max-width: 100%;
  max-height: 390px;
  margin: 0 auto 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.selection-hint {
  margin: -12px 0 18px;
  color: var(--muted);
  font-size: 11px;
}

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

.option {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  transition: .16s ease;
}

.option:hover { border-color: rgba(57,169,255,.46); }

.option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.option.correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.option.incorrect {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.option.disabled { cursor: default; }

.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-letter {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 900;
}

.option.selected .option-letter {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary-strong);
}

.option.correct .option-letter {
  color: #071f18;
  border-color: var(--success);
  background: var(--success);
}

.option.incorrect .option-letter {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

.option-text { padding-top: 4px; font-size: 14px; }

.feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13px;
}

.feedback.success { color: var(--success); background: var(--success-soft); }

.feedback.error { color: var(--danger); background: var(--danger-soft); }

.question-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 17px 20px;
  border-top: 1px solid var(--border);
}

.session-side {
  display: grid;
  align-content: start;
  gap: 14px;
}

.side-card { padding: 17px; }

.side-card h3 { margin: 0 0 12px; font-size: 14px; }

.question-map {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.map-item {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.map-item.current { color: #fff; border-color: var(--primary); background: var(--primary-strong); }

.map-item.answered { color: var(--success); border-color: rgba(49,196,141,.45); background: var(--success-soft); }

.map-item.wrong { color: var(--danger); border-color: rgba(255,107,122,.45); background: var(--danger-soft); }

.session-progress-text {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 12px;
  margin-bottom: 14px;
}

.library-toolbar input,
.library-toolbar select {
  min-height: 43px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  outline: 0;
}

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

.question-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.question-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 11px;
  font-weight: 900;
}

.question-row h3 {
  margin: 0 0 5px;
  font-size: 13px;
  line-height: 1.45;
}

.question-row p { margin: 0; color: var(--muted); font-size: 10px; }

.row-actions { display: flex; gap: 7px; }

.tiny-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.tiny-button:hover { border-color: var(--primary); }

.empty-state {
  display: grid;
  min-height: 290px;
  place-items: center;
  padding: 30px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.result-card { padding: clamp(24px, 4vw, 42px); text-align: center; }

.result-score {
  display: grid;
  width: 170px;
  height: 170px;
  margin: 22px auto;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
}

.result-score strong { display: block; font-size: 45px; }

.result-score span { color: var(--muted); font-size: 12px; }

.result-grid {
  display: grid;
  max-width: 720px;
  margin: 22px auto;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.result-stat {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.result-stat strong { display: block; font-size: 23px; }

.result-stat span { color: var(--muted); font-size: 10px; }

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: min(360px, calc(100vw - 36px));
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 12px;
  animation: toast-in .2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.62);
}

.modal-backdrop.hidden { display: none; }

.modal {
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal h2 { margin: 0 0 8px; }

.modal p { margin: 0 0 20px; color: var(--muted); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.mobile-only { display: none; }

@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .session-shell { grid-template-columns: 1fr; }
  .session-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open { transform: translateX(0); }

  .main-column {
    width: 100%;
    margin-left: 0;
  }

  .mobile-only { display: grid; }

  .hero,
  .setup-grid { grid-template-columns: 1fr; }

  .hero-score { min-height: 190px; }

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

  .page-heading { display: block; }
}

@media (max-width: 620px) {
  #app { padding-top: 22px; }

  .topbar { min-height: 64px; padding-inline: 12px; }

  .global-search { min-width: 0; }

  .stats-grid,
  .form-grid,
  .result-grid,
  .session-side { grid-template-columns: 1fr; }

  .library-toolbar { grid-template-columns: 1fr; }

  .question-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .question-map { grid-template-columns: repeat(8, 1fr); }

  .page-footer { flex-direction: column; }

  .question-actions { flex-wrap: wrap; }

  .question-actions > * { flex: 1; }

  .hero h1 { font-size: 34px; }
}


/* AZ-900 Learning Hub v2 additions */
.translate-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(57,169,255,.45);
  border-radius: 9px;
  color: var(--primary);
  background: var(--primary-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.translate-button:hover { border-color: var(--primary); }
.translate-button:disabled { cursor: wait; opacity: .68; }

.translation-panel {
  margin: -8px 0 22px;
  padding: 16px;
  border: 1px solid rgba(57,169,255,.35);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: var(--primary-soft);
}

.translation-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.translation-heading strong { color: var(--primary); font-size: 13px; }
.translation-heading span { color: var(--muted); font-size: 10px; }
.translated-question { margin: 0 0 10px; font-weight: 750; }
.translation-options { display: grid; gap: 7px; margin: 0; padding-left: 22px; color: var(--muted); font-size: 13px; }
.translation-options strong { color: var(--text); }

.session-tools { display: grid; gap: 9px; }
.review-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

@media (max-width: 720px) {
  .translation-heading { display: grid; gap: 3px; }
  .review-summary-grid { grid-template-columns: 1fr; }
  .question-top { align-items: flex-start; }
  .question-top > div:last-child { flex-wrap: wrap; justify-content: flex-end; }
}

/* Multi-certification hub additions */
.cert-picker {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  white-space: nowrap;
}
.cert-picker span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.cert-picker select {
  border: 0;
  color: var(--text);
  background: transparent;
  outline: 0;
  font-weight: 900;
}
.footer-links { display: flex; gap: 12px; }
.secondary-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-2);
  font-weight: 750;
  text-decoration: none;
}
.secondary-link:hover { background: var(--surface-3); }

.roadmap-strip {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin: 20px 0;
}
.roadmap-mini {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}
.roadmap-mini > span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 900;
}
.roadmap-mini strong, .roadmap-mini small { display: block; }
.roadmap-mini strong { color: var(--text); font-size: 13px; }
.roadmap-mini small { font-size: 10px; }
.roadmap-mini.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.roadmap-mini.active > span { color: #071521; background: var(--primary); }
.roadmap-arrow { display: grid; place-items: center; color: var(--muted); }

.roadmap-callout {
  margin-bottom: 22px;
  padding: 17px 19px;
  border: 1px solid rgba(246,196,83,.45);
  border-radius: 14px;
  background: var(--warning-soft);
}
.roadmap-callout strong { color: var(--warning); }
.roadmap-callout p { margin: 5px 0 0; color: var(--muted); }
.roadmap-timeline { max-width: 980px; margin: 0 auto; }
.roadmap-step {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0,0,0,.07);
}
.roadmap-step.current { border-color: rgba(57,169,255,.65); box-shadow: 0 16px 38px rgba(19,141,233,.12); }
.step-number {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  color: #071521;
  background: linear-gradient(145deg, var(--primary), #7d68ff);
  font-size: 17px;
  font-weight: 900;
}
.step-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.step-heading h2 { margin: 0; font-size: 21px; }
.step-heading > strong { color: var(--primary); font-size: 23px; }
.step-main > p { color: var(--muted); }
.roadmap-syllabus { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.roadmap-syllabus span {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 10px;
}
.roadmap-syllabus b { color: var(--text); }
.roadmap-note { font-size: 12px; }
.timeline-connector { padding: 6px 0; color: var(--primary); font-size: 24px; text-align: center; }

.question-images {
  display: grid;
  gap: 12px;
  margin: 0 0 22px;
}
.question-images .question-image { margin: 0 auto; }
.lab-intro,
.lab-solution,
.solution-placeholder {
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: 12px;
}
.lab-intro { border: 1px solid rgba(57,169,255,.35); background: var(--primary-soft); }
.lab-intro p, .lab-solution p { margin: 5px 0 0; white-space: pre-wrap; }
.lab-solution { border: 1px solid rgba(49,196,141,.45); background: var(--success-soft); }
.lab-solution strong { color: var(--success); }
.translated-solution { margin-top: 12px; }
.solution-placeholder {
  border: 1px dashed var(--border);
  color: var(--muted);
  background: var(--surface-2);
  text-align: center;
}

@media (max-width: 820px) {
  .cert-picker span { display: none; }
  .roadmap-strip { display: grid; grid-template-columns: 1fr; }
  .roadmap-arrow { transform: rotate(90deg); }
}
@media (max-width: 620px) {
  .cert-picker { padding-inline: 7px; }
  .cert-picker select { max-width: 76px; }
  .global-search { display: none; }
  .roadmap-step { grid-template-columns: 1fr; }
  .step-heading { display: grid; }
}


/* Vocabulary learning */
.vocabulary-promo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
}
.vocabulary-promo h2 { margin: 0 0 7px; font-size: 21px; }
.vocabulary-promo p { margin: 0 0 16px; color: var(--muted); }
.vocabulary-promo-stats { display: grid; min-width: 185px; justify-items: center; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--primary-soft); text-align: center; }
.vocabulary-promo-stats strong { font-size: 29px; }
.vocabulary-promo-stats span, .vocabulary-promo-stats small { color: var(--muted); }
.vocabulary-promo-stats small { margin-top: 5px; font-size: 10px; }
.vocab-stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.vocab-mode-guide { display: grid; align-content: start; gap: 13px; }
.vocab-mode-guide > h2 { margin-bottom: 2px; }
.vocab-guide-item { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.vocab-guide-item > b { display: grid; min-height: 38px; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); font-size: 11px; }
.vocab-guide-item strong { display: block; font-size: 13px; }
.vocab-guide-item p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.vocab-word-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.vocab-word-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.vocab-word-row > div { min-width: 0; display: grid; gap: 2px; }
.vocab-word-row strong { font-size: 14px; }
.vocab-word-row span { color: var(--muted); font-size: 12px; }
.vocab-word-row small { color: var(--muted); font-size: 9px; }
.vocabulary-session-shell { align-items: start; }
.vocab-question-content { min-height: 420px; display: flex; flex-direction: column; justify-content: center; }
.vocab-term-large, .vocab-meaning-large { display: block; margin-bottom: 10px; text-align: center; font-size: clamp(28px, 5vw, 48px); font-weight: 850; line-height: 1.2; letter-spacing: -.025em; }
.vocab-meaning-large { font-size: clamp(23px, 4vw, 37px); }
.vocab-prompt-note { margin: 0 0 28px; color: var(--muted); text-align: center; }
.vocab-sentence { max-width: 850px; margin: 0 auto 12px; font-size: clamp(20px, 3vw, 31px); font-weight: 720; line-height: 1.5; text-align: center; }
.sentence-blank { color: var(--primary); white-space: nowrap; }
.vocab-options { width: 100%; }
.vocab-options .option { width: 100%; color: var(--text); text-align: left; }
.vocab-typing-wrap { width: min(680px, 100%); margin: 0 auto; }
.vocab-typing-input { width: 100%; min-height: 58px; padding: 0 18px; border: 2px solid var(--border); border-radius: 13px; color: var(--text); background: var(--surface-2); outline: none; font-size: 18px; text-align: center; }
.vocab-typing-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.vocab-typing-input.correct { border-color: var(--success); background: var(--success-soft); }
.vocab-typing-input.incorrect { border-color: var(--danger); background: var(--danger-soft); }
.vocab-example { margin-top: 8px; color: var(--text); font-style: italic; }
.speak-button { white-space: nowrap; }

@media (max-width: 1080px) {
  .vocab-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .vocab-word-list { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .vocabulary-promo { grid-template-columns: 1fr; }
  .vocabulary-promo-stats { min-width: 0; }
  .vocab-stats-grid { grid-template-columns: 1fr; }
  .vocab-question-content { min-height: 340px; }
  .speak-button { min-height: 34px; font-size: 10px; }
}


/* v5: book reader and sentence English */
.sentence-promo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--primary-soft) 55%, var(--surface)));
}
.sentence-setup-grid { margin-top: 18px; }
.sentence-difficult-list { display: grid; gap: 9px; }
.sentence-difficult-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}
.sentence-difficult-list article div { min-width: 0; display: grid; gap: 4px; }
.sentence-difficult-list strong { font-size: 12px; line-height: 1.45; }
.sentence-difficult-list small { color: var(--muted); font-size: 10px; }
.sentence-content > h2,
.sentence-study-prompt h2 { font-size: clamp(19px, 2.4vw, 28px); line-height: 1.5; }
.sentence-study-prompt { margin-bottom: 18px; }
.sentence-translation,
.book-sentence-translation {
  margin-top: 14px;
  padding: 13px 15px;
  border-left: 3px solid var(--primary);
  border-radius: 0 10px 10px 0;
  color: var(--text);
  background: var(--primary-soft);
}
.sentence-translation p { margin: 5px 0 0; }
.sentence-self-rating { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sentence-actions-inline { display: flex; gap: 8px; margin: 12px 0; }
.compact-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sentence-loading {
  display: grid;
  min-height: 330px;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 35px;
  text-align: center;
}
.loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--surface-3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: sentence-spin .8s linear infinite;
}
@keyframes sentence-spin { to { transform: rotate(360deg); } }
.book-progress-card {
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(240px, 1fr);
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  padding: 15px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.book-progress-card > div:first-child { display: grid; }
.book-progress-card span { color: var(--muted); font-size: 11px; }
.book-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.book-sidebar { position: sticky; top: 90px; max-height: calc(100vh - 112px); overflow: auto; padding: 13px; }
.book-sidebar > input {
  width: 100%; min-height: 40px; margin-bottom: 11px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--surface-2); outline: none;
}
.book-toc { display: grid; gap: 7px; }
.book-chapter { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.book-chapter summary { display: flex; justify-content: space-between; gap: 8px; padding: 10px; cursor: pointer; font-size: 11px; font-weight: 800; background: var(--surface-2); }
.book-chapter summary span { color: var(--muted); }
.book-chapter > div { display: grid; padding: 5px; }
.book-section-link,
.book-search-results button {
  width: 100%; padding: 8px 9px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; text-align: left;
}
.book-section-link:hover,
.book-section-link.active,
.book-search-results button:hover { color: var(--text); background: var(--primary-soft); }
.book-search-results { display: grid; gap: 5px; }
.book-search-results > strong { margin: 3px 5px 6px; font-size: 11px; }
.book-search-results button span { display: block; color: var(--primary); font-size: 9px; }
.book-reader { min-width: 0; overflow: hidden; }
.book-reader-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 24px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.book-reader-header h1 { margin: 0 0 5px; font-size: clamp(22px, 3vw, 32px); }
.book-reader-header p { margin: 0; color: var(--muted); font-size: 11px; }
.book-content { padding: clamp(22px, 4vw, 42px); font-size: 14px; line-height: 1.75; }
.book-content h1, .book-content h2, .book-content h3, .book-content h4 { margin-top: 1.5em; color: var(--text); line-height: 1.3; }
.book-content p { margin: 0 0 1em; }
.book-content ul, .book-content ol { padding-left: 24px; }
.book-content li { margin-bottom: .4em; }
.book-content pre { overflow: auto; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); font-size: 11px; }
.book-content table { width: 100%; border-collapse: collapse; overflow: auto; font-size: 11px; }
.book-content th, .book-content td { padding: 8px; border: 1px solid var(--border); text-align: left; }
.book-content blockquote { margin-left: 0; padding: 8px 14px; border-left: 3px solid var(--primary); color: var(--muted); background: var(--primary-soft); }
.book-sentences { padding: 0 clamp(22px, 4vw, 42px) 38px; }
.book-sentence-card { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 11px; padding: 14px 0; border-top: 1px solid var(--border); }
.book-sentence-card > span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); font-size: 10px; font-weight: 900; }
.book-sentence-card p { margin: 2px 0 9px; line-height: 1.55; }
.cert-roadmap-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.cert-roadmap-tab { min-height: 38px; padding: 0 16px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface); cursor: pointer; font-weight: 800; }
.cert-roadmap-tab.active { color: #fff; border-color: var(--primary); background: var(--primary-strong); }
.roadmap-cert-groups { display: grid; gap: 24px; }
.cert-path { scroll-margin-top: 90px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); overflow: hidden; }
.cert-path.current { border-color: rgba(57,169,255,.55); box-shadow: var(--shadow); }
.cert-path-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 23px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cert-path-header h2 { margin: 0 0 5px; }
.cert-path-header p { margin: 0; color: var(--muted); }
.cert-path-steps { display: grid; gap: 0; padding: 8px 22px 22px; }
.cert-path-step { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.cert-path-step:last-child { border-bottom: 0; }
.cert-path-step h3 { margin: 0 0 4px; font-size: 15px; }
.cert-path-step p { margin: 0; color: var(--muted); font-size: 12px; }
.cert-path-step .tiny-button { margin-top: 9px; }
@media (max-width: 1050px) {
  .book-layout { grid-template-columns: 1fr; }
  .book-sidebar { position: static; max-height: none; }
  .book-toc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .sentence-promo, .book-progress-card { grid-template-columns: 1fr; }
  .sentence-self-rating, .compact-options, .book-toc { grid-template-columns: 1fr; }
  .book-reader-header, .cert-path-header { flex-direction: column; }
  .book-reader-header .button-row { width: 100%; }
  .book-reader-header .button-row > * { flex: 1; }
}


/* Automatic answer, speech and advance flow */
.auto-flow-status {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}
.auto-flow-hint {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.feedback.success .auto-flow-hint { color: color-mix(in srgb, var(--success) 70%, var(--muted)); }
.feedback.error .auto-flow-hint { color: color-mix(in srgb, var(--danger) 70%, var(--muted)); }
@media (max-width: 620px) {
  .auto-flow-status {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}


/* ========================================================================== 
   v7 — Mobile-first short learning feed and adaptive experience
   ========================================================================== */
.mobile-bottom-nav { display: none; }

.smart-feed-shell {
  width: min(760px, 100%);
  margin: 0 auto;
}
.feed-progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px 999px 0 0;
  background: var(--surface-3);
}
.feed-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #7d68ff);
  transition: width .25s ease;
}
.smart-feed-card {
  position: relative;
  display: grid;
  min-height: min(760px, calc(100dvh - 150px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0 0 22px 22px;
  background:
    radial-gradient(circle at 82% 12%, rgba(57,169,255,.16), transparent 18rem),
    linear-gradient(160deg, var(--surface), var(--bg));
  box-shadow: var(--shadow);
  animation: feed-card-in .24s ease;
  touch-action: pan-y;
}
@keyframes feed-card-in {
  from { opacity: .15; transform: translateY(22px) scale(.985); }
}
.smart-feed-card.answered-correct { box-shadow: 0 0 0 2px rgba(49,196,141,.38), var(--shadow); }
.smart-feed-card.answered-wrong { box-shadow: 0 0 0 2px rgba(255,107,122,.36), var(--shadow); }
.feed-header {
  position: relative;
  z-index: 3;
  display: flex;
  min-height: 61px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 72px 11px 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(16px);
}
.feed-header > div { display: grid; }
.feed-header strong { font-size: 12px; }
.feed-for-you { color: var(--primary); font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.feed-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(24px, 6vw, 48px) 88px clamp(96px, 12vw, 128px) clamp(22px, 5vw, 46px);
  scrollbar-width: thin;
}
.feed-topic { margin-bottom: 12px; color: var(--muted); font-size: 11px; font-weight: 800; }
.feed-scroll h1 {
  max-width: 900px;
  margin: 0 0 24px;
  font-size: clamp(22px, 4vw, 38px);
  line-height: 1.35;
  letter-spacing: -.025em;
}
.feed-blank { color: var(--primary); white-space: nowrap; }
.feed-options-list { width: 100%; }
.feed-option { width: 100%; min-height: 56px; color: var(--text); text-align: left; }
.feed-translation {
  margin: -10px 0 20px;
  padding: 12px 14px;
  border-left: 3px solid var(--primary);
  border-radius: 0 10px 10px 0;
  background: var(--primary-soft);
  font-size: 13px;
}
.feed-translation.muted { color: var(--muted); }
.feed-feedback {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
}
.feed-feedback.success { color: var(--success); background: var(--success-soft); }
.feed-feedback.error { color: var(--danger); background: var(--danger-soft); }
.feed-feedback span { color: var(--text); font-size: 13px; }
.feed-feedback small { color: var(--muted); }
.feed-action-rail {
  position: absolute;
  right: 10px;
  bottom: 78px;
  z-index: 5;
  display: grid;
  gap: 10px;
}
.feed-action-rail button {
  display: grid;
  width: 58px;
  min-height: 58px;
  place-items: center;
  align-content: center;
  gap: 1px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 50%;
  color: var(--text);
  background: rgba(7,16,31,.76);
  box-shadow: 0 8px 22px rgba(0,0,0,.2);
  backdrop-filter: blur(12px);
  cursor: pointer;
}
.feed-action-rail button.active { color: #07101f; background: var(--warning); }
.feed-action-rail span { font-size: 18px; font-weight: 900; }
.feed-action-rail small { font-size: 8px; font-weight: 800; }
.feed-footer {
  position: absolute;
  inset: auto 0 0;
  z-index: 4;
  display: grid;
  min-height: 62px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 78px 9px 12px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(16px);
}
.feed-footer button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}
.feed-footer button:first-child { text-align: left; }
.feed-footer button:last-child { text-align: right; }
.feed-footer span { color: var(--muted); font-size: 9px; font-weight: 800; }

@media (max-width: 820px) {
  :root { --mobile-nav-height: 66px; --mobile-topbar-height: 58px; }
  body { padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); }
  body.learning-session-mode { overflow: hidden; padding-bottom: 0; }
  .sidebar { width: min(86vw, 320px); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .main-column { min-height: 100dvh; }
  .topbar {
    min-height: var(--mobile-topbar-height);
    padding: 8px 10px;
    gap: 8px;
  }
  .global-search { display: none; }
  .cert-picker { min-height: 39px; flex: 1; justify-content: space-between; }
  .cert-picker span { font-size: 9px; }
  .top-actions { margin-left: 0; }
  .top-actions .avatar { display: none; }
  #app { padding: 18px 12px calc(24px + var(--mobile-nav-height)); }
  .page-footer { display: none; }
  .mobile-bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 45;
    display: grid;
    min-height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    grid-template-columns: repeat(5, 1fr);
    padding: 5px 5px env(safe-area-inset-bottom);
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(20px);
  }
  .mobile-bottom-nav button {
    display: grid;
    min-width: 0;
    place-items: center;
    align-content: center;
    gap: 1px;
    border: 0;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
  }
  .mobile-bottom-nav button span { font-size: 17px; font-weight: 900; }
  .mobile-bottom-nav button small { overflow: hidden; max-width: 100%; font-size: 8px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-bottom-nav button.active { color: var(--primary); background: var(--primary-soft); }

  body.learning-session-mode .topbar { display: none; }
  body.learning-session-mode .mobile-bottom-nav { display: none; }
  body.learning-session-mode #app { height: 100dvh; padding: 0; overflow: hidden; }
  body.learning-session-mode .main-column { min-height: 100dvh; }

  .smart-feed-shell { width: 100%; height: 100dvh; }
  .feed-progress { position: fixed; inset: 0 0 auto; z-index: 60; height: 3px; border-radius: 0; }
  .smart-feed-card { width: 100%; height: 100dvh; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .feed-header { min-height: 56px; padding: calc(7px + env(safe-area-inset-top)) 72px 7px 14px; }
  .feed-scroll { padding: 22px 78px calc(92px + env(safe-area-inset-bottom)) 16px; }
  .feed-scroll h1 { font-size: clamp(21px, 6vw, 30px); line-height: 1.38; }
  .feed-option { min-height: 58px; padding: 13px 12px; border-radius: 13px; }
  .feed-option .option-text { font-size: 13px; line-height: 1.45; }
  .feed-action-rail { right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); gap: 8px; }
  .feed-action-rail button { width: 54px; min-height: 54px; }
  .feed-footer { min-height: calc(58px + env(safe-area-inset-bottom)); padding: 7px 70px calc(7px + env(safe-area-inset-bottom)) 10px; }
  .feed-footer span { display: none; }
  .feed-footer { grid-template-columns: 1fr 1fr; }

  .session-shell,
  .vocabulary-session-shell {
    display: block;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
  }
  .session-shell .question-card,
  .vocabulary-session-shell .question-card {
    position: relative;
    display: grid;
    width: 100%;
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .session-shell .question-top {
    position: relative;
    z-index: 4;
    min-height: 55px;
    padding: calc(7px + env(safe-area-inset-top)) 10px 7px;
    overflow-x: auto;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(16px);
  }
  .session-shell .question-meta { flex-wrap: nowrap; min-width: max-content; }
  .session-shell .question-top > div:last-child { min-width: max-content; }
  .session-shell .translate-button { min-height: 34px; padding-inline: 9px; font-size: 9px; }
  .session-shell .question-content {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 14px 100px;
  }
  .session-shell .question-content h2 { font-size: clamp(19px, 5.3vw, 27px); line-height: 1.42; }
  .session-shell .options-list { gap: 9px; }
  .session-shell .option { min-height: 58px; padding: 13px 12px; border-radius: 13px; }
  .session-shell .option-text { font-size: 13px; line-height: 1.45; }
  .session-shell .question-actions {
    position: absolute;
    inset: auto 0 0;
    z-index: 5;
    min-height: calc(58px + env(safe-area-inset-bottom));
    align-items: center;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(16px);
  }
  .session-shell .question-actions .secondary-button { min-height: 40px; }
  .session-shell .session-side { display: none; }
  .vocab-term-large, .vocab-meaning-large { font-size: clamp(27px, 9vw, 42px); }
  .vocab-sentence { font-size: clamp(19px, 5.5vw, 27px); }
  .vocab-question-content { min-height: 0; justify-content: flex-start; }

  .hero { padding: 24px 19px; border-radius: 17px; }
  .hero h1 { font-size: clamp(29px, 9vw, 42px); }
  .hero-actions > * { flex: 1 1 145px; }
  .stats-grid { gap: 9px; }
  .stat-card { padding: 14px; }
  .stat-card strong { font-size: 23px; }
  .category-card { padding: 16px; }
  .page-heading { margin-bottom: 18px; }
  .page-heading h1 { font-size: 26px; }
  .question-map { grid-template-columns: repeat(7, 1fr); }
  button, .option { -webkit-tap-highlight-color: transparent; }
}

@media (max-width: 390px) {
  .mobile-bottom-nav button small { font-size: 7px; }
  .feed-scroll { padding-left: 12px; padding-right: 70px; }
  .feed-action-rail button { width: 50px; min-height: 50px; }
  .session-shell .question-content { padding-inline: 11px; }
  .option-letter { width: 28px; height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .smart-feed-card { animation: none; }
  * { scroll-behavior: auto !important; }
}

.mobile-session-exit { display: none; }
@media (max-width: 820px) {
  body.learning-session-mode .mobile-session-exit {
    position: fixed;
    top: calc(9px + env(safe-area-inset-top));
    right: 9px;
    z-index: 90;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 50%;
    color: var(--text);
    background: rgba(7,16,31,.76);
    backdrop-filter: blur(14px);
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
  }
  body.learning-session-mode .question-top { padding-right: 52px; }
  body.learning-session-mode .feed-header { padding-right: 56px; }
}
