/* GAME OVERLAY MODAL */
.game-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.game-modal.active {
  display: flex;
}

.game-window {
  background: white;
  width: 100%;
  max-width: 820px;
  min-height: 560px;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* GAME HEADER HUD */
.game-hud {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-icon {
  font-size: 26px;
}

.hud-name {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

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

.hud-badge {
  background: white;
  border: 1px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-timer {
  color: #ef4444;
}

.hud-score {
  color: #2563eb;
}

.hud-close-btn {
  background: #f1f5f9;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s;
}

.hud-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* GAME MAIN CANVAS / ARENA */
.game-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 24px;
  position: relative;
  background: #ffffff;
  overflow: auto;
}

.game-viewport canvas {
  touch-action: none;
  outline: none;
}

/* UNIVERSAL INTERACTIVE ELEMENTS */
.math-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  max-width: 600px;
  width: 100%;
}

.math-question {
  font-size: 40px;
  font-weight: 900;
  color: #1e3a8a;
  margin-bottom: 24px;
  font-family: 'Courier New', Courier, monospace;
}

.math-hint {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 20px;
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
}

.btn-answer {
  background: white;
  border: 2px solid #cbd5e1;
  padding: 16px;
  border-radius: 12px;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.btn-answer:hover {
  border-color: #2563eb;
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.15);
}

.btn-answer.correct {
  background: #10b981 !important;
  color: white !important;
  border-color: #059669 !important;
}

.btn-answer.wrong {
  background: #ef4444 !important;
  color: white !important;
  border-color: #dc2626 !important;
}

/* GAME CANVAS STYLING */
canvas.game-canvas {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  max-width: 100%;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.04);
}

/* 1v1 DUEL ARENA SPECIFIC HUD */
.duel-health-bars {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 20px;
  gap: 30px;
}

.player-bar-container {
  flex: 1;
}

.player-label {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}

.health-track {
  height: 14px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.health-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s ease;
}

.health-fill.danger {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* GAME OVER SCREEN */
.game-over-panel {
  text-align: center;
  animation: fadeIn 0.4s ease;
}

.game-over-icon {
  font-size: 60px;
  margin-bottom: 12px;
}

.game-over-title {
  font-size: 28px;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 8px;
}

.game-over-score {
  font-size: 44px;
  font-weight: 900;
  color: #2563eb;
  margin-bottom: 24px;
}

.btn-restart {
  background: #2563eb;
  color: white;
  border: none;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  transition: all 0.2s;
}

.btn-restart:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
}
