:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  --question-inline-math-scale: 1.14em;
  --question-display-math-scale: 1.08em;
  --compact-inline-math-scale: 1.08em;
  --chem-reaction-scheme-max-width: 350px;
  --chem-reaction-scheme-max-height: 90px;
  --question-chem-structure-max-width: 280px;
  --question-chem-structure-max-height: 140px;
  --matching-chem-structure-cap-height: 19px;
  --matching-chem-structure-max-width: 260px;
  --matching-chem-structure-max-height: none;
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.16), transparent 28%),
    linear-gradient(180deg, #eef2ff 0%, #f8faff 100%);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
}

body.image-viewer-open {
  overflow: hidden;
}

.app-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 18px 16px 124px;
}

.app-shell--compact-nav {
  padding-bottom: 96px;
}

.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #e5e7eb;
  padding: 18px 12px 20px;
  margin-bottom: 16px;
}

.profile-user {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.avatar-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
}

.avatar,
.avatar-image {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: block;
}

.avatar-fallback {
  background: linear-gradient(135deg, #c7d2fe, #818cf8);
  color: white;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.profile-online {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #22c55e;
  border: 3px solid white;
}

.profile-meta {
  min-width: 0;
}

.profile-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.profile-username {
  margin-top: 4px;
  color: #6b7280;
  font-size: 14px;
}

.quota-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

.quota-pill-button {
  appearance: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.quota-icon {
  font-size: 20px;
  line-height: 1;
}

.quota-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.panel {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dbe4ff;
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 18px 40px rgba(40, 62, 120, 0.08);
  min-width: 0;
  max-width: 100%;
}

.home-hero {
  background:
    linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(56, 189, 248, 0.06)),
    rgba(255, 255, 255, 0.96);
}

.home-hero.compact {
  padding-bottom: 18px;
}

.screen-topbar {
  display: grid;
  gap: 14px;
}

.screen-topbar-balance-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.screen-topbar-title {
  margin-bottom: 0;
}

.screen-topbar-copy {
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: normal;
  white-space: normal;
  max-width: 620px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #4f46e5;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0 0 12px;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.muted {
  color: #6b7280;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  min-width: 0;
}

.hero-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  line-height: 1.1;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.info-chip-button {
  width: 24px;
  height: 24px;
  border: 1.5px solid rgba(17, 24, 39, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  color: rgba(17, 24, 39, 0.78);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-style: italic;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: none;
  box-shadow: none;
}

.info-chip-button[aria-expanded="true"] {
  background: #f8fafc;
  color: rgba(17, 24, 39, 0.92);
  border-color: rgba(17, 24, 39, 0.82);
}

.card {
  background: #f8faff;
  border: 1px solid #dbe4ff;
  border-radius: 16px;
  padding: 14px;
  min-width: 0;
  max-width: 100%;
}

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

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: #4338ca;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.subject-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

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

.hub-card,
.subject,
.primary {
  border: 0;
  border-radius: 24px;
  padding: 18px 18px 20px;
  cursor: pointer;
}

.hub-card {
  min-height: 188px;
  background: linear-gradient(180deg, #ffffff, #fbfcff);
  border: 1px solid #dfe7ff;
  box-shadow: 0 16px 36px rgba(40, 62, 120, 0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.hub-card.active {
  border-color: #c7d2fe;
  box-shadow: 0 22px 42px rgba(79, 70, 229, 0.14);
  transform: translateY(-1px);
}

.hub-card.passive {
  cursor: default;
}

.hub-icon {
  font-size: 38px;
  line-height: 1;
}

.hub-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  color: #111827;
}

.hub-copy {
  font-size: 15px;
  line-height: 1.45;
  color: #6b7280;
}

.coming-soon {
  margin-top: auto;
  font-size: 12px;
  font-weight: 700;
  color: #4f46e5;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.subject {
  background: #eef2ff;
  color: #3730a3;
  text-align: left;
  display: grid;
  gap: 4px;
  border: 1px solid transparent;
}

.subject small {
  color: #6b7280;
}

.subject.active,
.primary {
  background: linear-gradient(135deg, #4f46e5, #5b4ef6);
  color: white;
}

.primary[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary.ghost {
  width: auto;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.secondary {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.secondary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.secondary.danger {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff7f7;
}

.workspace-panel {
  margin-top: 6px;
}

.balance-grid {
  display: grid;
  gap: 14px;
}

.balance-card {
  background: #f8faff;
  border: 1px solid #dbe4ff;
  border-radius: 20px;
  padding: 20px 18px;
  display: grid;
  gap: 12px;
}

.balance-main-card {
  gap: 10px;
}

.balance-main-copy {
  display: grid;
  gap: 10px;
}

.balance-main-copy p,
.balance-copy {
  margin: 0;
  color: #6b7280;
  font-size: 15px;
  line-height: 1.5;
}

.balance-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.balance-card-head h2 {
  margin: 0;
}

.balance-emoji {
  font-size: 24px;
  line-height: 1;
}

.balance-action {
  width: 100%;
  margin-top: 4px;
}

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

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

.groups-summary-card {
  background: #f8faff;
  border: 1px solid #dbe4ff;
  border-radius: 20px;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.groups-summary-card h2 {
  margin: 6px 0 8px;
}

.groups-summary-actions {
  display: grid;
  gap: 10px;
  min-width: 190px;
}

.invite-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  width: fit-content;
}

.members-list,
.ranking-list {
  display: grid;
  gap: 10px;
}

.member-row,
.ranking-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 12px 14px;
}

.member-role {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.ranking-place {
  flex: 0 0 28px;
  font-weight: 800;
  color: #4f46e5;
}

.ranking-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
}

.ranking-value {
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1;
}

.stage-card {
  background: #f8faff;
  border: 1px solid #dbe4ff;
  border-radius: 20px;
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.stage-head h3 {
  margin: 6px 0 0;
  font-size: 18px;
}

.stage-kicker {
  color: #4f46e5;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stage-copy {
  margin: 0;
  color: #6b7280;
  line-height: 1.45;
  font-size: 14px;
}

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

.mode-chip {
  border: 1px solid #c7d2fe;
  background: #fff;
  color: #3730a3;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mode-chip.active {
  background: linear-gradient(135deg, #4f46e5, #5b4ef6);
  border-color: transparent;
  color: white;
}

.stage-action {
  width: 100%;
}

.question-browser-shortcuts {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.question-browser-shortcut {
  width: 100%;
  border: 1px dashed #c7d2fe;
  border-radius: 16px;
  background: #ffffff;
  color: #4338ca;
  padding: 12px 14px;
  display: grid;
  gap: 3px;
  justify-items: start;
  font: inherit;
  cursor: pointer;
}

.question-browser-shortcut--compact {
  border-style: solid;
  background: #f8faff;
}

.question-browser-shortcut span {
  font-weight: 800;
}

.question-browser-shortcut small {
  color: #6b7280;
  font-size: 12px;
}

.question-browser-controls {
  display: grid;
  gap: 8px;
}

.question-browser-runner--compact {
  gap: 12px;
}

.question-browser-jump {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.question-browser-index-input {
  font-weight: 800;
}

.question-browser-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr);
}

.variant-select,
.text-answer {
  width: 100%;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 12px 14px;
  background: white;
  font: inherit;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat-card {
  background: #f8faff;
  border: 1px solid #dbe4ff;
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.stat-label {
  color: #6b7280;
  font-size: 13px;
}

.stat-value {
  font-size: 22px;
  line-height: 1.15;
}

.variant {
  display: grid;
  gap: 12px;
}

.variant-runner {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.variant-runner--compact {
  gap: 12px;
}

@media (min-width: 641px) {
  .variant-runner--compact .question-card.focus,
  .question-browser-runner--compact .question-card.focus {
    overflow: hidden;
  }

  .variant-runner--compact .question-prompt,
  .question-browser-runner--compact .question-prompt {
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 4px;
    overscroll-behavior-x: contain;
  }

  .variant-runner--compact .question-content,
  .variant-runner--compact .structured-table,
  .question-browser-runner--compact .question-content,
  .question-browser-runner--compact .structured-table {
    min-width: 0;
    max-width: 100%;
  }

  .variant-runner--compact .structured-table,
  .question-browser-runner--compact .structured-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
  }

  .variant-runner--compact .structured-table table,
  .question-browser-runner--compact .structured-table table {
    width: 100%;
    max-width: none;
  }

  .variant-runner--compact .structured-table--content-table table,
  .question-browser-runner--compact .structured-table--content-table table {
    table-layout: fixed;
  }

  .variant-runner--compact .structured-table--content-table th,
  .variant-runner--compact .structured-table--content-table td,
  .question-browser-runner--compact .structured-table--content-table th,
  .question-browser-runner--compact .structured-table--content-table td {
    min-width: 0;
    max-width: none;
    padding: 8px 10px;
    overflow-wrap: anywhere;
    word-break: normal;
  }
}

body.tg-desktop-platform .variant-runner--compact .question-card.focus,
body.tg-desktop-platform .question-browser-runner--compact .question-card.focus {
  overflow: hidden;
}

body.tg-desktop-platform .variant-runner--compact .question-prompt,
body.tg-desktop-platform .question-browser-runner--compact .question-prompt {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
  overscroll-behavior-x: contain;
}

body.tg-desktop-platform .variant-runner--compact .question-content,
body.tg-desktop-platform .variant-runner--compact .structured-table,
body.tg-desktop-platform .question-browser-runner--compact .question-content,
body.tg-desktop-platform .question-browser-runner--compact .structured-table {
  min-width: 0;
  max-width: 100%;
}

body.tg-desktop-platform .variant-runner--compact .structured-table,
body.tg-desktop-platform .question-browser-runner--compact .structured-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}

body.tg-desktop-platform .variant-runner--compact .structured-table table,
body.tg-desktop-platform .question-browser-runner--compact .structured-table table {
  width: 100%;
  max-width: none;
}

body.tg-desktop-platform .variant-runner--compact .structured-table--content-table table,
body.tg-desktop-platform .question-browser-runner--compact .structured-table--content-table table {
  table-layout: fixed;
}

body.tg-desktop-platform .variant-runner--compact .structured-table--content-table th,
body.tg-desktop-platform .variant-runner--compact .structured-table--content-table td,
body.tg-desktop-platform .question-browser-runner--compact .structured-table--content-table th,
body.tg-desktop-platform .question-browser-runner--compact .structured-table--content-table td {
  min-width: 0;
  max-width: none;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (hover: hover) and (pointer: fine) {
  .variant-runner--compact .question-card.focus,
  .question-browser-runner--compact .question-card.focus {
    overflow: hidden;
  }

  .variant-runner--compact .question-prompt,
  .question-browser-runner--compact .question-prompt {
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 4px;
    overscroll-behavior-x: contain;
  }

  .variant-runner--compact .question-content,
  .variant-runner--compact .structured-table,
  .question-browser-runner--compact .question-content,
  .question-browser-runner--compact .structured-table {
    min-width: 0;
    max-width: 100%;
  }

  .variant-runner--compact .structured-table,
  .question-browser-runner--compact .structured-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
  }

  .variant-runner--compact .structured-table table,
  .question-browser-runner--compact .structured-table table {
    width: 100%;
    max-width: none;
  }

  .variant-runner--compact .structured-table--content-table table,
  .question-browser-runner--compact .structured-table--content-table table {
    table-layout: fixed;
  }

  .variant-runner--compact .structured-table--content-table th,
  .variant-runner--compact .structured-table--content-table td,
  .question-browser-runner--compact .structured-table--content-table th,
  .question-browser-runner--compact .structured-table--content-table td {
    min-width: 0;
    max-width: none;
    padding: 8px 10px;
    overflow-wrap: anywhere;
    word-break: normal;
  }
}

.runner-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.question-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  gap: 8px;
}

.question-dot {
  border: 1px solid #dbe4ff;
  background: #fff;
  color: #6b7280;
  border-radius: 12px;
  padding: 10px 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.question-dot.active {
  background: linear-gradient(135deg, #4f46e5, #5b4ef6);
  color: white;
  border-color: transparent;
}

.question-dot.answered:not(.active) {
  background: #eefcf3;
  color: #166534;
  border-color: #bbf7d0;
}

.question-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.question-card.focus {
  padding: 18px;
}

.question-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.question-heading > div {
  min-width: 0;
}

.question-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #4338ca;
}

.question-meta {
  font-size: 13px;
  color: #6b7280;
}

.question-count {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 8px 10px;
}

.question-prompt {
  line-height: 1.55;
  white-space: normal;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  hyphens: auto;
}

.question-content {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.question-flow-aside {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.question-flow-aside-text,
.question-flow-aside-media {
  min-width: 0;
}

.question-flow-aside-media .question-media {
  height: 100%;
  align-items: flex-start;
}

.question-text {
  white-space: pre-wrap;
}

.question-media {
  margin: 0;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.question-inline-scheme {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
  font-family: "Times New Roman", "STIX Two Text", serif;
  font-size: 1.08em;
  line-height: 1.2;
  margin: 4px 0;
}

.question-inline-scheme-text {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  white-space: normal;
}

.question-inline-scheme-img {
  display: inline-block;
  width: auto;
  max-width: min(100%, 240px);
  max-height: 90px;
  object-fit: contain;
  vertical-align: middle;
}

.question-inline-scheme-img--diagram,
.question-inline-scheme-img--chem-structure {
  max-width: min(100%, 180px);
  max-height: 90px;
}

.question-media-img {
  display: block;
  width: auto;
  max-width: min(100%, 520px);
  height: auto;
  object-fit: contain;
}

.question-media:not(.question-media--table) .question-media-img {
  max-height: 420px;
}

.question-media.question-media--diagram .question-media-img {
  max-width: min(100%, 400px);
  max-height: 280px;
}

.question-media.question-media--graph .question-media-img {
  max-width: min(100%, 400px);
  max-height: 280px;
}

.question-media.question-media--chem-structure .question-media-img {
  max-width: min(100%, var(--question-chem-structure-max-width));
  max-height: var(--question-chem-structure-max-height);
}

.chem-equilibrium-arrow {
  display: inline-block;
  font-family: "Times New Roman", "STIX Two Text", serif;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .question-flow-aside {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 320px);
    grid-template-areas: "text media";
    column-gap: 24px;
    align-items: start;
  }

  .question-flow-aside--left {
    grid-template-columns: minmax(180px, 320px) minmax(0, 1fr);
    grid-template-areas: "media text";
  }

  .question-flow-aside-text {
    grid-area: text;
  }

  .question-flow-aside-media {
    grid-area: media;
  }

  .question-flow-aside-media .question-media {
    justify-content: center;
  }

  .question-flow-aside-media .question-media:not(.question-media--table) .question-media-img {
    max-width: min(100%, 320px);
    max-height: 260px;
  }
}

.media-open-button {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

.media-open-button:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.32);
  outline-offset: 4px;
}

.media-zoom-badge {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(165, 180, 252, 0.9);
  background: rgba(238, 242, 255, 0.92);
  color: #4f46e5;
  font-size: 0;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.14);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.media-zoom-badge::before {
  content: "";
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 999px;
  transform: translate(-1px, -1px);
}

.media-zoom-badge::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(5px, 5px) rotate(45deg);
  transform-origin: center;
}

.media-open-button:hover .media-zoom-badge,
.media-open-button:focus-visible .media-zoom-badge {
  border-color: rgba(99, 102, 241, 0.95);
  background: rgba(224, 231, 255, 0.96);
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.2);
  transform: translateY(-1px);
}

.question-media--table .media-open-button {
  width: 100%;
}

.question-media--table .question-media-img {
  width: 100%;
  max-width: 100%;
  border: 1px solid #dbe4ff;
  border-radius: 12px;
  background: #fff;
}

.question-table-frame {
  width: 100%;
  min-height: 220px;
  border: 1px solid #dbe4ff;
  border-radius: 12px;
  background: #fff;
}

.structured-table {
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.structured-table table {
  width: auto;
  min-width: min(100%, 360px);
  border-collapse: collapse;
  table-layout: auto;
  color: #111827;
  font-size: 18px;
  line-height: 1.35;
  background: #fff;
}

.structured-table th,
.structured-table td {
  border: 1px solid #6b7280;
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  background: #fff;
}

.structured-table th {
  font-weight: 700;
}

.structured-table-cell--blank {
  height: 44px;
}

.structured-table p {
  margin: 0;
}

.structured-table mjx-container {
  display: inline-block;
  margin: 0 0.08em;
  font-size: var(--compact-inline-math-scale) !important;
  overflow: visible !important;
  vertical-align: middle;
}

.structured-table mjx-container[display="true"] {
  display: block;
  font-size: 1em !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  padding-block: 0.18em;
}

.structured-table--compact {
  padding: 0;
}

.structured-table--compact table {
  min-width: 260px;
  font-size: 16px;
}

.structured-table--content-table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.structured-table--content-table table {
  width: max-content;
  min-width: 100%;
  max-width: none;
}

.structured-table--content-table th,
.structured-table--content-table td {
  min-width: 108px;
  max-width: 260px;
  overflow-wrap: break-word;
  hyphens: auto;
}

.structured-table--numbered-cell-grid th,
.structured-table--numbered-cell-grid td {
  position: relative;
  min-width: 128px;
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.structured-table-cell-number {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 1;
  font-weight: 800;
  line-height: 1;
  text-align: left;
}

.structured-table-cell-body {
  display: flex;
  box-sizing: border-box;
  min-height: 96px;
  padding: 28px 10px 12px;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1em;
  font-weight: 400;
  line-height: 1.18;
}

.structured-table-cell-body b,
.structured-table-cell-body strong {
  font-weight: 800;
}

.structured-table-cell-body p {
  margin: 0;
}

.variant-runner--compact .structured-table--numbered-cell-grid th,
.variant-runner--compact .structured-table--numbered-cell-grid td,
.question-browser-runner--compact .structured-table--numbered-cell-grid th,
.question-browser-runner--compact .structured-table--numbered-cell-grid td {
  min-width: 0;
  padding: 0;
}

.variant-runner--compact .structured-table--numbered-cell-grid .structured-table-cell-body,
.question-browser-runner--compact .structured-table--numbered-cell-grid .structured-table-cell-body {
  min-height: 78px;
  padding: 26px 6px 10px;
  font-size: 1em;
  font-weight: 400;
  line-height: 1.14;
}

.variant-runner--compact .structured-table--numbered-cell-grid .structured-table-cell-number,
.question-browser-runner--compact .structured-table--numbered-cell-grid .structured-table-cell-number {
  top: 8px;
  left: 8px;
  font-size: 0.95em;
}

.structured-table--answer-template {
  --template-table-width: 426px;
  width: min(100%, var(--template-table-width));
  max-width: 100%;
  overflow-x: hidden;
}

.structured-table--answer-template table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
  font-size: 16px;
  line-height: 1.18;
}

.structured-table--answer-template th,
.structured-table--answer-template td {
  border-color: #4b5563;
  padding: 5px 8px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

.structured-table--answer-template th {
  font-weight: 600;
  text-wrap: balance;
}

.structured-table--answer-template .structured-table-cell--answer-template span {
  display: block;
}

.structured-table--answer-template .structured-table-cell--blank {
  height: 34px;
}

.asset-missing {
  border: 1px dashed #c7d2fe;
  border-radius: 12px;
  padding: 12px;
  color: #6b7280;
  font-weight: 700;
  background: #f8faff;
}

.option-list {
  display: grid;
  gap: 8px;
}

.option-list-compact {
  gap: 10px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.option-content {
  display: grid;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.option-content--media {
  align-items: center;
  min-height: 56px;
  overflow: visible;
}

.option-text {
  white-space: pre-wrap;
}

.question-text--rich,
.option-text--rich {
  white-space: normal;
}

.question-card[data-subject-id="chemistry"] {
  --chemistry-formula-font: Georgia, "Times New Roman", Times, serif;
}

.question-card[data-subject-id="chemistry"] .question-text--rich,
.question-card[data-subject-id="chemistry"] .option-text--rich,
.question-card[data-subject-id="chemistry"] .matching-content,
.question-card[data-subject-id="chemistry"] .structured-table {
  font-family: var(--chemistry-formula-font);
  font-style: normal;
  font-weight: 400;
}

.question-card[data-subject-id="chemistry"] .question-text--rich span,
.question-card[data-subject-id="chemistry"] .option-text--rich span,
.question-card[data-subject-id="chemistry"] .matching-content span,
.question-card[data-subject-id="chemistry"] .structured-table span {
  font-style: normal;
  font-weight: inherit;
}

.question-card[data-subject-id="chemistry"] .structured-table .structured-table-cell-number,
.structured-table .structured-table-cell-number {
  font-weight: 800;
}

.question-card[data-subject-id="chemistry"] math,
.question-card[data-subject-id="chemistry"] mjx-container {
  font-style: normal;
  font-weight: 400 !important;
}

.question-card[data-subject-id="chemistry"] mjx-mi {
  font-style: normal !important;
}

.question-text--rich p,
.option-text--rich p {
  margin: 0 0 0.6em;
}

.question-text--rich p:last-child,
.option-text--rich p:last-child {
  margin-bottom: 0;
}

.question-text--rich .MsoNormal,
.option-text--rich .MsoNormal {
  margin: 0;
}

.question-text--rich .chem-reaction-scheme-block {
  display: block;
}

.question-text--rich .chem-reaction-scheme-block p {
  margin: 0 0 14px;
}

.question-text--rich .chem-reaction-scheme-block p:last-child {
  margin-bottom: 0;
}

.question-text--rich .chem-reaction-scheme {
  display: flex;
  justify-content: center;
  margin: 14px auto 18px;
  min-width: 0;
  width: 100%;
}

.question-text--rich .chem-reaction-scheme svg {
  display: block;
  height: auto;
  max-height: var(--chem-reaction-scheme-max-height);
  max-width: min(100%, var(--chem-reaction-scheme-max-width));
  overflow: visible;
  width: min(100%, var(--chem-reaction-scheme-max-width));
}

.question-text--rich sub,
.question-text--rich sup,
.option-text--rich sub,
.option-text--rich sup {
  line-height: 0;
}

.question-text--rich math,
.option-text--rich math {
  display: inline-block;
  font-size: var(--question-inline-math-scale);
  max-width: 100%;
  overflow: visible;
  vertical-align: middle;
}

.question-text--rich mjx-container,
.option-text--rich mjx-container {
  display: inline-block;
  font-size: var(--question-inline-math-scale) !important;
  max-width: 100%;
  overflow: visible !important;
  vertical-align: middle;
}

.question-text--rich mjx-container[display="true"],
.option-text--rich mjx-container[display="true"] {
  display: block;
  font-size: var(--question-display-math-scale) !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  padding-block: 0.18em;
}

.option-media {
  margin: 0;
  min-width: 0;
  overflow: visible;
}

.option-media-img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  height: auto;
  object-fit: contain;
}

.option-content--media .option-media-img {
  width: auto;
}

.option-media-img--chem-structure,
.question-media-img--chem-structure {
  max-width: min(100%, var(--question-chem-structure-max-width));
  max-height: var(--question-chem-structure-max-height);
}

.option-table-frame {
  width: 100%;
  min-height: 160px;
  border: 1px solid #dbe4ff;
  border-radius: 10px;
  background: #fff;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgba(8, 13, 24, 0.94);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.image-viewer--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.image-viewer-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: max(14px, env(safe-area-inset-top)) 14px 8px;
}

.image-viewer-close {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.image-viewer-stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px 14px 12px;
  touch-action: none;
  overscroll-behavior: contain;
  cursor: default;
}

.image-viewer-stage--dragging {
  cursor: grabbing;
}

.image-viewer-img {
  display: block;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 156px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  transition: transform 140ms ease;
  will-change: transform;
}

.image-viewer-img--active {
  cursor: grab;
}

.image-viewer-img--immediate {
  transition: none;
}

.image-viewer-controls {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px max(18px, env(safe-area-inset-bottom));
}

.image-viewer-controls button {
  min-width: 56px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.option-tile {
  border: 1px solid #dbe4ff;
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
}

.option-tile--text {
  align-items: center;
  min-height: 54px;
  padding-block: 11px;
}

.option-tile--text .option-content {
  gap: 0;
}

.option-tile--text .option-text {
  line-height: 1.25;
}

.option-tile--media {
  align-items: flex-start;
}

.option-tile.selected {
  border-color: #818cf8;
  background: #eef2ff;
}

.answer-box {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.answer-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.answer-input-row--has-prefix {
  grid-template-columns: minmax(0, max-content) minmax(88px, 1fr);
}

.answer-input-row--has-suffix {
  grid-template-columns: minmax(88px, 1fr) minmax(0, max-content);
}

.answer-input-row--has-prefix.answer-input-row--has-suffix {
  grid-template-columns: minmax(0, max-content) minmax(72px, 1fr) minmax(0, max-content);
}

.answer-input {
  width: 100%;
  font-size: 16px;
  min-width: 0;
}

.answer-textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.45;
}

.answer-affix {
  min-width: 0;
  max-width: 26vw;
  color: #111827;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.08;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

.matching-panel {
  display: grid;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
}

.matching-panel--prompt {
  margin: 18px 0 22px;
}

.question-card .question-prompt + .matching-panel {
  margin-top: 10px;
}

.matching-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.matching-column {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.matching-column-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  color: #374151;
  border-bottom: 1px solid #dbe4ff;
  padding-bottom: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.matching-options-reference {
  max-width: 520px;
}

.matching-options-reference .matching-list {
  gap: 4px;
}

.matching-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid #eef2ff;
  min-width: 0;
}

.matching-key {
  min-width: 0;
  font-weight: 900;
  color: #111827;
  text-align: center;
}

.matching-content {
  min-width: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.matching-content .option-text,
.matching-content .option-text--rich {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.matching-elements {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.matching-elements--inline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.24em 0.45em;
}

.matching-elements--inline .option-media,
.matching-elements--inline .option-text {
  margin: 0;
}

.matching-content .option-media {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-start;
}

.matching-content .option-media-img {
  width: auto;
  max-width: min(100%, 220px);
  max-height: 160px;
}

.matching-content .option-media-img--chem-structure,
.matching-content .question-media-img--chem-structure {
  max-width: min(100%, var(--matching-chem-structure-max-width));
  max-height: var(--matching-chem-structure-max-height);
  height: auto;
}

.matching-content p {
  margin: 0;
}

.chem-equation {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.08em 0.28em;
  max-width: 100%;
  font-family: inherit;
  font-style: normal;
  font-weight: 400;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: normal;
}

.chem-equation .chem-part,
.chem-equation .chem-op,
.chem-equation .chem-arrow,
.chem-equation .chem-bond {
  display: inline-block;
  white-space: nowrap;
  font-style: normal;
}

.chem-equation sub,
.chem-equation sup {
  font-size: 0.62em;
  line-height: 0;
}

.chem-equation sub {
  vertical-align: sub;
}

.chem-equation sup {
  vertical-align: super;
}

.matching-content .chem-equation {
  font-size: 1em;
}

.matching-content math {
  display: inline-block;
  font-size: var(--compact-inline-math-scale);
  max-width: 100%;
  overflow: visible;
  vertical-align: middle;
}

.matching-content mjx-container {
  display: inline-block;
  font-size: var(--compact-inline-math-scale) !important;
  max-width: 100%;
  overflow: visible !important;
  vertical-align: middle;
}

.matching-content mjx-container[display="true"] {
  display: block;
  font-size: 1em !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  padding-block: 0.18em;
}

.matching-answer-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  padding-top: 2px;
}

.matching-answer-grid--multi {
  grid-template-columns: repeat(auto-fit, minmax(min(176px, 100%), 1fr));
}

.matching-answer-grid--slots-2,
.matching-answer-grid--slots-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.matching-answer-grid--slots-3,
.matching-answer-grid--slots-5,
.matching-answer-grid--slots-6 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.matching-answer-grid--slots-2 .matching-select-cell,
.matching-answer-grid--slots-3 .matching-select-cell,
.matching-answer-grid--slots-4 .matching-select-cell,
.matching-answer-grid--slots-5 .matching-select-cell,
.matching-answer-grid--slots-6 .matching-select-cell {
  grid-template-columns: minmax(20px, max-content) minmax(0, 1fr);
}

.matching-answer-grid--slots-3 .matching-select-cell,
.matching-answer-grid--slots-5 .matching-select-cell,
.matching-answer-grid--slots-6 .matching-select-cell {
  gap: 4px;
  padding-inline: 6px;
}

.matching-answer-grid--slots-3 .matching-select,
.matching-answer-grid--slots-5 .matching-select,
.matching-answer-grid--slots-6 .matching-select {
  padding-inline: 4px;
}

.matching-select-cell {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  border: 1px solid #dbe4ff;
  border-radius: 14px;
  padding: 10px 8px;
  background: #f8faff;
  min-width: 0;
}

.matching-select-cell span {
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.matching-select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-weight: 800;
  text-align: center;
  padding: 0 10px;
}

.feedback-card {
  border-radius: 16px;
  padding: 14px;
  border: 1px solid #dbe4ff;
  background: #f8faff;
  display: grid;
  gap: 8px;
}

.feedback-card.ok {
  background: #eefcf3;
  border-color: #bbf7d0;
}

.feedback-card.bad {
  background: #fff7ed;
  border-color: #fed7aa;
}

.feedback-title {
  font-size: 16px;
  font-weight: 800;
}

.feedback-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: #374151;
}

.feedback-solution {
  line-height: 1.5;
  white-space: pre-wrap;
}

.runner-actions,
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.question-browser-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr);
}

.prep-grid .hub-card {
  min-height: 168px;
}

.bottom-nav {
  --bottom-nav-edge: 12px;
  --bottom-nav-size: 72px;
  position: fixed;
  right: max(var(--bottom-nav-edge), calc((100vw - 720px) / 2));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(calc(100vw - 24px), 720px);
  min-height: var(--bottom-nav-size);
  display: block;
  padding: 10px;
  border-radius: 999px;
  background: rgba(16, 24, 40, 0.94);
  border: 1px solid rgba(99, 102, 241, 0.18);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(16px);
  z-index: 30;
  overflow: hidden;
  transition: width 220ms ease, min-height 220ms ease, height 220ms ease, padding 220ms ease, box-shadow 220ms ease;
}

.bottom-nav-items {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  opacity: 1;
  visibility: visible;
  transition: opacity 140ms ease, visibility 140ms ease;
}

.global-menu-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.18);
  cursor: default;
  z-index: 29;
}

.bottom-nav-toggle {
  display: none;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.bottom-nav-toggle span {
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

.bottom-nav-toggle:active {
  transform: scale(0.96);
}

.bottom-nav--collapsed {
  width: var(--bottom-nav-size);
  min-height: var(--bottom-nav-size);
  height: var(--bottom-nav-size);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav--collapsed .bottom-nav-items {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.bottom-nav--collapsed .bottom-nav-toggle {
  display: inline-flex;
}

.bottom-nav-item {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  padding: 10px 6px;
  display: grid;
  justify-items: center;
  gap: 4px;
  font: inherit;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.bottom-nav-item.active {
  background: #ffffff;
  color: #111827;
}

.bottom-nav-item:active {
  transform: translateY(1px);
}

.bottom-nav-icon {
  font-size: 18px;
  line-height: 1;
}

.bottom-nav-label {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
}

.bottom-nav--task {
  padding: 8px;
}

.task-action-items {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  gap: 8px;
  align-items: center;
}

.task-action-core {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 2fr) minmax(0, 0.8fr);
  gap: 8px;
  align-items: stretch;
}

.task-menu-toggle,
.task-question-toggle,
.task-action-button {
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.task-menu-toggle,
.task-question-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.task-menu-toggle {
  flex-direction: column;
  gap: 5px;
}

.task-menu-toggle span {
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

.task-question-toggle {
  font-size: 24px;
  line-height: 1;
}

.task-question-toggle.active {
  background: #ffffff;
  color: #111827;
}

.task-action-spacer {
  min-height: 52px;
}

.task-action-button {
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
}

.task-action-button--side {
  font-size: 24px;
}

.task-action-button--primary {
  background: linear-gradient(135deg, #5b4df2, #493cf0);
  color: #ffffff;
  font-size: 16px;
}

.task-action-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.task-question-navigator {
  position: fixed;
  right: max(12px, calc((100vw - 720px) / 2));
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 88px);
  width: min(calc(100vw - 24px), 720px);
  max-height: calc(100dvh - max(14px, env(safe-area-inset-bottom)) - 112px);
  padding: 18px;
  border-radius: 28px;
  background: rgba(16, 24, 40, 0.96);
  border: 1px solid rgba(99, 102, 241, 0.22);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(18px);
  z-index: 29;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

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

.task-question-navigator-kicker {
  color: rgba(255, 255, 255, 0.56);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.task-question-navigator h2 {
  margin: 2px 0 0;
  color: #ffffff;
  font-size: 20px;
  line-height: 1.15;
}

.task-question-navigator-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.task-question-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.task-question-grid::-webkit-scrollbar {
  width: 6px;
}

.task-question-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
}

.task-question-number {
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.task-question-number.answered {
  border-color: rgba(255, 255, 255, 0.26);
  color: rgba(255, 255, 255, 0.92);
}

.task-question-number.status-correct {
  border-color: rgba(52, 211, 153, 0.64);
  color: #bbf7d0;
}

.task-question-number.status-incorrect {
  border-color: rgba(248, 113, 113, 0.82);
  color: #fecaca;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.32);
}

.task-question-number.status-correct_after_incorrect {
  border-color: rgba(250, 204, 21, 0.88);
  color: #fef3c7;
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.34);
}

.task-question-number.active {
  background: #ffffff;
  border-color: #ffffff;
  color: #111827;
  box-shadow: 0 12px 28px rgba(255, 255, 255, 0.14);
}

.task-question-number.active.status-correct {
  border-color: rgba(52, 211, 153, 0.9);
  box-shadow:
    inset 0 0 0 2px rgba(52, 211, 153, 0.85),
    0 12px 28px rgba(255, 255, 255, 0.14);
}

.task-question-number.active.status-incorrect {
  border-color: rgba(248, 113, 113, 0.95);
  box-shadow:
    inset 0 0 0 2px rgba(248, 113, 113, 0.92),
    0 12px 28px rgba(255, 255, 255, 0.14);
}

.task-question-number.active.status-correct_after_incorrect {
  border-color: rgba(250, 204, 21, 0.98);
  box-shadow:
    inset 0 0 0 2px rgba(250, 204, 21, 0.92),
    0 12px 28px rgba(255, 255, 255, 0.14);
}

.task-question-navigator-footer {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(16, 24, 40, 0.76), rgba(16, 24, 40, 0.98));
}

.task-question-progress {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
}

.task-finish-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.task-finish-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.36);
  cursor: default;
  z-index: 40;
}

.confirm-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(100vw - 24px), 560px);
  padding: 22px;
  border-radius: 22px;
  background: rgba(16, 24, 40, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.36);
  color: #ffffff;
  z-index: 41;
}

.confirm-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.confirm-dialog-message {
  padding-right: 44px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

.confirm-dialog-button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.confirm-dialog-button--ghost {
  background: transparent;
  color: #7ab9ff;
}

.confirm-dialog-button--primary {
  background: #ffffff;
  color: #111827;
}

@media (max-width: 640px) {
  :root {
    --chem-reaction-scheme-max-width: 100%;
    --chem-reaction-scheme-max-height: 80px;
    --question-chem-structure-max-width: 240px;
    --question-chem-structure-max-height: 120px;
    --matching-chem-structure-cap-height: 17px;
    --matching-chem-structure-max-width: 240px;
    --matching-chem-structure-max-height: none;
  }

  .app-shell {
    padding: 14px 12px 118px;
  }

  .app-shell--compact-nav {
    padding-bottom: 92px;
  }

  .profile-hero {
    padding: 14px 8px 18px;
  }

  .section-head {
    flex-direction: column;
  }

  .hub-grid,
  .workspace-grid,
  .groups-state-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stage-card {
    grid-column: span 2;
  }

  .primary {
    width: 100%;
  }

  .secondary {
    width: 100%;
  }

  .question-browser-jump .secondary {
    width: auto;
  }

  .question-browser-actions {
    grid-template-columns: 1fr;
  }

  .status-chip {
    padding: 6px 9px;
    font-size: 12px;
  }

  .question-card.focus {
    padding: 14px;
  }

  .answer-input-row {
    gap: 8px;
  }

  .answer-input-row--has-prefix {
    grid-template-columns: minmax(0, max-content) minmax(72px, 1fr);
  }

  .answer-input-row--has-suffix {
    grid-template-columns: minmax(72px, 1fr) minmax(0, max-content);
  }

  .answer-input-row--has-prefix.answer-input-row--has-suffix {
    grid-template-columns: minmax(0, max-content) minmax(60px, 1fr) minmax(0, max-content);
  }

  .answer-affix {
    max-width: 24vw;
    font-size: 16px;
  }

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

  .matching-select-cell {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .matching-answer-grid--slots-3,
  .matching-answer-grid--slots-5,
  .matching-answer-grid--slots-6 {
    gap: 6px;
  }

  .matching-answer-grid--slots-3 .matching-select-cell,
  .matching-answer-grid--slots-5 .matching-select-cell,
  .matching-answer-grid--slots-6 .matching-select-cell {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 3px;
    padding: 8px 4px;
  }

  .matching-answer-grid--slots-3 .matching-select-cell span,
  .matching-answer-grid--slots-5 .matching-select-cell span,
  .matching-answer-grid--slots-6 .matching-select-cell span {
    font-size: 16px;
  }

  .matching-answer-grid--slots-3 .matching-select,
  .matching-answer-grid--slots-5 .matching-select,
  .matching-answer-grid--slots-6 .matching-select {
    min-height: 38px;
    padding-inline: 2px;
  }

  .question-media:not(.question-media--table) .question-media-img {
    max-height: 360px;
  }

  .question-media.question-media--diagram .question-media-img {
    max-width: min(100%, 280px);
    max-height: 200px;
  }

  .question-media.question-media--graph .question-media-img {
    max-width: min(100%, 280px);
    max-height: 200px;
  }

  .question-media.question-media--chem-structure .question-media-img {
    max-width: min(100%, var(--question-chem-structure-max-width));
    max-height: var(--question-chem-structure-max-height);
  }

  .structured-table {
    width: fit-content;
    max-width: 100%;
    padding: 0;
  }

  .structured-table table {
    min-width: 280px;
    font-size: 16px;
  }

  .structured-table th,
  .structured-table td {
    padding: 8px;
  }

  .structured-table--answer-template table {
    width: 100%;
    min-width: 0;
    font-size: 15px;
  }

  .structured-table--answer-template th,
  .structured-table--answer-template td {
    padding: 5px 6px;
  }

  .groups-summary-card {
    flex-direction: column;
    align-items: stretch;
  }

  .groups-summary-actions {
    min-width: 0;
  }

  .quota-pill {
    padding: 10px 14px;
  }

  .quota-value {
    font-size: 20px;
  }

  .bottom-nav {
    --bottom-nav-edge: 8px;
    --bottom-nav-size: 70px;
    width: calc(100vw - 16px);
    right: var(--bottom-nav-edge);
    bottom: max(10px, env(safe-area-inset-bottom));
    padding: 8px;
  }

  .bottom-nav-items {
    gap: 4px;
  }

  .bottom-nav--collapsed {
    width: var(--bottom-nav-size);
    min-height: var(--bottom-nav-size);
    height: var(--bottom-nav-size);
    padding: 0;
  }

  .bottom-nav-item {
    padding: 10px 4px;
  }

  .bottom-nav-label {
    font-size: 11px;
  }

  .task-action-items {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    gap: 6px;
  }

  .task-action-core {
    grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.8fr) minmax(0, 0.75fr);
    gap: 6px;
  }

  .task-menu-toggle,
  .task-question-toggle,
  .task-action-button {
    min-height: 50px;
  }

  .task-action-spacer {
    min-height: 50px;
  }

  .task-action-button--primary {
    font-size: 15px;
  }

  .task-question-navigator {
    bottom: calc(max(14px, env(safe-area-inset-bottom)) + 84px);
    max-height: calc(100dvh - max(14px, env(safe-area-inset-bottom)) - 104px);
    padding: 16px;
    border-radius: 26px;
  }

  .task-question-grid {
    gap: 7px;
  }

  .task-question-number {
    border-radius: 12px;
    font-size: 15px;
  }

  .task-finish-button {
    min-height: 46px;
  }

  .confirm-dialog {
    width: calc(100vw - 16px);
    padding: 20px;
    border-radius: 20px;
  }

  .confirm-dialog-message {
    font-size: 17px;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-inline: 8px;
  }

  .panel {
    padding: 16px;
  }

  .question-card.focus {
    padding: 12px;
  }

  .status-chip {
    padding: 5px 8px;
    font-size: 11px;
  }

  .answer-affix {
    max-width: 22vw;
  }

  .hub-grid,
  .workspace-grid,
  .groups-state-grid {
    grid-template-columns: 1fr;
  }

  .stage-card {
    grid-column: auto;
  }

  .hub-card {
    min-height: 164px;
  }

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

  .screen-topbar-copy {
    max-width: none;
  }

  .bottom-nav-label {
    font-size: 10px;
  }
}
