:root {
  --violet: #2563EB;
  --lagoon: #000000;
  --gold: #eab308;
  --alabaster: #FFFFFF;
  --moss: #475569;
  --white: #ffffff;
  --surface: rgba(255, 255, 255, 0.92);
  --border: rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 28px 60px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 16px 34px rgba(0, 0, 0, 0.12);
  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--gx-font-body) ;
  color: var(--lagoon);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(196, 181, 253, 0.18), transparent 28%),
    linear-gradient(160deg, #f8f7ef 0%, #edf3f6 100%);
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

.quiz-header-shell,
.quiz-footer-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.quiz-header-shell {
  padding: 1rem 0 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
}

.logo-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.logo-copy h1 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: 0.04em;
  font-family: var(--gx-font-display) ;
}

.logo-copy span {
  color: var(--moss);
  font-size: 0.9rem;
}

.quiz-main-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.hero-card,
.setup-card,
.status-card,
.question-card,
.results-shell,
.result-card,
.results-rank-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.hero-kicker {
  margin: 0 0 0.45rem;
  color: var(--violet);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
}

.hero-copy h2,
.results-hero h2 {
  margin: 0;
  font-size: clamp(1.9rem, 1.2rem + 2vw, 3rem);
  line-height: 1.05;
  font-family: var(--gx-font-display) ;
  letter-spacing: 0.03em;
}

.selected-category-label,
.selected-language-label,
.selection-helper-text,
#result-summary-copy,
#setup-rank-copy,
#result-rank-copy {
  color: var(--moss);
}

.selected-category-label,
.selected-language-label {
  margin: 0.45rem 0 0;
  font-weight: 600;
}

.selection-helper-text {
  max-width: 720px;
  margin: 0.9rem 0 0;
  line-height: 1.6;
}

.setup-grid,
.results-grid {
  display: grid;
  gap: 1.25rem;
}

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

.setup-card,
.results-rank-panel {
  padding: 1.5rem;
}

.setup-card-action {
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.setup-card-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.16);
  border-color: rgba(37, 99, 235, 0.26);
}

.setup-card-action:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.34);
  outline-offset: 3px;
}

.setup-card-action.is-disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.setup-card-action.is-disabled:hover {
  transform: none;
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

.setup-card-head,
.status-topline,
.question-meta,
.rank-progress-text {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.pill,
.difficulty-pill,
.soft-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill {
  background: rgba(37, 99, 235, 0.12);
  color: var(--violet);
}

.difficulty-pill {
  background: rgba(0, 0, 0, 0.09);
  color: var(--lagoon);
}

.soft-chip {
  background: rgba(93, 115, 124, 0.12);
  color: var(--moss);
}

.setup-card h3,
.status-card h3,
.rank-summary h3,
.question-card h2 {
  margin: 0;
}

.setup-card h3 {
  font-size: 2rem;
  margin-top: 0.7rem;
}

.setup-card p {
  margin: 0.65rem 0 0;
  line-height: 1.6;
}

.setup-metrics,
.level-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.2rem;
}

.metric-tile,
.result-card {
  padding: 1.25rem;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
  border: 1px solid rgba(37, 99, 235, 0.15);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.12);
}

.metric-tile span,
.result-card span,
.mini-stat span {
  display: block;
  color: var(--moss);
  font-size: 0.85rem;
  font-weight: 600;
}

.metric-tile strong,
.result-card strong,
.mini-stat strong {
  display: block;
  margin-top: 0.45rem;
  font-size: 1.35rem;
  color: var(--lagoon);
}

.setup-card-cta {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-start;
}

.play-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(196, 181, 253, 0.18), rgba(37, 99, 235, 0.14));
  color: var(--lagoon);
  font-weight: 800;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.rank-summary {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.rank-image {
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.15));
}

.rank-progress-shell {
  margin-top: 1rem;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.progress-track.wide {
  height: 14px;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--gold));
  transition: width 260ms ease;
}

.quiz-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.25rem;
}

.quiz-sidebar {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.status-card {
  padding: 1.2rem;
}

.timer-ring {
  display: grid;
  place-items: center;
  align-content: center;
  position: relative;
  gap: 0.1rem;
  width: 142px;
  height: 142px;
  margin: 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--timer-accent, #22c55e) var(--timer-angle, 360deg), rgba(0, 0, 0, 0.12) 0deg);
  color: var(--lagoon);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.16),
    0 0 0 10px rgba(255, 255, 255, 0.38);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.timer-ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.08),
    inset 0 16px 22px rgba(37, 99, 235, 0.05);
}

.timer-ring::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  border: 1px dashed rgba(0, 0, 0, 0.1);
  opacity: 0.6;
}

.timer-ring > * {
  position: relative;
  z-index: 1;
}

.timer-ring span {
  font-size: 2.65rem;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.05em;
  text-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.timer-ring small {
  display: block;
  color: var(--moss);
    text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.66rem;
  font-weight: 800;
  margin-top: -0.1rem;
}

.compact-stats {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-stat {
  padding: 0.9rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.question-panel {
  display: grid;
  gap: 1rem;
}

.question-card {
  padding: 1.35rem;
}

.question-card h2 {
  margin-top: 0.8rem;
  font-size: clamp(1.2rem, 0.95rem + 0.9vw, 1.65rem);
  line-height: 1.55;
}

.mobile-quiz-stats-toggle,
.mobile-quiz-stats-panel {
  display: none;
}

.mobile-quiz-stats-toggle {
  width: 100%;
  margin-top: 0.95rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.78);
  color: var(--lagoon);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  font: inherit;
  font-weight: 700;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.mobile-quiz-stats-panel {
  margin-top: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.question-media {
  margin-top: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.88);
  padding: 0.95rem;
}

.question-media img,
.question-media svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 14px;
}

.options-container {
  display: grid;
  gap: 0.9rem;
}

.option-btn {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.94);
  color: var(--lagoon);
  padding: 1rem 1.1rem;
  border-radius: 20px;
  text-align: left;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
  font: inherit;
}

.option-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.45);
}

.option-btn:disabled {
  cursor: default;
}

.option-btn.correct {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(22, 163, 74, 0.46);
}

.option-btn.incorrect {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(220, 38, 38, 0.34);
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.results-shell {
  padding: 1.6rem;
}

.results-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1.35rem;
}

.result-buttons,
.modal-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.4rem;
}

.result-account-note {
  margin: 1rem 0 0;
  color: var(--moss);
  line-height: 1.6;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.3rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: var(--white);
  background: linear-gradient(135deg, var(--lagoon), var(--violet));
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.18);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-accent {
  color: #3d2c00;
  background: linear-gradient(135deg, #ffd36f, var(--gold));
}

#start-level-btn,
.btn-accent {
  color: #3a2a00;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.48), transparent 28%),
    linear-gradient(135deg, #f9dc99 0%, var(--gold) 48%, #d98f18 100%);
  border: 1px solid rgba(196, 181, 253, 0.5);
  box-shadow:
    0 16px 26px rgba(196, 181, 253, 0.34),
    inset 0 -4px 8px rgba(82, 56, 0, 0.18),
    inset 0 4px 8px rgba(255, 255, 255, 0.42);
}

#start-level-btn:hover,
.btn-accent:hover {
  transform: scale(1.04) translateY(-2px);
  box-shadow:
    0 22px 34px rgba(196, 181, 253, 0.42),
    inset 0 -4px 8px rgba(82, 56, 0, 0.14),
    inset 0 4px 10px rgba(255, 255, 255, 0.5);
}

.btn-outline {
  color: var(--lagoon);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  background: rgba(12, 29, 43, 0.58);
  backdrop-filter: blur(6px);
  z-index: 1000;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: min(640px, 100%);
  max-height: min(90vh, 820px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 28px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  position: relative;
}

.small-modal {
  width: min(460px, 100%);
  text-align: center;
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: var(--lagoon);
  font-size: 1.3rem;
  cursor: pointer;
}

.language-modal-content,
.level-info-modal-content {
  text-align: center;
}

.level-info-modal-content {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.modal-ready-copy {
  max-width: 34rem;
  margin: 0.35rem auto 0;
  color: var(--lagoon);
  line-height: 1.65;
  font-size: 1.02rem;
}

.modal-ready-copy strong {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(196, 181, 253, 0.12));
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--lagoon);
  font-size: clamp(1.02rem, 0.95rem + 0.35vw, 1.15rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
}

.modal-ready-actions {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.modal-ready-actions[hidden],
.level-details-panel {
  display: none;
}

.modal-notice-panel {
  padding: 1rem 1.05rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.96));
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.modal-notice-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--lagoon);
  font-weight: 800;
  font-size: 0.98rem;
}

.modal-notice-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.modal-notice-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  text-align: left;
}

.modal-notice-item i {
  color: var(--violet);
  margin-top: 0.15rem;
}

.modal-notice-item p {
  margin: 0;
  color: var(--moss);
  line-height: 1.62;
}

.level-details-panel {
  margin-top: 0.1rem;
}

.language-modal-copy {
  max-width: 34rem;
  margin: 0.7rem auto 0;
  color: var(--moss);
  line-height: 1.6;
}

.language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.language-card {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 22px;
  padding: 1rem;
  background: rgba(255,255,255,0.96);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}

.language-card.active {
  border-color: rgba(37, 99, 235, 0.62);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(255,255,255,0.98));
  transform: scale(1.04);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.22);
}

.language-card:hover {
  transform: translateY(-2px);
}
.language-card.active:hover {
  transform: scale(1.04) translateY(-2px);
}

.language-name {
  display: block;
  font-weight: 800;
  transition: color var(--transition), font-size var(--transition);
}

.language-card.active .language-name {
  color: var(--violet);
  font-size: 1.1rem;
}

.language-copy {
  display: block;
  margin-top: 0.3rem;
  color: var(--moss);
  font-size: 0.92rem;
}

.instruction-list {
  margin-top: 1.1rem;
  display: grid;
  gap: 1rem;
  text-align: left;
}

.instruction-item {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 1rem 1.05rem;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.94));
  border: 1px solid rgba(0, 0, 0, 0.07);
}

.instruction-item i {
  color: var(--violet);
  margin-top: 0.1rem;
}

.instruction-item p {
  margin: 0;
  color: var(--lagoon);
  line-height: 1.68;
}

.feedback-modal-content h2 {
  margin: 0.25rem 0 0;
}

.feedback-modal-content p {
  color: var(--moss);
}

.feedback-note {
  margin: 0.75rem 0 0;
  line-height: 1.55;
}

.feedback-answer-box {
  margin: 1rem 0 1.2rem;
  padding: 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.feedback-answer-box span {
  display: block;
  color: var(--moss);
  font-size: 0.82rem;
}

.feedback-answer-box strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.15rem;
  color: var(--lagoon);
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
}

.rankup-modal-content {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.24), transparent 35%),
    radial-gradient(circle at bottom, rgba(196, 181, 253, 0.22), transparent 34%),
    rgba(255, 255, 255, 0.98);
  animation: rankupCardRise 420ms ease;
}

.rankup-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.rankup-burst span {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--violet));
  opacity: 0;
  animation: rankupSpark 1.2s ease-out infinite;
}

.rankup-burst span:nth-child(1) { top: 16%; left: 18%; animation-delay: 0s; }
.rankup-burst span:nth-child(2) { top: 18%; right: 22%; animation-delay: 0.16s; }
.rankup-burst span:nth-child(3) { top: 48%; left: 8%; animation-delay: 0.28s; }
.rankup-burst span:nth-child(4) { top: 56%; right: 10%; animation-delay: 0.4s; }
.rankup-burst span:nth-child(5) { bottom: 18%; left: 24%; animation-delay: 0.52s; }
.rankup-burst span:nth-child(6) { bottom: 14%; right: 26%; animation-delay: 0.64s; }

.rankup-badge-showcase {
  display: grid;
  gap: 0.8rem;
  justify-items: center;
  margin: 1rem 0 1.35rem;
}

.rankup-image {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 18px 20px rgba(37, 99, 235, 0.25));
  animation: rankBadgePop 700ms cubic-bezier(.2,.8,.2,1);
}

.rankup-track {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--lagoon);
  font-weight: 700;
}

.rankup-from {
  color: var(--moss);
}

.rankup-to {
  color: var(--violet);
}

@keyframes rankupCardRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rankBadgePop {
  0% {
    opacity: 0;
    transform: scale(0.55) rotate(-12deg);
  }
  65% {
    opacity: 1;
    transform: scale(1.08) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes rankupSpark {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.4);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-22px) scale(1.4);
  }
}

.back-blocked-message {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%) translateY(20px);
  width: min(92vw, 560px);
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.96);
  color: #fff;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 1100;
}

.back-blocked-message.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.quiz-footer-shell {
  padding: 0 0 1.4rem;
  color: var(--moss);
  text-align: center;
}

@media (max-width: 980px) {
  .setup-grid,
  .quiz-shell,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .hero-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .quiz-main-shell,
  .quiz-header-shell,
  .quiz-footer-shell {
    width: min(100% - 1rem, 1180px);
  }

  .hero-card,
  .setup-card,
  .status-card,
  .question-card,
  .results-shell,
  .results-rank-panel,
  .modal-content {
    border-radius: 22px;
  }

  .modal {
    align-items: flex-start;
    padding: 0.8rem;
  }

  .modal-content {
    max-height: none;
    overflow-y: visible;
    padding: 1.15rem;
  }

  .setup-metrics,
  .level-info-grid,
  .language-grid,
  .compact-stats {
    grid-template-columns: 1fr;
  }

  .quiz-footer,
  .result-buttons,
  .modal-buttons,
  .feedback-actions {
    flex-direction: column;
  }

  .modal-ready-actions {
    flex-direction: column;
  }

  .modal-notice-panel,
  .instruction-item {
    padding: 0.95rem;
    border-radius: 18px;
  }

  .btn,
  .language-card,
  .option-btn {
    width: 100%;
  }

  .close-btn {
    top: 0.75rem;
    right: 0.75rem;
  }

  .quiz-sidebar .compact-stats {
    display: none;
  }

  .mobile-quiz-stats-toggle {
    display: inline-flex;
  }

  .mobile-quiz-stats-panel {
    display: none;
  }

  .mobile-quiz-stats-panel.show {
    display: grid;
  }
}

/* Pre-quiz briefing screen */
#quiz-page {
  background:
    radial-gradient(circle at 7% 4%, rgba(31, 102, 255, 0.1), transparent 22rem),
    radial-gradient(circle at 92% 12%, rgba(56, 135, 255, 0.09), transparent 19rem),
    #f8fbff !important;
}

#quiz-page .quiz-main-shell {
  width: min(1180px, calc(100% - 32px));
  padding: clamp(22px, 3vw, 46px) 0 42px;
}

#setup-screen .prequiz-shell {
  width: 100%;
}

.prequiz-hero,
.prequiz-card {
  border: 1px solid #dce8fb;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 42px rgba(41, 88, 157, 0.1);
}

.prequiz-hero {
  position: relative;
  min-height: 330px;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  align-items: center;
  overflow: hidden;
  border-radius: 24px;
  isolation: isolate;
}

.prequiz-hero::before {
  position: absolute;
  z-index: -1;
  right: -7%;
  bottom: -58%;
  width: 67%;
  aspect-ratio: 1.45;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(220, 233, 255, 0.9), rgba(246, 250, 255, 0.2));
  content: "";
}

.prequiz-hero-copy {
  position: relative;
  z-index: 2;
  padding: 36px 0 36px clamp(26px, 4vw, 54px);
}

.prequiz-eyebrow,
.prequiz-card-kicker {
  margin: 0;
  color: #1556d7;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prequiz-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  color: #152569;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.88rem;
}

.prequiz-eyebrow lucide-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #d7e4fb;
  border-radius: 8px;
  color: #1556d7;
}

.prequiz-hero h1,
.prequiz-hero h2 {
  margin: 0;
  color: #091960;
  font-family: var(--gx-font-body, inherit);
  font-size: clamp(1.85rem, 2.7vw, 2.75rem);
  font-weight: 800;
  line-height: 1.12;
}

.prequiz-hero-copy > p:not(.prequiz-eyebrow) {
  margin: 10px 0 0;
  color: #172b70;
  font-size: clamp(0.88rem, 1.2vw, 1rem);
}

.prequiz-selectors {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
  max-width: 470px;
  margin-top: 26px;
}

.prequiz-selector {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 16px;
  border: 1px solid #d9e5fa;
  border-radius: 12px;
  background: #ffffff;
  color: #0758e8;
  box-shadow: 0 7px 18px rgba(50, 98, 178, 0.05);
  text-align: left;
}

.prequiz-selector > lucide-icon:first-child {
  flex: 0 0 auto;
  font-size: 1.75rem;
}

.prequiz-level-glyph {
  flex: 0 0 auto;
  color: #1464ef;
  font-size: 1.9rem;
  line-height: 1;
  text-shadow: 7px 7px 0 rgba(97, 159, 255, 0.38);
}

.prequiz-selector span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.prequiz-selector small {
  color: #35509d;
  font-size: 0.61rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.prequiz-selector strong {
  overflow: hidden;
  color: #0c1c68;
  font-size: 0.9rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prequiz-language-button {
  cursor: pointer;
}

.prequiz-language-button:hover,
.prequiz-language-button:focus-visible {
  border-color: #94b9ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.prequiz-language-button > lucide-icon:last-child {
  margin-left: auto;
  color: #102871;
  font-size: 1rem;
}

.prequiz-artwork {
  position: relative;
  align-self: stretch;
  min-width: 0;
  margin: 0;
}

.prequiz-artwork img {
  position: absolute;
  top: 50%;
  right: clamp(-82px, -5vw, -28px);
  width: min(720px, 135%);
  max-width: none;
  transform: translateY(-48%);
  mix-blend-mode: screen;
  filter: saturate(1.06) drop-shadow(0 20px 22px rgba(24, 73, 174, 0.14));
}

.prequiz-content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.86fr) minmax(440px, 1.14fr);
  gap: 18px;
  align-items: start;
  margin-top: 20px;
}

.prequiz-card {
  min-height: 332px;
  padding: clamp(22px, 3vw, 32px);
  border-radius: 20px;
}

.prequiz-card h3 {
  margin: 24px 0 18px;
  color: #0c1b60;
  font-size: 0.95rem;
  font-weight: 800;
}

.prequiz-topic {
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 13px 16px;
  border: 1px solid #d4e2fa;
  border-radius: 13px;
  background: linear-gradient(110deg, #ffffff, #f6faff);
}

.prequiz-topic-icon {
  width: 48px;
  height: 48px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: #0960f5;
  background: #eaf2ff;
  font-size: 1.55rem;
}

.prequiz-topic strong {
  color: #0c1b60;
  font-size: 0.96rem;
  line-height: 1.45;
}

.prequiz-note,
.prequiz-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 22px 0 0;
  color: #53699f;
  font-size: 0.73rem;
  line-height: 1.55;
}

.prequiz-note lucide-icon,
.prequiz-info lucide-icon {
  flex: 0 0 auto;
  color: #3773e6;
  font-size: 0.92rem;
}

.prequiz-details-list {
  margin: 16px 0 0;
}

.prequiz-details-list > div {
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(135px, auto);
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid #e2eafb;
}

.prequiz-details-list > div:last-child {
  border-bottom: 0;
}

.prequiz-details-list dt,
.prequiz-details-list dd {
  margin: 0;
  color: #17347d;
  font-size: 0.81rem;
}

.prequiz-details-list dt {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prequiz-details-list dt lucide-icon {
  color: #2665d7;
  font-size: 1rem;
}

.prequiz-details-list dd {
  display: grid;
  justify-items: end;
  color: #0b1a62;
  font-weight: 800;
  text-align: right;
}

.prequiz-details-list dd small {
  margin-top: 2px;
  color: #5d75ac;
  font-size: 0.65rem;
  font-weight: 500;
}

.prequiz-details-list .is-positive,
.prequiz-details-list .is-negative {
  display: block;
  font-size: 0.73rem;
}

.prequiz-details-list .is-positive { color: #06945b; }
.prequiz-details-list .is-negative { color: #e83838; margin-top: 2px; }

.prequiz-info {
  margin-top: 15px;
  padding: 13px 15px;
  border: 1px solid #cee0ff;
  border-radius: 9px;
  background: #f2f7ff;
  color: #244790;
}

.prequiz-info lucide-icon {
  font-size: 1.25rem;
}

.prequiz-start-button {
  min-width: 208px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 24px auto 0;
  padding: 13px 26px;
  border: 0;
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(135deg, #2872f8, #0754df);
  box-shadow: 0 14px 24px rgba(20, 91, 230, 0.25);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
}

.prequiz-start-button:hover { transform: translateY(-1px); }
.prequiz-start-button:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.28); outline-offset: 3px; }
.prequiz-start-button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }
.prequiz-start-button lucide-icon { font-size: 1.2rem; }

.prequiz-action-row {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px auto 0;
}

.prequiz-action-row .prequiz-start-button {
  flex: 1 1 auto;
  margin: 0;
}

.quiz-sound-toggle {
  width: 42px;
  height: 42px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #c8dcfc;
  border-radius: 50%;
  color: #145ee1;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(29, 91, 200, 0.12);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.quiz-sound-toggle lucide-icon { font-size: 1.15rem; }
.quiz-sound-toggle:hover, .quiz-sound-toggle:focus-visible { border-color: #1f68e8; background: #eef5ff; outline: none; transform: translateY(-1px); }
.quiz-sound-toggle:focus-visible { box-shadow: 0 0 0 3px rgba(31, 104, 232, 0.18); }
.quiz-sound-toggle.is-muted { border-color: #f0c5cc; color: #b24152; background: #fff6f7; }
.quiz-sound-toggle[aria-pressed="true"] { border-color: #f0c5cc; color: #b24152; background: #fff6f7; }

.prequiz-sound-toggle {
  width: 56px;
  height: 56px;
  border-radius: 10px;
}

.question-meta-chips {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.question-meta .quiz-sound-toggle { margin-left: auto; align-self: flex-start; }

.prequiz-runtime-data {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 1024px) {
  #quiz-page .quiz-main-shell { width: min(820px, calc(100% - 28px)); }
  .prequiz-hero { min-height: 278px; grid-template-columns: minmax(0, 1fr) minmax(255px, 0.74fr); }
  .prequiz-hero-copy { padding: 26px 0 26px 30px; }
  .prequiz-eyebrow { margin-bottom: 18px; }
  .prequiz-artwork img { right: -78px; width: min(540px, 155%); }
  .prequiz-content-grid { grid-template-columns: 1fr; gap: 14px; }
  .prequiz-card { min-height: 0; }
  .prequiz-choice-card { padding-bottom: 24px; }
}

@media (max-width: 600px) {
  #quiz-page .quiz-main-shell { width: calc(100% - 20px); padding-top: 18px; }
  .prequiz-hero { min-height: 282px; display: block; border-radius: 18px; }
  .prequiz-hero::before { right: -35%; bottom: -31%; width: 118%; }
  .prequiz-hero-copy { padding: 20px 16px; }
  .prequiz-eyebrow { margin-bottom: 21px; font-size: 0.77rem; }
  .prequiz-eyebrow lucide-icon { width: 24px; height: 24px; }
  .prequiz-hero h1,
  .prequiz-hero h2 { max-width: 185px; font-size: 1.32rem; }
  .prequiz-hero-copy > p:not(.prequiz-eyebrow) { max-width: 190px; margin-top: 7px; font-size: 0.7rem; line-height: 1.5; }
  .prequiz-selectors { grid-template-columns: 1fr; gap: 7px; max-width: none; margin-top: 17px; padding-right: 86px; }
  .prequiz-selector { min-height: 48px; gap: 10px; padding: 8px 11px; border-radius: 9px; }
  .prequiz-selector > lucide-icon:first-child { font-size: 1.25rem; }
  .prequiz-level-glyph { font-size: 1.35rem; }
  .prequiz-selector small { font-size: 0.5rem; }
  .prequiz-selector strong { font-size: 0.72rem; }
  .prequiz-artwork { position: absolute; top: 45px; right: -47px; width: 190px; height: 156px; }
  .prequiz-artwork img { top: 0; right: 0; width: 260px; transform: none; }
  .prequiz-content-grid { margin-top: 12px; gap: 12px; }
  .prequiz-card { padding: 18px 14px; border-radius: 14px; }
  .prequiz-card-kicker { font-size: 0.61rem; }
  .prequiz-card h3 { margin: 15px 0 12px; font-size: 0.74rem; }
  .prequiz-topic { min-height: 58px; gap: 10px; padding: 8px 10px; border-radius: 9px; }
  .prequiz-topic-icon { width: 34px; height: 34px; border-radius: 8px; font-size: 1.1rem; }
  .prequiz-topic strong { font-size: 0.72rem; }
  .prequiz-note { margin-top: 13px; font-size: 0.6rem; }
  .prequiz-details-list { margin-top: 9px; }
  .prequiz-details-list > div { min-height: 31px; grid-template-columns: minmax(0, 1fr) minmax(104px, auto); gap: 8px; }
  .prequiz-details-list dt, .prequiz-details-list dd { font-size: 0.61rem; }
  .prequiz-details-list dt { gap: 7px; }
  .prequiz-details-list dt lucide-icon { font-size: 0.78rem; }
  .prequiz-details-list dd small, .prequiz-details-list .is-positive, .prequiz-details-list .is-negative { font-size: 0.52rem; }
  .prequiz-info { margin-top: 10px; padding: 9px 10px; font-size: 0.58rem; line-height: 1.4; }
  .prequiz-info lucide-icon { font-size: 0.9rem; }
  .prequiz-start-button { width: 100%; min-height: 48px; margin-top: 14px; border-radius: 9px; font-size: 0.85rem; }
  .prequiz-action-row { gap: 9px; margin-top: 14px; }
  .prequiz-action-row .prequiz-start-button { width: auto; min-width: 0; flex: 1 1 auto; margin: 0; }
  .prequiz-sound-toggle { width: 48px; height: 48px; border-radius: 9px; }
}

/* Quiz start redesign: compact blue briefing, strong mobile layout */
#quiz-page {
  --quiz-blue: #2563eb;
  --quiz-blue-deep: #1d4ed8;
  --quiz-text: #111827;
  --quiz-muted: #536173;
  --quiz-line: #dbe7ff;
  background:
    radial-gradient(circle at 12% 8%, rgba(37, 99, 235, 0.08), transparent 30%),
    linear-gradient(180deg, #f7faff 0%, #ffffff 52%, #f7faff 100%) !important;
}

#quiz-page .quiz-header-shell {
  display: none;
}

#quiz-page .quiz-main-shell {
  width: min(1120px, calc(100% - 28px));
  padding: 16px 0 10px;
}

#quiz-page .quiz-footer-shell {
  padding-bottom: 10px;
  font-size: 0.78rem;
}

#setup-screen .hero-card,
#setup-screen .setup-card,
#setup-screen .setup-tips {
  border: 1px solid var(--quiz-line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.08);
}

#setup-screen .hero-card {
  position: relative;
  min-height: 244px;
  overflow: hidden;
  align-items: stretch;
  margin-bottom: 14px;
  padding: 26px 28px;
  background:
    radial-gradient(circle at 68% 28%, rgba(147, 197, 253, 0.55), transparent 12%),
    radial-gradient(circle at 82% 52%, rgba(255, 255, 255, 0.18), transparent 18%),
    linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
}

#setup-screen .hero-card::after {
  content: "";
  position: absolute;
  right: 124px;
  bottom: 30px;
  width: 220px;
  height: 52px;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.22), transparent 68%);
  opacity: 0.72;
  pointer-events: none;
}

#setup-screen .hero-copy {
  position: relative;
  z-index: 2;
  width: min(560px, 58%);
  display: grid;
  align-content: center;
}

#setup-screen .hero-kicker {
  width: fit-content;
  margin-bottom: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.18);
  color: #ffffff;
  letter-spacing: 0;
  font-size: 0.76rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

#setup-screen .hero-copy h2 {
  max-width: 470px;
  font-family: var(--gx-font-body) ;
  font-size: clamp(2rem, 1.45rem + 1.8vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 900;
}

.selection-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

#setup-screen .selected-category-label,
#setup-screen .selected-language-label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.78rem;
  font-weight: 800;
}

#setup-screen .selection-helper-text {
  max-width: 520px;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.55;
  font-size: 0.84rem;
}

#setup-screen .selection-helper-text + .selection-helper-text {
  margin-top: 7px;
}

#setup-screen #open-level-info-btn {
  position: absolute;
  z-index: 3;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  color: var(--quiz-blue) !important;
  background: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.18);
  padding: 12px 16px;
  font-size: 0.82rem;
}

.quiz-hero-visual {
  position: absolute;
  z-index: 2;
  right: 170px;
  top: 42px;
  width: 190px;
  height: 136px;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0.82;
  filter: saturate(1.05);
}

.hero-trophy {
  position: relative;
  z-index: 2;
  width: 92px;
  height: 92px;
  transform: translateY(-3px);
  display: grid;
  place-items: center;
  border-radius: 26px;
  color: #ffffff;
  background:
    radial-gradient(circle at 34% 20%, rgba(255, 255, 255, 0.45), transparent 28%),
    linear-gradient(150deg, #74b4ff 0%, #2563eb 60%, #1d4ed8 100%);
  box-shadow:
    0 24px 44px rgba(15, 23, 42, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 8px 16px rgba(255, 255, 255, 0.22),
    inset 0 -16px 26px rgba(29, 78, 216, 0.38);
  font-size: 2.9rem;
}

.hero-book {
  position: absolute;
  left: 24px;
  right: 8px;
  height: 24px;
  border-radius: 8px;
  box-shadow:
    0 18px 28px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.hero-book-one {
  bottom: 24px;
  background: linear-gradient(90deg, rgba(239, 246, 255, 0.96), rgba(147, 197, 253, 0.82));
}

.hero-book-two {
  bottom: 0;
  background: linear-gradient(90deg, rgba(191, 219, 254, 0.95), rgba(29, 78, 216, 0.9));
}

.hero-shine {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.24);
}

.hero-shine-one {
  left: 0;
  top: 42px;
  width: 12px;
  height: 12px;
}

.hero-shine-two {
  right: 0;
  top: 16px;
  width: 7px;
  height: 7px;
}

#setup-screen .setup-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
}

#setup-screen .setup-card {
  padding: 26px;
}

#setup-screen .setup-card-head {
  align-items: center;
}

#setup-screen .pill,
#setup-screen .soft-chip,
#setup-screen .difficulty-pill {
  padding: 6px 10px;
  font-size: 0.72rem;
}

#setup-screen .setup-card h3 {
  margin-top: 14px;
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--quiz-text);
}

#setup-screen .setup-card p {
  margin-top: 8px;
  color: var(--quiz-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

#setup-screen .setup-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

#setup-screen .metric-tile {
  min-height: 86px;
  display: grid;
  align-content: center;
  padding: 14px 16px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--quiz-line);
  box-shadow: none;
}

#setup-screen .metric-tile:last-child {
  grid-column: 1 / -1;
}

#setup-screen .metric-tile span {
  color: var(--quiz-muted);
  font-size: 0.72rem;
}

#setup-screen .metric-tile strong {
  margin-top: 6px;
  color: var(--quiz-text);
  font-size: 1rem;
  line-height: 1.35;
}

#setup-screen .setup-card-cta {
  margin-top: 14px;
}

#setup-screen .play-chip {
  width: 100%;
  justify-content: center;
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 0;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

#setup-screen .rank-summary {
  align-items: center;
  margin-top: 18px;
}

#setup-screen .rank-image {
  width: 82px;
  height: 82px;
}

#setup-screen .rank-summary h3 {
  color: var(--quiz-text);
  font-size: 1.8rem;
  font-weight: 900;
}

#setup-screen .rank-progress-shell {
  margin-top: 22px;
}

#setup-screen .rank-progress-text {
  margin-bottom: 8px;
  color: var(--quiz-text);
  font-size: 0.76rem;
  font-weight: 900;
}

#setup-screen .progress-track {
  height: 10px;
  background: #e8eef8;
}

#setup-screen .progress-fill {
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.rank-mini-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 28px;
}

.rank-mini-metrics span {
  min-height: 62px;
  display: grid;
  place-items: center;
  gap: 5px;
  color: var(--quiz-text);
  font-size: 0.72rem;
  font-weight: 800;
}

.rank-mini-metrics i {
  color: var(--quiz-blue);
  font-size: 1.15rem;
}

.setup-tips {
  margin-top: 14px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: minmax(260px, 1.45fr) repeat(3, minmax(130px, 0.7fr));
  gap: 16px;
  align-items: center;
}

.setup-tip-main,
.setup-tip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.setup-tip-main > i {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(145deg, #2563eb, #60a5fa);
  font-size: 1.8rem;
  flex: 0 0 auto;
}

.setup-tip-main strong,
.setup-tip span {
  display: block;
  color: var(--quiz-blue);
  font-weight: 900;
}

.setup-tip-main span {
  display: block;
  margin-top: 4px;
  color: var(--quiz-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.setup-tip i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--quiz-blue);
  background: #eef4ff;
  flex: 0 0 auto;
}

@media (max-width: 940px) {
  #setup-screen .hero-copy {
    width: min(620px, 100%);
  }

  .quiz-hero-visual {
    opacity: 0.18;
    right: 28px;
    top: 46px;
  }

  #setup-screen #open-level-info-btn {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    align-self: end;
    margin-top: auto;
  }

  #setup-screen .setup-grid,
  .setup-tips {
    grid-template-columns: 1fr;
  }

  .setup-tip {
    min-height: 42px;
  }
}

@media (max-width: 640px) {
  #quiz-page .quiz-main-shell {
    width: calc(100% - 16px);
    padding-top: 8px;
  }

  #setup-screen .hero-card {
    min-height: 0;
    padding: 16px;
    display: grid;
    gap: 14px;
  }

  #setup-screen .hero-copy {
    width: 100%;
  }

  #setup-screen .hero-copy h2 {
    max-width: 280px;
    font-size: 1.72rem;
  }

  #setup-screen .selection-helper-text {
    display: none;
  }

  .selection-tags {
    margin-top: 12px;
  }

  #setup-screen #open-level-info-btn {
    width: fit-content;
    min-width: 0;
    padding: 10px 13px;
    font-size: 0.76rem;
    justify-self: start;
  }

  .quiz-hero-visual {
    display: block;
    width: 104px;
    height: 86px;
    right: 8px;
    top: 56px;
    opacity: 0.22;
    filter: saturate(1.05);
  }

  .hero-trophy {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    font-size: 1.68rem;
    transform: translateY(-3px);
  }

  .hero-book {
    left: 12px;
    right: 0;
    height: 12px;
    border-radius: 5px;
  }

  .hero-book-one {
    bottom: 18px;
  }

  .hero-book-two {
    bottom: 4px;
  }

  #setup-screen .setup-card {
    padding: 16px;
  }

  #setup-screen .setup-card h3 {
    font-size: 1.55rem;
    margin-top: 10px;
  }

  #setup-screen .setup-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #setup-screen .metric-tile {
    min-height: 74px;
    padding: 11px;
  }

  #setup-screen .metric-tile strong {
    font-size: 0.86rem;
  }

  #setup-screen .rank-summary {
    gap: 12px;
  }

  #setup-screen .rank-image {
    width: 62px;
    height: 62px;
  }

  #setup-screen .rank-summary h3 {
    font-size: 1.35rem;
  }

  #setup-screen .rank-card {
    display: grid;
    gap: 14px;
    min-height: 0;
  }

  #setup-screen .rank-progress-shell {
    margin-top: 4px;
  }

  #setup-screen .rank-progress-text {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.72rem;
  }

  .rank-mini-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-top: 18px;
  }

  .rank-mini-metrics span {
    min-height: 50px;
    font-size: 0;
  }

  .rank-mini-metrics i {
    font-size: 1.05rem;
  }

  #setup-screen .rank-card,
  #setup-screen .rank-summary,
  #setup-screen .rank-progress-shell,
  #setup-screen .rank-mini-metrics {
    visibility: visible;
    opacity: 1;
  }

  .setup-tips {
    padding: 14px;
    gap: 12px;
  }

  .setup-tip-main {
    align-items: flex-start;
  }

  .setup-tip-main > i {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.35rem;
  }

  .setup-tip {
    display: none;
  }
}

/* Final responsive polish for the quiz start hero artwork */
@media (max-width: 940px) and (min-width: 641px) {
  #setup-screen .hero-card {
    min-height: 248px;
    padding: 22px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 18px;
  }

  #setup-screen .hero-copy {
    width: 100%;
    max-width: 560px;
  }

  .quiz-hero-visual {
    position: relative;
    top: auto;
    right: auto;
    align-self: center;
    justify-self: center;
    width: 168px;
    height: 122px;
    opacity: 0.76;
  }

  #setup-screen #open-level-info-btn {
    grid-column: 2;
    justify-self: center;
    align-self: start;
    margin-top: 0;
  }

  #setup-screen .hero-card::after {
    right: 28px;
    bottom: 24px;
    width: 220px;
    opacity: 0.38;
  }
}

@media (max-width: 640px) {
  #setup-screen .hero-card {
    min-height: 224px;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 10px 12px;
    padding: 16px 14px;
    border-radius: 18px;
  }

  #setup-screen .hero-copy {
    grid-column: 1 / -1;
    padding-right: 84px;
  }

  #setup-screen .hero-copy h2 {
    max-width: 250px;
    font-size: clamp(1.52rem, 8vw, 1.9rem);
  }

  .selection-tags {
    max-width: 210px;
  }

  #setup-screen #open-level-info-btn {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    margin-top: 4px;
    border-radius: 12px;
  }

  .quiz-hero-visual {
    position: absolute;
    right: 12px;
    top: 48px;
    width: 92px;
    height: 82px;
    opacity: 0.72;
    z-index: 1;
  }

  .hero-trophy {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 1.55rem;
  }

  .hero-book {
    left: 8px;
    height: 11px;
  }

  #setup-screen .hero-card::after {
    right: 8px;
    bottom: 78px;
    width: 108px;
    height: 34px;
    opacity: 0.28;
  }
}

/* Result screen redesign */
#results-screen {
  padding: 0.4rem 0 1.5rem;
}

#results-screen .results-shell {
  position: relative;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(1.7rem, 4vw, 3.6rem);
  border: 1px solid rgba(199, 214, 238, 0.72);
  border-radius: 18px;
  background:
    radial-gradient(circle at 17% 24%, rgba(37, 99, 235, 0.06), transparent 23%),
    radial-gradient(circle at 86% 32%, rgba(147, 197, 253, 0.08), transparent 25%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.96));
  box-shadow: 0 28px 70px rgba(45, 86, 145, 0.15);
  overflow: hidden;
}

#results-screen .results-shell::before,
#results-screen .results-shell::after {
  content: none;
  display: none;
}

#results-screen .results-shell::before {
  top: 86px;
  left: 21%;
}

#results-screen .results-shell::after {
  top: 96px;
  right: 19%;
  background: #f4b51f;
  transform: rotate(-52deg);
}

.results-top-actions {
  display: none;
}

.results-top-actions span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(213, 224, 244, 0.9);
  border-radius: 50%;
  color: #285ff3;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 22px rgba(45, 86, 145, 0.12);
}

#results-screen .results-hero {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  z-index: 1;
}

#results-screen .hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 38px;
  margin: 0 auto 1.25rem;
  padding: 0 1.25rem;
  border-radius: 12px;
  color: #215bf3;
  background: rgba(232, 240, 255, 0.92);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
}

#results-screen .result-status-pill {
  text-transform: uppercase;
}

#results-screen .hero-kicker i {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #ffffff;
  background: #285ff3;
  font-size: 0.68rem;
}

#results-screen .results-hero h2 {
  color: #071538;
  font-family: var(--gx-font-body) ;
  font-size: clamp(2rem, 4.2vw, 3rem);
  line-height: 1.18;
  font-weight: 950;
  letter-spacing: 0;
}

#results-screen .results-hero h2 span {
  color: #315bf5;
}

#results-screen #result-summary-copy {
  max-width: 700px;
  margin: 1.25rem auto 0;
  color: #334a78;
  font-size: 0.96rem;
  line-height: 1.65;
  font-weight: 500;
}

#results-screen .results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 2rem;
}

#results-screen .result-card {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  min-height: 96px;
  padding: 1.2rem;
  border: 1px solid rgba(213, 224, 244, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 28px rgba(45, 86, 145, 0.07);
}

#results-screen .result-card:hover {
  transform: none;
  box-shadow: 0 12px 28px rgba(45, 86, 145, 0.07);
}

.result-card-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: #285ff3;
  background: #eef5ff;
  font-size: 1.55rem;
}

.result-card-icon.accuracy {
  color: #6d45f5;
  background: #f1edff;
}

.result-card-icon.ge {
  color: #08aa99;
  background: #e8fbf7;
}

.result-card-icon.xp {
  color: #f26c14;
  background: #fff2e9;
}

.result-card-icon.streak {
  color: #f29b16;
  background: #fff6df;
}

#results-screen .result-card span {
  color: #10204a;
  font-size: 0.82rem;
  font-weight: 650;
}

#results-screen .result-card strong {
  margin-top: 0.32rem;
  color: #071538;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 950;
}

#results-screen .results-rank-panel {
  margin-top: 1.25rem;
  padding: 1.25rem;
  border: 1px solid rgba(213, 224, 244, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(45, 86, 145, 0.07);
}

#results-screen .rank-summary {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

#results-screen .rank-image {
  width: 98px;
  height: 98px;
  border-radius: 50%;
  object-fit: cover;
}

#results-screen .rank-summary h3 {
  margin: 0;
  color: #071538;
  font-size: 1.15rem;
  font-weight: 950;
}

#results-screen #result-rank-copy {
  margin: 0.35rem 0 0;
  color: #40588b;
  line-height: 1.45;
}

#results-screen .rank-progress-shell {
  margin-top: 1rem;
}

#results-screen .rank-progress-text {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.55rem;
  color: #13275e;
  font-size: 0.82rem;
  font-weight: 800;
}

#results-screen .progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e6e6e6;
  overflow: hidden;
}

#results-screen .progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f61ff, #7f65ff);
}

#results-screen .result-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 1.65rem;
}

#results-screen #next-level-btn {
  display: none;
}

#results-screen .btn {
  min-height: 54px;
  border-radius: 14px;
  box-shadow: none;
  font-size: 0.98rem;
}

#results-screen .btn-outline {
  border: 1px solid rgba(49, 91, 245, 0.38);
  color: #112762;
  background: rgba(255, 255, 255, 0.92);
}

#results-screen #back-to-home-btn {
  background: linear-gradient(135deg, #293ecf, #246bff);
  color: #ffffff;
}

#results-screen .result-account-box {
  display: flex;
  gap: 1rem;
  margin-top: 1.6rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid rgba(213, 224, 244, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

#results-screen .result-account-box > i {
  color: #2861f5;
  font-size: 1.35rem;
  margin-top: 0.1rem;
}

#results-screen .result-account-note {
  margin: 0;
  color: #40588b;
  font-size: 0.9rem;
  line-height: 1.55;
}

#results-screen #result-account-note {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #dfe7f4;
}

@media (max-width: 760px) {
  #results-screen {
    padding-top: 0;
  }

  #results-screen .results-shell {
    width: min(100%, 360px);
    padding: 5.4rem 1.25rem 1.35rem;
    border-radius: 22px;
  }

  #results-screen .results-shell::before {
    top: 116px;
    left: 18%;
    width: 10px;
  }

  #results-screen .results-shell::after {
    top: 112px;
    right: 16%;
    width: 10px;
  }

  #results-screen .hero-kicker {
    min-height: 29px;
    margin-bottom: 0.85rem;
    padding: 0 0.78rem;
    border-radius: 8px;
    font-size: 0.64rem;
  }

  #results-screen .hero-kicker i {
    width: 14px;
    height: 14px;
    font-size: 0.55rem;
  }

  #results-screen .results-hero h2 {
    font-size: 1.6rem;
    line-height: 1.22;
  }

  #results-screen #result-summary-copy {
    margin-top: 0.9rem;
    font-size: 0.84rem;
    line-height: 1.6;
  }

  #results-screen .results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin-top: 1.3rem;
    border: 1px solid rgba(213, 224, 244, 0.9);
    border-radius: 12px;
    overflow: hidden;
  }

  #results-screen .result-card {
    display: grid;
    align-content: center;
    gap: 0.45rem;
    min-height: 98px;
    padding: 0.75rem;
    border-width: 0 1px 1px 0;
    border-radius: 0;
    box-shadow: none;
  }

  #results-screen .result-card:nth-child(3n) {
    border-right: 0;
  }

  #results-screen .result-card:nth-last-child(-n + 3) {
    border-bottom: 0;
  }

  .result-card-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  #results-screen .result-card span {
    font-size: 0.66rem;
  }

  #results-screen .result-card strong {
    font-size: 0.98rem;
  }

  #results-screen .results-rank-panel {
    padding: 0.8rem;
  }

  #results-screen .rank-image {
    width: 70px;
    height: 70px;
  }

  #results-screen .rank-summary {
    gap: 0.8rem;
  }

  #results-screen .rank-summary h3 {
    font-size: 1rem;
  }

  #results-screen #result-rank-copy,
  #results-screen .rank-progress-text {
    font-size: 0.74rem;
  }

  #results-screen .result-buttons {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    margin-top: 0.9rem;
  }

  #results-screen .btn {
    min-height: 36px;
    border-radius: 10px;
    font-size: 0.74rem;
  }

  #results-screen .result-account-box {
    margin-top: 0.9rem;
    padding: 1rem;
    border-radius: 12px;
  }

#results-screen .result-account-note {
    font-size: 0.72rem;
  }
}

/* Keep the briefing composition above the legacy quiz and result styles. */
#quiz-page {
  background:
    radial-gradient(circle at 7% 4%, rgba(31, 102, 255, 0.1), transparent 22rem),
    radial-gradient(circle at 92% 12%, rgba(56, 135, 255, 0.09), transparent 19rem),
    #f8fbff !important;
}

#quiz-page .quiz-main-shell {
  width: min(1180px, calc(100% - 32px));
  padding: clamp(22px, 3vw, 46px) 0 42px;
}

#setup-screen #open-level-info-btn {
  position: static;
  top: auto;
  right: auto;
  width: auto;
  margin: 0;
  transform: none;
}

.prequiz-artwork img {
  mix-blend-mode: normal;
}

/* Final pre-quiz refinement: use the app's actual quiz data without reference-only copy. */
.prequiz-shell,
.prequiz-shell button,
.prequiz-shell input,
.prequiz-shell select {
  font-family: Arial, Helvetica, sans-serif;
}

.prequiz-hero h1,
.prequiz-hero h2 {
  font-family: inherit;
  letter-spacing: -0.035em;
}

.prequiz-level-glyph {
  font-size: 0;
  text-shadow: none;
}

.prequiz-level-glyph::after {
  color: #1464ef;
  content: "\25B2";
  font-size: 1.75rem;
  line-height: 1;
  text-shadow: 6px 6px 0 rgba(97, 159, 255, 0.32);
}

@media (min-width: 1025px) {
  .prequiz-artwork img {
    right: -22px;
    width: min(590px, 104%);
  }
}

@media (max-width: 1024px) and (min-width: 601px) {
  .prequiz-artwork img {
    right: -48px;
    width: min(490px, 142%);
  }
}

@media (max-width: 1024px) {
  #quiz-page .quiz-main-shell { width: min(820px, calc(100% - 28px)); }
}

@media (max-width: 600px) {
  #quiz-page .quiz-main-shell { width: calc(100% - 20px); padding-top: 18px; }
  .prequiz-level-glyph::after { font-size: 1.28rem; }
  .prequiz-artwork { right: -38px; width: 174px; }
  .prequiz-artwork img { width: 236px; }
}

/* Pre-quiz: one page scroll, native language dropdown, and contained artwork. */
html:has(body#quiz-page) {
  height: auto !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body#quiz-page {
  height: auto !important;
  min-height: 100dvh;
  overflow-x: clip !important;
  overflow-y: visible !important;
}

body#quiz-page .quiz-main-shell,
body#quiz-page #setup-screen,
body#quiz-page .prequiz-shell {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

body#quiz-page .prequiz-hero {
  z-index: 1;
  overflow: hidden !important;
}

/* Keep the hero artwork and its decorative circle inside the hero card. */
body#quiz-page .prequiz-content-grid,
body#quiz-page .prequiz-start-button {
  position: relative;
  z-index: 2;
}

.prequiz-language-control {
  cursor: pointer;
}

.prequiz-language-control span {
  flex: 1 1 auto;
}

.prequiz-language-control select {
  width: 100%;
  min-height: 0 !important;
  height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  color: #0c1c68;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
}

.prequiz-language-control > lucide-icon:last-child {
  pointer-events: none;
}

/* Custom language menu: avoids browser-select rendering and stays inside the page design. */
.prequiz-language-menu {
  position: relative;
  min-width: 0;
}

.prequiz-language-menu .prequiz-language-control {
  width: 100%;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.prequiz-language-menu .prequiz-language-control:hover,
.prequiz-language-menu .prequiz-language-control:focus-visible {
  border-color: #94b9ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.prequiz-language-menu .prequiz-language-control > lucide-icon:last-child {
  margin-left: auto;
  transition: transform 180ms ease;
}

.prequiz-language-menu .prequiz-language-control[aria-expanded="true"] > lucide-icon:last-child {
  transform: rotate(180deg);
}

.prequiz-language-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  padding: 6px;
  border: 1px solid #bfd5fb;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 16px 32px rgba(32, 81, 160, 0.2);
}

.prequiz-language-options[hidden] {
  display: none;
}

.prequiz-language-options button {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  color: #0d246f;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  text-align: left;
}

.prequiz-language-options button:hover,
.prequiz-language-options button:focus-visible,
.prequiz-language-options button[aria-selected="true"] {
  color: #ffffff;
  background: #1f68e8;
  outline: none;
}

@media (min-width: 1025px) {
  .prequiz-hero {
    min-height: 490px;
    grid-template-columns: minmax(0, 0.84fr) minmax(530px, 1.16fr);
  }

  .prequiz-hero-copy {
    padding-block: 56px;
  }

  .prequiz-artwork {
    display: grid;
    place-items: center;
  }

  .prequiz-artwork img {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    height: min(430px, 88%);
    max-width: 100%;
    transform: none;
    object-fit: contain;
  }
}

@media (max-width: 1024px) and (min-width: 601px) {
  .prequiz-hero {
    min-height: 390px;
  }

  .prequiz-artwork {
    display: grid;
    place-items: center;
  }

  .prequiz-artwork img {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    height: min(320px, 86%);
    max-width: 100%;
    transform: none;
    object-fit: contain;
  }
}

@media (max-width: 600px) {
  .prequiz-hero {
    min-height: 430px;
  }

  .prequiz-hero-copy {
    height: 430px;
    padding: 28px 22px 22px;
  }

  .prequiz-hero h1,
  .prequiz-hero h2 {
    max-width: 210px;
  }

  .prequiz-hero-copy > p:not(.prequiz-eyebrow) {
    max-width: 210px;
  }

  .prequiz-artwork {
    top: 58px;
    right: 10px;
    width: 190px;
    height: 180px;
  }

  .prequiz-artwork img {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    height: 100%;
    transform: none;
    object-fit: contain;
  }

  .prequiz-selectors {
    position: absolute;
    top: auto !important;
    right: 22px;
    bottom: 24px;
    left: 22px;
    margin: 0 !important;
    padding-right: 0;
  }

  .prequiz-language-options { border-radius: 10px; }
  .prequiz-language-options button { min-height: 36px; font-size: 0.72rem; }
}

@media (max-width: 760px) and (min-width: 601px) {
  .prequiz-hero {
    min-height: 640px;
    display: block;
  }

  .prequiz-hero-copy {
    height: 640px;
    padding: 34px 30px;
  }

  .prequiz-hero h1,
  .prequiz-hero h2 { max-width: 300px; }
  .prequiz-hero-copy > p:not(.prequiz-eyebrow) { max-width: 310px; }

  .prequiz-artwork {
    position: absolute;
    top: 36px;
    right: 18px;
    width: 290px;
    height: 220px;
  }

  .prequiz-artwork img {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    height: 100%;
    transform: none;
    object-fit: contain;
  }

  .prequiz-selectors {
    position: absolute;
    top: auto !important;
    right: 30px;
    bottom: 112px;
    left: 30px;
    grid-template-columns: 1fr;
    margin: 0 !important;
  }
}

@media (max-width: 600px) {
  /* Match the Arcade mobile hero: a stable card height, clear copy area, and
     a contained right-aligned illustration rather than a scaled-down image. */
  .prequiz-hero {
    min-height: 510px;
    border-radius: 22px;
  }

  .prequiz-hero-copy {
    height: 510px;
    padding: 38px 25px 0;
  }

  .prequiz-hero h1,
  .prequiz-hero h2 {
    max-width: 215px;
    font-size: clamp(1.85rem, 9.2vw, 2.2rem);
    line-height: 1.04;
  }

  .prequiz-hero-copy > p:not(.prequiz-eyebrow) {
    max-width: 215px;
    margin-top: 12px;
    font-size: 0.82rem;
    line-height: 1.55;
  }

  .prequiz-artwork {
    top: 155px;
    right: 0;
    bottom: auto;
    left: auto;
    width: 100%;
    height: 220px;
  }

  .prequiz-artwork img {
    position: absolute;
    top: auto;
    right: 0;
    bottom: 0;
    left: auto;
    width: auto;
    height: 100%;
    max-width: none;
    object-fit: contain;
    object-position: right bottom;
  }

  .prequiz-selectors {
    right: 25px;
    bottom: 24px;
    left: 25px;
    gap: 10px;
  }

  .prequiz-selector {
    min-height: 58px;
    padding: 10px 14px;
    border-radius: 12px;
  }

  .prequiz-selector > lucide-icon:first-child {
    font-size: 1.55rem;
  }

  .prequiz-selector small { font-size: 0.57rem; }
  .prequiz-selector strong { font-size: 0.82rem; }
  .prequiz-level-glyph::after { font-size: 1.52rem; }

  /* The controls sit at the bottom of the mobile hero, so open upward and
     remain inside the clipped card instead of spilling over the content cards. */
  .prequiz-language-options {
    top: auto;
    bottom: calc(100% + 8px);
  }
}

/* Answer review remains readable on compact screens. */
#feedback-modal .qp-pop__box { max-height: calc(100dvh - 24px); overflow-y: auto; }
.qp-answer-review { grid-column: 1 / -1; width: 100%; min-width: 0; box-sizing: border-box; text-align: left; background: #f1f6ff; border: 1px solid #d8e5fb; border-radius: 12px; padding: 12px 16px; margin: 16px 0; }
.qp-answer-review h3 { font-size: 1rem; margin: 10px 0 6px; }
#feedback-modal .qp-answer-review p { font-size: .95rem; line-height: 1.6; margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
