.mcq-page {
  --mcq-card-max: 680px;
  --mcq-glass: rgba(255, 255, 255, 0.72);
  --mcq-glass-strong: rgba(255, 255, 255, 0.86);
  --mcq-green-soft: rgba(59, 122, 87, 0.12);
  --mcq-red-soft: rgba(163, 78, 54, 0.12);
  --mcq-amber-soft: rgba(180, 120, 34, 0.12);
}

body.dark-theme.mcq-page {
  --mcq-glass: rgba(26, 37, 25, 0.74);
  --mcq-glass-strong: rgba(28, 41, 27, 0.9);
  --mcq-green-soft: rgba(116, 183, 108, 0.18);
  --mcq-red-soft: rgba(248, 113, 113, 0.16);
  --mcq-amber-soft: rgba(251, 191, 36, 0.14);
}

.mcq-page .glass-panel {
  background: var(--mcq-glass);
  border: 1px solid rgba(45, 90, 39, 0.12);
  border-radius: 22px;
  box-shadow: 0 22px 70px rgba(33, 71, 38, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.54);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
}

body.dark-theme .mcq-page .glass-panel,
body.dark-theme.mcq-page .glass-panel {
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mcq-main {
  min-width: 0;
  overflow: hidden;
}

body.mcq-page:not(.mcq-wrong-page) .app-container,
body.mcq-page:not(.mcq-wrong-page) .main-content {
  height: calc(100dvh / var(--study-page-zoom, 1));
  min-height: 0;
  overflow: hidden;
}

.mcq-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mcq-workspace {
  width: min(980px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

.mcq-hero {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0;
  margin-bottom: 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.mcq-hero > div:first-child {
  display: none;
}

.mcq-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary-color);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
}

.mcq-hero h1,
.wrong-bank-heading h2 {
  margin: 5px 0 0;
  color: var(--text-main);
  font-size: clamp(1.28rem, 2vw, 1.82rem);
  line-height: 1.25;
}

.mcq-hero p,
.wrong-bank-heading p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.mcq-mode-tabs,
.wrong-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(45, 90, 39, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.mcq-mode-btn,
.wrong-filter-group button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
}

.mcq-mode-btn.active,
.wrong-filter-group button[aria-pressed="true"] {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 8px 20px rgba(45, 90, 39, 0.20);
}

.mcq-mode-btn svg,
.wrong-filter-group svg {
  width: 16px;
  height: 16px;
}

.mcq-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--mcq-card-max));
  align-items: start;
  justify-content: center;
}

.mcq-card {
  position: relative;
  min-height: 0;
  padding: clamp(18px, 2.4vw, 28px);
}

.mcq-card-topline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.mcq-progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(45, 90, 39, 0.12);
}

#mcq-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  transition: width 0.24s ease;
}

.mcq-stem {
  margin: 16px 0 18px;
  color: var(--text-main);
  font-size: clamp(1.08rem, 1.7vw, 1.42rem);
  line-height: 1.75;
  font-weight: 800;
  letter-spacing: 0;
}

.mcq-options {
  display: grid;
  gap: 10px;
}

.mcq-option-btn {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(45, 90, 39, 0.14);
  border-radius: 16px;
  background: var(--mcq-glass-strong);
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.mcq-option-btn:hover:not(:disabled),
.mcq-option-btn:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(45, 90, 39, 0.32);
  box-shadow: 0 12px 28px rgba(45, 90, 39, 0.10);
}

.mcq-option-btn:disabled {
  cursor: default;
}

.mcq-option-letter {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(45, 90, 39, 0.10);
  color: var(--primary-color);
  font-weight: 900;
}

.mcq-option-text {
  min-width: 0;
  line-height: 1.55;
  font-size: 0.98rem;
  font-weight: 650;
}

.mcq-option-btn.is-correct {
  border-color: rgba(59, 122, 87, 0.68);
  background: var(--mcq-green-soft);
  box-shadow: 0 12px 28px rgba(59, 122, 87, 0.10);
}

.mcq-option-btn.is-correct .mcq-option-letter {
  background: var(--success-color);
  color: #fff;
}

.mcq-option-btn.is-wrong {
  border-color: rgba(163, 78, 54, 0.72);
  background: var(--mcq-red-soft);
}

.mcq-option-btn.is-wrong .mcq-option-letter {
  background: var(--danger-color);
  color: #fff;
}

.mcq-option-btn.is-muted {
  opacity: 0.62;
}

.mcq-feedback {
  margin-top: 14px;
  padding: 13px 15px;
  overflow: visible;
  border-radius: 18px;
  border: 1px solid rgba(45, 90, 39, 0.12);
  background: rgba(255, 255, 255, 0.64);
}

.mcq-feedback.is-correct {
  border-color: rgba(59, 122, 87, 0.28);
  background: var(--mcq-green-soft);
}

.mcq-feedback.is-wrong {
  border-color: rgba(163, 78, 54, 0.30);
  background: var(--mcq-red-soft);
}

.mcq-feedback h3 {
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.mcq-feedback p {
  margin: 8px 0 0;
  color: var(--text-main);
  line-height: 1.72;
  font-size: 0.94rem;
}

.mcq-actions,
.mcq-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.mcq-card > .mcq-actions {
  position: absolute;
  inset: 50% auto auto auto;
  display: contents;
  margin-top: 0;
}

.mcq-card > .mcq-actions .mcq-action-btn {
  width: auto;
  min-height: 0;
}

.mcq-side-nav-btn {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 42px !important;
  min-width: 42px;
  height: 42px;
  min-height: 42px !important;
  padding: 0;
  border-radius: 999px;
  transform: translateY(-50%);
  box-shadow: 0 10px 24px rgba(31, 54, 38, 0.12);
}

.mcq-side-nav-btn span {
  display: none;
}

.mcq-side-nav-prev {
  left: -10px;
}

.mcq-side-nav-next {
  right: -10px;
}

.mcq-action-btn,
.mcq-bank-entry {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(45, 90, 39, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--text-main);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.mcq-action-btn.primary {
  margin-left: auto;
  border-color: transparent;
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 10px 22px rgba(45, 90, 39, 0.18);
}

.mcq-card > .mcq-actions .mcq-action-btn.primary {
  margin-left: 0;
}

.mcq-action-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.mcq-action-btn svg,
.mcq-bank-entry svg {
  width: 17px;
  height: 17px;
}

.mcq-bank-entry {
  width: 100%;
  justify-content: flex-start;
  border-radius: 16px;
}

.mcq-bank-entry strong {
  margin-left: auto;
  min-width: 28px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-color);
  font-size: 0.78rem;
}

@media (min-width: 861px) {
  .mcq-page .mcq-sidebar {
    transition: margin-left 0.24s ease, transform 0.24s ease, opacity 0.18s ease;
  }

  .mcq-page .mcq-sidebar.collapsed {
    margin-left: calc(-1 * var(--study-sidebar-width, 292px));
  }

  .mcq-page .mcq-sidebar.collapsed .sidebar-toggle-trigger {
    right: -29px;
  }

  .mcq-page .mcq-sidebar.collapsed .sidebar-toggle-trigger {
    color: var(--primary-color);
  }
}

.mcq-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mcq-stat-grid div {
  padding: 12px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.mcq-stat-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.mcq-stat-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--text-main);
  font-size: 1.12rem;
}

.mcq-mini-map {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.mcq-map-btn {
  height: 38px;
  border: 1px solid rgba(45, 90, 39, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.mcq-map-btn.is-active {
  background: var(--primary-color);
  color: #fff;
}

.mcq-map-btn.is-correct {
  border-color: rgba(59, 122, 87, 0.45);
  background: var(--mcq-green-soft);
  color: var(--success-color);
}

.mcq-map-btn.is-wrong {
  border-color: rgba(163, 78, 54, 0.45);
  background: var(--mcq-red-soft);
  color: var(--danger-color);
}

.wrong-bank-panel {
  margin-top: 18px;
  padding: 20px;
}

.wrong-bank-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.wrong-bank-list {
  display: grid;
  gap: 10px;
}

.wrong-bank-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid rgba(45, 90, 39, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.wrong-bank-item strong {
  display: block;
  color: var(--text-main);
  line-height: 1.45;
}

.wrong-bank-item span {
  display: inline-block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.wrong-bank-empty {
  padding: 28px;
  border: 1px dashed rgba(45, 90, 39, 0.22);
  border-radius: 18px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.65;
}

.mcq-card.is-empty {
  display: grid;
  place-items: center;
  min-height: 360px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 1080px) {
  .mcq-page .mcq-sidebar.open {
    position: fixed !important;
    z-index: 1200 !important;
  }

  .mcq-page .sidebar-overlay.active {
    display: block !important;
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    z-index: 1190;
    background: rgba(15, 23, 15, 0.30);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
  }

  .mcq-page .sidebar-toggle-trigger {
    display: none;
  }

  .mcq-page #menu-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .mcq-page .mobile-only {
    display: inline-flex !important;
  }

  .mcq-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .mcq-workspace {
    width: min(640px, calc(100% - 40px));
  }

}

@media (min-width: 769px) and (max-width: 1400px) {
  .mcq-page .sidebar-toggle-trigger {
    display: flex !important;
  }

  .mcq-page #menu-btn,
  .mcq-page #close-sidebar-btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}

@media (max-width: 760px) {
  .mcq-workspace {
    width: min(352px, calc(100% - 32px));
    padding-top: 10px;
  }

  .mcq-hero {
    justify-content: stretch;
    margin-bottom: 10px;
  }

  .mcq-mode-tabs {
    width: 100%;
  }

  .wrong-bank-heading {
    display: grid;
  }

  .mcq-mode-tabs,
  .wrong-filter-group {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .mcq-card {
    min-height: 0;
    padding: 16px 14px;
  }

  .mcq-stem {
    font-size: 1.04rem;
    line-height: 1.68;
  }

  .mcq-option-btn {
    grid-template-columns: 36px minmax(0, 1fr);
    min-height: 56px;
    padding: 11px 12px;
  }

  .mcq-option-letter {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .mcq-panel-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mcq-card > .mcq-actions {
    display: contents;
  }

  .mcq-card > .mcq-actions .mcq-action-btn {
    width: 38px !important;
    min-width: 38px;
    height: 38px;
    min-height: 38px !important;
  }

  .mcq-side-nav-prev {
    left: -4px;
  }

  .mcq-side-nav-next {
    right: -4px;
  }

  .mcq-action-btn.primary {
    margin-left: 0;
  }

  .mcq-mini-map {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
