/* ==========================================================================
   Arene AcademieCo - Multi-Game Educational Arena
   Pop Art / Modern / Fun style
   All styles scoped to #academy-game-root
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
#academy-game-root {
  --bdt-bg: #1a1a2e;
  --bdt-primary: #e94560;
  --bdt-secondary: #0f3460;
  --bdt-energy: #f5c518;
  --bdt-success: #00d2ff;
  --bdt-text: #ffffff;
  --bdt-heart: #ff4757;
  --bdt-heart-lost: #444466;
  --bdt-border: 3px solid rgba(233, 69, 96, 0.4);
  --bdt-radius: 14px;
  --bdt-radius-sm: 8px;
  --bdt-shadow-glow: 0 0 20px rgba(233, 69, 96, 0.3);
  --bdt-font: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --bdt-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   Base Container
   -------------------------------------------------------------------------- */
#academy-game-root {
  font-family: var(--bdt-font);
  background: var(--bdt-bg);
  color: var(--bdt-text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

#academy-game-root *,
#academy-game-root *::before,
#academy-game-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   Shared Components
   -------------------------------------------------------------------------- */

/* --- Player Card --- */
#academy-game-root .bdt-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

#academy-game-root .bdt-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--bdt-primary);
  box-shadow: 0 0 15px rgba(233, 69, 96, 0.4);
}

#academy-game-root .bdt-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Rarity glow overrides */
#academy-game-root .bdt-avatar-wrap.rarity-common {
  border-color: #b0b0b0;
  box-shadow: 0 0 12px rgba(176, 176, 176, 0.3);
}
#academy-game-root .bdt-avatar-wrap.rarity-rare {
  border-color: #4dabf7;
  box-shadow: 0 0 18px rgba(77, 171, 247, 0.5);
}
#academy-game-root .bdt-avatar-wrap.rarity-epic {
  border-color: #be4bdb;
  box-shadow: 0 0 22px rgba(190, 75, 219, 0.5);
}
#academy-game-root .bdt-avatar-wrap.rarity-legendary {
  border-color: var(--bdt-energy);
  box-shadow: 0 0 28px rgba(245, 197, 24, 0.6);
  animation: legendaryPulse 2s ease-in-out infinite;
}

#academy-game-root .bdt-player-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-align: center;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#academy-game-root .bdt-player-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--bdt-energy);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#academy-game-root .bdt-player-level {
  font-size: 12px;
  font-weight: 700;
  color: var(--bdt-success);
}

/* --- Hearts --- */
#academy-game-root .bdt-hearts {
  display: flex;
  gap: 6px;
  font-size: 22px;
  line-height: 1;
}

#academy-game-root .bdt-heart {
  color: var(--bdt-heart);
  transition: all 0.3s ease;
  display: inline-block;
}

#academy-game-root .bdt-heart.lost {
  color: var(--bdt-heart-lost);
  transform: scale(0.85);
  animation: heartBreak 0.5s ease forwards;
}

/* --- Buttons --- */
#academy-game-root .bdt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--bdt-font);
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 14px 32px;
  border: 3px solid transparent;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--bdt-transition);
  position: relative;
  overflow: hidden;
  outline: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#academy-game-root .bdt-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}

#academy-game-root .bdt-btn:active {
  transform: scale(0.95);
}

#academy-game-root .bdt-btn-primary {
  background: linear-gradient(135deg, var(--bdt-primary), #d63851);
  color: var(--bdt-text);
  border-color: var(--bdt-primary);
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
}

#academy-game-root .bdt-btn-primary:hover {
  box-shadow: 0 6px 30px rgba(233, 69, 96, 0.6);
  transform: translateY(-2px);
}

#academy-game-root .bdt-btn-secondary {
  background: transparent;
  color: var(--bdt-text);
  border-color: rgba(255, 255, 255, 0.3);
}

#academy-game-root .bdt-btn-secondary:hover {
  border-color: var(--bdt-success);
  color: var(--bdt-success);
}

#academy-game-root .bdt-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* --------------------------------------------------------------------------
   SCREEN 0: MENU
   -------------------------------------------------------------------------- */
#academy-game-root .aca-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 600px;
  width: 100%;
  animation: fadeIn 0.5s ease;
  padding: 10px 0;
}

#academy-game-root .aca-logo-big {
  width: 80px;
  height: 80px;
}

#academy-game-root .aca-menu-title {
  font-size: 30px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 3px;
  text-align: center;
  background: linear-gradient(135deg, var(--bdt-primary), var(--bdt-energy), var(--bdt-success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

#academy-game-root .aca-menu-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  margin-top: -12px;
}

#academy-game-root .aca-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

#academy-game-root .aca-section-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: rgba(255, 255, 255, 0.4);
}

/* --- Level buttons --- */
#academy-game-root .aca-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

#academy-game-root .aca-level-btn {
  font-family: var(--bdt-font);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 50px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 52, 96, 0.3);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: var(--bdt-transition);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#academy-game-root .aca-level-btn:hover {
  border-color: var(--bdt-success);
  color: var(--bdt-success);
}

#academy-game-root .aca-level-btn.active {
  border-color: var(--bdt-energy);
  color: var(--bdt-energy);
  background: rgba(245, 197, 24, 0.12);
  box-shadow: 0 0 14px rgba(245, 197, 24, 0.25);
}

/* --- Mode cards --- */
#academy-game-root .aca-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 420px;
}

#academy-game-root .aca-mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--bdt-radius);
  background: linear-gradient(145deg, rgba(15, 52, 96, 0.4), rgba(26, 26, 46, 0.7));
  cursor: pointer;
  transition: var(--bdt-transition);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#academy-game-root .aca-mode-card:hover {
  border-color: rgba(0, 210, 255, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.15);
}

#academy-game-root .aca-mode-card.selected {
  border-color: var(--bdt-success);
  background: linear-gradient(145deg, rgba(0, 210, 255, 0.1), rgba(15, 52, 96, 0.5));
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.25);
}

#academy-game-root .aca-mode-icon {
  font-size: 32px;
  line-height: 1;
}

#academy-game-root .aca-mode-label {
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.5px;
}

#academy-game-root .aca-mode-desc {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  line-height: 1.3;
}

/* --- Play button --- */
#academy-game-root .aca-play-btn {
  margin-top: 4px;
  font-size: 18px;
  padding: 16px 48px;
}

/* --------------------------------------------------------------------------
   SCREEN 1: Matchmaking
   -------------------------------------------------------------------------- */
#academy-game-root .bdt-matchmaking {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 600px;
  width: 100%;
  animation: fadeIn 0.5s ease;
}

/* --- Logo --- */
#academy-game-root .bdt-logo {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 0 18px rgba(0, 210, 255, 0.5)) drop-shadow(0 0 40px rgba(0, 210, 255, 0.2));
  animation: logoPulse 3s ease-in-out infinite;
}

#academy-game-root .bdt-logo svg {
  width: 100%;
  height: 100%;
}

#academy-game-root .bdt-logo svg path {
  fill: rgba(255, 255, 255, 0.9);
}

@keyframes logoPulse {
  0%, 100% {
    filter: drop-shadow(0 0 18px rgba(0, 210, 255, 0.5)) drop-shadow(0 0 40px rgba(0, 210, 255, 0.2));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 28px rgba(0, 210, 255, 0.7)) drop-shadow(0 0 60px rgba(245, 197, 24, 0.3));
    transform: scale(1.04);
  }
}

#academy-game-root .bdt-matchmaking-title {
  font-size: 28px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  background: linear-gradient(135deg, var(--bdt-primary), var(--bdt-energy));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#academy-game-root .aca-level-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 5px 16px;
  border-radius: 50px;
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.3);
  color: var(--bdt-success);
  letter-spacing: 1px;
  margin-top: -12px;
}

/* Versus row */
#academy-game-root .bdt-versus-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

#academy-game-root .bdt-versus-row .bdt-player {
  flex: 1;
  max-width: 180px;
}

#academy-game-root .bdt-vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 60px;
}

#academy-game-root .bdt-vs-text {
  font-size: 32px;
  font-weight: 900;
  color: var(--bdt-energy);
  text-shadow: 0 0 20px rgba(245, 197, 24, 0.5);
}

/* Searching animation */
#academy-game-root .bdt-searching {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 180px;
}

#academy-game-root .bdt-searching-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px dashed var(--bdt-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  animation: spin 3s linear infinite, pulse 1.5s ease-in-out infinite;
}

#academy-game-root .bdt-searching-text {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Opponent found */
#academy-game-root .bdt-player.opponent-found {
  animation: slideInRight 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#academy-game-root .bdt-player.user-reveal {
  animation: slideInLeft 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Difficulty selector */
#academy-game-root .bdt-difficulty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

#academy-game-root .bdt-difficulty-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.5);
}

#academy-game-root .bdt-difficulty-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

#academy-game-root .bdt-diff-btn {
  font-family: var(--bdt-font);
  font-size: 13px;
  font-weight: 800;
  padding: 10px 20px;
  border-radius: 50px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 52, 96, 0.4);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: var(--bdt-transition);
  text-transform: uppercase;
  letter-spacing: 1px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#academy-game-root .bdt-diff-btn:hover {
  border-color: var(--bdt-success);
  color: var(--bdt-success);
}

#academy-game-root .bdt-diff-btn.active {
  border-color: var(--bdt-energy);
  color: var(--bdt-energy);
  background: rgba(245, 197, 24, 0.1);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

#academy-game-root .bdt-diff-detail {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
}

/* --------------------------------------------------------------------------
   SCREEN 2: Battle
   -------------------------------------------------------------------------- */
#academy-game-root .bdt-battle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 560px;
  animation: fadeIn 0.4s ease;
}

/* Top bar */
#academy-game-root .bdt-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

#academy-game-root .bdt-topbar-player {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

#academy-game-root .bdt-topbar-player.right {
  flex-direction: row-reverse;
  text-align: right;
}

#academy-game-root .bdt-topbar-player .bdt-mini-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--bdt-primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bdt-secondary);
  font-weight: 900;
  font-size: 16px;
}

#academy-game-root .bdt-topbar-player .bdt-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#academy-game-root .bdt-topbar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#academy-game-root .bdt-topbar-name {
  font-size: 13px;
  font-weight: 800;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#academy-game-root .bdt-topbar-hearts {
  font-size: 16px;
  display: flex;
  gap: 3px;
}

#academy-game-root .bdt-topbar-player.right .bdt-topbar-hearts {
  justify-content: flex-end;
}

/* Round counter */
#academy-game-root .bdt-round-counter {
  font-size: 14px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  flex-shrink: 0;
}

/* Timer bar */
#academy-game-root .bdt-timer-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

#academy-game-root .bdt-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--bdt-success), var(--bdt-energy));
  border-radius: 4px;
  width: 100%;
  transform-origin: right center;
  transition: background 0.3s ease;
}

#academy-game-root .bdt-timer-bar.warning {
  background: linear-gradient(90deg, var(--bdt-energy), #ff9500);
}

#academy-game-root .bdt-timer-bar.danger {
  background: linear-gradient(90deg, var(--bdt-primary), #ff4757);
  animation: timerPulse 0.5s ease-in-out infinite;
}

/* Question display */
#academy-game-root .bdt-equation-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  padding: 20px 0;
}

#academy-game-root .bdt-question-display {
  text-align: center;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 100%;
}

/* Math equation display */
#academy-game-root .bdt-question-display .bdt-equation {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 3px;
  text-shadow: 0 0 30px rgba(233, 69, 96, 0.4);
  line-height: 1.3;
}

/* Text question display */
#academy-game-root .bdt-question-prompt {
  font-size: 18px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 12px;
  line-height: 1.4;
  padding: 0 8px;
}

#academy-game-root .bdt-question-word {
  font-size: 36px;
  font-weight: 900;
  color: var(--bdt-energy);
  text-shadow: 0 0 20px rgba(245, 197, 24, 0.3);
  letter-spacing: 2px;
}

/* Answer grid */
#academy-game-root .bdt-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 10;
}

#academy-game-root .bdt-answer-btn {
  font-family: var(--bdt-font);
  font-size: 22px;
  font-weight: 900;
  padding: 16px 12px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--bdt-radius);
  background: linear-gradient(145deg, rgba(15, 52, 96, 0.5), rgba(26, 26, 46, 0.8));
  color: var(--bdt-text);
  cursor: pointer;
  transition: var(--bdt-transition);
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
}

#academy-game-root .bdt-answer-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), transparent);
  pointer-events: none;
}

#academy-game-root .bdt-answer-btn:hover:not(:disabled) {
  border-color: var(--bdt-success);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.2);
}

#academy-game-root .bdt-answer-btn:active:not(:disabled) {
  transform: scale(0.95);
}

#academy-game-root .bdt-answer-btn.correct {
  border-color: var(--bdt-success);
  background: rgba(0, 210, 255, 0.2);
  animation: bounce 0.5s ease;
  box-shadow: 0 0 25px rgba(0, 210, 255, 0.4);
}

#academy-game-root .bdt-answer-btn.wrong {
  border-color: var(--bdt-heart);
  background: rgba(255, 71, 87, 0.2);
  animation: shake 0.5s ease;
  box-shadow: 0 0 25px rgba(255, 71, 87, 0.3);
}

#academy-game-root .bdt-answer-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#academy-game-root .bdt-answer-btn.bot-choice {
  border-color: #be4bdb;
  box-shadow: 0 0 18px rgba(190, 75, 219, 0.35);
  position: relative;
}

#academy-game-root .bdt-bot-tag {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 14px;
  line-height: 1;
  opacity: 0.9;
  pointer-events: none;
}

/* Battle feedback overlay */
#academy-game-root .bdt-feedback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
}

#academy-game-root .bdt-feedback-text {
  font-size: 48px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow: 0 0 30px currentColor;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), fadeOut 0.8s 0.5s ease forwards;
}

#academy-game-root .bdt-feedback-text.hit { color: var(--bdt-success); }
#academy-game-root .bdt-feedback-text.slow { color: #f5c518; }
#academy-game-root .bdt-feedback-text.error { color: var(--bdt-heart); }
#academy-game-root .bdt-feedback-text.timeout { color: var(--bdt-energy); }

/* Hit flash overlay */
#academy-game-root .bdt-hit-flash {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  animation: hitFlash 0.4s ease forwards;
}

#academy-game-root .bdt-hit-flash.user-hit { background: rgba(255, 71, 87, 0.3); }
#academy-game-root .bdt-hit-flash.opponent-hit { background: rgba(0, 210, 255, 0.2); }

/* --------------------------------------------------------------------------
   SCREEN 3: Results
   -------------------------------------------------------------------------- */
#academy-game-root .bdt-results {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 100;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 20px 24px;
  animation: fadeIn 0.6s ease;
  overflow-y: auto;
}

#academy-game-root .bdt-results-title {
  font-size: 42px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-align: center;
  line-height: 1.2;
}

#academy-game-root .bdt-results-title.victory {
  background: linear-gradient(135deg, var(--bdt-energy), var(--bdt-success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: bounce 0.6s ease;
  text-shadow: none;
}

#academy-game-root .bdt-results-title.defeat { color: rgba(255, 255, 255, 0.5); }
#academy-game-root .bdt-results-title.draw { color: var(--bdt-energy); }

#academy-game-root .bdt-results-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}

#academy-game-root .bdt-results-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--bdt-energy);
  box-shadow: 0 0 30px rgba(245, 197, 24, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bdt-secondary);
  font-size: 40px;
  font-weight: 900;
}

#academy-game-root .bdt-results-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#academy-game-root .bdt-rewards {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

#academy-game-root .bdt-reward {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 52, 96, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 8px 18px;
  font-size: 16px;
  font-weight: 800;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

#academy-game-root .bdt-reward:nth-child(1) { animation-delay: 0.2s; }
#academy-game-root .bdt-reward:nth-child(2) { animation-delay: 0.35s; }

#academy-game-root .bdt-reward .xp { color: var(--bdt-success); }
#academy-game-root .bdt-reward .gems { color: var(--bdt-energy); }

#academy-game-root .bdt-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

#academy-game-root .bdt-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 50px;
  background: rgba(245, 197, 24, 0.1);
  border: 1px solid rgba(245, 197, 24, 0.3);
  color: var(--bdt-energy);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

#academy-game-root .bdt-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#academy-game-root .bdt-stat {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
}

#academy-game-root .bdt-stat strong { color: var(--bdt-text); }

/* ── Score section ── */
#academy-game-root .bdt-score-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#academy-game-root .bdt-score-value {
  font-size: 40px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--bdt-energy), #ff6b81);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#academy-game-root .bdt-stars {
  display: flex;
  gap: 6px;
  font-size: 32px;
}

#academy-game-root .bdt-star.filled {
  color: var(--bdt-energy);
  text-shadow: 0 0 12px rgba(245, 197, 24, 0.5);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
#academy-game-root .bdt-star.filled:nth-child(1) { animation-delay: 0.1s; }
#academy-game-root .bdt-star.filled:nth-child(2) { animation-delay: 0.25s; }
#academy-game-root .bdt-star.filled:nth-child(3) { animation-delay: 0.4s; }
#academy-game-root .bdt-star.empty { color: rgba(255, 255, 255, 0.15); }

/* ── Stats grid ── */
#academy-game-root .bdt-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 500px;
}

#academy-game-root .bdt-stat-box {
  text-align: center;
  background: rgba(15, 52, 96, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 6px;
}

#academy-game-root .bdt-stat-number {
  font-size: 20px;
  font-weight: 900;
  color: var(--bdt-text);
}

#academy-game-root .bdt-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
}

/* ── Round recap ── */
#academy-game-root .bdt-recap-section {
  width: 100%;
  max-width: 520px;
}

#academy-game-root .bdt-recap-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 8px;
}

#academy-game-root .bdt-recap-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

#academy-game-root .bdt-recap-list::-webkit-scrollbar { width: 4px; }
#academy-game-root .bdt-recap-list::-webkit-scrollbar-track { background: transparent; }
#academy-game-root .bdt-recap-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

#academy-game-root .bdt-recap-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(15, 52, 96, 0.3);
  font-size: 13px;
  font-weight: 600;
}

#academy-game-root .bdt-recap-row.wrong,
#academy-game-root .bdt-recap-row.timeout { background: rgba(233, 69, 96, 0.1); }
#academy-game-root .bdt-recap-row.hit { background: rgba(46, 213, 115, 0.1); }
#academy-game-root .bdt-recap-row.slow { background: rgba(245, 197, 24, 0.08); }
#academy-game-root .bdt-recap-row.both_wrong,
#academy-game-root .bdt-recap-row.both_timeout { background: rgba(190, 75, 219, 0.08); }

#academy-game-root .bdt-recap-num {
  color: rgba(255, 255, 255, 0.3);
  font-size: 11px;
  min-width: 16px;
}

#academy-game-root .bdt-recap-icon { font-size: 14px; flex-shrink: 0; }

#academy-game-root .bdt-recap-q {
  flex: 1;
  color: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#academy-game-root .bdt-recap-time {
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  min-width: 35px;
  text-align: right;
}

#academy-game-root .bdt-recap-pts {
  font-size: 12px;
  font-weight: 800;
  min-width: 45px;
  text-align: right;
  color: rgba(255, 255, 255, 0.3);
}

#academy-game-root .bdt-recap-pts.pos { color: var(--bdt-success); }

#academy-game-root .bdt-results-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

/* --------------------------------------------------------------------------
   Confetti
   -------------------------------------------------------------------------- */
#academy-game-root .bdt-confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 110;
  overflow: hidden;
}

#academy-game-root .bdt-confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall linear forwards;
}

#academy-game-root .bdt-confetti-piece.square { border-radius: 2px; }
#academy-game-root .bdt-confetti-piece.circle { border-radius: 50%; }

/* Floating Text */
#academy-game-root .bdt-float-text {
  position: absolute;
  font-size: 20px;
  font-weight: 900;
  pointer-events: none;
  z-index: 30;
  animation: floatUp 1.2s ease forwards;
}

/* --------------------------------------------------------------------------
   Countdown overlay
   -------------------------------------------------------------------------- */
#academy-game-root .bdt-countdown-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#academy-game-root .bdt-countdown-number {
  font-size: 120px;
  font-weight: 900;
  color: var(--bdt-energy);
  text-shadow: 0 0 40px rgba(245, 197, 24, 0.6);
  animation: countdownPop 0.8s ease forwards;
}

/* --------------------------------------------------------------------------
   Keyframe Animations
   -------------------------------------------------------------------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-8px) rotate(-1deg); }
  20% { transform: translateX(8px) rotate(1deg); }
  30% { transform: translateX(-6px) rotate(-0.5deg); }
  40% { transform: translateX(6px) rotate(0.5deg); }
  50% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@keyframes bounce {
  0% { transform: scale(1); }
  20% { transform: scale(1.15); }
  40% { transform: scale(0.95); }
  60% { transform: scale(1.05); }
  80% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-80px) scale(0.8); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(80px) scale(0.8); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

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

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg) scale(0.3); opacity: 0; }
}

@keyframes timerPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.3); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes hitFlash { 0% { opacity: 0.7; } 100% { opacity: 0; } }

@keyframes heartBreak {
  0% { transform: scale(1); }
  25% { transform: scale(1.3) rotate(-10deg); }
  50% { transform: scale(0.6) rotate(5deg); }
  100% { transform: scale(0.85) rotate(0); }
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(1.3); }
}

@keyframes legendaryPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(245, 197, 24, 0.4); }
  50% { box-shadow: 0 0 35px rgba(245, 197, 24, 0.7); }
}

@keyframes countdownPop {
  0% { opacity: 0; transform: scale(2.5); }
  50% { opacity: 1; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(0.5); }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  #academy-game-root { padding: 12px; }

  #academy-game-root .aca-menu-title { font-size: 22px; letter-spacing: 2px; }
  #academy-game-root .aca-logo-big { width: 60px; height: 60px; }
  #academy-game-root .aca-level-btn { font-size: 12px; padding: 7px 12px; }
  #academy-game-root .aca-mode-card { padding: 14px 8px; }
  #academy-game-root .aca-mode-icon { font-size: 26px; }
  #academy-game-root .aca-mode-label { font-size: 12px; }

  #academy-game-root .bdt-matchmaking-title { font-size: 20px; letter-spacing: 1px; }
  #academy-game-root .bdt-avatar-wrap { width: 60px; height: 60px; }
  #academy-game-root .bdt-player-name { font-size: 13px; }
  #academy-game-root .bdt-vs-text { font-size: 24px; }

  #academy-game-root .bdt-question-display .bdt-equation { font-size: 34px; }
  #academy-game-root .bdt-question-prompt { font-size: 15px; }
  #academy-game-root .bdt-question-word { font-size: 26px; }
  #academy-game-root .bdt-answer-btn { font-size: 18px; padding: 14px 10px; }

  #academy-game-root .bdt-results-title { font-size: 30px; letter-spacing: 2px; }
  #academy-game-root .bdt-score-value { font-size: 30px; }
  #academy-game-root .bdt-stars { font-size: 26px; }
  #academy-game-root .bdt-stats-grid { grid-template-columns: repeat(2, 1fr); }
  #academy-game-root .bdt-recap-q { max-width: 120px; }
  #academy-game-root .bdt-feedback-text { font-size: 32px; }
  #academy-game-root .bdt-topbar-name { font-size: 11px; max-width: 70px; }
  #academy-game-root .bdt-topbar-player .bdt-mini-avatar { width: 32px; height: 32px; }
  #academy-game-root .bdt-btn { font-size: 14px; padding: 12px 24px; }
  #academy-game-root .bdt-countdown-number { font-size: 80px; }
}

@media (max-width: 360px) {
  #academy-game-root .bdt-question-display .bdt-equation { font-size: 26px; }
  #academy-game-root .bdt-question-word { font-size: 22px; }
  #academy-game-root .bdt-answers { gap: 8px; }
  #academy-game-root .bdt-answer-btn { font-size: 16px; padding: 12px 8px; }
  #academy-game-root .aca-modes { gap: 8px; }
}
