:root {
  --ink: #382316;
  --parchment: rgba(251, 245, 229, 0.94);
  --parchment-strong: #FAF2DC;
  --mst-teal: #2B534D;
  --mst-red: #9E261B;
  --mst-navy: #243442;
  --gold: #FFE47A;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #241811;
  color: var(--ink);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  user-select: none;
  touch-action: none;
}

#club-3d-canvas,
#club-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

/* Outdoors: 3D Gardenscapes WebGL scene sits below crisp transparent HUD/glints canvas */
#club-3d-canvas {
  z-index: 2;
  pointer-events: none;
}

#club-canvas {
  z-index: 4;
  cursor: grab;
}

#club-canvas.is-dragging {
  cursor: grabbing;
}

/* Indoors: Classroom diorama draws on #club-canvas below, 3D Gardenscapes characters render crisply on top! */
body.in-classroom #club-canvas {
  z-index: 2;
  cursor: pointer;
}

body.in-classroom #club-3d-canvas {
  z-index: 4;
}

[hidden] {
  display: none !important;
}

/* ==================== 4-CORNER FLOATING GAME HUD (ZERO FULL-WIDTH BARS!) ==================== */
.hud-hideable {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

body.hud-hidden .hud-hideable {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-8px);
}

body.hud-hidden .student-dock-wrap,
body.hud-hidden .hud-br {
  transform: translateY(10px);
}

.hud-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  background: rgba(251, 245, 229, 0.96);
  border: 2.2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(56, 35, 22, 0.30), inset 0 1.5px 0 rgba(255, 255, 255, 0.82);
  contain: layout style;
}

.club-topbar {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: none;
  z-index: 32;
}

/* Indoors: hide outdoor topbar completely so Interior Corner HUD is a clean SINGLE tier! */
body.in-classroom .club-topbar {
  display: none;
}

.club-brand {
  gap: 8px;
  flex-shrink: 0;
  max-width: min(320px, calc(50vw - 14px));
}

.club-brand-text {
  min-width: 0;
}

.club-crest {
  width: 31px;
  height: 31px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--mst-red), var(--mst-teal));
  border: 2px solid var(--ink);
  color: #FFF6D6;
  font-weight: 800;
  font-size: 10.8px;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.club-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
}

.club-sub {
  font-size: 10.6px;
  font-weight: 600;
  color: var(--mst-teal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 175px;
}

.club-actions {
  gap: 5px;
  flex-wrap: nowrap;
}

/* ==================== 8-CLASSROOM & MORE DROPDOWN POPOVERS ==================== */
.class-dropdown-wrap,
.more-dropdown-wrap {
  position: relative;
}

.class-menu-btn {
  background: #FFF7DE;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.class-menu-btn[aria-expanded="true"],
#btn-more-menu[aria-expanded="true"] {
  background: var(--mst-teal);
  color: #FFFDF6;
}

.classroom-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 296px;
  max-height: min(72vh, 480px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 7px;
  background: var(--parchment-strong);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(26, 14, 6, 0.42), inset 0 2px 0 rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 44;
  animation: dropFade 0.16s ease-out;
}

.classroom-menu::-webkit-scrollbar {
  width: 6px;
}

.classroom-menu::-webkit-scrollbar-thumb {
  background: rgba(56, 35, 22, 0.28);
  border-radius: 99px;
}

.classroom-menu.align-right {
  left: auto;
  right: 0;
}

.more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 218px;
  padding: 6px;
  background: var(--parchment-strong);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(26, 14, 6, 0.42), inset 0 2px 0 rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 45;
  animation: dropFade 0.16s ease-out;
}

.more-menu-item {
  width: 100%;
  padding: 7.5px 10px;
  border-radius: 9px;
  border: 1.5px solid rgba(56, 35, 22, 0.22);
  background: #FFFDF7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background 0.12s ease, transform 0.08s ease;
}

.more-menu-item:hover {
  background: #FFF0C4;
  transform: translateX(2px);
}

.more-menu-item.accent-item {
  background: var(--mst-red);
  color: #FFFDF5;
  border-color: var(--ink);
}

.more-menu-item.accent-item:hover {
  filter: brightness(1.08);
  background: var(--mst-red);
}

.more-menu-sep {
  height: 1.5px;
  background: rgba(56, 35, 22, 0.16);
  margin: 2px 4px;
}

.hud-eye-btn {
  background: #EFE7D4;
}

.hud-restore-pill {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 48;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: rgba(251, 245, 229, 0.90);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  opacity: 0.45;
  box-shadow: 0 3px 10px rgba(20, 12, 6, 0.35);
  transition: opacity 0.18s ease, transform 0.12s ease;
}

.hud-restore-pill:hover {
  opacity: 1;
  transform: translateY(-1px);
  background: #FFF7DE;
}

/* BOTTOM-RIGHT Compact Camera & Sound Corner Cluster */
.hud-br {
  position: fixed;
  bottom: 10px;
  right: 10px;
  z-index: 32;
  padding: 4.5px 6px;
  gap: 5px;
}

@keyframes dropFade {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.class-menu-item {
  width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(56, 35, 22, 0.25);
  background: #FFFDF7;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  transition: background 0.12s ease, transform 0.08s ease;
}

.class-menu-item:hover {
  background: #FFF0C4;
  transform: translateX(2px);
}

.class-menu-item.active {
  background: var(--mst-teal);
  color: #FFFDF6;
  border-color: var(--ink);
}

.class-menu-item.active .class-menu-sub {
  color: rgba(255, 253, 246, 0.84);
}

.class-menu-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.class-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.4px solid rgba(56, 35, 22, 0.45);
  flex-shrink: 0;
}

.class-menu-name {
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.15;
}

.class-menu-sub {
  font-size: 10.5px;
  color: #6B4D35;
}

.class-menu-status {
  font-size: 12px;
  flex-shrink: 0;
}

.wood-btn {
  padding: 5.5px 10px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: #F4E4BC;
  color: var(--ink);
  font-size: 11.8px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(56, 35, 22, 0.3);
  transition: transform 0.08s ease, filter 0.12s ease, background 0.12s ease;
}

.wood-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

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

.wood-btn.accent-btn {
  background: var(--mst-red);
  color: #FFF8E6;
}

.wood-btn.portal-btn {
  background: var(--mst-navy);
  color: #E2F4F0;
}

.wood-btn.icon-only {
  padding: 5.5px 7.5px;
}

.wood-btn.recenter-highlight {
  background: linear-gradient(180deg, #FFE47A 0%, #F2B530 100%);
  border-color: #7A440E;
  animation: pulseGold 1.4s ease-in-out infinite;
}

@keyframes pulseGold {

  0%,
  100% {
    box-shadow: 0 2px 0 rgba(56, 35, 22, 0.3), 0 0 0 0 rgba(242, 181, 48, 0.55);
  }

  50% {
    box-shadow: 0 2px 0 rgba(56, 35, 22, 0.3), 0 0 0 6px rgba(242, 181, 48, 0);
  }
}

/* Signature Playrix / Gardenscapes Glossy Green Button */
.gs-green-btn {
  background: linear-gradient(180deg, #7BE044 0%, #4FB822 100%);
  color: #FFFFFF;
  border-color: #2A6414;
  text-shadow: 0 1px 1px rgba(24, 62, 10, 0.65);
  box-shadow: 0 3px 0 #2D6B15, inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* Signature Playrix Golden Star Counter Pill */
.gs-star-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4.5px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFF0A8 0%, #F4B93B 100%);
  border: 2px solid #7C4B12;
  color: #4A2708;
  font-size: 12.5px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(88, 48, 12, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.gs-star-icon {
  font-size: 13.5px;
  filter: drop-shadow(0 1px 1px rgba(96, 48, 0, 0.4));
}

/* Playrix Celebration Floating Star Ribbon (sits in wide-open top center!) */
.gs-celebrate {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, #FFF7CC 0%, #FFE07A 100%);
  border: 3px solid #8A5012;
  box-shadow: 0 12px 32px rgba(28, 14, 4, 0.48), inset 0 2px 0 rgba(255, 255, 255, 0.85);
  z-index: 60;
  pointer-events: none;
}

body.in-classroom .gs-celebrate {
  top: 12px;
}

.gs-celebrate.pop-anim {
  animation: gsCelebrateBounce 0.42s cubic-bezier(0.22, 1.35, 0.36, 1);
}

@keyframes gsCelebrateBounce {
  0% {
    opacity: 0;
    transform: translate(-50%, -18px) scale(0.75);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.gs-celebrate-star {
  font-size: 28px;
  animation: gsStarSpin 1.2s ease-in-out infinite alternate;
}

@keyframes gsStarSpin {
  from {
    transform: rotate(-10deg) scale(1);
  }

  to {
    transform: rotate(12deg) scale(1.14);
  }
}

.gs-celebrate-title {
  font-size: 15px;
  font-weight: 900;
  color: #7D3B08;
  letter-spacing: 0.01em;
}

.gs-celebrate-sub {
  font-size: 12px;
  font-weight: 700;
  color: #5C3818;
}

/* ==================== ICONIC GARDENSCAPES BOTTOM DIALOGUE CARD ==================== */
.gs-dialogue {
  position: fixed;
  left: 50%;
  bottom: 98px;
  transform: translateX(-50%);
  width: min(700px, calc(100vw - 28px));
  display: flex;
  align-items: flex-end;
  gap: 0;
  z-index: 38;
  pointer-events: auto;
  animation: gsPopUp 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  transition: bottom 0.22s ease;
}

body.dock-collapsed .gs-dialogue {
  bottom: 18px;
}

@keyframes gsPopUp {
  from {
    opacity: 0;
    transform: translate(-50%, 16px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.gs-portrait-wrap {
  position: relative;
  width: 178px;
  height: 194px;
  margin-right: -28px;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  filter: drop-shadow(0 8px 14px rgba(32, 18, 10, 0.42));
}

.portrait-hd-img {
  width: 178px;
  height: 194px;
  object-fit: contain;
  object-position: bottom center;
  pointer-events: none;
  transform-origin: bottom center;
  animation: portraitBreathe 3.2s ease-in-out infinite;
}

.portrait-hd-img.portrait-pop {
  animation: portraitPop 0.36s cubic-bezier(0.22, 1.32, 0.36, 1), portraitBreathe 3.2s ease-in-out 0.36s infinite;
}

@keyframes portraitPop {
  0% {
    opacity: 0;
    transform: translate(-8px, 18px) scale(0.86) rotate(-3deg);
  }

  100% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
}

@keyframes portraitBreathe {

  0%,
  100% {
    transform: translateY(0) scale(1, 1) rotate(0deg);
  }

  50% {
    transform: translateY(-2.5px) scale(1.012, 1.018) rotate(0.9deg);
  }
}

#portrait-3d-canvas {
  width: 156px;
  height: 168px;
  pointer-events: none;
}

.gs-speaker-pill {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 15px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3FA4E8 0%, #2478BE 100%);
  border: 2px solid #FFFFFF;
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(24, 58, 92, 0.45);
}

.gs-dialogue-card {
  flex: 1;
  min-height: 92px;
  padding: 14px 16px 11px 44px;
  background: linear-gradient(180deg, #FFFDF7 0%, #F8F0DC 100%);
  border: 3px solid #E5D4B3;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(24, 14, 8, 0.36), inset 0 2px 0 #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.gs-dialogue-text {
  font-size: 14px;
  font-weight: 700;
  color: #4D3624;
  line-height: 1.45;
}

.gs-dialogue-text .hl {
  color: #39961A;
  font-weight: 800;
}

.gs-dialogue-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gs-close-hint {
  background: transparent;
  border: 0;
  color: #8A6F56;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.gs-close-hint:hover {
  color: #4D3624;
}

/* ==================== GARDENSCAPES WOODEN TABLET ("SỔ TAY CLB") ==================== */
.gs-tablet {
  width: min(660px, calc(100vw - 24px));
  border-radius: 22px;
  padding: 12px;
  background: linear-gradient(180deg, #D99B58 0%, #B47234 100%);
  border: 3px solid #593314;
  box-shadow: 0 16px 42px rgba(18, 10, 5, 0.55), inset 0 2px 0 rgba(255, 232, 188, 0.6);
}

.gs-tablet-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 10px;
  color: #FFFDF6;
}

.gs-tablet-day {
  font-weight: 800;
  font-size: 15px;
  text-shadow: 0 1px 2px rgba(48, 24, 8, 0.5);
  white-space: nowrap;
}

.gs-progress-track {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: rgba(42, 22, 8, 0.45);
  border: 1.5px solid rgba(255, 230, 180, 0.45);
  overflow: hidden;
}

.gs-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #42B8F5, #7CE8FF);
  box-shadow: 0 0 10px rgba(124, 232, 255, 0.65);
  transition: width 0.35s ease;
}

.gs-tablet-pct {
  font-weight: 800;
  font-size: 13px;
}

.gs-tablet-x {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  background: linear-gradient(180deg, #F0624A, #C63420);
  color: #FFFFFF;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.gs-tablet-body {
  display: grid;
  grid-template-columns: 144px 1fr;
  background: #FFFBF0;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #7C4E22;
  min-height: 320px;
  max-height: 62vh;
}

.gs-tablet-side {
  background: #EFE7D4;
  border-right: 1.5px solid #D9CBB0;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gs-tab-item {
  padding: 8px 10px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: #5C432D;
  transition: background 0.12s ease;
}

.gs-tab-item:hover:not(.active) {
  background: rgba(92, 67, 45, 0.10);
}

.gs-tab-item.active {
  background: linear-gradient(180deg, #429DE2, #2674B8);
  color: #FFFFFF;
}

.gs-task-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.gs-task-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  background: linear-gradient(180deg, #E8F6FF, #F7E8C6);
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

.gs-tablet-list {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gs-task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1.8px solid #E5D9BE;
  box-shadow: 0 2px 0 rgba(86, 56, 26, 0.12);
}

.gs-task-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.gs-task-name {
  font-size: 13px;
  font-weight: 800;
  color: #3D2818;
}

.gs-task-sub {
  font-size: 11px;
  color: #7A6048;
  margin-top: 2px;
}

/* ==================== SINGLE-TIER CLASSROOM INTERIOR CORNER HUD ==================== */
.interior-banner {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: none;
  z-index: 32;
}

.int-meta {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 6px 12px;
  max-width: min(390px, calc(54vw - 14px));
}

.int-actions {
  gap: 6px;
  padding: 5px 8px;
  flex-shrink: 0;
}

.int-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--mst-teal);
  line-height: 1.2;
}

.int-sub {
  font-size: 10.8px;
  color: #5D4230;
  line-height: 1.25;
}

.exam-sbd-badge {
  position: fixed;
  transform: translate(-50%, -100%);
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(158, 38, 27, 0.94);
  color: #FFFDF5;
  border: 1.8px solid #FFE47A;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(24, 14, 8, 0.42);
  z-index: 26;
}

.exam-sbd-badge.is-seated {
  background: rgba(43, 83, 77, 0.95);
}

/* ==================== TOAST (Sits neatly above bottom-right controls!) ==================== */
.club-toast {
  position: fixed;
  bottom: 58px;
  right: 12px;
  top: auto;
  padding: 8px 13px;
  border-radius: 11px;
  background: var(--mst-teal);
  color: #FFFDF5;
  border: 2px solid var(--ink);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 0 rgba(56, 35, 22, 0.35);
  z-index: 42;
  max-width: min(360px, calc(100vw - 24px));
}

/* ==================== BOTTOM-LEFT FLOATING STUDENT SWITCHER PILL & POPOVER ==================== */
.student-dock-wrap {
  position: fixed;
  bottom: 10px;
  left: 10px;
  right: auto;
  width: min(740px, calc(100vw - 190px));
  padding: 7px 10px 8px;
  background: rgba(251, 245, 229, 0.96);
  border: 2.2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(56, 35, 22, 0.32), inset 0 1.5px 0 rgba(255, 255, 255, 0.8);
  z-index: 32;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  contain: layout style;
}

.student-dock-wrap.collapsed {
  width: auto;
  padding: 4.5px 6px;
  gap: 0;
}

.student-dock-wrap.collapsed .student-dock {
  display: none;
}

.dock-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  margin-bottom: 0;
}

.dock-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: var(--mst-teal);
  color: #FFFDF6;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(56, 35, 22, 0.3);
  transition: transform 0.08s ease, filter 0.12s ease;
}

.dock-toggle-pill:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.dock-mini-btn {
  background: #FFF6DC;
}

.student-dock {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.student-dock::-webkit-scrollbar {
  height: 5px;
}

.student-dock::-webkit-scrollbar-thumb {
  background: rgba(56, 35, 22, 0.25);
  border-radius: 99px;
}

.stu-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4.5px 9px;
  border-radius: 10px;
  border: 1.8px solid rgba(56, 35, 22, 0.5);
  background: #FFFBF2;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s ease;
}

.stu-chip:hover {
  background: #FFF0C4;
  transform: translateY(-1px);
}

.stu-chip.active {
  background: var(--mst-teal);
  color: #FFFDF6;
  border-color: var(--ink);
  box-shadow: 0 2px 0 rgba(56, 35, 22, 0.35);
}

.stu-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.8px solid var(--ink);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #FFFFFF;
  flex-shrink: 0;
}

.stu-av-img {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  border: 1.8px solid var(--ink);
  object-fit: cover;
  object-position: top center;
  background: linear-gradient(180deg, #E8F6FF 0%, #FBECC8 100%);
  flex-shrink: 0;
}

.stu-name {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.15;
}

.stu-meta {
  font-size: 9.5px;
  opacity: 0.78;
}

/* ==================== MODALS & JOIN FORM ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 14, 8, 0.62);
  display: grid;
  place-items: center;
  z-index: 52;
  padding: 12px;
}

.join-modal {
  width: 360px;
  max-width: calc(100vw - 24px);
  padding: 18px;
  border-radius: 16px;
  background: var(--parchment-strong);
  border: 2.5px solid var(--ink);
  box-shadow: 0 12px 32px rgba(24, 14, 8, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-title {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--mst-teal);
}

.modal-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #5D4230;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select {
  padding: 8px 10px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: #FFFDF8;
  color: var(--ink);
  font-size: 12.5px;
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ==================== NON-BLOCKING RIGHT-HAND LIVE 3D CUSTOMIZER DRAWER ==================== */
.customize-drawer {
  position: fixed;
  top: 66px;
  right: 12px;
  width: 344px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 156px);
  overflow-y: auto;
  border-radius: 18px;
  background: rgba(250, 242, 220, 0.96);
  border: 2.5px solid var(--ink);
  box-shadow: 0 14px 36px rgba(24, 14, 8, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.85);
  z-index: 41;
  animation: drawerSlideIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes drawerSlideIn {
  from {
    opacity: 0;
    transform: translateX(28px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.drawer-inner {
  padding: 14px 15px 15px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drawer-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: #F4E4BC;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
}

.drawer-close-btn:hover {
  background: #F0624A;
  color: #FFFFFF;
}

.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.color-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: #5D4230;
  text-align: center;
}

.color-field input[type="color"] {
  width: 44px;
  height: 30px;
  padding: 2px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: #FFFDF8;
  cursor: pointer;
}

/* ==================== EDUCATIONAL CLASSROOM MINI-QUIZ MODAL ==================== */
.gs-quiz-card {
  width: min(560px, calc(100vw - 24px));
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, #FFFDF7 0%, #F7ECDA 100%);
  border: 3px solid var(--ink);
  box-shadow: 0 18px 46px rgba(18, 10, 5, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.quiz-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.quiz-room-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--mst-teal);
}

.quiz-progress {
  font-size: 11.5px;
  font-weight: 700;
  color: #7A5C42;
  margin-top: 2px;
}

.quiz-question {
  font-size: 15px;
  font-weight: 800;
  color: #2E1D12;
  line-height: 1.48;
  padding: 12px 14px;
  border-radius: 13px;
  background: #FFFFFF;
  border: 2px solid #E5D4B3;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.quiz-opt-btn {
  padding: 11px 12px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: #FFFBF0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  line-height: 1.35;
  box-shadow: 0 3px 0 rgba(56, 35, 22, 0.22);
  transition: transform 0.08s ease, background 0.12s ease;
}

.quiz-opt-btn:hover:not(:disabled) {
  background: #FFF0C4;
  transform: translateY(-1px);
}

.quiz-opt-btn:disabled {
  cursor: default;
}

.quiz-opt-btn.correct {
  background: linear-gradient(180deg, #7BE044 0%, #4FB822 100%);
  color: #FFFFFF;
  border-color: #265E12;
  text-shadow: 0 1px 1px rgba(20, 52, 8, 0.5);
}

.quiz-opt-btn.wrong {
  background: linear-gradient(180deg, #F06856 0%, #C83724 100%);
  color: #FFFFFF;
  border-color: #6B1A10;
}

.quiz-explain {
  padding: 11px 13px;
  border-radius: 12px;
  background: #EDF7F4;
  border: 2px solid var(--mst-teal);
  color: #1D3B36;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}

.quiz-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.quiz-reward-note {
  font-size: 12px;
  font-weight: 800;
  color: #7D4610;
}

.quiz-foot-btns {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ==================== MOBILE / TABLET RESPONSIVE ==================== */
@media (max-width: 1080px) {
  .club-topbar {
    gap: 6px;
    padding: 5px 8px;
  }

  .club-brand-text .club-title {
    font-size: 12.5px;
  }

  .club-actions {
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .club-actions::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 720px) {
  .club-topbar {
    top: 6px;
    left: 6px;
    right: 6px;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }

  .club-brand {
    justify-content: space-between;
  }

  .club-actions {
    justify-content: flex-start;
  }

  .classroom-menu {
    position: fixed;
    top: 96px;
    left: 12px;
    right: 12px;
    width: auto;
  }

  .interior-banner {
    top: 8px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .student-dock-wrap:not(.collapsed) {
    width: calc(100vw - 20px);
    bottom: 58px;
  }

  .customize-drawer {
    top: auto;
    bottom: 58px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 52vh;
  }

  .gs-dialogue {
    bottom: 86px;
  }

  .gs-portrait-wrap {
    width: 106px;
    height: 116px;
    margin-right: -14px;
  }

  .portrait-hd-img,
  #portrait-3d-canvas {
    width: 106px;
    height: 116px;
  }

  .gs-dialogue-card {
    padding: 10px 12px 9px 22px;
  }

  .gs-dialogue-text {
    font-size: 12.5px;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .gs-tablet-body {
    grid-template-columns: 1fr;
  }

  .gs-tablet-side {
    flex-direction: row;
    border-right: 0;
    border-bottom: 1.5px solid #D9CBB0;
    overflow-x: auto;
  }

  .dock-hint {
    display: none;
  }
}


/* ==================== 8-ZONE WORLD MAP MODAL & TOPBAR BUTTON ==================== */
.world-map-btn {
  background: linear-gradient(180deg, #EAF6F3, #D5EBE5);
  color: var(--mst-teal);
  border-color: var(--mst-teal);
  font-weight: 800;
}

.world-map-btn:hover {
  background: #2B534D;
  color: #FFFDF5;
}

.wm-card {
  width: min(900px, 95vw);
  background: #FAF2DC;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(20, 12, 8, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.85);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(43, 83, 77, 0.10);
  border-bottom: 2px solid rgba(56, 35, 22, 0.18);
}

.wm-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.wm-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--mst-teal);
  margin-top: 2px;
}

.wm-canvas {
  position: relative;
  height: min(475px, 65vh);
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 245, 210, 0.82) 0%, rgba(220, 236, 215, 0.72) 55%, rgba(196, 220, 206, 0.85) 100%);
  border-bottom: 2px solid rgba(56, 35, 22, 0.16);
  overflow: hidden;
}

.wm-svg-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wm-nodes {
  position: absolute;
  inset: 0;
}

.wm-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 158px;
  padding: 4.5px;
  border-radius: 13px;
  background: #FFFDF7;
  border: 2.5px solid var(--ink);
  box-shadow: 0 4px 0 rgba(56, 35, 22, 0.28);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.wm-node:hover {
  transform: translate(-50%, -54%) scale(1.04);
  border-color: var(--mst-red);
  box-shadow: 0 7px 14px rgba(56, 35, 22, 0.34);
  z-index: 5;
}

.wm-node.active {
  border-color: var(--mst-red);
  background: #FFF7DE;
  box-shadow: 0 0 0 3px rgba(158, 38, 27, 0.25), 0 5px 0 rgba(56, 35, 22, 0.3);
  z-index: 4;
}

.wm-node-thumb {
  width: 100%;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  border: 1.5px solid rgba(56, 35, 22, 0.22);
  display: block;
}

.wm-node-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 2px;
}

.wm-node-name {
  font-size: 11.6px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  width: 100%;
}

.wm-node-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  font-size: 9.8px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(255, 253, 245, 0.94);
  color: var(--mst-teal);
  border: 1.2px solid rgba(56, 35, 22, 0.28);
  box-shadow: 0 2px 5px rgba(20, 12, 6, 0.26);
  flex-shrink: 0;
}

.wm-node.active .wm-node-badge {
  background: var(--mst-red);
  color: #FFFDF5;
  border-color: rgba(255, 248, 220, 0.85);
}

.wm-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  flex-wrap: wrap;
}

.wm-tip {
  font-weight: 600;
  color: var(--mst-teal);
}

@media (max-width: 720px) {
  .wm-node {
    width: 112px;
    padding: 4px;
  }
  .wm-node-thumb {
    height: 36px;
  }
  .wm-node-name {
    font-size: 10px;
  }
}


/* ==================== HUB & SPOKE HUD: SMART LEVEL, COINS & DAILY QUEST CHIP ==================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.hud-left-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
  max-width: min(560px, calc(62vw - 12px));
}

.club-brand {
  max-width: 100%;
  flex-wrap: wrap;
}

.level-select-wrap {
  display: inline-flex;
  align-items: center;
}

.level-select {
  padding: 4px 8px;
  border-radius: 999px;
  border: 2px solid var(--mst-teal);
  background: linear-gradient(180deg, #FFFFFF 0%, #EEF6F4 100%);
  color: var(--mst-teal);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  outline: none;
  box-shadow: 0 2px 0 rgba(43, 83, 77, 0.25);
  transition: background 0.14s ease, transform 0.08s ease;
}

.level-select:hover,
.level-select:focus {
  background: #E2F2EE;
  transform: translateY(-1px);
}

.gs-currency-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.gs-coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4.5px 9.5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFF3C4 0%, #F0AA36 100%);
  border: 2px solid #7C4410;
  color: #4A2406;
  font-size: 12.2px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(88, 48, 12, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.currency-bump {
  animation: currBump 0.36s cubic-bezier(0.22, 1.4, 0.36, 1);
}

@keyframes currBump {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.hub-quest-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 7px;
  border-radius: 13px;
  border: 2px solid var(--ink);
  background: rgba(251, 245, 229, 0.94);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(56, 35, 22, 0.28), inset 0 1.5px 0 rgba(255, 255, 255, 0.8);
  transition: transform 0.12s ease, background 0.14s ease;
}

.hub-quest-pill:hover {
  transform: translateY(-1.5px);
  background: #FFF7DE;
}

.hq-badge {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(180deg, #9E261B, #7B1B12);
  color: #FFF7DE;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
}

.hq-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 118px;
}

.hq-title {
  font-size: 11.2px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}

.hq-bar {
  width: 118px;
  height: 6px;
  border-radius: 99px;
  background: rgba(56, 35, 22, 0.18);
  overflow: hidden;
  display: block;
}

.hq-bar-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #62C932, #9EE855);
  transition: width 0.32s ease;
}

.hq-cta {
  font-size: 11px;
  font-weight: 800;
  color: var(--mst-teal);
  padding: 2px 6px;
  border-radius: 7px;
  background: rgba(43, 83, 77, 0.10);
}

.hq-cta.has-reward {
  background: #9E261B;
  color: #FFFDF5;
  animation: pulseGold 1.4s ease-in-out infinite;
}

.gs-dialogue-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gs-amber-btn {
  background: linear-gradient(180deg, #FFD86B 0%, #E89D24 100%);
  color: #3F2105;
  border-color: #7A440E;
  box-shadow: 0 3px 0 #7A440E, inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.class-menu-section {
  font-size: 10.2px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mst-teal);
  padding: 6px 6px 2px;
}

/* ==================== UNIFIED HUB & SPOKE GARDENSCAPES MODAL ==================== */
.hub-card {
  width: min(840px, 95vw);
  max-height: 88vh;
  background: #FAF2DC;
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 18px 46px rgba(20, 12, 6, 0.56), inset 0 2px 0 rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: dropFade 0.18s ease-out;
}

.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: linear-gradient(180deg, rgba(43, 83, 77, 0.14) 0%, rgba(43, 83, 77, 0.06) 100%);
  border-bottom: 2px solid rgba(56, 35, 22, 0.18);
}

.hub-header-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.hub-header-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 2px solid var(--ink);
  background: #FFFDF6;
  display: grid;
  place-items: center;
  font-size: 21px;
  flex-shrink: 0;
  box-shadow: 0 3px 0 rgba(56, 35, 22, 0.22);
}

.hub-title {
  font-size: 16.5px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.2;
}

.hub-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--mst-teal);
  margin-top: 2px;
}

.hub-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hub-level-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(43, 83, 77, 0.12);
  border: 1.5px solid var(--mst-teal);
  color: var(--mst-teal);
  font-size: 11.2px;
  font-weight: 800;
  white-space: nowrap;
}

.hub-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: #F1E6CC;
  border-bottom: 1.8px solid rgba(56, 35, 22, 0.16);
  overflow-x: auto;
  flex-shrink: 0;
}

.hub-tab-btn {
  padding: 6.5px 12px;
  border-radius: 11px;
  border: 2px solid rgba(56, 35, 22, 0.35);
  background: #FFFDF7;
  color: var(--ink);
  font-size: 12.2px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.12s ease;
}

.hub-tab-btn:hover {
  background: #FFF0C4;
  transform: translateY(-1px);
}

.hub-tab-btn.active {
  background: var(--mst-teal);
  color: #FFFDF6;
  border-color: var(--ink);
  box-shadow: 0 2px 0 rgba(56, 35, 22, 0.3);
}

.hub-tab-smart {
  font-size: 9.5px;
  padding: 1.5px 5px;
  border-radius: 99px;
  background: rgba(255, 228, 122, 0.92);
  color: #5A2E08;
  font-weight: 900;
}

.hub-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hub-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: #F3E9D1;
  border-top: 2px solid rgba(56, 35, 22, 0.16);
  flex-wrap: wrap;
}

.hub-foot-note {
  font-size: 11.8px;
  font-weight: 700;
  color: #6B4D35;
}

.hub-foot-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

/* Progress banner inside Hub modals */
.hub-progress-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 13px;
  background: #FFFDF7;
  border: 2px solid #DECBA6;
  flex-wrap: wrap;
}

.hub-prog-bar {
  flex: 1;
  min-width: 140px;
  height: 10px;
  border-radius: 99px;
  background: #E8DEC7;
  overflow: hidden;
  border: 1px solid rgba(56, 35, 22, 0.2);
}

.hub-prog-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #2B534D, #4CA993);
  transition: width 0.3s ease;
}

/* Quick Hub & Spoke Navigation Grid */
.hub-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 9px;
}

.hub-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 9px;
}

.hub-item-card {
  padding: 11px 12px;
  border-radius: 13px;
  background: #FFFDF8;
  border: 2px solid #E2D2B2;
  box-shadow: 0 2px 0 rgba(56, 35, 22, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.hub-item-card.done-card {
  border-color: #6BC73E;
  background: #F5FCEF;
}

.hub-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hub-item-title {
  font-size: 13.2px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
}

.hub-item-meta {
  font-size: 11.4px;
  color: #6B4D35;
  line-height: 1.4;
}

.hub-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10.4px;
  font-weight: 800;
  background: rgba(43, 83, 77, 0.11);
  color: var(--mst-teal);
}

.hub-tag.red-tag {
  background: rgba(158, 38, 27, 0.11);
  color: var(--mst-red);
}

.hub-tag.gold-tag {
  background: rgba(244, 185, 59, 0.25);
  color: #7D4408;
}

/* Interactive Video Lesson Preview Panel */
.lesson-player-box {
  padding: 13px 15px;
  border-radius: 14px;
  background: linear-gradient(135deg, #243442 0%, #2B534D 100%);
  color: #FFFDF6;
  border: 2.5px solid var(--ink);
  box-shadow: 0 6px 18px rgba(24, 36, 48, 0.28);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.lesson-player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lesson-player-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #FFE999;
}

.lesson-points {
  margin-left: 16px;
  font-size: 12.2px;
  line-height: 1.5;
  color: #EDF6F4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Library Filter & Inline Reader */
.lib-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lib-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1.8px solid rgba(56, 35, 22, 0.35);
  background: #FFFDF8;
  color: var(--ink);
  font-size: 11.4px;
  font-weight: 800;
  cursor: pointer;
}

.lib-chip.active {
  background: var(--mst-teal);
  color: #FFFDF6;
  border-color: var(--ink);
}

.lib-reader-pre {
  white-space: pre-wrap;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 12.5px;
  line-height: 1.55;
  padding: 10px 12px;
  border-radius: 10px;
  background: #F4FAF8;
  border: 1.8px solid rgba(43, 83, 77, 0.35);
  color: #1D3530;
}

/* Timed Mock Test (Exam Tower) */
.exam-timer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 12px;
  background: #FFF6DD;
  border: 2px solid #D49B38;
  font-weight: 800;
  font-size: 13px;
  color: #5C320A;
}

.exam-clock {
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--mst-red);
  color: #FFFDF5;
  font-variant-numeric: tabular-nums;
}

/* Teacher Office Q&A & Competency */
.office-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  border-radius: 13px;
  background: #FFFDF8;
  border: 2px solid #E2D2B2;
}

.office-form textarea {
  width: 100%;
  min-height: 76px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 2px solid rgba(56, 35, 22, 0.45);
  background: #FFFFFF;
  color: var(--ink);
  font-family: inherit;
  font-size: 12.8px;
  resize: vertical;
  outline: none;
}

/* World Map Header Switcher */
.wm-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.wm-mode-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: rgba(56, 35, 22, 0.12);
  border: 1.6px solid rgba(56, 35, 22, 0.25);
  gap: 3px;
}

.wm-mode-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}

.wm-mode-btn.active {
  background: var(--mst-teal);
  color: #FFFDF6;
  box-shadow: 0 2px 4px rgba(24, 14, 8, 0.22);
}

.wm-hub-node {
  width: 174px;
  padding: 6.5px 8px;
  gap: 3px;
}

.wm-hub-node.is-hub {
  width: 204px;
  background: linear-gradient(180deg, #FFF7DC 0%, #FDEAB0 100%);
  border-color: var(--mst-red);
  box-shadow: 0 0 0 3px rgba(158, 38, 27, 0.22), 0 5px 0 rgba(56, 35, 22, 0.3);
}

.wm-hub-sub {
  font-size: 10px;
  font-weight: 600;
  color: #6B4D35;
  text-align: center;
  line-height: 1.25;
}

@media (max-width: 720px) {
  .hud-left-stack {
    max-width: 100%;
    width: 100%;
  }
  .hub-quest-pill {
    display: none;
  }
  .hub-level-pill {
    display: none;
  }
  .wm-hub-node {
    width: 126px;
  }
  .wm-hub-sub {
    display: none;
  }
}


/* ==================== OPTION C: 1-CLICK GRADE PICKER & ACTIVE CAMPUS WORLD MAP ==================== */
.gs-grade-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.grade-pill {
  padding: 4.5px 10px;
  border-radius: 999px;
  border: 2px solid rgba(56, 35, 22, 0.35);
  background: #FFFDF8;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.14s ease, border-color 0.14s ease;
}

.grade-pill:hover {
  transform: translateY(-1px);
  background: #FFF0C4;
}

.grade-pill.active {
  background: var(--mst-teal);
  color: #FFFDF5;
  border-color: var(--ink);
  box-shadow: 0 2px 0 rgba(56, 35, 22, 0.28);
}

.wm-hub-node.is-my-grade {
  background: linear-gradient(180deg, #FFF7DC 0%, #FFE89E 100%);
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(255, 212, 74, 0.45), 0 5px 0 rgba(56, 35, 22, 0.3);
  z-index: 4;
}


/* ==================== IN-CLASSROOM FOCUSED STUDY STUDIO & CRISP MATH FORMULAS ==================== */
.cs-lecture-btn {
  background: linear-gradient(180deg, #2E645C 0%, #244C46 100%) !important;
  color: #FFFDF5 !important;
  border-color: #1A3631 !important;
}
.cs-lecture-btn:hover {
  filter: brightness(1.07);
}

.cs-backdrop {
  z-index: 62;
  background: rgba(20, 28, 34, 0.56);
  backdrop-filter: blur(4px);
  padding: 16px;
}

/* Study-With-Me 1-Click Split Mode: docks cleanly on the right so 3D classroom stays live on the left! */
.cs-backdrop.is-split-mode {
  background: transparent;
  backdrop-filter: none;
  justify-content: flex-end;
  align-items: stretch;
  padding: 64px 14px 14px 14px;
  pointer-events: none;
}

.cs-card {
  --study-font-scale: 1;
  width: min(1100px, 95vw);
  height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  background: #F7F9F8;
  color: #182430;
  border-radius: 18px;
  border: 2.5px solid #2B534D;
  box-shadow: 0 22px 54px rgba(15, 23, 30, 0.45);
  overflow: hidden;
  pointer-events: auto;
  transition: width 0.22s ease, height 0.22s ease;
}

.cs-card.is-split-mode {
  width: min(630px, 53vw);
  height: 100%;
  box-shadow: -8px 0 36px rgba(15, 23, 30, 0.34);
}

/* Fullscreen focused study mode (100% viewport for maximum reading/video/practice area) */
.cs-backdrop.is-fullscreen {
  padding: 0;
  background: #F7F9F8;
  backdrop-filter: none;
}

.cs-card.is-fullscreen {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.cs-card.is-fullscreen .cs-header {
  padding: 8px 18px;
}

.cs-card.is-fullscreen .cs-tabs {
  padding: 7px 18px;
}

.cs-card.is-fullscreen .cs-body {
  padding: 16px 22px 24px;
}

.cs-card.is-fullscreen .cs-lecture-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.cs-card.is-fullscreen .cs-drill-layout {
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.78fr);
  gap: 18px;
}

.cs-card.is-fullscreen .cs-doc-iframe {
  height: min(74vh, 720px);
}

.cs-fullscreen-btn.is-active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}
.cs-fullscreen-btn.is-active:hover {
  background: #22443F;
}

.cs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #EEF4F2;
  border-bottom: 1.5px solid #CBD4D2;
  flex-shrink: 0;
}

.cs-header-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.cs-crest {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #2B534D;
  color: #FFFDF5;
  display: grid;
  place-items: center;
  font-size: 19px;
  flex-shrink: 0;
}

.cs-title {
  font-size: 15.5px;
  font-weight: 800;
  color: #182430;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.cs-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(43, 83, 77, 0.12);
  border: 1px solid rgba(43, 83, 77, 0.3);
  color: #2B534D;
  font-size: 11px;
  font-weight: 800;
}

.cs-formula-hint {
  font-size: 11.5px;
  color: #4A5B68;
  font-weight: 600;
}

.cs-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cs-font-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1.4px solid #CBD4D2;
}

.cs-tool-btn {
  padding: 3px 7px;
  border-radius: 7px;
  border: 1px solid #CBD4D2;
  background: #F7F9F8;
  color: #182430;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.cs-tool-btn:hover {
  background: #E4EEEB;
  border-color: #2B534D;
}

.cs-font-label {
  font-size: 11px;
  font-weight: 800;
  color: #243442;
  min-width: 34px;
  text-align: center;
}

.cs-layout-btn {
  padding: 6px 11px;
  border-radius: 10px;
  border: 1.5px solid #243442;
  background: #FFFFFF;
  color: #243442;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.cs-layout-btn:hover {
  background: #243442;
  color: #FFFDF5;
}

.cs-tabs {
  display: flex;
  gap: 6px;
  padding: 9px 16px;
  background: #FFFFFF;
  border-bottom: 1.5px solid #CBD4D2;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.cs-tab-btn {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1.5px solid #CBD4D2;
  background: #F7F9F8;
  color: #243442;
  font-size: 12.8px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.cs-tab-btn:hover {
  border-color: #2B534D;
  background: #EDF4F2;
}
.cs-tab-btn.active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}

.cs-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: calc(14.5px * var(--study-font-scale));
  line-height: 1.62;
}

/* ==================== TAB 1: SYNCHRONIZED 2-COLUMN VIDEO + PINNED FORMULAS ==================== */
.cs-lecture-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(300px, 1fr);
  gap: 16px;
  align-items: start;
}

.cs-card.is-split-mode .cs-lecture-grid,
.cs-card.is-split-mode .cs-drill-layout {
  grid-template-columns: 1fr;
}

.cs-video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #101A21;
  border: 2px solid #243442;
}

.cs-real-video,
.cs-real-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Built-in Interactive Green Chalkboard Lesson Simulator */
.cs-chalkboard-stage {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 280px;
  padding: 16px 18px;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 20%, #244C41 0%, #17332C 100%);
  border: 5px solid #8C5A32;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(15, 23, 30, 0.18);
  color: #FAF9F2;
  gap: 14px;
}

.cs-chalk-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #D2E6DF;
}

.cs-chalk-pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 232, 158, 0.45);
  color: #FFE89E;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.cs-chalk-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cs-chalk-lesson-title {
  font-size: calc(15.5px * var(--study-font-scale));
  font-weight: 800;
  color: #FFF7D6;
}

.cs-chalk-eq {
  padding: 12px 16px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px dashed rgba(255, 232, 158, 0.45);
  text-align: center;
  font-size: calc(18px * var(--study-font-scale));
  color: #FFFFFF;
}
.cs-chalk-eq .mf-frac .mf-num {
  border-bottom-color: #FFF7D6;
}

.cs-chalk-point {
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(16, 36, 30, 0.55);
  border-left: 3.5px solid #FFE47A;
  font-size: calc(13.8px * var(--study-font-scale));
  color: #F4FAF7;
}

.cs-chalk-step {
  color: #FFE47A;
  font-weight: 800;
  margin-right: 4px;
}

.cs-chalk-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cs-play-btn {
  padding: 7px 14px;
  border-radius: 9px;
  border: 1.5px solid #FFE47A;
  background: #2B534D;
  color: #FFFDF5;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.cs-play-btn:hover {
  background: #366860;
}

.cs-progress-wrap {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
  cursor: pointer;
}

.cs-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7BE044 0%, #FFE47A 100%);
  transition: width 0.25s linear;
}

.cs-pct {
  font-size: 12px;
  font-weight: 800;
  color: #FFE89E;
  min-width: 34px;
  text-align: right;
}

.cs-lesson-bar {
  margin-top: 12px;
  padding: 13px 15px;
  border-radius: 13px;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-ls-head {
  font-size: calc(15px * var(--study-font-scale));
  font-weight: 800;
  color: #182430;
}

.cs-ls-desc {
  margin: 4px 0 0;
  color: #3D4E5C;
  font-size: calc(13.5px * var(--study-font-scale));
}

.cs-lesson-cta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cs-playlist-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 13px;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
}

.cs-box-label {
  font-size: 12.5px;
  font-weight: 800;
  color: #2B534D;
  margin-bottom: 8px;
}

.cs-playlist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cs-lesson-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.4px solid #CBD4D2;
  background: #F7F9F8;
  color: #182430;
  cursor: pointer;
}
.cs-lesson-item:hover {
  border-color: #2B534D;
  background: #EEF4F2;
}
.cs-lesson-item.active {
  border-color: #2B534D;
  background: #E5F0ED;
  box-shadow: inset 3px 0 0 #2B534D;
}

.cs-li-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #243442;
  color: #FFFDF5;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 800;
  flex-shrink: 0;
}
.cs-lesson-item.done .cs-li-num {
  background: #2B534D;
}

.cs-li-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cs-li-title {
  font-size: 13px;
  font-weight: 800;
  color: #182430;
}

.cs-li-meta {
  font-size: 11.5px;
  color: #526370;
  font-weight: 600;
}

/* ==================== PINNED FORMULA COLUMN & TEXTBOOK FORMULA CARDS ==================== */
.cs-formula-col {
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 14px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
}

.cs-formula-col-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1.2px solid #CBD4D2;
  font-size: 13.5px;
  font-weight: 800;
  color: #2B534D;
}

.cs-fc-hint {
  font-size: 11.5px;
  font-weight: 600;
  color: #5A6B78;
}

.cs-formula-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mf-formula-card {
  padding: 11px 13px;
  border-radius: 11px;
  background: #F7F9F8;
  border: 1.2px solid #CBD4D2;
  border-left: 4px solid #2B534D;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mf-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mf-card-title {
  font-size: calc(12.8px * var(--study-font-scale));
  font-weight: 800;
  color: #182430;
}

.mf-card-tag {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(158, 38, 27, 0.1);
  color: #9E261B;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.mf-card-eq {
  padding: 9px 10px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid #DDE5E3;
  text-align: center;
  overflow-x: auto;
  font-size: calc(16.5px * var(--study-font-scale));
  color: #182430;
}

.mf-card-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mf-legend-chip {
  padding: 2px 7px;
  border-radius: 6px;
  background: #EDF3F1;
  color: #243442;
  font-size: calc(11.8px * var(--study-font-scale));
  font-weight: 600;
}

.mf-card-tip {
  font-size: calc(12px * var(--study-font-scale));
  color: #2B534D;
  background: rgba(43, 83, 77, 0.07);
  padding: 5px 8px;
  border-radius: 7px;
}

.cs-keypoints-card {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(158, 38, 27, 0.05);
  border: 1.2px solid rgba(158, 38, 27, 0.2);
}

.cs-kp-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #9E261B;
  margin-bottom: 5px;
}

.cs-kp-list {
  margin: 0;
  padding-left: 18px;
  font-size: calc(13px * var(--study-font-scale));
  color: #243442;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ==================== CRISP OFFLINE MATH FORMULA TYPOGRAPHY (.mf-*) ==================== */
.mf-math {
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", Georgia, serif;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.mf-inline {
  font-size: 1.07em;
  padding: 0 2px;
}

.mf-display-block {
  margin: 10px 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #F7F9F8;
  border-left: 3.5px solid #2B534D;
  text-align: center;
  font-size: 1.18em;
  overflow-x: auto;
}

.mf-var {
  font-style: italic;
  font-weight: 600;
}

.mf-text,
.mf-fn {
  font-style: normal;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.9em;
}

.mf-fn {
  font-family: "Cambria Math", Georgia, serif;
  margin-right: 2px;
}

.mf-op {
  padding: 0 3px;
}

.mf-arrow {
  color: #9E261B;
  font-weight: 800;
  padding: 0 2px;
}

.mf-quad {
  display: inline-block;
  width: 1.1em;
}

.mf-thin {
  display: inline-block;
  width: 0.2em;
}

/* True Stacked Vertical Fractions (\dfrac{num}{den}) */
.mf-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 3px;
  line-height: 1.18;
  font-size: 0.96em;
}

.mf-frac .mf-num {
  padding: 0 5px 2px;
  border-bottom: 1.4px solid currentColor;
  text-align: center;
}

.mf-frac .mf-den {
  padding: 2px 5px 0;
  text-align: center;
}

/* Square root with crisp overbar */
.mf-sqrt {
  display: inline-flex;
  align-items: baseline;
  vertical-align: middle;
  margin: 0 2px;
}

.mf-root-idx {
  font-size: 0.65em;
  margin-right: -2px;
}

.mf-rad-sign {
  font-size: 1.14em;
  line-height: 1;
}

.mf-rad-body {
  border-top: 1.3px solid currentColor;
  padding: 1px 3px 0 2px;
}

/* Vector arrow over variable (\vec{F}) */
.mf-vec {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.92;
  vertical-align: baseline;
  margin: 0 1px;
}

.mf-vec-arrow {
  font-size: 0.65em;
  margin-bottom: -2px;
}

.mf-overline {
  display: inline-block;
  border-top: 1.3px solid currentColor;
  line-height: 1.05;
  padding-top: 1px;
}

/* Integrals & Sums with upper/lower limits */
.mf-bigop {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-right: 3px;
}

.mf-bigop-sym {
  font-size: 1.38em;
  line-height: 1;
}

.mf-bigop-lims {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.65em;
  line-height: 1.05;
  margin-left: 1px;
}

.mf-sup,
.mf-sub {
  font-size: 0.72em;
  line-height: 0;
}

/* Academic Data & Statistics Tables parsed from LaTeX \begin{tabular} */
.mf-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 10px 0;
  border-radius: 10px;
  border: 1.4px solid #2B534D;
  background: #FFFFFF;
}

.mf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(13.8px * var(--study-font-scale, 1));
  color: #182430;
}

.mf-table th {
  padding: 8px 11px;
  background: rgba(43, 83, 77, 0.1);
  color: #182430;
  font-weight: 800;
  border: 1px solid #CBD4D2;
  white-space: nowrap;
}

.mf-table td {
  padding: 7px 11px;
  border: 1px solid #CBD4D2;
  vertical-align: middle;
}

.mf-table tbody tr:nth-child(even) td {
  background: #F7F9F8;
}

.mf-table .mf-td-bold {
  font-weight: 800;
  color: #243442;
}

/* Crisp Real LaTeX TikZ Diagrams (\begin{tikzpicture} -> 220 DPI PNG cache) */
.mf-tikz-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}
.mf-tikz-row .mf-tikz-box {
  margin: 0;
  flex: 0 1 auto;
}
.mf-tikz-row .mf-tikz-img {
  max-width: min(100%, 360px);
  max-height: 240px;
}

.mf-tikz-box {
  margin: 10px auto;
  padding: 10px 14px;
  border-radius: 11px;
  background: #FFFFFF;
  border: 1.4px solid #CBD4D2;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
}

.mf-tikz-img {
  display: block;
  max-width: min(100%, 540px);
  max-height: 340px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.cs-opt-btn .mf-tikz-box {
  margin: 4px auto;
  padding: 6px;
  border-color: #DDE5E3;
}

.cs-opt-btn .mf-tikz-img {
  max-width: 240px;
  max-height: 165px;
}

.mb-pick-opt .mf-tikz-box {
  margin: 4px 0;
  padding: 4px;
}

.mb-pick-opt .mf-tikz-img {
  max-width: 180px;
  max-height: 120px;
}

/* ==================== TAB 2: PRACTICE & TIMED TEST ==================== */
.cs-practice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.cs-mode-pills {
  display: inline-flex;
  gap: 6px;
  background: #E8EFED;
  padding: 4px;
  border-radius: 11px;
}

.cs-mode-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #243442;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.cs-mode-btn.active {
  background: #FFFFFF;
  color: #2B534D;
  box-shadow: 0 2px 6px rgba(24, 36, 48, 0.12);
}

.cs-practice-reward {
  font-size: 12px;
  font-weight: 800;
  color: #9E261B;
}

.cs-drill-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(270px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.cs-q-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 11px;
}

.cs-q-pill {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1.4px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.cs-q-pill.solved {
  background: #E6F4EC;
  border-color: #2B534D;
  color: #2B534D;
}
.cs-q-pill.active {
  background: #243442;
  border-color: #243442;
  color: #FFFDF5;
}

.cs-question-card {
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.cs-q-tag {
  padding: 3px 9px;
  border-radius: 7px;
  background: #2B534D;
  color: #FFFDF5;
  font-size: 11.5px;
  font-weight: 800;
}

.cs-q-status {
  font-size: 12px;
  font-weight: 700;
  color: #526370;
}
.cs-q-status.done {
  color: #2B534D;
}

.cs-hint-toggle {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1.4px solid #2B534D;
  background: #EEF5F3;
  color: #2B534D;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.cs-hint-toggle:hover {
  background: #2B534D;
  color: #FFFDF5;
}

.cs-q-prompt {
  font-size: calc(16px * var(--study-font-scale));
  font-weight: 700;
  color: #182430;
  line-height: 1.65;
}

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

.cs-opt-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1.6px solid #CBD4D2;
  background: #F7F9F8;
  color: #182430;
  font-size: calc(14.5px * var(--study-font-scale));
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}
.cs-opt-btn:hover:not(:disabled) {
  border-color: #2B534D;
  background: #EAF3F0;
  transform: translateY(-1px);
}
.cs-opt-btn.is-selected {
  border-color: #243442;
  background: #E4ECF2;
}
.cs-opt-btn.is-correct {
  border-color: #2B534D;
  background: #E2F4EA;
  color: #173F34;
}
.cs-opt-btn.is-wrong {
  border-color: #9E261B;
  background: #FBE9E7;
  color: #7D1B12;
}

.cs-opt-letter {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #243442;
  color: #FFFDF5;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 800;
  flex-shrink: 0;
}
.cs-opt-btn.is-correct .cs-opt-letter {
  background: #2B534D;
}
.cs-opt-btn.is-wrong .cs-opt-letter {
  background: #9E261B;
}

.cs-explain-box {
  padding: 12px 14px;
  border-radius: 11px;
  border-left: 4px solid #2B534D;
  background: #EDF6F2;
  color: #182430;
}
.cs-explain-box.err {
  border-left-color: #9E261B;
  background: #FDF2F1;
}

.cs-ex-head {
  font-weight: 800;
  margin-bottom: 5px;
  color: #182430;
}

.cs-ex-body {
  font-size: calc(14.5px * var(--study-font-scale));
  line-height: 1.65;
}

.cs-q-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid #E2E9E7;
  flex-wrap: wrap;
}

.cs-q-foot-right {
  display: flex;
  gap: 8px;
}

/* Timed Test View */
.cs-timed-intro {
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 14px;
  padding: 28px 24px;
  text-align: center;
  max-width: 620px;
  margin: 14px auto;
}
.cs-ti-icon {
  font-size: 40px;
  margin-bottom: 8px;
}
.cs-timed-intro h3 {
  margin: 0 0 8px;
  color: #182430;
}
.cs-ti-reward {
  color: #9E261B;
  margin-bottom: 16px;
}
.cs-big-btn {
  padding: 10px 20px !important;
  font-size: 14px !important;
}

.cs-timed-sticky {
  position: sticky;
  top: -2px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: #EEF4F2;
  border: 1.5px solid #2B534D;
  box-shadow: 0 -16px 0 0 #FFFDF7, 0 4px 12px rgba(24, 36, 48, 0.12);
  flex-wrap: wrap;
}

.cs-timed-score {
  color: #2B534D;
  font-size: 14px;
}

.cs-timed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cs-timed-q {
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 13px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-tq-head {
  font-weight: 800;
  color: #182430;
}

/* ==================== TAB 3: DOCS & FORMULA BOOKLET ==================== */
.cs-docs-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cs-sec-title {
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 800;
  color: #2B534D;
}

.cs-formula-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.cs-formula-grid-2.is-single {
  grid-template-columns: 1fr;
}

.cs-docs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cs-doc-card {
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 13px;
  padding: 14px 16px;
}

.cs-doc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cs-doc-type {
  padding: 2px 9px;
  border-radius: 6px;
  background: rgba(158, 38, 27, 0.08);
  border: 1px solid rgba(158, 38, 27, 0.28);
  color: #9E261B;
  font-size: 11.2px;
  font-weight: 800;
}

.cs-doc-title {
  font-weight: 800;
  color: #182430;
}

.cs-doc-pages {
  margin-left: auto;
  font-size: 12px;
  color: #5A6B78;
  font-weight: 700;
}

.cs-doc-sum {
  margin: 6px 0 8px;
  color: #425361;
  font-size: calc(13.5px * var(--study-font-scale));
}

.cs-doc-content {
  padding: 10px 12px;
  border-radius: 9px;
  background: #F7F9F8;
  border: 1px solid #DDE5E3;
  font-size: calc(14px * var(--study-font-scale));
  line-height: 1.7;
}

@media (max-width: 860px) {
  .cs-lecture-grid,
  .cs-drill-layout,
  .cs-formula-grid-2,
  .cs-options-grid {
    grid-template-columns: 1fr;
  }
  .cs-formula-hint,
  .cs-layout-btn:not(.cs-fullscreen-btn) {
    display: none;
  }
}


/* ==================== ON-SITE ADMIN CMS MODAL & INLINE CRUD STYLES ==================== */
.cs-admin-btn {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1.5px solid #9E261B;
  background: #FFFFFF;
  color: #9E261B;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.cs-admin-btn:hover {
  background: #FBE9E7;
}
.cs-admin-btn.is-admin-on {
  background: #9E261B;
  color: #FFFDF5;
  box-shadow: 0 0 0 2px rgba(158, 38, 27, 0.22);
}

.cs-box-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cs-lesson-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.cs-lesson-row .cs-lesson-item {
  flex: 1;
}

.cs-inline-adm {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.cs-formula-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cs-card-adm-bar {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.cs-practice-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cs-doc-link-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.cs-doc-open-a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px !important;
  font-size: 12.5px !important;
}

.cs-doc-iframe-wrap {
  margin: 8px 0 10px;
  width: 100%;
  height: 360px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #2B534D;
  background: #EEF4F2;
}

.cs-doc-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Admin CMS Modal */
.adm-backdrop {
  z-index: 75;
  background: rgba(18, 26, 33, 0.62);
  backdrop-filter: blur(4px);
  padding: 16px;
}

.adm-card {
  width: min(920px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #F7F9F8;
  color: #182430;
  border-radius: 18px;
  border: 2.5px solid #243442;
  box-shadow: 0 24px 56px rgba(10, 18, 26, 0.5);
  overflow: hidden;
}

.adm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #EEF4F2;
  border-bottom: 1.5px solid #CBD4D2;
  flex-shrink: 0;
}

.adm-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.adm-crest {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #9E261B;
  color: #FFFDF5;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.adm-title {
  font-size: 15.5px;
  font-weight: 800;
  color: #182430;
}

.adm-status {
  font-size: 11.8px;
  font-weight: 700;
  color: #2B534D;
  margin-top: 2px;
}

.adm-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.adm-login-box {
  max-width: 520px;
  margin: 18px auto;
  padding: 24px;
  border-radius: 15px;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.adm-login-icon {
  font-size: 38px;
}
.adm-login-box h3 {
  margin: 0;
  color: #182430;
}
.adm-login-box p {
  margin: 0;
  font-size: 13.5px;
  color: #425361;
  line-height: 1.55;
}

.adm-pin-row {
  display: flex;
  gap: 8px;
}
.adm-pin-row .adm-input {
  flex: 1;
}

.adm-pin-err {
  color: #9E261B;
  font-size: 13px;
  font-weight: 800;
  background: #FBE9E7;
  padding: 7px 10px;
  border-radius: 8px;
}

.adm-pin-hint {
  font-size: 12px;
  color: #526370;
  background: #F7F9F8;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px dashed #CBD4D2;
}

.adm-top-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1.2px solid #CBD4D2;
  flex-wrap: wrap;
}

.adm-room-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 280px;
  flex: 1;
}
.adm-room-picker > span {
  font-size: 12px;
  font-weight: 800;
  color: #243442;
}

.adm-util-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.adm-kind-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.adm-kind-tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.adm-kind-btn {
  padding: 6px 12px;
  border-radius: 9px;
  border: 1.4px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.adm-kind-btn.active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}

.adm-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adm-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 11px;
  background: #FFFFFF;
  border: 1.4px solid #CBD4D2;
}

.adm-item-info {
  min-width: 0;
  flex: 1;
}

.adm-item-top {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.adm-item-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #182430;
}

.adm-item-meta {
  font-size: 12px;
  color: #526370;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-item-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.adm-tag {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 800;
  background: #EAEFEF;
  color: #243442;
}
.adm-tag.is-new {
  background: #E2F4EA;
  color: #1D5A43;
}
.adm-tag.is-edit {
  background: #FFF3DC;
  color: #8A5622;
}

.adm-add-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1.4px solid #2B534D;
  background: #2B534D;
  color: #FFFDF5;
  font-size: 11.8px;
  font-weight: 800;
  cursor: pointer;
}
.adm-add-btn:hover {
  filter: brightness(1.08);
}

.adm-mini-btn {
  padding: 5px 9px;
  border-radius: 8px;
  border: 1.3px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  font-size: 11.8px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.adm-mini-btn:hover {
  border-color: #2B534D;
  background: #EEF4F2;
}
.adm-mini-btn.is-danger {
  color: #9E261B;
  border-color: rgba(158, 38, 27, 0.35);
}
.adm-mini-btn.is-danger:hover {
  background: #FBE9E7;
  border-color: #9E261B;
}

.adm-file-lbl {
  display: inline-flex;
  align-items: center;
}

/* Editor Form */
.adm-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 14px;
  padding: 16px;
}

.adm-edit-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1.2px solid #E2E9E7;
  flex-wrap: wrap;
}
.adm-edit-head h4 {
  margin: 0;
  font-size: 15px;
  color: #182430;
}
.adm-room-pill {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: #EEF4F2;
  color: #2B534D;
  font-size: 11.5px;
  font-weight: 800;
}

.adm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.adm-field > label {
  font-size: 12.2px;
  font-weight: 800;
  color: #243442;
}

.adm-opt-lbl {
  display: flex !important;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.adm-input,
.adm-select,
.adm-textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1.5px solid #CBD4D2;
  background: #FAFBF9;
  color: #182430;
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  box-sizing: border-box;
}
.adm-input:focus,
.adm-select:focus,
.adm-textarea:focus {
  border-color: #2B534D;
  background: #FFFFFF;
}
.adm-mono {
  font-family: Consolas, "Courier New", monospace;
}

.adm-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.adm-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.adm-detect-pill {
  font-size: 12px;
  font-weight: 700;
  color: #2B534D;
  margin-top: 2px;
}

.adm-latex-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.adm-chip {
  padding: 3px 8px;
  border-radius: 7px;
  border: 1.2px solid #2B534D;
  background: #EEF5F3;
  color: #2B534D;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.adm-chip:hover {
  background: #2B534D;
  color: #FFFDF5;
}

.adm-preview-box {
  padding: 12px 14px;
  border-radius: 11px;
  background: #F7F9F8;
  border: 1.4px dashed #2B534D;
}
.adm-prev-label {
  font-size: 11.8px;
  font-weight: 800;
  color: #2B534D;
  margin-bottom: 8px;
}

.adm-edit-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1.2px solid #E2E9E7;
}

@media (max-width: 700px) {
  .adm-row-2,
  .adm-row-3 {
    grid-template-columns: 1fr;
  }
}


/* ==================== MATHBANK 62,500-QUESTION UI & KATEX HARMONIZATION ==================== */
.katex {
  font-size: 1.07em;
}
.cs-chalk-eq .katex,
.cs-chalk-point .katex {
  color: #FFFDF5;
}

.adm-kind-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mb-filter-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: #EEF4F2;
  border: 1.4px solid #CBD4D2;
}

.mb-sel {
  width: auto !important;
  min-width: 120px;
  flex: 0 1 auto;
  padding: 6px 9px !important;
  font-size: 12.5px !important;
  font-weight: 700;
}

.mb-sel-wide {
  min-width: 175px;
  flex: 1 1 180px;
}

.mb-reload-btn {
  padding: 6px 12px !important;
  font-size: 12.2px !important;
  white-space: nowrap;
}

.mb-loading {
  padding: 34px 16px;
  text-align: center;
  font-weight: 800;
  color: #2B534D;
  background: #FFFFFF;
  border: 1.4px dashed #CBD4D2;
  border-radius: 13px;
}

.mb-badge {
  padding: 2.5px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.mb-lvl-m1 { background: #E4F4EC; color: #1B5E42; }
.mb-lvl-m2 { background: #E6EFF6; color: #1E4466; }
.mb-lvl-m3 { background: #FFF2DC; color: #8A5312; }
.mb-lvl-m4 { background: #FBE9E7; color: #9E261B; }

.mb-type-tn { background: #EAEFEF; color: #243442; }
.mb-type-ds { background: #E9F3F0; color: #2B534D; border: 1px solid rgba(43, 83, 77, 0.35); }
.mb-type-tln { background: #FDF0EE; color: #9E261B; border: 1px solid rgba(158, 38, 27, 0.3); }

.mb-yccd-line {
  font-size: 12px;
  color: #4A5D6A;
  margin-top: -6px;
}

.mb-topic-mini {
  font-size: 12px;
  font-weight: 700;
  color: #526370;
}

.mb-hint-box {
  padding: 11px 14px;
  border-radius: 11px;
  background: #F4F9F7;
  border: 1.3px dashed #2B534D;
  color: #182430;
  font-size: calc(13.8px * var(--study-font-scale, 1));
}
.mb-hint-head {
  font-weight: 800;
  color: #2B534D;
  margin-bottom: 5px;
}
.mb-hint-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Phần II: Đúng / Sai 4 mệnh đề */
.mb-tf-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mb-tf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #F7F9F8;
  border: 1.4px solid #CBD4D2;
  flex-wrap: wrap;
}
.mb-tf-row.is-correct {
  background: #E4F5EC;
  border-color: #2B534D;
}
.mb-tf-row.is-wrong {
  background: #FBEAE8;
  border-color: #9E261B;
}

.mb-tf-text {
  flex: 1 1 260px;
  font-size: calc(14.5px * var(--study-font-scale, 1));
  color: #182430;
  line-height: 1.55;
}

.mb-tf-btns {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}

.mb-tf-btn {
  padding: 6px 13px;
  border-radius: 8px;
  border: 1.5px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.mb-tf-btn:hover:not(:disabled) {
  border-color: #2B534D;
}
.mb-tf-btn.selected-true {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}
.mb-tf-btn.selected-false {
  background: #9E261B;
  border-color: #9E261B;
  color: #FFFDF5;
}

.mb-tf-key {
  font-size: 12px;
  font-weight: 800;
  color: #243442;
  min-width: 58px;
  text-align: right;
}

/* Phần III: Trả lời ngắn */
.mb-tln-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.mb-tln-inp {
  max-width: 300px;
  font-weight: 800;
  font-size: calc(15px * var(--study-font-scale, 1)) !important;
}
.mb-tln-key {
  font-size: 13.5px;
  color: #2B534D;
}

/* Exam Configurator & Section Headers */
.mb-exam-setup {
  background: #FFFFFF;
  border: 1.6px solid #CBD4D2;
  border-radius: 15px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mb-es-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.mb-es-icon {
  font-size: 34px;
  line-height: 1;
}
.mb-es-head h3 {
  margin: 0 0 5px;
  font-size: 15.5px;
  color: #182430;
}
.mb-es-head p {
  margin: 0;
  font-size: 13px;
  color: #425361;
  line-height: 1.5;
}

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

.mb-es-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1.2px solid #E2E9E7;
  flex-wrap: wrap;
}

.mb-exam-section-hdr {
  padding: 8px 13px;
  border-radius: 9px;
  background: #243442;
  color: #FFFDF5;
  font-size: 12.8px;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-top: 4px;
}

/* Admin MathBank Picker */
.mb-pick-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}

.mb-pick-card {
  padding: 12px 14px;
  border-radius: 11px;
  background: #FAFBF9;
  border: 1.4px solid #CBD4D2;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mb-pick-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mb-pick-btn {
  margin-left: auto;
  padding: 5px 11px !important;
  font-size: 12px !important;
}

.mb-pick-prompt {
  font-size: 14px;
  font-weight: 700;
  color: #182430;
  line-height: 1.55;
}

.mb-pick-opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mb-pick-opt {
  padding: 5px 8px;
  border-radius: 7px;
  background: #FFFFFF;
  border: 1px solid #DDE5E3;
  font-size: 12.8px;
  color: #243442;
}
.mb-pick-opt.is-ans {
  background: #E2F4EA;
  border-color: #2B534D;
  color: #173F34;
  font-weight: 700;
}

@media (max-width: 720px) {
  .mb-es-grid,
  .mb-pick-opts,
  .mb-bp-grid,
  .mb-custom-grid,
  .mb-sb-parts,
  .mb-s27-score-strip {
    grid-template-columns: 1fr;
  }
}

/* ==================== THPT 2027 EXAM BLUEPRINT, NAVIGATOR, SCOREBOARD & MATRIX ==================== */
.mb-es-preset-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mb-blueprint-box {
  padding: 13px 15px;
  border-radius: 12px;
  background: #F7F9F8;
  border: 1.5px solid #2B534D;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mb-bp-title {
  font-size: 13.2px;
  font-weight: 800;
  color: #182430;
}

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

.mb-bp-item {
  padding: 9px 11px;
  border-radius: 9px;
  background: #FFFFFF;
  border: 1.2px solid #CBD4D2;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mb-bp-item span {
  font-size: 11.4px;
  font-weight: 700;
  color: #4A5B68;
}
.mb-bp-item strong {
  font-size: 13.5px;
  font-weight: 800;
  color: #2B534D;
}

.mb-bp-note {
  font-size: 12.2px;
  color: #243442;
  line-height: 1.48;
  padding-top: 6px;
  border-top: 1px dashed #CBD4D2;
}

.mb-custom-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 11px 13px;
  border-radius: 11px;
  background: #F4F8F6;
  border: 1.3px solid #CBD4D2;
}

/* ==================== CUSTOM COGNITIVE RATIO PANEL (M1 : M2 : M3 : M4) ==================== */
.mb-ratio-panel {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #F7F9F8;
  border: 1.5px solid #2B534D;
  box-shadow: 0 2px 8px rgba(24, 36, 48, 0.04);
}

.mb-rp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.mb-rp-title {
  font-size: 13px;
  font-weight: 800;
  color: #182430;
}

.mb-rp-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mb-rp-chip {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1.2px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  font-size: 11.4px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.mb-rp-chip:hover {
  border-color: #2B534D;
  background: #EDF4F2;
}

.mb-rp-chip.active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}

.mb-ratio-bar {
  display: flex;
  width: 100%;
  height: 22px;
  border-radius: 8px;
  overflow: hidden;
  background: #E2EAE8;
  border: 1px solid #CBD4D2;
}

.mb-rbar-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.8px;
  font-weight: 800;
  color: #FFFDF5;
  white-space: nowrap;
  overflow: hidden;
  transition: width 0.18s ease;
}

.mb-rbar-seg.is-m1 { background: #2B534D; }
.mb-rbar-seg.is-m2 { background: #467870; }
.mb-rbar-seg.is-m3 { background: #243442; }
.mb-rbar-seg.is-m4 { background: #9E261B; }

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

.mb-ratio-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1.3px solid #CBD4D2;
  border-top-width: 3px;
}

.mb-ratio-card.is-m1 { border-top-color: #2B534D; }
.mb-ratio-card.is-m2 { border-top-color: #467870; }
.mb-ratio-card.is-m3 { border-top-color: #243442; }
.mb-ratio-card.is-m4 { border-top-color: #9E261B; }

.mb-rc-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mb-rc-tag {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
  color: #FFFDF5;
}

.mb-ratio-card.is-m1 .mb-rc-tag { background: #2B534D; }
.mb-ratio-card.is-m2 .mb-rc-tag { background: #467870; }
.mb-ratio-card.is-m3 .mb-rc-tag { background: #243442; }
.mb-ratio-card.is-m4 .mb-rc-tag { background: #9E261B; }

.mb-rc-name {
  font-size: 11.8px;
  font-weight: 700;
  color: #243442;
}

.mb-rc-inp-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mb-ratio-num {
  width: 62px !important;
  padding: 4px 7px !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
  text-align: center;
}

.mb-rc-pct {
  font-size: 12.5px;
  font-weight: 800;
  color: #526370;
}

.mb-rc-est {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 800;
  color: #2B534D;
  white-space: nowrap;
}

.mb-ratio-range {
  width: 100%;
  margin: 0;
  cursor: pointer;
  accent-color: #2B534D;
}

.mb-ratio-card.is-m3 .mb-ratio-range { accent-color: #243442; }
.mb-ratio-card.is-m4 .mb-ratio-range { accent-color: #9E261B; }

.mb-rp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed #CBD4D2;
}

.mb-rp-status {
  font-size: 12.2px;
  font-weight: 600;
  color: #243442;
}

.mb-rp-status.is-ok { color: #2B534D; }
.mb-rp-status.is-warn { color: #243442; }
.mb-rp-status.is-err { color: #9E261B; }

.mb-rp-norm-btn {
  padding: 5px 11px;
  border-radius: 8px;
  border: 1.4px solid #2B534D;
  background: #FFFFFF;
  color: #2B534D;
  font-size: 11.8px;
  font-weight: 800;
  cursor: pointer;
}

.mb-rp-norm-btn:hover {
  background: #2B534D;
  color: #FFFDF5;
}

@media (max-width: 780px) {
  .mb-ratio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.mb-auto-matrix-note {
  padding: 10px 13px;
  border-radius: 10px;
  background: rgba(43, 83, 77, 0.08);
  border-left: 3.5px solid #2B534D;
  font-size: 12.5px;
  color: #182430;
  line-height: 1.5;
}

/* Live Question Navigator Strip (1..22 grouped by Part I / II / III) */
.mb-nav-strip {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin-bottom: 12px;
  border-radius: 11px;
  background: #F7F9F8;
  border: 1.4px solid #CBD4D2;
}
.mb-nav-lbl {
  font-size: 11.8px;
  font-weight: 800;
  color: #243442;
  margin-right: 4px;
}
.mb-nav-pill {
  min-width: 28px;
  height: 27px;
  padding: 0 6px;
  border-radius: 7px;
  border: 1.3px solid #CBD4D2;
  background: #FFFFFF;
  color: #182430;
  font-size: 11.8px;
  font-weight: 800;
  cursor: pointer;
}
.mb-nav-pill.type-ds { border-color: rgba(43, 83, 77, 0.5); }
.mb-nav-pill.type-tln { border-color: rgba(158, 38, 27, 0.45); }
.mb-nav-pill:hover { border-color: #2B534D; background: #EAF2EF; }
.mb-nav-pill.is-done { background: #243442; border-color: #243442; color: #FFFDF5; }
.mb-nav-pill.is-right { background: #2B534D; border-color: #2B534D; color: #FFFDF5; }
.mb-nav-pill.is-partial { background: #EFE6D2; border-color: #2B534D; color: #182430; }
.mb-nav-pill.is-wrong { background: #9E261B; border-color: #9E261B; color: #FFFDF5; }

/* Post-Submission Detailed 3-Part & M1-M4 Scoreboard */
.mb-scoreboard {
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: 13px;
  background: #FFFFFF;
  border: 2px solid #2B534D;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.mb-sb-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.mb-sb-score {
  padding: 8px 14px;
  border-radius: 11px;
  background: rgba(43, 83, 77, 0.1);
  border: 1.5px solid #2B534D;
  color: #2B534D;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}
.mb-sb-score span {
  font-size: 13px;
  font-weight: 700;
  color: #243442;
  margin-left: 2px;
}
.mb-sb-title {
  font-size: 14px;
  font-weight: 800;
  color: #182430;
}
.mb-sb-sub {
  font-size: 12.5px;
  color: #425361;
  margin-top: 2px;
}
.mb-sb-parts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.mb-sb-part {
  padding: 9px 11px;
  border-radius: 9px;
  background: #F7F9F8;
  border: 1.2px solid #CBD4D2;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mb-sb-part span { font-size: 11.4px; font-weight: 700; color: #4A5B68; }
.mb-sb-part strong { font-size: 15px; font-weight: 800; color: #2B534D; }
.mb-sb-part small { font-size: 11.4px; color: #243442; }

.mb-sb-levels {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid #E2E9E7;
}
.mb-sb-lhead {
  font-size: 12px;
  font-weight: 800;
  color: #243442;
}

/* ==================== THPT 2027 OFFICIAL STRUCTURE & MATRIX EXPLORER (.mb-s27-*) ==================== */
.mb-s27-wrap {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.mb-s27-banner {
  padding: 14px 16px;
  border-radius: 13px;
  background: rgba(43, 83, 77, 0.08);
  border: 1.5px solid #2B534D;
}
.mb-s27-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(158, 38, 27, 0.12);
  border: 1px solid rgba(158, 38, 27, 0.35);
  color: #9E261B;
  font-size: 10.8px;
  font-weight: 800;
  margin-bottom: 5px;
}
.mb-s27-bhead h3 {
  margin: 0 0 4px;
  font-size: 15.5px;
  color: #182430;
}
.mb-s27-bhead p {
  margin: 0;
  font-size: 12.8px;
  color: #243442;
  line-height: 1.5;
}

.mb-s27-table-wrap {
  overflow-x: auto;
  border-radius: 11px;
  border: 1.3px solid #CBD4D2;
  background: #FFFFFF;
}
.mb-s27-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.4px;
  color: #182430;
}
.mb-s27-table th {
  text-align: left;
  padding: 8px 10px;
  background: rgba(36, 52, 66, 0.09);
  color: #182430;
  font-weight: 800;
  border-bottom: 1.5px solid #243442;
  white-space: nowrap;
}
.mb-s27-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #E5ECEA;
  vertical-align: top;
}
.mb-s27-table tbody tr:last-child td { border-bottom: 0; }
.mb-s27-table tr.is-hl {
  background: rgba(43, 83, 77, 0.07);
}
.mb-s27-subfmt {
  font-size: 11.2px;
  color: #526370;
  font-weight: 600;
  margin-top: 1px;
}

.mb-s27-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mb-s27-chip {
  padding: 6px 11px;
  border-radius: 9px;
  border: 1.4px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  font-size: 12.2px;
  font-weight: 800;
  cursor: pointer;
}
.mb-s27-chip:hover {
  border-color: #2B534D;
  background: #EEF4F2;
}
.mb-s27-chip.active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}

.mb-s27-detail {
  padding: 15px 16px;
  border-radius: 13px;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mb-s27-dhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.mb-s27-dhead h4 {
  margin: 0 0 4px;
  font-size: 15px;
  color: #182430;
}
.mb-s27-dhead p {
  margin: 0;
  font-size: 12.8px;
  color: #425361;
  line-height: 1.5;
  max-width: 720px;
}

.mb-s27-score-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.mb-s27-scard {
  padding: 8px 10px;
  border-radius: 9px;
  background: #F7F9F8;
  border: 1.2px solid #CBD4D2;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mb-s27-scard.is-accent {
  background: rgba(158, 38, 27, 0.06);
  border-color: rgba(158, 38, 27, 0.28);
}
.mb-s27-scard span { font-size: 11px; font-weight: 700; color: #526370; }
.mb-s27-scard strong { font-size: 12.2px; font-weight: 800; color: #182430; line-height: 1.35; }

.mb-s27-tips {
  padding: 10px 13px;
  border-radius: 10px;
  background: #F7F9F8;
  border-left: 3.5px solid #9E261B;
}
.mb-s27-tips-title {
  font-size: 12.6px;
  font-weight: 800;
  color: #9E261B;
  margin-bottom: 5px;
}
.mb-s27-tips ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: #243442;
  line-height: 1.52;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ==================== FULL-SCREEN CBT EXAM ARENA (PHƯƠNG ÁN 1 · 100vw × 100vh) ==================== */
.cbt-overlay {
  --cbt-font-scale: 1;
  position: fixed;
  inset: 0;
  z-index: 95;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #F4F7F6;
  color: #182430;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.cbt-topbar {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: #FFFFFF;
  border-bottom: 2px solid #2B534D;
  box-shadow: 0 2px 10px rgba(24, 36, 48, 0.06);
}

.cbt-tb-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1 1 240px;
}

.cbt-crest {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #2B534D;
  color: #FFFDF5;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

.cbt-tb-meta {
  min-width: 0;
}

.cbt-tb-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #182430;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cbt-tb-sub {
  font-size: 11.6px;
  font-weight: 600;
  color: #526370;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cbt-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(43, 83, 77, 0.09);
  border: 1.6px solid #2B534D;
  color: #182430;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.cbt-timer-pill strong {
  font-weight: 900;
  color: #2B534D;
  letter-spacing: 0.5px;
}

.cbt-timer-pill.is-urgent {
  background: rgba(158, 38, 27, 0.1);
  border-color: #9E261B;
}

.cbt-timer-pill.is-urgent strong {
  color: #9E261B;
}

.cbt-timer-pill.is-done {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}

.cbt-timer-pill.is-done strong {
  color: #FFFDF5;
}

.cbt-tb-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cbt-view-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: #EAF0EE;
  border: 1px solid #CBD4D2;
  gap: 3px;
}

.cbt-vs-btn {
  padding: 5px 11px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: #243442;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.cbt-vs-btn.active {
  background: #2B534D;
  color: #FFFDF5;
}

.cbt-tool-pill {
  padding: 6px 11px;
  border-radius: 9px;
  border: 1.4px solid #243442;
  background: #FFFFFF;
  color: #243442;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.cbt-tool-pill:hover {
  background: #243442;
  color: #FFFDF5;
}

.cbt-top-cta {
  padding: 6px 13px !important;
  font-size: 12.5px !important;
}

.cbt-exit-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1.4px solid #CBD4D2;
  background: #F7F9F8;
  color: #243442;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.cbt-exit-btn:hover {
  background: #9E261B;
  border-color: #9E261B;
  color: #FFFFFF;
}

/* Main 2-Column CBT Workspace */
.cbt-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.cbt-stage {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #F4F7F6;
}

.cbt-stage-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 26px 22px;
  font-size: calc(15.5px * var(--cbt-font-scale));
  line-height: 1.66;
}

.cbt-q-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1.4px solid #CBD4D2;
}

.cbt-q-ribbon-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cbt-part-pill {
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11.6px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.cbt-part-pill.type-tn {
  background: rgba(36, 52, 66, 0.1);
  color: #243442;
}

.cbt-part-pill.type-ds {
  background: rgba(43, 83, 77, 0.12);
  color: #2B534D;
}

.cbt-part-pill.type-tln {
  background: rgba(158, 38, 27, 0.11);
  color: #9E261B;
}

.cbt-q-counter {
  font-size: 13.5px;
  font-weight: 700;
  color: #182430;
}

.cbt-flag-btn {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1.4px solid #CBD4D2;
  background: #F7F9F8;
  color: #243442;
  font-size: 12.2px;
  font-weight: 800;
  cursor: pointer;
}

.cbt-flag-btn:hover {
  border-color: #9E261B;
  color: #9E261B;
}

.cbt-flag-btn.is-flagged {
  background: rgba(158, 38, 27, 0.1);
  border-color: #9E261B;
  color: #9E261B;
}

.cbt-flag-mini {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 7px;
  border: 1px solid #CBD4D2;
  background: #F7F9F8;
  cursor: pointer;
  font-size: 12.5px;
}

.cbt-flag-mini.is-flagged {
  border-color: #9E261B;
  background: rgba(158, 38, 27, 0.1);
}

/* Smart Auto-Split View for Visual Questions (TikZ / Tables) -> Zero Scrolling! */
.cbt-q-split {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 18px;
  align-items: start;
}

.cbt-split-left,
.cbt-split-right {
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(24, 36, 48, 0.04);
}

.cbt-pane-lbl {
  font-size: 12px;
  font-weight: 800;
  color: #2B534D;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1.2px solid #E4ECEA;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cbt-zoom-tip {
  font-size: 11px;
  font-weight: 600;
  color: #637583;
}

.cbt-q-centered {
  max-width: 920px;
  margin: 0 auto;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 15px;
  padding: 22px 26px;
  box-shadow: 0 2px 12px rgba(24, 36, 48, 0.04);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cbt-prompt-body {
  font-size: calc(16px * var(--cbt-font-scale));
  font-weight: 600;
  color: #182430;
  line-height: 1.7;
}

.cbt-overlay .mf-tikz-img {
  max-width: 100%;
  max-height: 410px;
}

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

.cbt-options-grid.is-stack {
  grid-template-columns: 1fr;
}

.cbt-opt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 15px;
  border-radius: 11px;
  border: 1.6px solid #CBD4D2;
  background: #FAFBF9;
  color: #182430;
  font-size: calc(15px * var(--cbt-font-scale));
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}

.cbt-opt-btn:hover:not(:disabled) {
  border-color: #2B534D;
  background: #EEF5F3;
}

.cbt-opt-btn.is-selected {
  border-color: #2B534D;
  background: rgba(43, 83, 77, 0.12);
  box-shadow: inset 3.5px 0 0 #2B534D;
}

.cbt-opt-btn.is-correct {
  border-color: #2B534D;
  background: #E2F4EA;
}

.cbt-opt-btn.is-wrong {
  border-color: #9E261B;
  background: #FBE9E7;
}

.cbt-opt-letter {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #243442;
  color: #FFFDF5;
  font-size: 13px;
  font-weight: 900;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.cbt-opt-btn.is-selected .cbt-opt-letter,
.cbt-opt-btn.is-correct .cbt-opt-letter {
  background: #2B534D;
}

.cbt-opt-btn.is-wrong .cbt-opt-letter {
  background: #9E261B;
}

.cbt-opt-text {
  flex: 1;
  min-width: 0;
  line-height: 1.5;
}

.cbt-tf-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cbt-tf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 11px;
  background: #FAFBF9;
  border: 1.5px solid #CBD4D2;
  flex-wrap: wrap;
}

.cbt-tf-row.is-correct {
  background: #E4F5EC;
  border-color: #2B534D;
}

.cbt-tf-row.is-wrong {
  background: #FBEAE8;
  border-color: #9E261B;
}

.cbt-tf-text {
  flex: 1 1 240px;
  font-size: calc(15px * var(--cbt-font-scale));
  color: #182430;
  line-height: 1.58;
}

.cbt-tf-btns {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}

.cbt-tln-box {
  padding: 16px 18px;
  border-radius: 12px;
  background: #FAFBF9;
  border: 1.5px solid #CBD4D2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cbt-tln-label {
  font-size: 13px;
  font-weight: 700;
  color: #243442;
}

.cbt-tln-inp {
  max-width: 320px;
  font-size: calc(17px * var(--cbt-font-scale)) !important;
  font-weight: 800;
  padding: 10px 14px !important;
  border-color: #2B534D !important;
  background: #FFFFFF !important;
}

/* Fixed Bottom Prev/Next Navigation Footer inside Left Stage */
.cbt-stage-foot {
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 26px;
  background: #FFFFFF;
  border-top: 1.5px solid #CBD4D2;
}

.cbt-kbd-hint {
  font-size: 12px;
  color: #526370;
}

.cbt-nav-btn {
  padding: 8px 18px;
  border-radius: 10px;
  border: 1.5px solid #CBD4D2;
  background: #F7F9F8;
  color: #182430;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}

.cbt-nav-btn:hover:not(:disabled) {
  border-color: #2B534D;
  background: #EAF3F0;
}

.cbt-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cbt-nav-btn.is-primary {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}

.cbt-nav-btn.is-primary:hover {
  background: #21423D;
}

.cbt-nav-btn.is-submit {
  background: #9E261B;
  border-color: #9E261B;
  color: #FFFDF5;
}

.cbt-nav-btn.is-submit:hover {
  background: #801E15;
}

/* Continuous Full Paper Mode (📑 Cả đề) */
.cbt-all-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cbt-all-card {
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 14px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Post-Submission Summary Screen */
.cbt-summary-wrap {
  max-width: 880px;
  margin: 18px auto 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cbt-summary-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.cbt-summary-tip {
  margin: 0;
  padding: 12px 16px;
  border-radius: 11px;
  background: #FFFFFF;
  border: 1.3px solid #CBD4D2;
  font-size: 13px;
  color: #243442;
  text-align: center;
}

/* Right OMR Answer Sheet Sidebar (276px fixed) */
.cbt-omr-side {
  width: 276px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border-left: 1.6px solid #CBD4D2;
}

.cbt-omr-head {
  padding: 13px 15px 11px;
  background: #F7F9F8;
  border-bottom: 1.2px solid #CBD4D2;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cbt-omr-title {
  font-size: 13px;
  font-weight: 900;
  color: #243442;
  letter-spacing: 0.3px;
}

.cbt-omr-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #425361;
}

.cbt-omr-bar {
  height: 7px;
  border-radius: 999px;
  background: #DDE5E3;
  overflow: hidden;
}

.cbt-omr-bar-fill {
  height: 100%;
  background: #2B534D;
  transition: width 0.2s ease;
}

.cbt-omr-sum-btn {
  margin: 10px 12px 0;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1.5px solid #2B534D;
  background: rgba(43, 83, 77, 0.08);
  color: #182430;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.cbt-omr-sum-btn.active {
  background: #2B534D;
  color: #FFFDF5;
}

.cbt-omr-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cbt-omr-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cbt-omr-gtitle {
  font-size: 11.4px;
  font-weight: 800;
  color: #243442;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.cbt-omr-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.cbt-omr-cell {
  position: relative;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid #CBD4D2;
  background: #FFFFFF;
  color: #182430;
  font-size: 12.8px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.cbt-omr-cell:hover {
  border-color: #2B534D;
  background: #EEF5F3;
}

.cbt-omr-cell.is-done {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}

.cbt-omr-cell.is-right {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}

.cbt-omr-cell.is-partial {
  background: #EFE6D2;
  border-color: #2B534D;
  color: #182430;
}

.cbt-omr-cell.is-wrong {
  background: #9E261B;
  border-color: #9E261B;
  color: #FFFDF5;
}

.cbt-omr-cell.is-flagged {
  box-shadow: inset 0 0 0 2px #9E261B;
}

.cbt-omr-cell.is-current {
  outline: 2.5px solid #243442;
  outline-offset: 1px;
}

.cbt-omr-sub {
  font-size: 9px;
  opacity: 0.85;
  margin-top: 2px;
}

.cbt-omr-flag {
  position: absolute;
  top: -5px;
  right: -4px;
  font-style: normal;
  font-size: 10px;
  line-height: 1;
}

.cbt-omr-legend {
  padding: 8px 14px;
  border-top: 1px solid #E4ECEA;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: #526370;
  font-weight: 600;
}

.cbt-omr-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lg-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  border: 1px solid #CBD4D2;
}

.lg-dot.is-empty { background: #FFFFFF; }
.lg-dot.is-done, .lg-dot.is-right { background: #2B534D; border-color: #2B534D; }
.lg-dot.is-partial { background: #EFE6D2; border-color: #2B534D; }
.lg-dot.is-wrong { background: #9E261B; border-color: #9E261B; }
.lg-dot.is-cur { background: #FFFFFF; border: 2px solid #243442; }

.cbt-omr-foot {
  padding: 12px 14px;
  border-top: 1.2px solid #CBD4D2;
  background: #F7F9F8;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cbt-full-btn {
  width: 100%;
  justify-content: center;
}

/* TikZ Click-to-Zoom Lightbox */
.cbt-lightbox {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(24, 36, 48, 0.72);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.cbt-lb-card {
  background: #FFFFFF;
  border-radius: 14px;
  border: 2px solid #2B534D;
  padding: 14px 18px 18px;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.cbt-lb-close {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1.4px solid #243442;
  background: #F7F9F8;
  color: #182430;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

.cbt-lb-img {
  max-width: 86vw;
  max-height: 78vh;
  object-fit: contain;
  display: block;
}

@media (max-width: 1020px) {
  .cbt-q-split {
    grid-template-columns: 1fr;
  }
  .cbt-tb-sub,
  .cbt-kbd-hint {
    display: none;
  }
}

@media (max-width: 820px) {
  .cbt-workspace {
    flex-direction: column;
  }
  .cbt-omr-side {
    width: 100%;
    max-height: 210px;
    border-left: 0;
    border-top: 1.6px solid #CBD4D2;
  }
  .cbt-omr-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
  .cbt-options-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== VĂN MIẾU MULTI-LEVEL GUIDE & BẢNG VÀNG BIA TIẾN SĨ ==================== */
.vm-cbt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.vm-cbt-card {
  background: #F7F9F8;
  border: 1.4px solid #CBD4D2;
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vm-cbt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #182430;
}

.vm-cbt-meta {
  font-size: 12px;
  color: #9E261B;
  font-weight: 700;
}

.vm-cbt-parts {
  font-size: 12px;
  color: #243442;
  line-height: 1.45;
}

.vm-cbt-note {
  font-size: 11.5px;
  color: #2B534D;
  background: rgba(43, 83, 77, 0.08);
  border-radius: 8px;
  padding: 6px 8px;
  line-height: 1.4;
}

.vm-honor-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vm-honor-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(43, 83, 77, 0.1) 0%, rgba(158, 38, 27, 0.07) 100%);
  border: 1.6px solid #CBD4D2;
  border-left: 5px solid #9E261B;
  border-radius: 14px;
  padding: 14px 16px;
}

.vm-honor-hero-left {
  flex: 1;
  min-width: 240px;
}

.vm-honor-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.4px;
  color: #9E261B;
  background: rgba(158, 38, 27, 0.1);
  padding: 3px 9px;
  border-radius: 99px;
  margin-bottom: 5px;
}

.vm-honor-hero h3 {
  margin: 0 0 4px;
  font-size: 16.5px;
  color: #182430;
}

.vm-honor-hero p {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: #243442;
}

.vm-honor-progress {
  width: 100%;
  max-width: 380px;
  height: 9px;
  background: #E2E8E6;
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid #CBD4D2;
}

.vm-honor-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2B534D 0%, #9E261B 100%);
  border-radius: 99px;
  transition: width 0.35s ease;
}

.vm-honor-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.vm-kpi-card {
  background: #FFFFFF;
  border: 1.4px solid #CBD4D2;
  border-radius: 11px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.vm-kpi-card span {
  font-size: 11.5px;
  font-weight: 700;
  color: #4D606D;
}

.vm-kpi-card strong {
  font-size: 16px;
  font-weight: 900;
  color: #2B534D;
}

.vm-me-row td {
  background: rgba(158, 38, 27, 0.09) !important;
  color: #182430;
}

@media (max-width: 820px) {
  .vm-cbt-grid {
    grid-template-columns: 1fr;
  }
  .vm-honor-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==================== VĂN MIẾU MONUMENT QUICK-INFO POPOVER CARD ==================== */
.vm-her-backdrop {
  z-index: 95;
  background: rgba(24, 36, 48, 0.42);
  backdrop-filter: blur(2.5px);
}

.vm-her-card {
  width: min(630px, 95vw);
  max-height: 90vh;
  background: #FFFDF8;
  border: 2px solid #2B534D;
  border-radius: 18px;
  box-shadow: 0 22px 48px rgba(24, 36, 48, 0.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: vmHerPop 0.18s cubic-bezier(0.2, 0.85, 0.3, 1);
}

@keyframes vmHerPop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.vm-her-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px 13px;
  background: rgba(43, 83, 77, 0.08);
  border-bottom: 1.5px solid #CBD4D2;
}

.vm-her-head-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.vm-her-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: #FFFFFF;
  border: 1.8px solid #9E261B;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(158, 38, 27, 0.12);
}

.vm-her-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.vm-her-pill {
  font-size: 11px;
  font-weight: 900;
  color: #2B534D;
  background: rgba(43, 83, 77, 0.12);
  padding: 2px 8px;
  border-radius: 99px;
}

.vm-her-status {
  font-size: 11px;
  font-weight: 800;
  color: #9E261B;
  background: rgba(158, 38, 27, 0.1);
  padding: 2px 8px;
  border-radius: 99px;
}

.vm-her-status.is-done {
  color: #2B534D;
  background: rgba(43, 83, 77, 0.12);
}

.vm-her-title {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  color: #182430;
  line-height: 1.25;
}

.vm-her-era {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
  color: #9E261B;
}

.vm-her-body {
  padding: 14px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vm-her-zone {
  font-size: 12px;
  font-weight: 800;
  color: #243442;
  background: #F7F9F8;
  border: 1px solid #CBD4D2;
  border-radius: 9px;
  padding: 6px 10px;
}

.vm-her-summary {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.58;
  color: #182430;
}

.vm-her-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vm-her-tag {
  font-size: 11.5px;
  font-weight: 800;
  color: #2B534D;
  background: rgba(43, 83, 77, 0.09);
  border: 1px solid rgba(43, 83, 77, 0.24);
  border-radius: 8px;
  padding: 4px 9px;
}

.vm-her-source {
  font-size: 11.5px;
  color: #5A6B76;
  font-style: italic;
}

.vm-her-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 18px 14px;
  background: #F7F9F8;
  border-top: 1.2px solid #CBD4D2;
}

.vm-her-nav,
.vm-her-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.vm-her-nav-btn {
  padding: 6px 10px !important;
  font-size: 12px !important;
}

.vm-her-body {
  overflow-y: auto;
}

.vm-her-dir-wrap {
  margin-top: 4px;
  padding-top: 9px;
  border-top: 1px dashed #CBD4D2;
}

.vm-her-dir-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #243442;
  margin-bottom: 6px;
}

.vm-her-dir {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.vm-her-chip {
  border: 1.2px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  border-radius: 99px;
  padding: 3.5px 8.5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.vm-her-chip:hover {
  border-color: #9E261B;
  color: #9E261B;
  background: rgba(158, 38, 27, 0.06);
}

.vm-her-chip.is-active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFDF5;
}

.vm-her-chip.is-done:not(.is-active) {
  background: rgba(43, 83, 77, 0.09);
  border-color: rgba(43, 83, 77, 0.35);
  color: #2B534D;
}

/* ==================== VĂN MIẾU PACKAGES 1+2+3+4 (KHOA CỬ · SỔ ĐIỂM · THƯ PHÁP · HỘ CHIẾU) ==================== */
.vm-passport-pill {
  border-color: #9E261B !important;
  background: linear-gradient(135deg, #FFFDF5 0%, #FDF3EE 100%) !important;
}

.vm-passport-bar {
  background: rgba(43, 83, 77, 0.06);
  border: 1.2px solid #CBD4D2;
  border-radius: 10px;
  padding: 9px 12px;
}

.vm-pp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #182430;
}

.vm-ritual-box {
  background: #F7F9F8;
  border: 1.5px solid #9E261B;
  border-radius: 12px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vm-ritual-title {
  font-size: 13px;
  font-weight: 800;
  color: #9E261B;
}

.vm-ritual-q {
  font-size: 13px;
  font-weight: 700;
  color: #182430;
  line-height: 1.45;
}

.vm-ritual-opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.vm-ritual-opt {
  text-align: left;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1.3px solid #CBD4D2;
  background: #FFFFFF;
  color: #182430;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.vm-ritual-opt:hover:not(:disabled) {
  border-color: #2B534D;
  background: rgba(43, 83, 77, 0.07);
}

.vm-ritual-opt.is-correct {
  background: rgba(43, 83, 77, 0.14);
  border-color: #2B534D;
  color: #182430;
}

.vm-ritual-opt.is-wrong {
  background: rgba(158, 38, 27, 0.12);
  border-color: #9E261B;
  color: #9E261B;
}

.vm-ritual-banner {
  font-size: 13px;
  line-height: 1.48;
  color: #182430;
}

.vm-ritual-miss {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #9E261B;
  font-weight: 700;
}

.vm-scroll-reveal {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #FFF8EA 0%, #FBECE6 100%);
  border: 1.8px solid #9E261B;
  border-radius: 12px;
  padding: 10px 12px;
}

.vm-scroll-han {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: #9E261B;
  color: #FFF6DF;
  font-size: 20px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 1px;
}

.vm-scroll-word {
  font-size: 14px;
  font-weight: 900;
  color: #9E261B;
}

.vm-scroll-quote {
  font-size: 12px;
  font-style: italic;
  color: #243442;
}

.vm-drum-pulse {
  animation: vmDrumShake 0.42s ease-out;
}

@keyframes vmDrumShake {
  0%, 100% { transform: scale(1); }
  20% { transform: scale(1.018); }
  45% { transform: scale(0.992); }
  70% { transform: scale(1.01); }
}

.vm-imp-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.vm-imp-card {
  background: #FFFFFF;
  border: 1.6px solid #CBD4D2;
  border-radius: 14px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vm-imp-card.is-rec {
  border-color: #9E261B;
  background: linear-gradient(180deg, #FFFDF8 0%, #FDF6F3 100%);
}

.vm-imp-card.is-passed {
  border-color: #2B534D;
  background: linear-gradient(180deg, #FFFFFF 0%, #F4FAF7 100%);
}

.vm-imp-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.vm-imp-icon {
  font-size: 26px;
  line-height: 1;
}

.vm-imp-title {
  font-size: 13.5px;
  font-weight: 900;
  color: #182430;
}

.vm-imp-sub {
  font-size: 11.5px;
  font-weight: 700;
  color: #2B534D;
  margin-top: 2px;
}

.vm-imp-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.48;
  color: #243442;
  flex: 1;
}

.vm-imp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.vm-imp-status {
  font-size: 11.5px;
  font-weight: 800;
  padding: 6px 8px;
  border-radius: 8px;
  background: #F7F9F8;
  border: 1px solid #CBD4D2;
}

.vm-imp-pass { color: #2B534D; }
.vm-imp-next { color: #9E261B; }
.vm-imp-try { color: #243442; }

.vm-retry-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(158, 38, 27, 0.08);
  border: 1.5px solid #9E261B;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13px;
  color: #182430;
}

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

.vm-sb-empty {
  font-size: 12.5px;
  color: #4D606D;
  padding: 12px;
  background: #F7F9F8;
  border-radius: 10px;
  border: 1px dashed #CBD4D2;
  line-height: 1.5;
}

.vm-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 128px;
  padding: 8px 6px 2px;
  background: #F7F9F8;
  border-radius: 10px;
  border: 1px solid #CBD4D2;
}

.vm-chart-col {
  flex: 1;
  min-width: 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.vm-chart-val {
  font-size: 10px;
  font-weight: 900;
  color: #182430;
}

.vm-chart-track {
  width: 100%;
  max-width: 26px;
  flex: 1;
  background: #E2E8E6;
  border-radius: 6px 6px 2px 2px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.vm-chart-fill {
  width: 100%;
  border-radius: 5px 5px 0 0;
  transition: height 0.35s ease;
}

.vm-chart-lbl {
  font-size: 10px;
  font-weight: 700;
  color: #5A6B76;
}

.vm-m-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.vm-m-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #243442;
  margin-bottom: 3px;
}

.vm-m-track {
  height: 9px;
  background: #E2E8E6;
  border-radius: 99px;
  overflow: hidden;
}

.vm-m-fill {
  height: 100%;
  border-radius: 99px;
}

.vm-m-fill.is-m1 { background: #2B534D; }
.vm-m-fill.is-m2 { background: #3E6B64; }
.vm-m-fill.is-m3 { background: #243442; }
.vm-m-fill.is-m4 { background: #9E261B; }

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

.vm-cal-card {
  border-radius: 13px;
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 1.6px solid #CBD4D2;
  background: #F7F9F8;
}

.vm-cal-card.is-owned {
  background: linear-gradient(180deg, #FFFDF5 0%, #FBF0E6 100%);
  border-color: #9E261B;
  box-shadow: 0 6px 14px rgba(158, 38, 27, 0.1);
}

.vm-cal-card.is-locked {
  opacity: 0.68;
}

.vm-cal-han {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #9E261B;
  color: #FFF8E6;
  font-size: 17px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vm-cal-card.is-locked .vm-cal-han {
  background: #94A3A0;
}

.vm-cal-word {
  font-size: 13px;
  font-weight: 900;
  color: #182430;
}

.vm-cal-meaning {
  font-size: 11px;
  color: #4D606D;
  line-height: 1.38;
}

.vm-cal-status {
  font-size: 11px;
  font-weight: 800;
  color: #2B534D;
  margin-top: auto;
}

@media (max-width: 900px) {
  .vm-imp-grid,
  .vm-sb-grid {
    grid-template-columns: 1fr;
  }
  .vm-cal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vm-ritual-opts {
    grid-template-columns: 1fr;
  }
}


/* ==================== SCHEDULED LIVE EXAM ROOMS (LAN / WI-FI) — MST PALETTE ==================== */
.adm-section-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid #CBD4D2;
  flex-wrap: wrap;
}

.adm-sec-btn {
  padding: 9px 15px;
  border-radius: 10px;
  border: 1.5px solid #CBD4D2;
  background: #F7F9F8;
  color: #243442;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.16s ease;
}

.adm-sec-btn:hover {
  border-color: #2B534D;
  background: #EEF4F2;
}

.adm-sec-btn.active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFFFF;
}

.le-lan-banner {
  background: #F7F9F8;
  border: 1.5px solid #2B534D;
  border-left: 5px solid #2B534D;
  border-radius: 12px;
  padding: 12px 15px;
  margin-bottom: 14px;
}

.le-lan-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #182430;
  margin-bottom: 6px;
}

.le-lan-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.le-lan-code {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1.2px solid #CBD4D2;
  color: #2B534D;
  font-size: 14px;
  font-weight: 800;
  user-select: all;
}

.le-lan-hint {
  margin-top: 6px;
  font-size: 11.5px;
  color: #4D606D;
}

.le-list-head-title {
  font-size: 14px;
  font-weight: 900;
  color: #182430;
}

.le-st-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.le-st-pill.is-live {
  background: rgba(43, 83, 77, 0.14);
  color: #1F453F;
  border: 1px solid rgba(43, 83, 77, 0.45);
}

.le-st-pill.is-upcoming {
  background: rgba(158, 38, 27, 0.10);
  color: #822017;
  border: 1px solid rgba(158, 38, 27, 0.35);
}

.le-st-pill.is-ended {
  background: #EAEFED;
  color: #4D606D;
  border: 1px solid #CBD4D2;
}

.le-quick-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  color: #243442;
}

.le-section-box {
  background: #F7F9F8;
  border: 1.2px solid #CBD4D2;
  border-radius: 12px;
  padding: 12px 14px;
}

.le-sec-title {
  font-size: 13px;
  font-weight: 900;
  color: #182430;
  margin-bottom: 10px;
}

.le-mode-radios {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.le-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #CBD4D2;
  background: #FFFFFF;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.le-mode-card.active {
  border-color: #2B534D;
  background: rgba(43, 83, 77, 0.08);
}

.le-mode-card strong {
  display: block;
  font-size: 13px;
  color: #182430;
  margin-bottom: 2px;
}

.le-mode-card small {
  display: block;
  font-size: 11.5px;
  color: #4D606D;
  line-height: 1.38;
}

.le-mode-opts {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.le-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #182430;
  cursor: pointer;
}

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

.le-room-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Student Portal & Leaderboard */
.le-portal {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.le-portal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 15px;
  border-radius: 12px;
  background: #F7F9F8;
  border: 1.4px solid #CBD4D2;
}

.le-portal-head h3 {
  margin: 0 0 3px;
  font-size: 16px;
  color: #182430;
}

.le-portal-head p {
  margin: 0;
  font-size: 12.5px;
  color: #4D606D;
}

.le-portal-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.le-rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.le-room-card {
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.le-room-card.is-live {
  border-color: #2B534D;
  box-shadow: 0 4px 14px rgba(43, 83, 77, 0.12);
}

.le-room-card.is-upcoming {
  border-color: rgba(158, 38, 27, 0.45);
}

.le-rc-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.le-rc-tag {
  font-size: 11px;
  font-weight: 700;
  color: #243442;
  background: #F7F9F8;
  border: 1px solid #CBD4D2;
  border-radius: 999px;
  padding: 2px 8px;
}

.le-rc-title {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  color: #182430;
  line-height: 1.35;
}

.le-rc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: #425361;
}

.le-rc-countdown {
  font-size: 12.5px;
  font-weight: 800;
  color: #9E261B;
  background: rgba(158, 38, 27, 0.08);
  border: 1px solid rgba(158, 38, 27, 0.22);
  border-radius: 8px;
  padding: 6px 10px;
}

.le-room-card.is-live .le-rc-countdown {
  color: #2B534D;
  background: rgba(43, 83, 77, 0.09);
  border-color: rgba(43, 83, 77, 0.28);
}

.le-room-card.is-ended .le-rc-countdown {
  color: #4D606D;
  background: #F7F9F8;
  border-color: #CBD4D2;
}

.le-card-top3 {
  font-size: 12px;
  color: #243442;
  background: #F7F9F8;
  border-radius: 8px;
  padding: 6px 10px;
}

.le-rc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}

.le-empty-box {
  text-align: center;
  padding: 28px 20px;
  border-radius: 14px;
  background: #F7F9F8;
  border: 1.5px dashed #CBD4D2;
  color: #243442;
}

.le-empty-box h4 {
  margin: 0 0 6px;
  color: #182430;
}

.le-checkin-card {
  background: #FFFFFF;
  border: 1.5px solid #2B534D;
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.le-ci-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.le-ci-head h4 {
  margin: 6px 0 3px;
  font-size: 16px;
  color: #182430;
}

.le-ci-sub {
  font-size: 12px;
  color: #4D606D;
}

.le-ci-note {
  font-size: 12px;
  color: #243442;
  background: #F7F9F8;
  border-left: 3.5px solid #2B534D;
  padding: 8px 12px;
  border-radius: 6px;
}

.le-table-wrap {
  overflow-x: auto;
  border: 1.2px solid #CBD4D2;
  border-radius: 12px;
  background: #FFFFFF;
}

.le-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  color: #182430;
}

.le-table th,
.le-table td {
  padding: 9px 11px;
  text-align: left;
  border-bottom: 1px solid #E5ECEA;
}

.le-table th {
  background: #F7F9F8;
  color: #243442;
  font-weight: 800;
  white-space: nowrap;
}

.le-table tr.is-podium {
  background: rgba(43, 83, 77, 0.06);
}

.le-lb-room-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.le-lb-room-tabs .adm-mini-btn.is-active {
  background: #2B534D;
  color: #FFFFFF;
  border-color: #2B534D;
}

.le-live-receipt {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(43, 83, 77, 0.10);
  border: 1.4px solid #2B534D;
  color: #182430;
  font-size: 13px;
}

.le-sol-lock-note {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(158, 38, 27, 0.08);
  border: 1.3px solid rgba(158, 38, 27, 0.35);
  color: #182430;
  font-size: 12.5px;
  line-height: 1.45;
}

/* Top-Left Floating Live Exam Alert Chip */
.live-exam-banner-pill {
  border-color: #9E261B !important;
  background: linear-gradient(180deg, #FFF7F5 0%, #FCECE8 100%) !important;
  animation: lePillPulse 2.2s ease-in-out infinite;
}

.live-exam-banner-pill.is-live {
  border-color: #2B534D !important;
  background: linear-gradient(180deg, #F3FAF8 0%, #E3F2EE 100%) !important;
}

.live-exam-banner-pill .le-pill-sub {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #4D606D;
}

@keyframes lePillPulse {
  0%, 100% { box-shadow: 0 3px 10px rgba(43, 83, 77, 0.22); }
  50% { box-shadow: 0 4px 18px rgba(158, 38, 27, 0.36); }
}

@media (max-width: 780px) {
  .le-mode-radios,
  .adm-form-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ==================== ONLINE EXAM PROCTORING & TUNNEL UI (MST PALETTE) ==================== */
.le-public-box {
  background: rgba(43, 83, 77, 0.09);
  border: 1.4px solid #2B534D;
  border-radius: 10px;
  padding: 10px 13px;
  margin-bottom: 10px;
}

.le-lan-code.is-public {
  border-color: #2B534D;
  color: #182430;
  background: #FFFFFF;
}

.le-public-tip {
  background: #FFFFFF;
  border: 1.2px dashed #2B534D;
  border-radius: 9px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #243442;
  line-height: 1.45;
}

.le-pin-warn {
  margin-top: 7px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(158, 38, 27, 0.09);
  border: 1.2px solid rgba(158, 38, 27, 0.38);
  color: #9E261B;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.adm-mini-btn.is-primary {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFFFF;
}

.adm-mini-btn.is-primary:hover {
  background: #21423D;
}

.le-whitelist-ta {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  resize: vertical;
  min-height: 68px;
}

.le-warn-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #EEF3F1;
  color: #2B534D;
  border: 1px solid #CBD4D2;
  white-space: nowrap;
}

.le-warn-badge.has-warn {
  background: rgba(158, 38, 27, 0.10);
  color: #9E261B;
  border-color: rgba(158, 38, 27, 0.42);
}

.le-dev-hint {
  font-size: 11.5px;
  color: #4D606D;
  white-space: nowrap;
}

.le-res-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cbt-proctor-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(43, 83, 77, 0.10);
  color: #182430;
  border: 1.2px solid rgba(43, 83, 77, 0.36);
  white-space: nowrap;
}

.cbt-proctor-pill.has-warn {
  background: rgba(158, 38, 27, 0.11);
  color: #9E261B;
  border-color: #9E261B;
}


/* ============================================================================
 * ĐẤU TRƯỜNG QUIZ GAME (KIỂU ZEP QUIZ — 3 CHẾ ĐỘ) & STUDIO TẠO ĐỀ AI (MST PALETTE)
 * Màu chuẩn MST: #2B534D (chủ đạo), #9E261B (nhấn), #243442 (bổ trợ),
 * #182430 (mực đậm), #F7F9F8 (nền sáng), #CBD4D2 (viền xám mảnh)
 * ============================================================================ */

/* Floating HUD Alert Pill */
.quiz-game-banner-pill {
  border-color: #2B534D;
  background: rgba(247, 249, 248, 0.96);
}
.quiz-game-banner-pill.is-live {
  border-color: #9E261B;
  box-shadow: 0 4px 16px rgba(158, 38, 27, 0.20);
}
.quiz-game-banner-pill .hq-cta {
  background: #2B534D;
  color: #FFFFFF;
}
.quiz-game-banner-pill.is-live .hq-cta {
  background: #9E261B;
}

/* ==================== ADMIN AI QUIZ STUDIO ==================== */
.qg-ai-bar {
  background: #F7F9F8;
  border: 1.5px solid #CBD4D2;
  border-left: 4px solid #2B534D;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.qg-ai-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.qg-ai-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(43, 83, 77, 0.10);
  color: #2B534D;
  border: 1px solid rgba(43, 83, 77, 0.28);
}
.qg-ai-pill.is-offline {
  background: rgba(36, 52, 66, 0.08);
  color: #243442;
  border-color: #CBD4D2;
}
.qg-ai-note {
  font-size: 12.2px;
  color: #334155;
  margin-top: 6px;
  line-height: 1.45;
}
.qg-ai-key-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #CBD4D2;
}
.qg-ai-key-form input,
.qg-ai-key-form select {
  flex: 1;
  min-width: 190px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1.3px solid #CBD4D2;
  background: #FFFFFF;
  color: #182430;
  font-size: 12.6px;
}

.qg-builder-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.qg-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.qg-mode-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1.6px solid #CBD4D2;
  background: #FFFFFF;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.qg-mode-grid label:hover {
  border-color: #2B534D;
  background: #F7F9F8;
}
.qg-mode-grid label:has(input:checked) {
  border-color: #2B534D;
  background: rgba(43, 83, 77, 0.08);
  box-shadow: 0 0 0 2px rgba(43, 83, 77, 0.18);
}

.qg-source-tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.qg-source-tabs button {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1.4px solid #CBD4D2;
  background: #F7F9F8;
  color: #243442;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.qg-source-tabs button.active {
  background: #2B534D;
  color: #FFFFFF;
  border-color: #2B534D;
}
.qg-source-body {
  background: #F7F9F8;
  border: 1.4px solid #CBD4D2;
  border-radius: 12px;
  padding: 13px 14px;
}
.qg-file-ok {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 8px;
  background: rgba(43, 83, 77, 0.11);
  color: #2B534D;
  font-size: 12.5px;
  font-weight: 700;
  margin-top: 6px;
}

.qg-q-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}
.qg-q-card {
  background: #FFFFFF;
  border: 1.4px solid #CBD4D2;
  border-radius: 11px;
  padding: 11px 13px;
}
.qg-q-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: #243442;
}
.qg-q-preview {
  font-size: 13.4px;
  color: #182430;
  background: #F7F9F8;
  padding: 7px 10px;
  border-radius: 8px;
  margin-bottom: 7px;
  border: 1px solid #E2E8E7;
}
.qg-q-edit-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 7px;
}
.qg-ed-prompt {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1.3px solid #CBD4D2;
  font-size: 12.8px;
  color: #182430;
  background: #FFFFFF;
}
.qg-q-opts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.qg-opt-ed {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1.2px solid #CBD4D2;
  background: #F7F9F8;
}
.qg-opt-ed.is-ans {
  border-color: #2B534D;
  background: rgba(43, 83, 77, 0.10);
}
.qg-ed-opt {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #182430;
  font-size: 12.5px;
  outline: none;
}

/* ==================== STUDENT PORTAL WIDGET ==================== */
.qg-portal-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: #182430;
}
.qg-portal-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(43, 83, 77, 0.10), rgba(36, 52, 66, 0.06));
  border: 1.5px solid #CBD4D2;
  border-left: 5px solid #2B534D;
}
.qg-portal-hero h3 {
  margin: 0 0 4px;
  font-size: 16.5px;
  color: #182430;
}
.qg-portal-hero p {
  margin: 0;
  font-size: 12.8px;
  color: #334155;
}
.qg-portal-hero-acts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.qg-portal-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qg-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.qg-sec-head h4 {
  margin: 0;
  font-size: 14.5px;
  color: #243442;
}
.qg-sec-note {
  font-size: 12px;
  color: #475569;
}
.qg-grade-pick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #243442;
}
.qg-grade-pick select {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1.4px solid #CBD4D2;
  background: #FFFFFF;
  color: #182430;
  font-weight: 700;
}
.qg-demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.qg-demo-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1.6px solid #CBD4D2;
  border-top: 4px solid var(--qg-accent, #2B534D);
  box-shadow: 0 4px 12px rgba(24, 36, 48, 0.05);
}
.qg-demo-icon {
  font-size: 28px;
  line-height: 1;
}
.qg-demo-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #182430;
}
.qg-demo-desc {
  margin: 0;
  font-size: 12.3px;
  color: #475569;
  line-height: 1.45;
  flex: 1;
}
.qg-room-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.qg-room-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 14px;
  border-radius: 13px;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
}
.qg-room-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}
.qg-room-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #182430;
}
.qg-room-meta {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #475569;
}
.qg-empty-room-box {
  padding: 14px;
  border-radius: 12px;
  border: 1.5px dashed #CBD4D2;
  background: #F7F9F8;
  font-size: 12.8px;
  color: #475569;
  line-height: 1.5;
}

/* Check-in Card */
.qg-portal-checkin {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qg-checkin-card {
  background: #FFFFFF;
  border: 1.6px solid #CBD4D2;
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.qg-checkin-head h3 {
  margin: 6px 0 3px;
  font-size: 18px;
  color: #182430;
}
.qg-checkin-head p {
  margin: 0;
  font-size: 12.8px;
  color: #475569;
}
.qg-checkin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 11px;
}
.qg-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: #243442;
}
.qg-field input,
.qg-field select {
  padding: 9px 11px;
  border-radius: 10px;
  border: 1.5px solid #CBD4D2;
  background: #F7F9F8;
  color: #182430;
  font-size: 13.5px;
}
.qg-field-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #243442;
  margin-bottom: 6px;
}
.qg-av-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 8px;
}
.qg-av-opt {
  cursor: pointer;
}
.qg-av-opt input {
  display: none;
}
.qg-av-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 6px;
  border-radius: 12px;
  border: 2px solid #CBD4D2;
  background: #F7F9F8;
  transition: transform 0.12s, border-color 0.15s;
}
.qg-av-opt input:checked + .qg-av-card {
  border-color: var(--av-border, #2B534D);
  background: var(--av-bg, #E8F3F1);
  transform: translateY(-2px);
}
.qg-av-emoji {
  font-size: 24px;
}
.qg-av-name {
  font-size: 11.8px;
  font-weight: 700;
  color: #182430;
}
.qg-err-box {
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(158, 38, 27, 0.10);
  border: 1.2px solid #9E261B;
  color: #9E261B;
  font-size: 12.8px;
  font-weight: 700;
}

/* Shared Buttons & Pills */
.qg-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.8px;
  font-weight: 800;
  color: #FFFFFF;
  background: var(--qg-accent, #2B534D);
  white-space: nowrap;
}
.qg-status-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.qg-status-pill.is-live { background: rgba(43, 83, 77, 0.14); color: #2B534D; }
.qg-status-pill.is-wait { background: rgba(180, 83, 9, 0.13); color: #92400E; }
.qg-status-pill.is-end  { background: #E2E8F0; color: #334155; }

.qg-btn-accent,
.qg-btn-soft,
.qg-btn-danger,
.qg-btn-close,
.qg-btn-hero {
  border: none;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
}
.qg-btn-accent {
  padding: 8px 13px;
  font-size: 12.8px;
  background: #2B534D;
  color: #FFFFFF;
}
.qg-btn-accent:hover { background: #21423D; }
.qg-btn-soft {
  padding: 8px 13px;
  font-size: 12.6px;
  background: #EEF2F1;
  color: #182430;
  border: 1.3px solid #CBD4D2;
}
.qg-btn-soft:hover { background: #E2EAE8; }
.qg-btn-danger {
  padding: 8px 13px;
  font-size: 12.6px;
  background: #9E261B;
  color: #FFFFFF;
}
.qg-btn-close {
  padding: 8px 12px;
  font-size: 12.6px;
  background: #243442;
  color: #FFFFFF;
}
.qg-btn-hero {
  padding: 12px 22px;
  font-size: 15px;
  background: linear-gradient(135deg, #2B534D, #1E3E39);
  color: #FFFFFF;
  box-shadow: 0 5px 16px rgba(43, 83, 77, 0.28);
}
.qg-btn-hero:hover { transform: translateY(-1px); }
.qg-btn-hero:disabled { opacity: 0.6; cursor: wait; }

/* ==================== FULL-SCREEN ARENA OVERLAY ==================== */
.qg-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: #EEF3F2;
  display: flex;
  flex-direction: column;
  color: #182430;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
.qg-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
}
.qg-loading-box {
  margin: auto;
  padding: 20px 28px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  font-weight: 800;
  color: #2B534D;
}

/* Top Bar */
.qg-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: #FFFFFF;
  border-bottom: 2px solid #CBD4D2;
  box-shadow: 0 2px 10px rgba(24, 36, 48, 0.06);
  z-index: 2;
}
.qg-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.qg-top-title {
  font-size: 15px;
  font-weight: 800;
  color: #182430;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}
.qg-top-sub {
  font-size: 11.8px;
  color: #475569;
  font-weight: 600;
}
.qg-timer-pill {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  background: #F7F9F8;
  border: 2px solid #2B534D;
  color: #2B534D;
}
.qg-timer-pill.is-urgent {
  border-color: #9E261B;
  background: rgba(158, 38, 27, 0.12);
  color: #9E261B;
  animation: qgPulseUrgent 0.7s infinite alternate;
}
.qg-timer-pill.is-boss {
  border-color: #9E261B;
  color: #9E261B;
  background: #FDF2F2;
}
@keyframes qgPulseUrgent {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}
.qg-host-controls,
.qg-student-pills {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.qg-code-chip {
  padding: 6px 11px;
  border-radius: 9px;
  border: 1.5px dashed #9E261B;
  background: #FDF2F2;
  color: #9E261B;
  font-size: 13px;
  cursor: pointer;
}
.qg-stat-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: #F7F9F8;
  border: 1.4px solid #CBD4D2;
  font-size: 13.5px;
  font-weight: 700;
}
.qg-stat-pill.is-streak {
  border-color: #9E261B;
  color: #9E261B;
  background: #FDF2F2;
}

/* Main Body */
.qg-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
}

/* Lobby Stage */
.qg-lobby-stage {
  max-width: 960px;
  margin: 10px auto;
}
.qg-lobby-card {
  background: #FFFFFF;
  border: 1.6px solid #CBD4D2;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 28px rgba(24, 36, 48, 0.08);
  text-align: center;
}
.qg-lobby-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
}
.qg-lobby-card h2 {
  margin: 10px 0 6px;
  font-size: 24px;
  color: #182430;
}
.qg-lobby-desc {
  margin: 0 0 18px;
  font-size: 14px;
  color: #475569;
}
.qg-host-join-box {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 14px;
  text-align: left;
  padding: 16px;
  border-radius: 14px;
  background: #F7F9F8;
  border: 1.5px solid #CBD4D2;
  margin-bottom: 18px;
}
.qg-label-caps {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #64748B;
  margin-bottom: 4px;
}
.qg-big-code {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #9E261B;
}
.qg-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.qg-url-row code {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid #CBD4D2;
  font-size: 12.5px;
  color: #2B534D;
  word-break: break-all;
}
.qg-host-hint {
  font-size: 12px;
  color: #475569;
  margin-top: 6px;
}
.qg-lobby-cta {
  margin-bottom: 18px;
}
.qg-waiting-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(43, 83, 77, 0.10);
  border: 1.4px solid #2B534D;
  color: #182430;
  font-size: 14px;
  margin-bottom: 18px;
}
.qg-pulse-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2B534D;
  animation: qgPulseUrgent 0.8s infinite alternate;
}
.qg-roster-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
  color: #243442;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #E2E8E7;
  margin-bottom: 12px;
}
.qg-roster-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.qg-roster-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #F7F9F8;
  border: 1.4px solid #CBD4D2;
  font-size: 13px;
}
.qg-roster-chip.is-me {
  border-color: #2B534D;
  background: #E8F3F1;
}
.qg-chip-av {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #2B534D;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* Play Grid (Mode 1 & Mode 3) */
.qg-play-grid {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 14px;
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  align-items: start;
}
.qg-main-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.qg-side-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qg-side-card {
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 14px;
  padding: 12px;
}
.qg-side-card h4 {
  margin: 0 0 9px;
  font-size: 13.5px;
  color: #243442;
  padding-bottom: 6px;
  border-bottom: 1px solid #E2E8E7;
}

/* Question Card */
.qg-question-card {
  background: #FFFFFF;
  border: 1.6px solid #CBD4D2;
  border-left: 5px solid #2B534D;
  border-radius: 14px;
  padding: 12px 16px;
}
.qg-question-card.is-boss-q {
  border-left-color: #9E261B;
}
.qg-q-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  margin-bottom: 6px;
}
.qg-q-num {
  padding: 3px 9px;
  border-radius: 999px;
  background: #2B534D;
  color: #FFFFFF;
  font-weight: 800;
}
.qg-q-type {
  padding: 3px 9px;
  border-radius: 999px;
  background: #EEF2F1;
  color: #243442;
  font-weight: 700;
}
.qg-q-hint {
  color: #475569;
  font-weight: 600;
}
.qg-q-prompt {
  font-size: 17px;
  font-weight: 700;
  color: #182430;
  line-height: 1.48;
}
.qg-reveal-banner {
  margin-top: 9px;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 13.5px;
}
.qg-reveal-banner.is-win,
.qg-reveal-banner.is-host {
  background: rgba(43, 83, 77, 0.11);
  border: 1.4px solid #2B534D;
  color: #182430;
}
.qg-reveal-banner.is-miss {
  background: rgba(158, 38, 27, 0.09);
  border: 1.4px solid #9E261B;
  color: #182430;
}
.qg-reveal-explain,
.qg-fb-explain {
  margin-top: 4px;
  font-size: 13px;
  color: #334155;
}

/* Interactive Canvas */
.qg-canvas-wrap {
  position: relative;
  background: #FFFFFF;
  border: 1.6px solid #CBD4D2;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(24, 36, 48, 0.07);
}
.qg-arena-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 46vh;
  object-fit: contain;
  cursor: pointer;
  touch-action: none;
}
.qg-arena-canvas.is-map {
  max-height: 70vh;
}

/* Quick-Choice KaTeX Option Bar */
.qg-option-bar,
.qg-boss-opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 4px;
}
.qg-opt-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 2px solid #CBD4D2;
  background: var(--opt-bg, #F7F9F8);
  color: #182430;
  font-size: 14.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.14s, box-shadow 0.14s;
}
.qg-opt-btn:hover:not(:disabled) {
  border-color: var(--opt-color, #2B534D);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24, 36, 48, 0.10);
}
.qg-opt-btn.is-selected {
  border-color: var(--opt-color, #2B534D);
  box-shadow: 0 0 0 3px rgba(43, 83, 77, 0.24);
}
.qg-opt-btn.is-correct {
  border-color: #2B534D;
  background: #D0EAE5;
  box-shadow: 0 0 0 3px rgba(43, 83, 77, 0.32);
}
.qg-opt-btn.is-dim {
  opacity: 0.48;
}
.qg-opt-badge {
  flex-shrink: 0;
  min-width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--opt-color, #2B534D);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
}
.qg-opt-text {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.qg-opt-count {
  font-size: 12px;
  font-weight: 800;
  color: #243442;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
}

/* Live Leaderboard */
.qg-lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qg-lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #F7F9F8;
  border: 1px solid #E2E8E7;
}
.qg-lb-row.is-me {
  background: #E8F3F1;
  border-color: #2B534D;
}
.qg-lb-rank {
  min-width: 24px;
  text-align: center;
  font-weight: 900;
  font-size: 13px;
}
.qg-lb-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #2B534D;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.qg-lb-info {
  flex: 1;
  min-width: 0;
}
.qg-lb-name {
  font-size: 12.6px;
  font-weight: 800;
  color: #182430;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qg-lb-sub {
  font-size: 11px;
  color: #64748B;
}
.qg-lb-score {
  font-size: 13.5px;
  font-weight: 900;
  color: #2B534D;
}
.qg-empty-mini {
  font-size: 12.5px;
  color: #64748B;
  text-align: center;
  padding: 12px;
}

/* ==================== MODE 2: BOSS CO-OP STAGE ==================== */
.qg-boss-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1360px;
  margin: 0 auto;
}
.qg-boss-top {
  display: grid;
  grid-template-columns: 420px 1fr 290px;
  gap: 12px;
  background: #FFFFFF;
  border: 1.6px solid #CBD4D2;
  border-radius: 16px;
  padding: 12px;
}
.qg-boss-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}
.qg-boss-status-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.qg-boss-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.qg-boss-title-row h3 {
  margin: 0;
  font-size: 18px;
  color: #182430;
}
.qg-lv-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: #9E261B;
  color: #FFFFFF;
  font-size: 12px;
}
.qg-ko-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: #F7F9F8;
  border: 1.2px solid #CBD4D2;
  font-size: 12.4px;
}
.qg-hp-bar-outer {
  position: relative;
  height: 28px;
  border-radius: 999px;
  background: #E2E8E7;
  border: 1.5px solid #243442;
  overflow: hidden;
}
.qg-hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #9E261B, #C83C2E);
  transition: width 0.28s ease;
}
.qg-hp-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}
.qg-team-towers {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qg-tower-row {
  display: grid;
  grid-template-columns: 125px 1fr 62px;
  align-items: center;
  gap: 8px;
  font-size: 12.2px;
  font-weight: 700;
}
.qg-tower-track {
  height: 13px;
  border-radius: 999px;
  background: #EEF2F1;
  overflow: hidden;
}
.qg-tower-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.qg-tower-pts {
  text-align: right;
  font-weight: 900;
  color: #243442;
}
.qg-boss-feed-box {
  background: #F7F9F8;
  border: 1px solid #CBD4D2;
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
}
.qg-boss-feed-box h4 {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: #243442;
}
.qg-feed-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 138px;
  overflow-y: auto;
}
.qg-feed-item {
  font-size: 11.8px;
  padding: 5px 8px;
  border-radius: 7px;
  background: #FFFFFF;
  border-left: 3px solid #2B534D;
  color: #182430;
  line-height: 1.35;
}
.qg-feed-item.is-crit,
.qg-feed-item.is-boss_ko {
  border-left-color: #9E261B;
  background: #FDF2F2;
  font-weight: 700;
}
.qg-boss-bottom {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 14px;
  align-items: start;
}
.qg-boss-host-board {
  grid-column: 1 / -1;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 16px;
  padding: 16px;
}
.qg-boss-host-board h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: #243442;
}
.qg-boss-feedback {
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 13.6px;
}
.qg-boss-feedback.is-win {
  background: rgba(43, 83, 77, 0.11);
  border: 1.5px solid #2B534D;
  color: #182430;
}
.qg-boss-feedback.is-miss {
  background: rgba(158, 38, 27, 0.09);
  border: 1.5px solid #9E261B;
  color: #182430;
}

/* ==================== MODE 3: TREASURE HUNT 2K ==================== */
.qg-treasure-hint-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 13px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1.4px solid #CBD4D2;
  font-size: 12.8px;
}
.qg-chest-progress {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(43, 83, 77, 0.11);
  color: #2B534D;
  font-weight: 700;
}
.qg-chest-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 220px;
  overflow-y: auto;
}
.qg-chest-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1.3px solid #CBD4D2;
  background: #F7F9F8;
  color: #182430;
  font-size: 12.2px;
  font-weight: 700;
  cursor: pointer;
}
.qg-chest-chip.is-opened {
  background: #E8F3F1;
  border-color: #2B534D;
  color: #2B534D;
}
.qg-chest-chip.is-boss {
  background: #FDF2F2;
  border-color: #9E261B;
  color: #9E261B;
}
.qg-chest-chip.is-locked {
  opacity: 0.65;
}

/* Chest Riddle Modal over 2K Map */
.qg-chest-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 36, 48, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 6;
}
.qg-chest-modal {
  width: min(640px, 100%);
  background: #FFFFFF;
  border-radius: 16px;
  border: 2px solid #2B534D;
  box-shadow: 0 18px 42px rgba(24, 36, 48, 0.34);
  overflow: hidden;
}
.qg-chest-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  background: rgba(43, 83, 77, 0.10);
  border-bottom: 1.5px solid #CBD4D2;
  font-weight: 900;
  font-size: 14px;
  color: #182430;
}
.qg-chest-modal-head.is-boss {
  background: rgba(158, 38, 27, 0.11);
  color: #9E261B;
}
.qg-mini-x {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: #243442;
  color: #FFFFFF;
  font-weight: 800;
  cursor: pointer;
}
.qg-chest-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==================== FINISHED PODIUM ==================== */
.qg-finish-stage {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}
.qg-finish-head {
  text-align: center;
}
.qg-finish-head h2 {
  margin: 0 0 4px;
  font-size: 24px;
  color: #182430;
}
.qg-finish-head p {
  margin: 0;
  color: #475569;
  font-size: 14px;
}
.qg-podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: end;
  width: 100%;
  max-width: 680px;
}
.qg-podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.qg-podium-av {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid #2B534D;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.qg-podium-name {
  font-size: 14.5px;
  font-weight: 900;
  color: #182430;
  text-align: center;
}
.qg-podium-cls {
  font-size: 11.8px;
  color: #64748B;
}
.qg-podium-block {
  width: 100%;
  border-radius: 14px 14px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  padding: 14px 8px;
}
.qg-podium-col.place-1 .qg-podium-block { min-height: 126px; background: linear-gradient(180deg, #2B534D, #1E3E39); }
.qg-podium-col.place-2 .qg-podium-block { min-height: 98px; background: linear-gradient(180deg, #243442, #182430); }
.qg-podium-col.place-3 .qg-podium-block { min-height: 78px; background: linear-gradient(180deg, #9E261B, #7B1D14); }
.qg-podium-medal { font-size: 28px; }
.qg-podium-score { font-size: 16px; font-weight: 900; }
.qg-finish-teams {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.qg-team-card {
  background: #FFFFFF;
  border: 1.4px solid #CBD4D2;
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 170px;
  text-align: center;
}
.qg-team-title { font-weight: 800; font-size: 14px; }
.qg-team-pts { font-size: 12.5px; color: #475569; margin-top: 2px; }
.qg-finish-table-wrap {
  width: 100%;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-radius: 16px;
  padding: 16px;
}
.qg-finish-table-wrap h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #243442;
}
.qg-finish-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .qg-play-grid,
  .qg-boss-top,
  .qg-boss-bottom,
  .qg-host-join-box {
    grid-template-columns: 1fr;
  }
  .qg-option-bar,
  .qg-boss-opts,
  .qg-q-opts-grid {
    grid-template-columns: 1fr;
  }
}


/* ==================== QUESTION REVIEW PANEL (ALL 3 MODES) ==================== */
.qg-btn-review-toggle {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1.5px solid #2B534D;
  background: rgba(43, 83, 77, 0.10);
  color: #182430;
  font-size: 12.6px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.qg-btn-review-toggle:hover,
.qg-btn-review-toggle.is-open {
  background: #2B534D;
  color: #FFFFFF;
}

.qg-complete-review-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 15px;
  border-radius: 13px;
  background: rgba(43, 83, 77, 0.12);
  border: 1.6px solid #2B534D;
  color: #182430;
  font-size: 13.4px;
  font-weight: 700;
  margin-bottom: 10px;
}

.qg-finish-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: center;
}
.qg-finish-tab {
  padding: 10px 18px;
  border-radius: 11px;
  border: 1.6px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  font-size: 13.8px;
  font-weight: 800;
  cursor: pointer;
}
.qg-finish-tab.active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(43, 83, 77, 0.24);
}

.qg-ingame-review-stage {
  max-width: 940px;
  margin: 0 auto;
}
.qg-review-wrap {
  width: 100%;
  background: #FFFFFF;
  border: 1.6px solid #CBD4D2;
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qg-rev-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.qg-rev-head h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #182430;
}
.qg-rev-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.qg-rev-stat {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.2px;
  font-weight: 700;
  border: 1.2px solid #CBD4D2;
  background: #F7F9F8;
  color: #182430;
}
.qg-rev-stat.is-ok   { border-color: rgba(43, 83, 77, 0.45); background: rgba(43, 83, 77, 0.09); color: #2B534D; }
.qg-rev-stat.is-warn { border-color: rgba(140, 91, 35, 0.45); background: #F7F1E7; color: #7A4B17; }
.qg-rev-stat.is-err  { border-color: rgba(158, 38, 27, 0.45); background: rgba(158, 38, 27, 0.09); color: #9E261B; }
.qg-rev-stat.is-acc  { border-color: #243442; background: #EAF0F4; color: #243442; }

.qg-rev-filters {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1.2px solid #E2E8E7;
}
.qg-rev-filter {
  padding: 6px 12px;
  border-radius: 9px;
  border: 1.3px solid #CBD4D2;
  background: #F7F9F8;
  color: #243442;
  font-size: 12.6px;
  font-weight: 800;
  cursor: pointer;
}
.qg-rev-filter.active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFFFF;
}
.qg-rev-filter.is-wrong-tab.active {
  background: #9E261B;
  border-color: #9E261B;
}

.qg-rev-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qg-rev-card {
  background: #F7F9F8;
  border: 1.4px solid #CBD4D2;
  border-left: 5px solid #2B534D;
  border-radius: 13px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.qg-rev-card.is-wrong   { border-left-color: #9E261B; background: #FDF7F7; }
.qg-rev-card.is-retried { border-left-color: #8C5B23; background: #FBF8F3; }
.qg-rev-card.is-skipped { border-left-color: #64748B; }
.qg-rev-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.qg-rev-qnum {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qg-rev-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.qg-rev-badge.is-ok   { background: rgba(43, 83, 77, 0.14); color: #2B534D; }
.qg-rev-badge.is-warn { background: rgba(140, 91, 35, 0.15); color: #7A4B17; }
.qg-rev-badge.is-err  { background: rgba(158, 38, 27, 0.14); color: #9E261B; }
.qg-rev-badge.is-skip { background: #E2E8F0; color: #334155; }

.qg-rev-prompt {
  font-size: 15px;
  font-weight: 700;
  color: #182430;
  line-height: 1.48;
}
.qg-rev-opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.qg-rev-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1.4px solid #CBD4D2;
  background: #FFFFFF;
  font-size: 13.6px;
  font-weight: 600;
  color: #182430;
}
.qg-rev-opt.is-correct,
.qg-rev-opt.is-correct-pick {
  border-color: #2B534D;
  background: #E4F2EF;
  font-weight: 800;
}
.qg-rev-opt.is-wrong-pick {
  border-color: #9E261B;
  background: #FBE9E8;
  color: #9E261B;
}
.qg-rev-opt-tag {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid currentColor;
}
.qg-rev-opt.is-correct .qg-rev-opt-tag,
.qg-rev-opt.is-correct-pick .qg-rev-opt-tag {
  color: #2B534D;
}
.qg-rev-opt.is-wrong-pick .qg-rev-opt-tag {
  color: #9E261B;
}
.qg-rev-explain {
  padding: 9px 12px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1.2px solid #CBD4D2;
  border-left: 3.5px solid #243442;
  font-size: 13.2px;
  color: #243442;
  line-height: 1.48;
}

@media (max-width: 780px) {
  .qg-rev-opts {
    grid-template-columns: 1fr;
  }
}


/* ==================== CỔNG KIỂM ĐỊNH ĐỀ TRƯỚC XUẤT BẢN (ADMIN AUDIT) ==================== */
.qa-audit-bar {
  border-radius: 12px;
  border: 1.5px solid #CBD4D2;
  background: #F7F9F8;
  padding: 11px 14px;
  margin-bottom: 12px;
}
.qa-audit-bar.is-ok    { border-color: #2B534D; background: rgba(43, 83, 77, 0.08); }
.qa-audit-bar.is-warn  { border-color: #8C5B23; background: #FBF7F0; }
.qa-audit-bar.is-error { border-color: #9E261B; background: rgba(158, 38, 27, 0.08); }

.qa-audit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #182430;
}
.qa-audit-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.qa-chip,
.qa-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.6px;
  font-weight: 800;
  background: #EEF2F1;
  color: #243442;
  border: 1px solid #CBD4D2;
}
.qa-chip.is-ok, .qa-pill.is-ok   { background: rgba(43, 83, 77, 0.13); color: #2B534D; border-color: rgba(43, 83, 77, 0.36); }
.qa-chip.is-warn, .qa-pill.is-warn { background: #F7F1E7; color: #7A4B17; border-color: rgba(140, 91, 35, 0.4); }
.qa-chip.is-err, .qa-pill.is-err { background: rgba(158, 38, 27, 0.13); color: #9E261B; border-color: rgba(158, 38, 27, 0.42); }

.qa-ai-note {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #CBD4D2;
  font-size: 12.4px;
  color: #243442;
  line-height: 1.45;
}
.qa-ai-note.has-err { color: #9E261B; font-weight: 700; }

.qa-card-ok    { border-left: 4px solid #2B534D !important; }
.qa-card-warn  { border-left: 4px solid #8C5B23 !important; }
.qa-card-error { border-left: 4px solid #9E261B !important; background: #FDF7F7 !important; }

.qa-issue-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 6px 0;
}
.qa-issue {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12.2px;
  font-weight: 700;
  line-height: 1.4;
}
.qa-issue.is-critical { background: rgba(158, 38, 27, 0.11); color: #9E261B; border: 1px solid rgba(158, 38, 27, 0.34); }
.qa-issue.is-warning  { background: #F7F1E7; color: #7A4B17; border: 1px solid rgba(140, 91, 35, 0.34); }
.qa-issue.is-info     { background: #EAF0F4; color: #243442; border: 1px solid #CBD4D2; }

.qa-sol-preview {
  margin-top: 8px;
  background: #F7F9F8;
  border: 1px solid #CBD4D2;
  border-radius: 9px;
  padding: 6px 10px;
}
.qa-sol-preview summary {
  cursor: pointer;
  font-size: 12.2px;
  font-weight: 700;
  color: #243442;
}
.qa-sol-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #CBD4D2;
  font-size: 13px;
  color: #182430;
  line-height: 1.48;
}

/* Live Exam Pre-Publish Variant Inspector */
.le-preview-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.le-prev-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.le-var-tabs,
.le-prev-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.le-var-tab {
  padding: 7px 13px;
  border-radius: 9px;
  border: 1.4px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  font-size: 12.6px;
  font-weight: 800;
  cursor: pointer;
}
.le-var-tab.active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFFFF;
}
.le-prev-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 4px;
}
.le-prev-qcard {
  background: #FFFFFF;
  border: 1.4px solid #CBD4D2;
  border-radius: 12px;
  padding: 12px 14px;
}
.le-prev-qhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.le-prev-qbody {
  font-size: 13.8px;
  color: #182430;
  line-height: 1.48;
  margin-bottom: 8px;
}
.le-prev-opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.le-prev-opt {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #F7F9F8;
  border: 1.2px solid #CBD4D2;
  font-size: 12.8px;
}
.le-prev-opt.is-ans {
  border-color: #2B534D;
  background: rgba(43, 83, 77, 0.11);
  font-weight: 800;
}
.le-prev-sts {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.le-prev-st {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #F7F9F8;
  border: 1px solid #CBD4D2;
  font-size: 12.8px;
}
.le-prev-st span:nth-child(2) {
  flex: 1;
}
@media (max-width: 780px) {
  .le-prev-opts { grid-template-columns: 1fr; }
}

/* Olympiad Contest Selector Modal (Primary & THCS in-place modal) */
.cs-ol-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cs-ol-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 15px;
  border-radius: 12px;
  background: #F7F9F8;
  border: 1.4px solid #CBD4D2;
  border-left: 5px solid #2B534D;
}
.cs-ol-hero-text strong {
  display: block;
  font-size: 14.5px;
  color: #182430;
  margin-bottom: 3px;
}
.cs-ol-hero-text p {
  margin: 0;
  font-size: 12.6px;
  color: #243442;
}
.cs-ol-hub-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(43, 83, 77, 0.12);
  color: #2B534D;
  border: 1px solid rgba(43, 83, 77, 0.32);
}
.cs-ol-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.cs-ol-grid.is-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.cs-ol-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1.5px solid #CBD4D2;
  border-top: 4px solid #2B534D;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.cs-ol-card:hover,
.cs-ol-card:focus-visible {
  transform: translateY(-2px);
  border-color: #2B534D;
  box-shadow: 0 8px 20px rgba(24, 36, 48, 0.10);
  outline: none;
}
.cs-ol-card-top {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.cs-ol-icon {
  font-size: 30px;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: #F7F9F8;
  border: 1px solid #CBD4D2;
  flex-shrink: 0;
}
.cs-ol-titles {
  flex: 1;
  min-width: 0;
}
.cs-ol-code-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.cs-ol-code {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.4px;
  font-weight: 900;
  background: #9E261B;
  color: #FFFFFF;
  letter-spacing: 0.3px;
}
.cs-ol-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #EEF2F1;
  color: #243442;
  border: 1px solid #CBD4D2;
}
.cs-ol-name {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #182430;
  line-height: 1.32;
}
.cs-ol-desc {
  margin: 0;
  font-size: 12.6px;
  color: #243442;
  line-height: 1.45;
}
.cs-ol-format {
  font-size: 11.8px;
  font-weight: 700;
  color: #2B534D;
}
.cs-ol-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cs-ol-stat {
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 11.6px;
  font-weight: 800;
  background: #F7F9F8;
  color: #243442;
  border: 1px solid #CBD4D2;
}
.cs-ol-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  margin-top: auto;
  border-top: 1px dashed #CBD4D2;
}
.cs-ol-cta {
  font-size: 12.6px;
  font-weight: 800;
  color: #2B534D;
}
.cs-tab-back-btn {
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 9px;
  border: 1.4px solid #9E261B;
  background: rgba(158, 38, 27, 0.08);
  color: #9E261B;
  font-size: 12.2px;
  font-weight: 800;
  cursor: pointer;
}
.cs-tab-back-btn:hover {
  background: #9E261B;
  color: #FFFFFF;
}
@media (max-width: 980px) {
  .cs-ol-grid.is-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .cs-ol-grid,
  .cs-ol-grid.is-grid-3 { grid-template-columns: 1fr; }
}

/* Quick Grade Chips inside Olympiad Cards + In-Modal Grade Switcher Bar */
.cs-ol-grade-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.cs-ol-grade-chip {
  padding: 3px 8px;
  border-radius: 7px;
  border: 1.2px solid #CBD4D2;
  background: #F7F9F8;
  color: #243442;
  font-size: 11.2px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.cs-ol-grade-chip:hover {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFFFF;
}
.cs-ol-grade-chip.is-default {
  border-color: rgba(43, 83, 77, 0.48);
  color: #2B534D;
  background: rgba(43, 83, 77, 0.10);
}
.cs-ol-grade-chip.is-default:hover {
  background: #2B534D;
  color: #FFFFFF;
}

.cs-tabs.has-grade-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
}
.cs-tabs-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}
.cs-ol-grade-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border-radius: 10px;
  background: #F7F9F8;
  border: 1px solid #CBD4D2;
}
.cs-ol-gbar-lbl {
  font-size: 11.8px;
  font-weight: 800;
  color: #243442;
}
.cs-ol-grade-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.cs-ol-grade-pill {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1.3px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  font-size: 11.8px;
  font-weight: 800;
  cursor: pointer;
}
.cs-ol-grade-pill:hover {
  border-color: #2B534D;
  color: #2B534D;
}
.cs-ol-grade-pill.active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFFFF;
}
.cs-ol-grade-focus {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: #2B534D;
}
.cs-ol-round-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 5px 10px;
  border-radius: 10px;
  background: #F7F1E7;
  border: 1px solid rgba(158, 38, 27, 0.28);
}
.cs-ol-round-pill {
  padding: 4px 11px;
  border-radius: 8px;
  border: 1.3px solid rgba(158, 38, 27, 0.35);
  background: #FFFFFF;
  color: #243442;
  font-size: 11.8px;
  font-weight: 800;
  cursor: pointer;
}
.cs-ol-round-pill:hover {
  border-color: #9E261B;
  color: #9E261B;
}
.cs-ol-round-pill.active {
  background: #9E261B;
  border-color: #9E261B;
  color: #FFFFFF;
}
.cs-ol-round-hint {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: #7A4B17;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cs-ol-pill-prog {
  font-size: 10.5px;
  font-weight: 800;
  opacity: 0.85;
  margin-left: 3px;
}
.cs-cms-debug-pill {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(36, 52, 66, 0.08);
  border: 1px solid rgba(36, 52, 66, 0.22);
  color: #243442;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
}
.cs-doc-next-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 12px;
  background: #F7F9F8;
  border: 1.5px solid #CBD4D2;
}
.cs-doc-next-cta-txt {
  font-size: 13px;
  font-weight: 700;
  color: #182430;
}
.adm-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.adm-upload-row .adm-input {
  flex: 1;
  min-width: 220px;
}
.adm-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1.4px solid #2B534D;
  background: rgba(43, 83, 77, 0.08);
  color: #2B534D;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.adm-upload-btn:hover {
  background: rgba(43, 83, 77, 0.16);
}
.adm-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #F7F9F8;
  border: 1px solid #CBD4D2;
}
.adm-paste-box {
  background: #F7F9F8;
  border: 1.5px solid #2B534D;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.adm-paste-prev-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.adm-paste-prev-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid #CBD4D2;
  font-size: 12.5px;
}
.adm-tag.is-lib {
  background: rgba(43, 83, 77, 0.12);
  color: #2B534D;
  border: 1px solid rgba(43, 83, 77, 0.35);
}
.adm-dropzone {
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1.8px dashed #2B534D;
  background: #F7F9F8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  transition: background 0.15s, border-color 0.15s;
}
.adm-dropzone.is-dragover {
  background: rgba(43, 83, 77, 0.12);
  border-color: #9E261B;
}
.adm-dropzone-txt {
  font-size: 12.5px;
  color: #182430;
  line-height: 1.45;
}
.adm-dropzone-txt code {
  background: rgba(36, 52, 66, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
}

/* ==================== MULTI-FORMAT QUESTIONS (FILL · MATCH · ESSAY) ==================== */
.cs-qtype-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(43, 83, 77, 0.1);
  color: #2B534D;
  border: 1px solid rgba(43, 83, 77, 0.28);
}
.cs-qtype-badge.is-fill {
  background: rgba(36, 52, 66, 0.08);
  color: #243442;
  border-color: rgba(36, 52, 66, 0.25);
}
.cs-qtype-badge.is-match {
  background: rgba(43, 83, 77, 0.1);
  color: #2B534D;
  border-color: rgba(43, 83, 77, 0.3);
}
.cs-qtype-badge.is-essay {
  background: rgba(158, 38, 27, 0.08);
  color: #9E261B;
  border-color: rgba(158, 38, 27, 0.28);
}

/* Fill-in-the-blank */
.cs-fill-inline {
  display: inline-block;
  min-width: 88px;
  max-width: 170px;
  padding: 3px 8px;
  margin: 0 3px;
  border-radius: 7px;
  border: 1.8px solid #2B534D;
  background: #FFFFFF;
  color: #182430;
  font-size: 0.96em;
  font-weight: 700;
  text-align: center;
  vertical-align: baseline;
}
.cs-fill-inline:focus,
.cs-fill-input:focus {
  outline: none;
  border-color: #9E261B;
  box-shadow: 0 0 0 2px rgba(158, 38, 27, 0.16);
}
.cs-fill-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}
.cs-fill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cs-fill-lbl {
  min-width: 84px;
  font-size: 13px;
  font-weight: 800;
  color: #243442;
}
.cs-fill-input {
  flex: 1;
  min-width: 160px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1.6px solid #CBD4D2;
  background: #FFFFFF;
  color: #182430;
  font-size: calc(14px * var(--study-font-scale, 1));
  font-weight: 700;
}
.cs-fill-inline.is-ok,
.cs-fill-input.is-ok {
  border-color: #2B534D;
  background: #ECF6F2;
  color: #184239;
}
.cs-fill-inline.is-err,
.cs-fill-input.is-err {
  border-color: #9E261B;
  background: #FDF1F0;
  color: #7D1B12;
}
.cs-fill-ans-hint {
  font-size: 12.5px;
  font-weight: 800;
  color: #2B534D;
}
.cs-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Matching pairs */
.cs-match-hint {
  font-size: 12.5px;
  color: #425361;
  margin-bottom: 8px;
}
.cs-match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 10px 0 12px;
}
.cs-match-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cs-match-col-head {
  font-size: 12px;
  font-weight: 800;
  color: #243442;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.cs-match-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.6px solid #CBD4D2;
  background: #FFFFFF;
  color: #182430;
  font-size: calc(13.8px * var(--study-font-scale, 1));
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, transform 0.12s;
}
.cs-match-item:hover:not(:disabled) {
  border-color: #2B534D;
  background: #F7F9F8;
}
.cs-match-item.is-active {
  border-color: #9E261B;
  background: #FDF4F2;
  box-shadow: 0 0 0 2px rgba(158, 38, 27, 0.16);
}
.cs-match-item.is-paired {
  border-color: #2B534D;
  background: #F1F7F5;
}
.cs-match-item.is-ok {
  border-color: #2B534D;
  background: #E7F5EE;
}
.cs-match-item.is-err {
  border-color: #9E261B;
  background: #FDECEA;
}
.cs-match-num {
  flex-shrink: 0;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 7px;
  background: #243442;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cs-match-body {
  flex: 1;
}
.cs-match-link-badge {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 6px;
  background: #2B534D;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
}
.cs-match-item.is-err .cs-match-link-badge {
  background: #9E261B;
}

/* Essay */
.cs-essay-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}
.cs-essay-textarea {
  width: 100%;
  min-height: 118px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1.6px solid #CBD4D2;
  background: #FFFFFF;
  color: #182430;
  font-family: inherit;
  font-size: calc(14px * var(--study-font-scale, 1));
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
}
.cs-essay-textarea:focus {
  outline: none;
  border-color: #2B534D;
  box-shadow: 0 0 0 2px rgba(43, 83, 77, 0.16);
}
.cs-essay-compare {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 11px;
  background: #F7F9F8;
  border: 1.5px solid #CBD4D2;
}
.cs-essay-rubric {
  margin: 4px 0 0;
  padding-left: 18px;
  color: #243442;
  font-size: 13.5px;
  line-height: 1.6;
}
.cs-essay-kw-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
}
.cs-essay-kw {
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 800;
}
.cs-essay-kw.is-hit {
  background: #E7F5EE;
  color: #184239;
  border: 1px solid rgba(43, 83, 77, 0.35);
}
.cs-essay-kw.is-miss {
  background: #FDECEA;
  color: #9E261B;
  border: 1px solid rgba(158, 38, 27, 0.3);
}
.cs-essay-self-eval {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed #CBD4D2;
}

/* Admin question type selector */
.adm-qtype-switch {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.adm-qtype-btn {
  padding: 6px 11px;
  border-radius: 8px;
  border: 1.4px solid #CBD4D2;
  background: #FFFFFF;
  color: #243442;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.adm-qtype-btn.active {
  background: #2B534D;
  border-color: #2B534D;
  color: #FFFFFF;
}
.adm-pair-row {
  display: grid;
  grid-template-columns: 28px 1fr 22px 1fr 34px;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
@media (max-width: 720px) {
  .cs-match-grid {
    grid-template-columns: 1fr;
  }
  .adm-pair-row {
    grid-template-columns: 24px 1fr 1fr 32px;
  }
}
