/* VietBCC - Math Games Ecosystem Stylesheet (Design System 2.0 / 3D Cartoon) */

/* -------------------- Game Hub -------------------- */
.games-hub-header {
  background: linear-gradient(135deg, #6C5CE7 0%, #A29BFE 60%, #FD79A8 100%);
  border-radius: var(--radius-2xl, 24px);
  padding: 36px 32px;
  color: #fff;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(108, 92, 231, 0.25);
}

.games-hub-header::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.games-hub-title {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.games-hub-subtitle {
  font-size: 1.05rem;
  opacity: 0.95;
  margin: 0 0 20px 0;
  max-width: 600px;
  line-height: 1.5;
}

/* User Quick Stats Bar */
.game-stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.game-stat-pill {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-full, 9999px);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

/* Category Filter Tabs */
.game-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.cat-tab-btn {
  background: var(--color-surface, #ffffff);
  border: 2px solid var(--color-border, #E2E8F0);
  border-radius: var(--radius-full, 9999px);
  padding: 10px 20px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-secondary, #64748B);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-tab-btn:hover {
  border-color: #6C5CE7;
  color: #6C5CE7;
  transform: translateY(-2px);
}

.cat-tab-btn.active {
  background: #6C5CE7;
  border-color: #6C5CE7;
  color: #fff;
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.35);
}

/* Game Cards Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.game-card {
  background: var(--color-surface, #ffffff);
  border-radius: var(--radius-xl, 20px);
  border: 2px solid var(--color-border, #E2E8F0);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  overflow: hidden;
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.08);
  border-color: #6C5CE7;
}

.game-card.disabled {
  opacity: 0.88;
  filter: saturate(0.85);
  background: #FAFAFC;
}

.game-card.disabled:hover {
  transform: translateY(-2px);
  border-color: var(--color-border, #E2E8F0);
}

.game-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.game-card-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
}

.game-badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full, 9999px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-active {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #C8E6C9;
}

.badge-coming {
  background: #FFF3E0;
  color: #E65100;
  border: 1px solid #FFE0B2;
}

.game-card-title {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-text-primary, #1E293B);
  margin: 0 0 6px 0;
}

.game-card-tagline {
  font-size: 0.88rem;
  color: #6C5CE7;
  font-weight: 700;
  margin: 0 0 10px 0;
}

.game-card-desc {
  font-size: 0.92rem;
  color: var(--color-text-secondary, #64748B);
  line-height: 1.45;
  margin-bottom: 20px;
  flex-grow: 1;
}

.game-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--color-border, #F1F5F9);
}

.game-card-levels {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748B;
}

/* -------------------- Game Arena (Missing Number) -------------------- */
.game-arena-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}

/* Arena Header */
.game-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface, #ffffff);
  border: 2px solid var(--color-border, #E2E8F0);
  border-radius: var(--radius-xl, 20px);
  padding: 12px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.arena-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.arena-title {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: var(--color-text-primary, #1E293B);
}

.arena-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.arena-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 1rem;
  padding: 6px 14px;
  border-radius: var(--radius-full, 9999px);
  background: #F8FAFC;
}

.badge-score {
  background: #FEF9C3;
  color: #A16207;
  border: 1px solid #FDE047;
}

.badge-combo {
  background: #FFEDD5;
  color: #C2410C;
  border: 1px solid #FDBA74;
  animation: pulse-combo 1.5s infinite;
}

@keyframes pulse-combo {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.audio-toggle-btn {
  background: transparent;
  border: 2px solid var(--color-border, #E2E8F0);
  border-radius: var(--radius-full, 9999px);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.audio-toggle-btn:hover {
  background: #F1F5F9;
}

/* Difficulty Selector in Arena */
.difficulty-selector {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.diff-btn {
  background: var(--color-surface, #ffffff);
  border: 2px solid var(--color-border, #E2E8F0);
  border-radius: var(--radius-full, 9999px);
  padding: 8px 18px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-secondary, #64748B);
  cursor: pointer;
  transition: all 0.2s ease;
}

.diff-btn.active {
  background: #6C5CE7;
  border-color: #6C5CE7;
  color: #fff;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

/* Progress bar */
.game-progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}

.game-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6C5CE7, #00B8B5);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Main Playing Card Stage */
.stage-card {
  background: var(--color-surface, #ffffff);
  border: 3px solid #E2E8F0;
  border-radius: var(--radius-2xl, 28px);
  padding: 36px 24px;
  text-align: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.06);
  position: relative;
  margin-bottom: 24px;
}

/* Panda Mascot Reaction */
.mascot-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.mascot-avatar {
  font-size: 2.8rem;
  animation: mascot-bounce 2.5s infinite;
  display: inline-block;
}

@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.mascot-speech {
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 16px;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #334155;
  position: relative;
}

.mascot-speech::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 8px 6px 0;
  border-style: solid;
  border-color: transparent #E2E8F0 transparent transparent;
}

/* Giant Equation Display */
.equation-display {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 3rem;
  font-weight: 800;
  color: #1E293B;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 20px 0 32px 0;
  min-height: 80px;
}

.blank-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: #F1F5F9;
  border: 3px dashed #6C5CE7;
  border-radius: 16px;
  color: #6C5CE7;
  font-size: 2.4rem;
  animation: pulse-slot 1.4s infinite alternate;
}

@keyframes pulse-slot {
  from { border-color: #6C5CE7; background: #F1F5F9; transform: scale(1); }
  to { border-color: #A29BFE; background: #EEF2FF; transform: scale(1.05); }
}

.blank-slot.solved {
  border-style: solid;
  background: #E8F5E9;
  border-color: #4CAF50;
  color: #2E7D32;
  animation: none;
}

/* 4 Multiple Choice Options */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 500px;
  margin: 0 auto;
}

.option-btn {
  background: var(--color-surface, #ffffff);
  border: 3px solid #E2E8F0;
  border-radius: var(--radius-xl, 20px);
  padding: 16px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.8rem;
  font-weight: 800;
  color: #1E293B;
  cursor: pointer;
  box-shadow: 0 6px 0 #CBD5E1;
  transition: all 0.15s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70px;
}

.option-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #CBD5E1;
  border-color: #6C5CE7;
}

.option-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #CBD5E1;
}

.option-btn .opt-key-hint {
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 0.75rem;
  color: #94A3B8;
  font-weight: 700;
}

.option-btn.correct {
  background: #4CAF50 !important;
  border-color: #388E3C !important;
  color: #fff !important;
  box-shadow: 0 4px 0 #2E7D32 !important;
}

.option-btn.wrong {
  background: #EF5350 !important;
  border-color: #D32F2F !important;
  color: #fff !important;
  box-shadow: 0 4px 0 #C62828 !important;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Feedback Banner */
.feedback-banner {
  min-height: 48px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.15rem;
  font-weight: 800;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.feedback-banner.show {
  opacity: 1;
}

.feedback-banner.correct {
  color: #2E7D32;
}

.feedback-banner.wrong {
  color: #C62828;
}

/* Result Modal */
.game-result-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.game-result-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.game-result-card {
  background: #fff;
  border-radius: 28px;
  padding: 36px 28px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-result-modal-overlay.open .game-result-card {
  transform: scale(1);
}

.result-stars {
  font-size: 2.8rem;
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.result-title {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2rem;
  font-weight: 800;
  color: #1E293B;
  margin: 0 0 6px 0;
}

.result-sub {
  font-size: 1rem;
  color: #64748B;
  margin: 0 0 24px 0;
}

.result-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.result-stat-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 12px 14px;
}

.result-stat-label {
  font-size: 0.8rem;
  color: #64748B;
  font-weight: 700;
  margin-bottom: 4px;
}

.result-stat-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.4rem;
  font-weight: 800;
  color: #1E293B;
}

.result-actions {
  display: flex;
  gap: 12px;
}

.result-actions .btn {
  flex: 1;
  padding: 14px 20px;
  font-size: 1.05rem;
}

/* Mobile Tweaks */
@media (max-width: 640px) {
  .games-hub-header {
    padding: 24px 20px;
  }
  .games-hub-title {
    font-size: 1.7rem;
  }
  .equation-display {
    font-size: 2.2rem;
  }
  .blank-slot {
    width: 58px;
    height: 58px;
    font-size: 1.8rem;
  }
  .options-grid {
    gap: 12px;
  }
  .option-btn {
    font-size: 1.5rem;
    min-height: 60px;
    padding: 12px;
  }
}
/* -------------------- Pattern Game Styles (Phase 02) -------------------- */
.pattern-sequence-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px 0 32px 0;
  min-height: 80px;
}

.pattern-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 64px;
  padding: 0 16px;
  background: #F8FAFC;
  border: 3px solid #00B8B5;
  border-radius: 18px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2rem;
  font-weight: 800;
  color: #0F766E;
  box-shadow: 0 6px 0 #99F6E4;
}

.pattern-arrow {
  color: #00B8B5;
  font-size: 1.8rem;
  font-weight: 800;
  animation: pulse-arrow 1.2s infinite alternate;
}

@keyframes pulse-arrow {
  from { transform: translateX(0); opacity: 0.8; }
  to { transform: translateX(3px); opacity: 1; }
}

.pattern-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 64px;
  padding: 0 16px;
  background: #EEF2FF;
  border: 3px dashed #6C5CE7;
  border-radius: 18px;
  color: #6C5CE7;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  animation: pulse-slot 1.4s infinite alternate;
}

.pattern-slot.solved {
  border-style: solid;
  background: #E8F5E9;
  border-color: #10B981;
  color: #047857;
  box-shadow: 0 6px 0 #A7F3D0;
  animation: none;
}

/* -------------------- Phase 03: Mystery Grid (Ô số bí ẩn) -------------------- */
.game-stage-3d-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-2xl, 24px);
}

.ambient-3d-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
}

.game-stage-content {
  position: relative;
  z-index: 1;
}

.mystery-grid-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 20px 0 28px 0;
  width: 100%;
}

.mystery-grid-board {
  display: inline-grid;
  gap: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  padding: 18px;
  border-radius: 24px;
  box-shadow: 0 12px 32px rgba(108, 92, 231, 0.12), inset 0 2px 4px rgba(255, 255, 255, 0.9);
  border: 3px solid rgba(108, 92, 231, 0.18);
  transition: all 0.3s ease;
}

.mystery-grid-board.grid-3x3 {
  grid-template-columns: repeat(3, 76px);
  grid-template-rows: repeat(3, 76px);
}

.mystery-grid-board.grid-4x4 {
  grid-template-columns: repeat(4, 62px);
  grid-template-rows: repeat(4, 62px);
  gap: 10px;
  padding: 16px;
}

.grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 2.5px solid #CBD5E1;
  border-radius: 16px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.85rem;
  font-weight: 800;
  color: #1E293B;
  box-shadow: 0 5px 0 #CBD5E1;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.mystery-grid-board.grid-4x4 .grid-cell {
  font-size: 1.5rem;
  border-radius: 14px;
}

.grid-cell.cell-header {
  background: #EEF2FF;
  border-color: #C7D2FE;
  color: #4F46E5;
  box-shadow: 0 5px 0 #C7D2FE;
  font-size: 1.5rem;
}

.grid-cell.cell-target {
  background: #FEF3C7;
  border-color: #FCD34D;
  color: #B45309;
  box-shadow: 0 5px 0 #FCD34D;
}

.grid-cell.cell-mystery {
  background: #FFF1F2;
  border: 3px dashed #F43F5E;
  color: #E11D48;
  font-size: 2.2rem;
  box-shadow: 0 5px 0 #FECDD3;
  animation: pulse-mystery 1.4s infinite alternate;
  cursor: pointer;
}

@keyframes pulse-mystery {
  0% { transform: scale(1); box-shadow: 0 5px 0 #FECDD3, 0 0 0 rgba(244, 63, 94, 0); }
  100% { transform: scale(1.05); box-shadow: 0 6px 0 #FECDD3, 0 0 16px rgba(244, 63, 94, 0.35); }
}

.grid-cell.cell-solved {
  border: 3px solid #10B981 !important;
  background: #D1FAE5 !important;
  color: #047857 !important;
  box-shadow: 0 6px 0 #A7F3D0 !important;
  animation: bounce-solved 0.5s ease-out;
}

@keyframes bounce-solved {
  0% { transform: scale(0.85); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Hint Button & Hint Display Box */
.hint-action-bar {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.btn-hint {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 2px solid #F59E0B;
  color: #B45309;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: var(--radius-full, 9999px);
  cursor: pointer;
  box-shadow: 0 4px 0 #D97706;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-hint:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #D97706;
  background: linear-gradient(135deg, #FDE68A 0%, #FCD34D 100%);
}

.btn-hint:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #D97706;
}

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

.hint-message-box {
  margin-top: 14px;
  padding: 12px 20px;
  background: #FFFBEB;
  border: 2px dashed #F59E0B;
  border-radius: 16px;
  color: #92400E;
  font-weight: 600;
  font-size: 1.02rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.3s ease;
  max-width: 520px;
  text-align: left;
}

@media (max-width: 576px) {
  .mystery-grid-board.grid-3x3 {
    grid-template-columns: repeat(3, 62px);
    grid-template-rows: repeat(3, 62px);
    gap: 8px;
    padding: 12px;
  }
  .mystery-grid-board.grid-3x3 .grid-cell {
    font-size: 1.5rem;
  }
  .mystery-grid-board.grid-4x4 {
    grid-template-columns: repeat(4, 48px);
    grid-template-rows: repeat(4, 48px);
    gap: 6px;
    padding: 10px;
  }
  .mystery-grid-board.grid-4x4 .grid-cell {
    font-size: 1.2rem;
  }
}

/* -------------------- Phase 04: Cứu Panda (Save Panda 3D) -------------------- */
.save-panda-card {
  padding: 18px 24px 28px 24px;
}

.panda-3d-stage {
  width: 100%;
  height: 380px;
  border-radius: var(--radius-2xl, 24px);
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #DFF9FB 0%, #C7ECEE 100%);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(9, 132, 227, 0.15);
  margin-bottom: 20px;
  border: 3px solid #74B9FF;
}

.save-panda-3d-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.panda-webgl-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #E0F2FE;
  color: #0369A1;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-weight: 700;
  font-size: 1.2rem;
}

.panda-quest-overlay {
  text-align: center;
  margin-bottom: 20px;
}

.bridge-equation-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #FFFFFF;
  border: 3px solid #0984E3;
  padding: 12px 32px;
  border-radius: var(--radius-full, 9999px);
  box-shadow: 0 8px 20px rgba(9, 132, 227, 0.2);
  margin-top: 10px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  color: #1E293B;
}

.bridge-equation-wrap .num {
  color: #0984E3;
}

.bridge-equation-wrap .op {
  color: #FD79A8;
}

.bridge-equation-wrap .q-mark {
  color: #F43F5E;
  display: inline-block;
  animation: pulse-q 1.2s infinite alternate;
}

@keyframes pulse-q {
  from { transform: scale(1); }
  to { transform: scale(1.2); }
}

.bridge-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 680px;
  margin: 0 auto;
}

.bridge-option-btn {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 3px solid #CBD5E1;
  border-radius: 20px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 0 #94A3B8;
  position: relative;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 90px;
}

.bridge-option-btn:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: #0984E3;
  box-shadow: 0 10px 0 #74B9FF;
}

.bridge-option-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #74B9FF;
}

.bridge-option-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.bridge-tag {
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.bridge-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.1rem;
  font-weight: 800;
  color: #0984E3;
  line-height: 1.1;
}

.bridge-key-hint {
  position: absolute;
  top: 6px;
  right: 8px;
  background: #E2E8F0;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748B;
}

.bridge-option-btn.correct {
  border-color: #10B981 !important;
  background: #D1FAE5 !important;
  box-shadow: 0 6px 0 #059669 !important;
}

.bridge-option-btn.correct .bridge-val {
  color: #047857 !important;
}

.bridge-option-btn.wrong {
  border-color: #EF4444 !important;
  background: #FEE2E2 !important;
  box-shadow: 0 6px 0 #DC2626 !important;
  animation: bridge-shake 0.4s ease;
}

.bridge-option-btn.wrong .bridge-val {
  color: #B91C1C !important;
}

@keyframes bridge-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (max-width: 640px) {
  .panda-3d-stage {
    height: 280px;
  }
  .bridge-options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .bridge-equation-wrap {
    font-size: 1.7rem;
    padding: 8px 20px;
  }
  .bridge-val {
    font-size: 1.8rem;
  }
}

/* -------------------- Phase 05: Math Rocket 🚀 -------------------- */
.rocket-stage-card {
  padding: 16px 24px 28px 24px;
}

.rocket-alt-fill {
  background: linear-gradient(90deg, #FD79A8 0%, #6C5CE7 50%, #00CEC9 100%) !important;
}

.rocket-hud-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: #0F172A;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 8px 16px;
  margin-bottom: 14px;
  color: #F8FAFC;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-size: 0.68rem;
  color: #94A3B8;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.hud-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
}

.hud-status-normal {
  color: #38BDF8;
}

.hud-status-turbo {
  color: #F43F5E;
  text-shadow: 0 0 8px rgba(244, 63, 94, 0.6);
  animation: pulse-turbo 0.6s infinite alternate;
}

@keyframes pulse-turbo {
  from { opacity: 0.8; transform: scale(1); }
  to { opacity: 1; transform: scale(1.08); }
}

.rocket-3d-stage {
  width: 100%;
  height: 380px;
  border-radius: var(--radius-2xl, 24px);
  position: relative;
  overflow: hidden;
  background: #060814;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(253, 121, 168, 0.2);
  margin-bottom: 20px;
  border: 3px solid #FD79A8;
}

.rocket-3d-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.rocket-webgl-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0B0C1E;
  color: #E2E8F0;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-weight: 700;
  font-size: 1.2rem;
}

.rocket-equation-card {
  text-align: center;
  margin-bottom: 20px;
}

.rocket-equation-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #0F172A;
  border: 3px solid #FD79A8;
  padding: 12px 34px;
  border-radius: var(--radius-full, 9999px);
  box-shadow: 0 8px 24px rgba(253, 121, 168, 0.35);
  margin-top: 10px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.3rem;
  font-weight: 800;
  color: #F8FAFC;
}

.rocket-equation-wrap .num {
  color: #38BDF8;
}

.rocket-equation-wrap .op {
  color: #F43F5E;
}

.rocket-equation-wrap .q-mark {
  color: #FBBF24;
  display: inline-block;
  animation: pulse-q 1.1s infinite alternate;
}

.rocket-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 680px;
  margin: 0 auto;
}

.rocket-opt-btn {
  background: linear-gradient(180deg, #FFFFFF 0%, #F1F5F9 100%);
  border: 3px solid #CBD5E1;
  border-radius: 20px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 0 #94A3B8;
  position: relative;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 90px;
}

.rocket-opt-btn:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: #FD79A8;
  box-shadow: 0 10px 0 #F472B6;
}

.rocket-opt-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #F472B6;
}

.rocket-opt-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.thruster-tag {
  font-size: 0.76rem;
  font-weight: 800;
  color: #64748B;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.thruster-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.1rem;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.1;
}

.thruster-key-hint {
  position: absolute;
  top: 6px;
  right: 8px;
  background: #E2E8F0;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748B;
}

.rocket-opt-btn.correct {
  border-color: #10B981 !important;
  background: #D1FAE5 !important;
  box-shadow: 0 6px 0 #059669 !important;
}

.rocket-opt-btn.correct .thruster-val {
  color: #047857 !important;
}

.rocket-opt-btn.wrong {
  border-color: #EF4444 !important;
  background: #FEE2E2 !important;
  box-shadow: 0 6px 0 #DC2626 !important;
  animation: rocket-shake 0.4s ease;
}

.rocket-opt-btn.wrong .thruster-val {
  color: #B91C1C !important;
}

@keyframes rocket-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (max-width: 640px) {
  .rocket-3d-stage {
    height: 280px;
  }
  .rocket-options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .rocket-equation-wrap {
    font-size: 1.8rem;
    padding: 8px 22px;
  }
  .thruster-val {
    font-size: 1.8rem;
  }
}

/* ==========================================================================
   PHASE 06: CỬA HÀNG TOÁN HỌC (MATH SHOP)
   ========================================================================== */

.shop-progress-fill {
  background: linear-gradient(90deg, #F59E0B, #10B981);
}

.shop-counter-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 2px solid #E2E8F0;
  overflow: hidden;
  padding: 24px;
}

.shop-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #059669, #10B981);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: 16px;
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.shop-store-logo {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-register-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.shop-cart-section {
  background: #F8FAFC;
  border: 2px dashed #CBD5E1;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 18px;
}

.cart-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #64748B;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.cart-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.shop-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.shop-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.item-emoji {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

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

.item-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1E293B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-qty {
  font-size: 0.78rem;
  color: #64748B;
  margin-top: 2px;
}

.item-qty b {
  color: #0F172A;
}

.item-price {
  background: #FEF3C7;
  color: #B45309;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #FDE68A;
  white-space: nowrap;
}

.shop-invoice-box {
  background: linear-gradient(180deg, #FFFFFF, #F8FAFC);
  border: 2px solid #E2E8F0;
  border-radius: 20px;
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.invoice-prompt {
  font-size: 1.05rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 12px;
  line-height: 1.4;
}

.shop-equation-wrap {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.4rem;
  font-weight: 800;
  color: #0F172A;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #FFFFFF;
  border: 2px dashed #CBD5E1;
  padding: 10px 28px;
  border-radius: 16px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.shop-coins-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

.shop-coin-btn {
  background: linear-gradient(180deg, #FFFFFF, #FFFBEB);
  border: 2.5px solid #F59E0B;
  border-radius: 20px;
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 0 #D97706;
  position: relative;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 105px;
}

.shop-coin-btn:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: #D97706;
  box-shadow: 0 10px 0 #B45309;
  background: linear-gradient(180deg, #FFFFFF, #FEF3C7);
}

.shop-coin-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #D97706;
}

.shop-coin-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.coin-icon {
  font-size: 1.5rem;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 3px rgba(217, 119, 6, 0.3));
}

.coin-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  color: #78350F;
  line-height: 1.05;
}

.coin-currency {
  font-size: 0.72rem;
  font-weight: 800;
  color: #92400E;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-top: 2px;
}

.shop-key-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #92400E;
}

.shop-coin-btn.correct {
  border-color: #10B981 !important;
  background: #D1FAE5 !important;
  box-shadow: 0 6px 0 #059669 !important;
}

.shop-coin-btn.correct .coin-val {
  color: #047857 !important;
}

.shop-coin-btn.wrong {
  border-color: #EF4444 !important;
  background: #FEE2E2 !important;
  box-shadow: 0 6px 0 #DC2626 !important;
  animation: shop-coin-shake 0.4s ease;
}

.shop-coin-btn.wrong .coin-val {
  color: #B91C1C !important;
}

@keyframes shop-coin-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (max-width: 640px) {
  .shop-counter-card {
    padding: 16px;
  }
  .cart-items-grid {
    grid-template-columns: 1fr;
  }
  .shop-coins-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .shop-equation-wrap {
    font-size: 1.8rem;
    padding: 8px 18px;
  }
  .coin-val {
    font-size: 1.8rem;
  }
}

/* ==========================================================================
   PHASE 07: QUA SÔNG (RIVER CROSSING PUZZLE 🐸)
   ========================================================================== */

.river-progress-fill {
  background: linear-gradient(90deg, #06B6D4, #10B981);
}

.river-stage-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 2px solid #E2E8F0;
  overflow: hidden;
  padding: 20px;
}

.river-3d-stage {
  width: 100%;
  height: 380px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #D9F3FB 0%, #BAE6FD 100%);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 18px;
}

.river-3d-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.river-webgl-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0369A1;
  background: #E0F2FE;
}

.river-quest-overlay {
  text-align: center;
  margin-bottom: 20px;
}

.river-prompt-box {
  font-size: 1.08rem;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 10px;
  line-height: 1.4;
}

.river-equation-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #F0FDFA;
  border: 2px dashed #99F6E4;
  padding: 8px 24px;
  border-radius: 16px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  color: #0F766E;
  box-shadow: inset 0 2px 4px rgba(13, 148, 136, 0.04);
}

.river-tag-pill {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0F766E;
  letter-spacing: 0.5px;
}

.river-math-hl {
  font-size: 2.3rem;
  font-weight: 800;
  color: #0E7490;
}

.river-stones-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

.river-stone-btn {
  background: linear-gradient(180deg, #F8FAFC 0%, #E2E8F0 100%);
  border: 2.5px solid #0D9488;
  border-radius: 20px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 0 #0F766E;
  position: relative;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 98px;
}

.river-stone-btn:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: #0F766E;
  box-shadow: 0 10px 0 #115E59;
  background: linear-gradient(180deg, #FFFFFF 0%, #CCFBF1 100%);
}

.river-stone-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0F766E;
}

.river-stone-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.stone-tag {
  font-size: 0.76rem;
  font-weight: 800;
  color: #0F766E;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.stone-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.05;
}

.stone-key-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #CCFBF1;
  border: 1px solid #99F6E4;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #0F766E;
}

.river-stone-btn.correct {
  border-color: #10B981 !important;
  background: #D1FAE5 !important;
  box-shadow: 0 6px 0 #059669 !important;
}

.river-stone-btn.correct .stone-val {
  color: #047857 !important;
}

.river-stone-btn.wrong {
  border-color: #EF4444 !important;
  background: #FEE2E2 !important;
  box-shadow: 0 6px 0 #DC2626 !important;
  animation: river-stone-shake 0.4s ease;
}

.river-stone-btn.wrong .stone-val {
  color: #B91C1C !important;
}

@keyframes river-stone-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (max-width: 640px) {
  .river-3d-stage {
    height: 290px;
  }
  .river-stones-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .river-equation-wrap {
    font-size: 1.8rem;
    padding: 6px 18px;
  }
  .stone-val {
    font-size: 1.8rem;
  }
}







/* ==========================================================================
   PHASE 08: BẮN BÓNG TOÁN HỌC (BUBBLE MATH 🎯🎈)
   ========================================================================== */

.bubble-stage-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 2px solid #E2E8F0;
  overflow: hidden;
  padding: 24px;
}

.bubble-equation-card {
  text-align: center;
  margin-bottom: 18px;
}

.bubble-equation-wrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #FFF1F2 0%, #FDF2F8 50%, #F5F3FF 100%);
  border: 2px dashed #F43F5E;
  border-radius: 20px;
  padding: 10px 32px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.3rem;
  font-weight: 800;
  color: #1E293B;
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.12);
}

.bubble-sky-arena {
  position: relative;
  width: 100%;
  height: 380px;
  border-radius: 20px;
  background: linear-gradient(180deg, #BAE6FD 0%, #E0F2FE 55%, #F0FDF4 100%);
  border: 3px solid #7DD3FC;
  box-shadow: inset 0 6px 16px rgba(255, 255, 255, 0.6), inset 0 -6px 16px rgba(14, 165, 233, 0.1);
  overflow: hidden;
  user-select: none;
  touch-action: none;
  cursor: crosshair;
}

/* Background floating decorative clouds & stars */
.bubble-cloud-bg {
  position: absolute;
  font-size: 2.8rem;
  opacity: 0.65;
  pointer-events: none;
  animation: cloud-drift 18s linear infinite;
}
.bubble-cloud-1 { top: 18px; left: -10%; animation-duration: 26s; }
.bubble-cloud-2 { top: 75px; left: -10%; animation-duration: 32s; animation-delay: -12s; font-size: 2.2rem; }
.bubble-cloud-3 { top: 130px; left: -10%; animation-duration: 22s; animation-delay: -6s; font-size: 2.5rem; opacity: 0.5; }

@keyframes cloud-drift {
  0% { transform: translateX(0); }
  100% { transform: translateX(1200px); }
}

.bubble-sparkle-bg {
  position: absolute;
  pointer-events: none;
  font-size: 1.2rem;
  opacity: 0.7;
  animation: sparkle-pulse 2s ease-in-out infinite alternate;
}
.bubble-sp-1 { top: 25px; right: 40px; }
.bubble-sp-2 { top: 90px; left: 35px; animation-delay: 1s; }

@keyframes sparkle-pulse {
  0% { transform: scale(0.8) rotate(0deg); opacity: 0.4; }
  100% { transform: scale(1.2) rotate(45deg); opacity: 0.9; }
}

/* Canvas Overlay */
.bubble-canvas-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* Options cluster containing 4 floating bubbles */
.bubble-options-cluster {
  position: absolute;
  top: 25px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 16px;
  z-index: 6;
}

/* 3D Glossy Translucent Bubble Button */
.glossy-bubble-btn {
  position: relative;
  width: 106px;
  height: 106px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, filter 0.2s ease;
  animation: bubble-float 3.2s ease-in-out infinite alternate;
  outline: none;
  padding: 0;
  background-clip: padding-box;
}

.glossy-bubble-btn:nth-child(1) { animation-delay: 0s; }
.glossy-bubble-btn:nth-child(2) { animation-delay: -0.8s; }
.glossy-bubble-btn:nth-child(3) { animation-delay: -1.6s; }
.glossy-bubble-btn:nth-child(4) { animation-delay: -2.4s; }

@keyframes bubble-float {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
  100% { transform: translateY(4px) rotate(-2deg); }
}

/* Color variations */
.bubble-color-0 {
  background: radial-gradient(circle at 35% 30%, #FFE4E6 0%, #FB7185 45%, #E11D48 100%);
  box-shadow: inset -5px -5px 12px rgba(159, 18, 57, 0.4), inset 4px 4px 10px rgba(255, 255, 255, 0.85), 0 10px 24px rgba(244, 63, 94, 0.35);
}
.bubble-color-1 {
  background: radial-gradient(circle at 35% 30%, #D1FAE5 0%, #34D399 45%, #059669 100%);
  box-shadow: inset -5px -5px 12px rgba(6, 95, 70, 0.4), inset 4px 4px 10px rgba(255, 255, 255, 0.85), 0 10px 24px rgba(16, 185, 129, 0.35);
}
.bubble-color-2 {
  background: radial-gradient(circle at 35% 30%, #FEF3C7 0%, #FBBF24 45%, #D97706 100%);
  box-shadow: inset -5px -5px 12px rgba(146, 64, 14, 0.4), inset 4px 4px 10px rgba(255, 255, 255, 0.85), 0 10px 24px rgba(245, 158, 11, 0.35);
}
.bubble-color-3 {
  background: radial-gradient(circle at 35% 30%, #EDE9FE 0%, #A78BFA 45%, #7C3AED 100%);
  box-shadow: inset -5px -5px 12px rgba(91, 33, 182, 0.4), inset 4px 4px 10px rgba(255, 255, 255, 0.85), 0 10px 24px rgba(139, 92, 246, 0.35);
}

.glossy-bubble-btn:hover:not(:disabled) {
  transform: scale(1.1) translateY(-6px);
  filter: brightness(1.08);
}

.glossy-bubble-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.glossy-bubble-btn:disabled {
  cursor: default;
}

/* Specular glassy reflection */
.bubble-specular-shine {
  position: absolute;
  top: 10px;
  left: 18px;
  width: 32px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.15) 100%);
  transform: rotate(-35deg);
  pointer-events: none;
}

/* Value text inside bubble */
.bubble-val-text {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.3rem;
  font-weight: 800;
  color: #FFFFFF;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* Key shortcut tag */
.bubble-key-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0F172A;
  color: #FFFFFF;
  border: 2px solid #FFFFFF;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

/* Pop burst animation */
.glossy-bubble-btn.bubble-popped {
  animation: bubble-pop-anim 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
}

@keyframes bubble-pop-anim {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.8; filter: brightness(1.5); }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Shake error animation */
.glossy-bubble-btn.bubble-shake {
  animation: bubble-shake-anim 0.4s ease !important;
}

@keyframes bubble-shake-anim {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px) rotate(-6deg); }
  40% { transform: translateX(10px) rotate(6deg); }
  60% { transform: translateX(-6px) rotate(-3deg); }
  80% { transform: translateX(6px) rotate(3deg); }
}

/* Cannon Aimer at bottom */
.bubble-cannon-wrap {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 8;
}

.bubble-cannon-barrel {
  position: absolute;
  bottom: 22px;
  left: 50%;
  width: 26px;
  height: 65px;
  background: linear-gradient(90deg, #1E293B, #475569 45%, #1E293B 100%);
  border-radius: 8px 8px 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform-origin: 50% 90%;
  transform: translateX(-50%) rotate(0deg);
  transition: transform 0.05s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cannon-nozzle {
  width: 32px;
  height: 10px;
  background: #0EA5E9;
  border-radius: 6px;
  box-shadow: 0 0 10px #38BDF8;
}

.cannon-sight {
  font-size: 0.9rem;
  margin-top: 8px;
}

.bubble-cannon-mount {
  position: relative;
  width: 68px;
  height: 32px;
  background: #334155;
  border-radius: 16px 16px 6px 6px;
  border: 3px solid #64748B;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cannon-wheel {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #F59E0B;
  border: 3px solid #B45309;
}

@media (max-width: 640px) {
  .bubble-sky-arena {
    height: 330px;
  }
  .bubble-options-cluster {
    padding: 0 6px;
  }
  .glossy-bubble-btn {
    width: 78px;
    height: 78px;
  }
  .bubble-val-text {
    font-size: 1.7rem;
  }
  .bubble-equation-wrap {
    font-size: 1.7rem;
    padding: 6px 18px;
  }
  .bubble-specular-shine {
    width: 22px;
    height: 12px;
    top: 6px;
    left: 12px;
  }
}


/* ==========================================================================
   PHASE 09: LẬT THẺ GHI NHỚ (MATH MEMORY 🃏🧠)
   ========================================================================== */

.memory-stage-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 2px solid #E2E8F0;
  overflow: hidden;
  padding: 24px;
}

.memory-board-wrapper {
  position: relative;
  width: 100%;
  min-height: 420px;
  background: linear-gradient(180deg, #F8FAFC 0%, #EEF2F6 100%);
  border-radius: 20px;
  border: 2px solid #E2E8F0;
  padding: 20px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
}

.memory-canvas-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
}

/* 3D Board Grid */
.memory-board-grid {
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 820px;
  perspective: 1200px;
  align-items: center;
  justify-content: center;
}

.memory-board-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(90px, 140px));
}

.memory-board-grid.cols-5 {
  grid-template-columns: repeat(5, minmax(80px, 130px));
}

.memory-board-grid.cols-6 {
  grid-template-columns: repeat(6, minmax(70px, 115px));
}

/* 3D Card Item */
.memory-card-wrap {
  aspect-ratio: 3 / 3.8;
  perspective: 1000px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.memory-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1), box-shadow 0.2s ease;
  border-radius: 16px;
}

.memory-card-wrap:hover:not(.is-flipped):not(.is-matched) .memory-card-inner {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.25);
}

/* Flipped state */
.memory-card-wrap.is-flipped .memory-card-inner {
  transform: rotateY(180deg);
}

/* Matched state */
.memory-card-wrap.is-matched .memory-card-inner {
  transform: rotateY(180deg) scale(0.98);
  box-shadow: 0 0 0 3px #10B981, 0 8px 20px rgba(16, 185, 129, 0.3) !important;
}

.memory-card-wrap.is-matched {
  cursor: default;
}

/* Shake mismatch animation */
.memory-card-wrap.is-shake .memory-card-inner {
  animation: card-shake-anim 0.45s ease;
}

@keyframes card-shake-anim {
  0%, 100% { transform: rotateY(180deg) translateX(0); }
  25% { transform: rotateY(180deg) translateX(-8px) rotateZ(-3deg); }
  75% { transform: rotateY(180deg) translateX(8px) rotateZ(3deg); }
}

/* Card Faces */
.memory-card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
}

/* Card Back (Face Down) */
.memory-card-back {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #C026D3 100%);
  border: 3px solid #FFFFFF;
  overflow: hidden;
}

.card-back-pattern {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 70%;
  height: 70%;
  border-radius: 12px;
  border: 2px dashed rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

.card-back-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.card-back-hologram {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 60%
  );
  pointer-events: none;
}

/* Card Front (Face Up) */
.memory-card-front {
  transform: rotateY(180deg);
  background: #FFFFFF;
  border: 3px solid #CBD5E1;
  padding: 10px;
  text-align: center;
}

.memory-card-wrap.is-matched .memory-card-front {
  background: linear-gradient(180deg, #FFFFFF 0%, #ECFDF5 100%);
  border-color: #10B981;
}

.card-front-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 6px;
}

.card-front-text {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.85rem;
  font-weight: 800;
  color: #1E293B;
  line-height: 1.1;
}

.memory-card-front.card-type-expr .card-front-text {
  color: #4F46E5;
}

.memory-card-front.card-type-val .card-front-text {
  color: #D97706;
  font-size: 2.2rem;
}

.card-front-type {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #94A3B8;
  padding: 2px 8px;
  background: #F1F5F9;
  border-radius: 999px;
}

.memory-card-wrap.is-matched .card-front-type {
  background: #D1FAE5;
  color: #059669;
}

@media (max-width: 640px) {
  .memory-board-wrapper {
    padding: 10px;
    min-height: 350px;
  }
  .memory-board-grid {
    gap: 8px;
  }
  .memory-board-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .memory-board-grid.cols-5 {
    grid-template-columns: repeat(5, 1fr);
  }
  .memory-board-grid.cols-6 {
    grid-template-columns: repeat(4, 1fr); /* Wrap to 4 cols on phone */
  }
  .card-front-text {
    font-size: 1.35rem !important;
  }
  .card-back-icon {
    font-size: 1.5rem;
  }
  .card-front-type {
    display: none;
  }
}


/* ==========================================================================
   PHASE 10: XÂY THÁP TOÁN HỌC (MATH TOWER 🏰)
   ========================================================================== */

.tower-progress-fill {
  background: linear-gradient(90deg, #F59E0B 0%, #D97706 50%, #4F46E5 100%);
}

.tower-stage-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 2px solid #E2E8F0;
  overflow: hidden;
  padding: 20px;
}

.tower-3d-stage {
  width: 100%;
  height: 380px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #87CEEB 0%, #BAE6FD 100%);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 18px;
}

.tower-3d-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.tower-webgl-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #B45309;
  background: #FEF3C7;
}

.tower-equation-card {
  text-align: center;
  margin-bottom: 18px;
}

.tower-equation-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #FFFBEB;
  border: 2px dashed #F59E0B;
  padding: 8px 24px;
  border-radius: 16px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  color: #78350F;
  box-shadow: inset 0 2px 4px rgba(245, 158, 11, 0.05);
}

.tower-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

/* Medieval Granite Stone Block Button */
.tower-stone-btn {
  background: linear-gradient(180deg, #F8FAFC 0%, #E2E8F0 60%, #CBD5E1 100%);
  border: 2.5px solid #64748B;
  border-radius: 20px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 0 #475569, inset 0 2px 4px rgba(255, 255, 255, 0.8);
  position: relative;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 98px;
}

.tower-stone-btn:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: #D97706;
  box-shadow: 0 10px 0 #B45309, inset 0 2px 6px rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, #FFFFFF 0%, #FEF3C7 60%, #FDE68A 100%);
}

.tower-stone-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #475569;
}

.tower-stone-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.tower-stone-tag {
  font-size: 0.76rem;
  font-weight: 800;
  color: #B45309;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.tower-stone-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  color: #1E293B;
  line-height: 1.05;
}

.tower-key-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #475569;
}

.tower-stone-btn.correct {
  border-color: #10B981 !important;
  background: #D1FAE5 !important;
  box-shadow: 0 6px 0 #059669 !important;
}

.tower-stone-btn.correct .tower-stone-val {
  color: #047857 !important;
}

.tower-stone-btn.wrong {
  border-color: #EF4444 !important;
  background: #FEE2E2 !important;
  box-shadow: 0 6px 0 #DC2626 !important;
  animation: tower-stone-shake 0.4s ease;
}

.tower-stone-btn.wrong .tower-stone-val {
  color: #B91C1C !important;
}

@keyframes tower-stone-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (max-width: 640px) {
  .tower-3d-stage {
    height: 290px;
  }
  .tower-options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .tower-equation-wrap {
    font-size: 1.8rem;
    padding: 6px 18px;
  }
  .tower-stone-val {
    font-size: 1.8rem;
  }
}


/* ==========================================================================
   PHASE 11: MẬT MÃ TOÁN HỌC (MATH CIPHER 📜🔐)
   ========================================================================== */

.cipher-progress-fill {
  background: linear-gradient(90deg, #10B981 0%, #059669 50%, #D97706 100%);
}

.cipher-stage-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 2px solid #E2E8F0;
  overflow: hidden;
  padding: 24px;
}

.cipher-particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

/* Ancient Secret Parchment Scroll */
.cipher-parchment-scroll {
  background: linear-gradient(180deg, #FFFDF5 0%, #FEF9E7 50%, #FDF6DE 100%);
  border: 3px dashed #D4A373;
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: inset 0 2px 8px rgba(180, 83, 9, 0.08), 0 6px 18px rgba(0, 0, 0, 0.04);
  margin-bottom: 20px;
  position: relative;
}

.parchment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  border-bottom: 1px dashed rgba(212, 163, 115, 0.5);
  padding-bottom: 8px;
}

.parchment-stamp {
  background: #DC2626;
  color: #FFFFFF;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  padding: 3px 10px;
  border-radius: 6px;
  transform: rotate(-3deg);
  display: inline-block;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.parchment-clue {
  font-size: 0.92rem;
  font-style: italic;
  font-weight: 700;
  color: #854D0E;
}

/* 10 Secret Slots Row */
.cipher-slots-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 10px 4px 6px;
}

.cipher-slot {
  width: 54px;
  height: 70px;
  background: #FFFFFF;
  border: 2.5px solid #CBD5E1;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
  user-select: none;
}

.cipher-slot.is-locked {
  background: #F8FAFC;
  opacity: 0.6;
  border-style: dashed;
}

.cipher-slot.is-active {
  border-color: #F59E0B;
  background: #FFFBEB;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3), 0 8px 16px rgba(245, 158, 11, 0.2);
  transform: translateY(-4px) scale(1.08);
}

.cipher-slot.is-decoded {
  border-color: #10B981;
  background: linear-gradient(180deg, #FFFFFF 0%, #ECFDF5 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
  animation: cipher-slot-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cipher-slot-pop {
  0% { transform: scale(0.8) rotate(-6deg); }
  50% { transform: scale(1.15) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.slot-lens {
  position: absolute;
  top: -12px;
  font-size: 1.1rem;
  animation: lens-bounce 1.5s ease-in-out infinite alternate;
}

@keyframes lens-bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

.slot-letter {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.85rem;
  font-weight: 900;
  color: #047857;
  line-height: 1;
}

.slot-letter-active {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.85rem;
  font-weight: 900;
  color: #D97706;
  line-height: 1;
}

.slot-letter-locked {
  font-size: 1.4rem;
  color: #94A3B8;
  font-weight: 800;
}

.slot-idx {
  font-size: 0.62rem;
  font-weight: 800;
  color: #64748B;
  position: absolute;
  bottom: 2px;
}

.slot-check {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.65rem;
  font-weight: 900;
  color: #10B981;
}

/* Alphabet Codex Ribbon */
.cipher-codex-container {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.codex-title {
  font-size: 0.76rem;
  font-weight: 800;
  color: #475569;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cipher-codex-ribbon {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.codex-chip {
  min-width: 34px;
  height: 44px;
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  user-select: none;
}

.codex-chip.is-highlight {
  background: #FEF3C7;
  border-color: #D97706;
  box-shadow: 0 0 0 2px #F59E0B;
  transform: translateY(-2px) scale(1.1);
}

.codex-letter {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  color: #1E293B;
  line-height: 1;
}

.codex-chip.is-highlight .codex-letter {
  color: #B45309;
}

.codex-num {
  font-size: 0.65rem;
  font-weight: 800;
  color: #64748B;
  line-height: 1;
  margin-top: 1px;
}

/* Decoder Equation Box */
.cipher-equation-card {
  text-align: center;
  margin-bottom: 20px;
}

.cipher-equation-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #F0FDF4;
  border: 2px dashed #86EFAC;
  padding: 10px 28px;
  border-radius: 18px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  color: #166534;
  box-shadow: inset 0 2px 4px rgba(22, 101, 52, 0.05);
}

.cipher-num {
  font-size: 2.3rem;
  font-weight: 800;
  color: #0F172A;
}

.cipher-op {
  font-size: 2.1rem;
  font-weight: 800;
  color: #16A34A;
}

.cipher-eq {
  font-size: 2.1rem;
  font-weight: 800;
  color: #059669;
}

.cipher-blank {
  font-size: 2.3rem;
  font-weight: 800;
  color: #D97706;
}

.cipher-shift {
  font-size: 0.95rem;
  font-weight: 800;
  color: #7C3AED;
  background: #EDE9FE;
  padding: 2px 8px;
  border-radius: 6px;
  margin: 0 4px;
}

/* 4 Wax Seal Options */
.cipher-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

.cipher-seal-btn {
  background: linear-gradient(180deg, #FFFFFF 0%, #FDF4E3 60%, #F9E7C4 100%);
  border: 2.5px solid #B45309;
  border-radius: 20px;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 0 #92400E, inset 0 2px 4px rgba(255, 255, 255, 0.9);
  position: relative;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 104px;
}

.cipher-seal-btn:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: #92400E;
  box-shadow: 0 10px 0 #78350F, inset 0 2px 6px rgba(255, 255, 255, 1);
  background: linear-gradient(180deg, #FFFFFF 0%, #FEF3C7 60%, #FDE68A 100%);
}

.cipher-seal-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #92400E;
}

.cipher-seal-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.seal-key-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #92400E;
}

.seal-icon-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.seal-stamp-icon {
  font-size: 1.15rem;
}

.seal-letter {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.35rem;
  font-weight: 900;
  color: #B45309;
}

.seal-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  color: #1E293B;
  line-height: 1.05;
}

.cipher-seal-btn.correct {
  border-color: #10B981 !important;
  background: #D1FAE5 !important;
  box-shadow: 0 6px 0 #059669 !important;
}

.cipher-seal-btn.correct .seal-val,
.cipher-seal-btn.correct .seal-letter {
  color: #047857 !important;
}

.cipher-seal-btn.wrong {
  border-color: #EF4444 !important;
  background: #FEE2E2 !important;
  box-shadow: 0 6px 0 #DC2626 !important;
  animation: cipher-seal-shake 0.4s ease;
}

.cipher-seal-btn.wrong .seal-val,
.cipher-seal-btn.wrong .seal-letter {
  color: #B91C1C !important;
}

@keyframes cipher-seal-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Victory Revealed Banner */
.cipher-revealed-banner {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 2px solid #F59E0B;
  border-radius: 16px;
  padding: 12px 18px;
  margin: 14px 0 18px;
  text-align: center;
}

.revealed-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: #92400E;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.revealed-word {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 900;
  color: #B45309;
  letter-spacing: 4px;
}

@media (max-width: 640px) {
  .cipher-stage-card {
    padding: 16px;
  }
  .cipher-options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .cipher-slot {
    width: 44px;
    height: 58px;
  }
  .slot-letter,
  .slot-letter-active {
    font-size: 1.45rem;
  }
  .cipher-equation-wrap {
    font-size: 1.8rem;
    padding: 6px 18px;
  }
  .seal-val {
    font-size: 1.8rem;
  }
}


/* ==========================================================================
   PHASE 12: MATH DUNGEON (HẦM NGỤC TOÁN HỌC 🗡️🏰)
   ========================================================================== */

.dungeon-progress-fill {
  background: linear-gradient(90deg, #DC2626 0%, #EA580C 50%, #F59E0B 100%);
}

.dungeon-combat-hud {
  background: #0F172A;
  border: 1.5px solid #334155;
  border-radius: 18px;
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dungeon-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dungeon-room-badge {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 0.95rem;
  font-weight: 800;
  color: #F8FAFC;
  background: #1E293B;
  border: 1px solid #475569;
  border-radius: 999px;
  padding: 3px 12px;
}

.dungeon-room-progress {
  font-size: 0.85rem;
  font-weight: 800;
  color: #94A3B8;
}

.dungeon-monster-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1E293B;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 8px 12px;
  gap: 12px;
}

.monster-info-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.monster-hud-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.monster-name-wrap {
  display: flex;
  flex-direction: column;
}

.monster-hud-name {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  color: #F8FAFC;
  line-height: 1.1;
}

.monster-hud-desc {
  font-size: 0.72rem;
  color: #94A3B8;
}

.monster-hp-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 140px;
}

.monster-hp-bar {
  width: 100%;
  height: 10px;
  background: #334155;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.monster-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #EF4444, #F59E0B);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.monster-hp-text {
  font-size: 0.72rem;
  font-weight: 800;
  color: #F87171;
  margin-top: 3px;
}

/* Stage Card */
.dungeon-stage-card {
  position: relative;
  background: #0F172A;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 2px solid #334155;
  overflow: hidden;
  padding: 20px;
}

.dungeon-3d-stage {
  width: 100%;
  height: 380px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: #0B0F19;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
  margin-bottom: 18px;
}

.dungeon-3d-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.dungeon-webgl-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #F59E0B;
  background: #1E293B;
}

/* Combat Equation */
.dungeon-equation-card {
  text-align: center;
  margin-bottom: 18px;
}

.dungeon-equation-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #1E293B;
  border: 2px dashed #F59E0B;
  padding: 8px 24px;
  border-radius: 16px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  color: #F8FAFC;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.dungeon-num {
  color: #F8FAFC;
}

.dungeon-op {
  color: #38BDF8;
}

.dungeon-eq {
  color: #F59E0B;
}

.dungeon-blank {
  color: #EF4444;
}

/* Sword Attack Options */
.dungeon-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

.dungeon-sword-btn {
  background: linear-gradient(180deg, #334155 0%, #1E293B 100%);
  border: 2.5px solid #64748B;
  border-radius: 20px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 0 #0F172A, inset 0 2px 4px rgba(255, 255, 255, 0.15);
  position: relative;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 98px;
}

.dungeon-sword-btn:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: #F59E0B;
  box-shadow: 0 10px 0 #B45309, inset 0 2px 6px rgba(245, 158, 11, 0.3);
  background: linear-gradient(180deg, #475569 0%, #1E293B 100%);
}

.dungeon-sword-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0F172A;
}

.dungeon-sword-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.sword-key-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #0F172A;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #94A3B8;
}

.sword-icon-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.sword-icon {
  font-size: 1.15rem;
}

.sword-action-tag {
  font-size: 0.72rem;
  font-weight: 800;
  color: #38BDF8;
  letter-spacing: 0.5px;
}

.sword-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  color: #F8FAFC;
  line-height: 1.05;
}

.dungeon-sword-btn.correct {
  border-color: #10B981 !important;
  background: linear-gradient(180deg, #065F46, #064E3B) !important;
  box-shadow: 0 6px 0 #047857 !important;
}

.dungeon-sword-btn.correct .sword-val {
  color: #34D399 !important;
}

.dungeon-sword-btn.wrong {
  border-color: #EF4444 !important;
  background: linear-gradient(180deg, #991B1B, #7F1D1D) !important;
  box-shadow: 0 6px 0 #991B1B !important;
  animation: dungeon-sword-shake 0.4s ease;
}

.dungeon-sword-btn.wrong .sword-val {
  color: #FCA5A5 !important;
}

@keyframes dungeon-sword-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Victory Treasure Highlight */
.dungeon-treasure-highlight {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border: 2px solid #F59E0B;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 14px 0 18px;
  text-align: center;
}

.treasure-icon {
  font-size: 2.5rem;
  margin-bottom: 4px;
}

.treasure-title {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.15rem;
  font-weight: 900;
  color: #FBBF24;
  letter-spacing: 1px;
}

@media (max-width: 640px) {
  .dungeon-3d-stage {
    height: 290px;
  }
  .dungeon-options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .dungeon-equation-wrap {
    font-size: 1.8rem;
    padding: 6px 18px;
  }
  .sword-val {
    font-size: 1.8rem;
  }
  .monster-hp-wrap {
    min-width: 90px;
  }
}

/* ==========================================================================
   Phase 13: Math Race 🏎️🏁 (Đường Đua Tốc Độ 3D) Styles
   ========================================================================== */

.race-cockpit-hud {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0B0F19 100%);
  border: 2px solid #334155;
  border-radius: 20px;
  padding: 14px 20px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.race-checkpoint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.race-checkpoint-badge {
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
  color: #FFFFFF;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.race-lap-progress {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  color: #94A3B8;
}

.race-telemetry-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.race-telemetry-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Digital Speedometer Gauge */
.speedometer-gauge {
  background: radial-gradient(circle, #1E293B 40%, #0F172A 90%);
  border: 3px solid #EF4444;
  border-radius: 16px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.4), inset 0 0 12px rgba(0, 0, 0, 0.5);
  min-width: 100px;
}

.speedometer-num {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  color: #F8FAFC;
  text-shadow: 0 0 12px rgba(248, 250, 252, 0.8), 0 0 24px rgba(239, 68, 68, 0.8);
}

.speedometer-unit {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #FCA5A5;
  margin-top: 2px;
}

.telemetry-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.race-pos-badge {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.15rem;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
}

.race-pos-badge.pos-first {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #FFFFFF;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

.race-pos-badge.pos-second {
  background: linear-gradient(135deg, #64748B 0%, #475569 100%);
  color: #E2E8F0;
  box-shadow: 0 0 10px rgba(100, 116, 139, 0.3);
}

.race-rival-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: #94A3B8;
}

/* Turbo Nitro Boost Bar */
.race-turbo-wrap {
  flex: 1;
  min-width: 200px;
}

.turbo-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 800;
  color: #38BDF8;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.turbo-bar-track {
  width: 100%;
  height: 14px;
  background: #1E293B;
  border: 2px solid #0284C7;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.turbo-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284C7 0%, #06B6D4 50%, #38BDF8 100%);
  border-radius: 999px;
  transition: width 0.35s ease-out;
  box-shadow: 0 0 10px #06B6D4;
}

.turbo-bar-fill.turbo-max {
  background: linear-gradient(90deg, #F59E0B 0%, #EF4444 50%, #EC4899 100%);
  box-shadow: 0 0 16px #EF4444;
  animation: turbo-pulse 0.8s infinite alternate;
}

@keyframes turbo-pulse {
  from { opacity: 0.85; filter: brightness(1); }
  to { opacity: 1; filter: brightness(1.3); }
}

.race-progress-fill {
  background: repeating-linear-gradient(
    45deg,
    #DC2626,
    #DC2626 12px,
    #FFFFFF 12px,
    #FFFFFF 24px
  );
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.4);
}

/* 3D Race Viewport */
.race-stage-card {
  background: #0B0F19;
  border: 2px solid #1E293B;
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.race-3d-stage {
  position: relative;
  width: 100%;
  height: 380px;
  border-radius: 18px;
  overflow: hidden;
  background: #090D1A;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.race-3d-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.race-webgl-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0F172A;
  color: #94A3B8;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.25rem;
  font-weight: 700;
}

/* Equation Display Card */
.race-equation-card {
  margin: 18px 0;
  text-align: center;
}

.race-equation-wrap {
  display: inline-block;
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border: 3px solid #EF4444;
  border-radius: 20px;
  padding: 10px 32px;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.3rem;
  font-weight: 900;
  color: #F8FAFC;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  letter-spacing: 2px;
}

/* 4 Gas Pedal Option Buttons */
.race-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 14px 0;
}

.race-pedal-btn {
  position: relative;
  background: linear-gradient(180deg, #334155 0%, #1E293B 60%, #0F172A 100%);
  border: 2px solid #475569;
  border-radius: 18px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

.race-pedal-btn:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.02);
  border-color: #EF4444;
  box-shadow: 0 12px 24px rgba(239, 68, 68, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.race-pedal-btn:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
}

.pedal-key-hint {
  position: absolute;
  top: 8px;
  left: 10px;
  background: #0284C7;
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pedal-pedal-top {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.pedal-icon {
  font-size: 1.1rem;
  color: #FACC15;
}

.pedal-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #94A3B8;
}

.pedal-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  color: #F8FAFC;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.race-pedal-btn.correct {
  background: linear-gradient(180deg, #10B981 0%, #059669 100%) !important;
  border-color: #34D399 !important;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.8) !important;
  transform: scale(1.05) !important;
}

.race-pedal-btn.wrong {
  background: linear-gradient(180deg, #EF4444 0%, #B91C1C 100%) !important;
  border-color: #F87171 !important;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.8) !important;
  animation: race-pedal-shake 0.4s ease-in-out;
}

@keyframes race-pedal-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* Victory Championship Trophy */
.race-trophy-highlight {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border: 2px solid #F59E0B;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 14px 0 18px;
  text-align: center;
}

.trophy-icon {
  font-size: 2.6rem;
  margin-bottom: 4px;
}

.trophy-title {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.15rem;
  font-weight: 900;
  color: #FBBF24;
  letter-spacing: 1px;
}

@media (max-width: 640px) {
  .race-3d-stage {
    height: 290px;
  }
  .race-options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .race-equation-wrap {
    font-size: 1.8rem;
    padding: 6px 18px;
  }
  .pedal-val {
    font-size: 1.8rem;
  }
  .race-telemetry-hud {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .race-telemetry-left {
    justify-content: space-between;
  }
}

/* ==========================================================================
   Phase 14: Câu Nào Khác Biệt? 🧠🔍 (Odd One Out) Styles
   ========================================================================== */

.detective-hud-card {
  background: linear-gradient(135deg, #0F172A 0%, #134E4A 50%, #0F172A 100%);
  border: 2px solid #14B8A6;
  border-radius: 20px;
  padding: 14px 20px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.detective-hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.detective-rank-badge {
  background: linear-gradient(135deg, #0D9488 0%, #115E59 100%);
  color: #FFFFFF;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detective-progress-text {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  color: #94A3B8;
}

.detective-progress-fill {
  background: linear-gradient(90deg, #0D9488 0%, #14B8A6 50%, #2DD4BF 100%);
  box-shadow: 0 0 12px rgba(20, 184, 166, 0.5);
}

.detective-stage-card {
  background: #0B0F19;
  border: 2px solid #1E293B;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.detective-clue-banner {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border: 2px solid #334155;
  border-radius: 18px;
  padding: 18px 24px;
  margin: 16px 0 22px;
  text-align: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.clue-tag-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid #14B8A6;
  border-radius: 999px;
  padding: 4px 14px;
  margin-bottom: 8px;
}

.clue-tag-icon {
  font-size: 1.05rem;
}

.clue-tag-text {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #2DD4BF;
}

.clue-prompt-text {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.45rem;
  font-weight: 800;
  color: #F8FAFC;
  margin: 4px 0 0;
  line-height: 1.35;
}

/* 4 Detective Cards Grid */
.detective-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin: 18px 0;
}

.detective-card-btn {
  position: relative;
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  border: 2px solid #334155;
  border-radius: 20px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  min-height: 140px;
  overflow: hidden;
}

.detective-card-btn:hover:not(:disabled) {
  transform: translateY(-5px) scale(1.02);
  border-color: #14B8A6;
  box-shadow: 0 14px 28px rgba(20, 184, 166, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.15);
}

.detective-card-btn:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
}

.detective-key-hint {
  position: absolute;
  top: 10px;
  left: 12px;
  background: #0D9488;
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.detective-card-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.detective-card-lens {
  font-size: 1.1rem;
}

.detective-card-tag {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #64748B;
}

.detective-card-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.1;
  color: #F8FAFC;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.detective-card-stamp {
  font-size: 0.72rem;
  font-weight: 800;
  color: #14B8A6;
  letter-spacing: 0.8px;
  margin-top: 8px;
  opacity: 0.8;
}

.detective-card-btn.correct {
  background: linear-gradient(180deg, #0D9488 0%, #065F46 100%) !important;
  border-color: #34D399 !important;
  box-shadow: 0 0 26px rgba(13, 148, 136, 0.8) !important;
  transform: scale(1.04) !important;
}

.detective-card-btn.correct .detective-card-stamp {
  color: #FDE047 !important;
  font-weight: 900;
}

.detective-card-btn.wrong {
  background: linear-gradient(180deg, #991B1B 0%, #7F1D1D 100%) !important;
  border-color: #F87171 !important;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.7) !important;
  animation: detective-card-shake 0.4s ease-in-out;
}

@keyframes detective-card-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* Detective Clue Analysis Card */
.detective-analysis-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(135deg, #134E4A 0%, #0F172A 100%);
  border: 2px solid #2DD4BF;
  border-radius: 18px;
  padding: 16px 20px;
  margin: 16px 0;
  box-shadow: 0 8px 24px rgba(20, 184, 166, 0.3);
  animation: analysis-fade-in 0.35s ease-out;
}

@keyframes analysis-fade-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.analysis-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.analysis-title {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 0.95rem;
  font-weight: 900;
  color: #FDE047;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.analysis-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: #E2E8F0;
  line-height: 1.45;
}

/* Victory Royal Detective Badge */
.detective-badge-highlight {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border: 2px solid #14B8A6;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 14px 0 18px;
  text-align: center;
}

.badge-icon {
  font-size: 2.6rem;
  margin-bottom: 4px;
}

.badge-title {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.15rem;
  font-weight: 900;
  color: #2DD4BF;
  letter-spacing: 1px;
}

@media (max-width: 640px) {
  .detective-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .detective-card-btn {
    min-height: 110px;
    padding: 16px;
  }
  .detective-card-val {
    font-size: 1.8rem;
  }
  .clue-prompt-text {
    font-size: 1.2rem;
  }
}

/* ==========================================================================
   Phase 15: Cân Toán Học ⚖️ (Math Balance 3D) Styles
   ========================================================================== */

.balance-telemetry-hud {
  background: linear-gradient(135deg, #0F172A 0%, #78350F 50%, #0F172A 100%);
  border: 2px solid #F59E0B;
  border-radius: 20px;
  padding: 14px 20px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.balance-hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.balance-round-badge {
  background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
  color: #FFFFFF;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.balance-progress-text {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  color: #94A3B8;
}

.balance-progress-fill {
  background: linear-gradient(90deg, #D97706 0%, #F59E0B 50%, #FBBF24 100%);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

.balance-stage-card {
  background: #0B0F19;
  border: 2px solid #1E293B;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* 3D Scale Viewport */
.balance-3d-stage {
  position: relative;
  width: 100%;
  height: 340px;
  border-radius: 18px;
  overflow: hidden;
  background: #090D1A;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
  margin-bottom: 18px;
}

.balance-3d-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.balance-webgl-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0F172A;
  color: #94A3B8;
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.25rem;
  font-weight: 700;
}

/* Scale Expression Board */
.scale-expression-board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0 22px;
  flex-wrap: wrap;
}

.scale-tray-box {
  flex: 1;
  min-width: 160px;
  max-width: 240px;
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border-radius: 18px;
  padding: 14px 18px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.left-tray-box {
  border: 2px solid #0284C7;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.25);
}

.left-tray-box .tray-label {
  color: #38BDF8;
}

.right-tray-box {
  border: 2px solid #EA580C;
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.25);
}

.right-tray-box .tray-label {
  color: #FB923C;
}

.tray-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  margin-bottom: 4px;
}

.tray-expr-val {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.1rem;
  font-weight: 900;
  color: #F8FAFC;
  line-height: 1.15;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.scale-operator-slot {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle, #1E293B 40%, #0F172A 90%);
  border: 3px dashed #F59E0B;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
  transition: all 0.25s ease;
}

.scale-operator-slot.correct {
  border-style: solid;
  border-color: #10B981;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.7);
}

.slot-symbol {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 2.4rem;
  font-weight: 900;
  color: #FBBF24;
}

.slot-symbol.correct-symbol {
  color: #34D399;
}

/* 3 Scale Operator Action Buttons (<, =, >) */
.scale-operators-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 16px 0;
}

.scale-op-btn {
  position: relative;
  background: linear-gradient(180deg, #334155 0%, #1E293B 60%, #0F172A 100%);
  border: 2px solid #475569;
  border-radius: 20px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

.scale-op-btn:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.02);
  border-color: #F59E0B;
  box-shadow: 0 12px 24px rgba(245, 158, 11, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.scale-op-btn:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
}

.op-key-hint {
  position: absolute;
  top: 8px;
  left: 10px;
  background: #D97706;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.op-symbol {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  color: #F8FAFC;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  margin-top: 8px;
}

.op-desc {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #94A3B8;
  margin-top: 4px;
}

.scale-op-btn.correct {
  background: linear-gradient(180deg, #10B981 0%, #059669 100%) !important;
  border-color: #34D399 !important;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.8) !important;
  transform: scale(1.05) !important;
}

.scale-op-btn.wrong {
  background: linear-gradient(180deg, #EF4444 0%, #B91C1C 100%) !important;
  border-color: #F87171 !important;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.8) !important;
  animation: scale-op-shake 0.4s ease-in-out;
}

@keyframes scale-op-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* Victory Grand Scale Trophy Highlight */
.balance-trophy-highlight {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border: 2px solid #F59E0B;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 14px 0 18px;
  text-align: center;
}

.balance-trophy-highlight .trophy-icon {
  font-size: 2.7rem;
  margin-bottom: 4px;
}

.balance-trophy-highlight .trophy-title {
  font-family: var(--font-heading, "Baloo 2", sans-serif);
  font-size: 1.15rem;
  font-weight: 900;
  color: #FBBF24;
  letter-spacing: 1px;
}

@media (max-width: 640px) {
  .balance-3d-stage {
    height: 270px;
  }
  .scale-operators-grid {
    gap: 10px;
  }
  .scale-op-btn {
    padding: 12px 6px;
  }
  .op-symbol {
    font-size: 2.2rem;
  }
  .op-desc {
    font-size: 0.65rem;
  }
  .tray-expr-val {
    font-size: 1.6rem;
  }
  .scale-operator-slot {
    width: 56px;
    height: 56px;
  }
  .slot-symbol {
    font-size: 1.8rem;
  }
}
