@keyframes hm-game-mode-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(1.08);
  }
}

@keyframes hm-game-mode-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@media (max-width: 760px) {
  .hm-game-mode-check-wrapper {
    position: static !important;
    margin: 10px auto;
    text-align: center;
    width: auto;
  }

  .hm-game-mode-student__topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .hm-game-mode-student__hud {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .hm-game-mode-hud-chip {
    flex: 1;
  }

  .hm-game-mode-options-grid {
    grid-template-columns: 1fr;
  }

  .hm-game-mode-option {
    min-height: 96px;
  }

  .hm-game-mode-teacher-grid,
  .hm-game-mode-reveal-panel,
  .hm-game-mode-podium,
  .hm-game-mode-console-layout,
  .hm-game-mode-projector-options,
  .hm-game-mode-projector-final-grid,
  .hm-game-mode-projector-podium div {
    grid-template-columns: 1fr;
  }

  .hm-game-mode-console-header {
    align-items: stretch;
    flex-direction: column;
  }

  .hm-game-mode-console-header__actions {
    justify-content: flex-start;
  }

  .hm-game-mode-projector-route {
    overflow: auto;
  }

  .hm-game-mode-projector-layer {
    min-height: auto;
    padding-bottom: 4rem;
  }

  .hm-game-mode-projector-race__row {
    grid-template-columns: minmax(76px, auto) minmax(0, 1fr) auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hm-game-mode-check-wrapper.checking i,
  .hm-game-mode-pulse-dot {
    animation: none;
  }

  .hm-game-mode-option,
  .hm-game-mode-team-lane__track i {
    transition: none;
  }
}

/* New Visual and Responsive Updates */
.hm-game-mode-multiplier-gauge {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
  margin: 0.5rem auto 1rem;
}
.hm-game-mode-multiplier-gauge__cell {
  width: 60px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.35);
  transition: all 0.2s ease;
}
.hm-game-mode-multiplier-gauge__cell.is-tier-10 {
  background: rgba(239, 68, 68, 0.12);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-12 {
  background: rgba(249, 115, 22, 0.12);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-15 {
  background: rgba(132, 204, 22, 0.12);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-20 {
  background: rgba(22, 163, 74, 0.12);
}
.hm-game-mode-multiplier-gauge__cell.is-active {
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 0 12px var(--glow-color);
  transform: scale(1.05);
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-10.is-active {
  background: #ef4444;
  --glow-color: rgba(239, 68, 68, 0.5);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-12.is-active {
  background: #f97316;
  --glow-color: rgba(249, 115, 22, 0.5);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-15.is-active {
  background: #84cc16;
  --glow-color: rgba(132, 204, 22, 0.5);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-20.is-active {
  background: #16a34a;
  --glow-color: rgba(22, 163, 74, 0.5);
}

.hm-game-mode-refresh-chip,
.hm-game-mode-exit-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}
.hm-game-mode-refresh-button,
.hm-game-mode-exit-button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 20px;
  margin-top: 2px;
  outline: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.hm-game-mode-refresh-button:hover,
.hm-game-mode-exit-button:hover {
  transform: scale(1.1);
  opacity: 0.8;
}

.hm-game-mode-score-feedback-box {
  background: rgba(245, 181, 27, 0.08);
  border: 2px solid rgba(245, 181, 27, 0.35);
  border-radius: 12px;
  padding: 0.9rem 1.4rem;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  box-shadow: 0 8px 32px rgba(245, 181, 27, 0.12);
  display: inline-block;
  margin: 0.8rem auto;
  text-align: center;
  line-height: 1.4;
}
.hm-feedback-num {
  color: #f5b51b;
  font-size: 1.2rem;
  font-weight: 900;
}
.hm-feedback-total {
  color: #10b981;
  font-size: 1.3rem;
  font-weight: 900;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

/* Laptop Height Adjustments */
@media (max-height: 850px) {
  .hm-game-mode-student__arena {
    grid-template-rows: auto auto 1fr auto;
    padding: 0.5rem 1rem;
  }
  .hm-game-mode-student__topbar {
    gap: 0.5rem;
  }
  .hm-game-mode-question-panel h1 {
    font-size: clamp(1.2rem, 2.5vw, 1.95rem) !important;
    line-height: 1.1;
  }
  .hm-game-mode-question-panel {
    min-height: auto;
  }
  .hm-game-mode-option {
    min-height: clamp(80px, 11vh, 116px) !important;
    padding: 0.6rem 1rem;
  }
  .hm-game-mode-option__key {
    height: 40px;
    width: 40px;
    font-size: 1.1rem;
    margin-right: 0.6rem;
  }
  .hm-game-mode-option__text {
    font-size: clamp(0.9rem, 1.8vw, 1.15rem) !important;
  }
  .hm-game-mode-multiplier-gauge {
    margin: 0.2rem auto 0.4rem;
  }
  .hm-game-mode-score-feedback-box {
    margin: 0.4rem auto;
    padding: 0.55rem 1rem;
    font-size: 0.92rem;
  }
  .hm-feedback-num {
    font-size: 1.05rem;
  }
  .hm-feedback-total {
    font-size: 1.15rem;
  }
  .hm-game-mode-score-strip__row {
    gap: 0.5rem;
  }
}

/* ==========================================================================
   HiveMind Game Mode Student Scoring and Multiplier UI Styles
   ========================================================================== */

/* Multi-State Multiplier Gauge States */
.hm-game-mode-multiplier-gauge__cell.is-applied {
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 0 12px var(--glow-color);
  transform: scale(1.05);
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-10.is-applied {
  background: #ef4444;
  --glow-color: rgba(239, 68, 68, 0.5);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-12.is-applied {
  background: #f97316;
  --glow-color: rgba(249, 115, 22, 0.5);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-15.is-applied {
  background: #84cc16;
  --glow-color: rgba(132, 204, 22, 0.5);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-20.is-applied {
  background: #16a34a;
  --glow-color: rgba(22, 163, 74, 0.5);
}

.hm-game-mode-multiplier-gauge__cell.is-unlocked-next {
  color: #ffffff;
  font-weight: 900;
  border: 2px dashed var(--glow-color);
  transform: scale(1.02);
  background: rgba(255, 255, 255, 0.05);
}
.hm-game-mode-multiplier-gauge__cell.is-tier-10.is-unlocked-next {
  --glow-color: #ef4444;
}
.hm-game-mode-multiplier-gauge__cell.is-tier-12.is-unlocked-next {
  --glow-color: #f97316;
}
.hm-game-mode-multiplier-gauge__cell.is-tier-15.is-unlocked-next {
  --glow-color: #84cc16;
}
.hm-game-mode-multiplier-gauge__cell.is-tier-20.is-unlocked-next {
  --glow-color: #16a34a;
}

.hm-game-mode-multiplier-gauge__cell.is-inactive {
  opacity: 0.4;
  filter: grayscale(40%);
}

/* Animations & Dynamic Streak Glow */
.hm-game-mode-student-streak {
  border-color: hsl(349, calc(16% + var(--streak-intensity) * 16.8%), calc(84% - var(--streak-intensity) * 8%)) !important;
  box-shadow: 0 0 calc(var(--streak-intensity) * 4px) rgba(251, 113, 133, 0.4);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@keyframes streakGrayscaleFade {
  0% {
    filter: grayscale(0);
    opacity: 1;
  }
  50% {
    filter: grayscale(0.5);
    opacity: 0.5;
  }
  100% {
    filter: grayscale(1);
    opacity: 0.8;
  }
}

.hm-game-mode-student-streak.streak-shatter strong {
  animation: streakGrayscaleFade 0.6s ease-out forwards;
}

@keyframes streakGlowPulse {
  0% {
    box-shadow: 0 0 0 0px var(--glow-color);
    transform: scale(1.02);
  }
  50% {
    box-shadow: 0 0 16px 4px var(--glow-color);
    transform: scale(1.08);
  }
  100% {
    box-shadow: 0 0 0 0px var(--glow-color);
    transform: scale(1.02);
  }
}
.streak-glow {
  animation: streakGlowPulse 1.2s ease-in-out infinite;
}

@keyframes streakShatterShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.streak-shatter {
  animation: streakShatterShake 0.3s ease-in-out;
}

/* Score Feedback Box Update */
.hm-game-mode-score-feedback-box {
  display: inline-flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Styled Equation Layout */
.hm-game-mode-score-equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.3rem auto 0.6rem;
}

.hm-equation-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: none; /* Keep casing clean (e.g. Base, Speed) */
  transition: all 0.2s ease;
}

.hm-equation-pill.is-muted {
  opacity: 0.45;
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  border: 1px dashed rgba(255, 255, 255, 0.15);
}

.hm-equation-pill.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.hm-equation-pill.is-incorrect {
  background: #dc3545;
  color: #ffffff;
  border: 1px solid #dc3545;
  box-shadow: 0 0 10px rgba(220, 53, 69, 0.4);
}

.hm-equation-pill.is-streak-lost {
  background: #000000;
  color: #ffffff;
  border: 1px solid #333333;
}

.hm-pill-total {
  background: linear-gradient(135deg, #f5b51b, #f2994a);
  color: #0d1b2a;
  font-weight: 800;
  border: 1px solid #f5b51b;
  box-shadow: 0 0 14px rgba(245, 181, 27, 0.5);
  font-size: 0.95rem;
  transform: scale(1.05);
}

.hm-equation-operator {
  font-size: 1.2rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0.1rem;
}

/* Verbal Feedback Lines */
.hm-game-mode-streak-verbal {
  margin-top: 0.6rem;
  text-align: center;
}

.hm-game-mode-streak-verbal p {
  margin: 0.25rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-transform: none; /* Keep text readable (Sentence case) */
}

.hm-verbal-line-status {
  color: #38bdf8 !important; /* light blue status */
  font-weight: 700 !important;
}

.hm-verbal-line-streak {
  color: #fb7185 !important; /* rose streak */
  font-weight: 700 !important;
}

.hm-verbal-line-next {
  color: #a7f3d0 !important; /* mint green next */
}

.streak-glow-text {
  text-shadow: 0 0 8px rgba(167, 243, 208, 0.6);
  font-weight: 800;
}

.hm-game-over-streak-celebration {
  display: block;
  margin-top: 0.5rem;
  color: #10b981 !important; /* green */
  font-weight: 700;
  font-size: 1.05rem;
}

/* Long question auto-shrink layout to ensure single-screen fit */
.hm-game-mode-question-panel h1.is-long-question {
  font-size: clamp(1.25rem, 3.2vw, 2.25rem) !important;
  line-height: 1.15;
  max-width: 900px;
}

/* Trophy & First-Place Victory Enhancements */
.hm-projector-trophy {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  font-size: 1.5rem;
  color: #f5b51b; /* gold */
  filter: drop-shadow(0 0 4px rgba(245, 181, 27, 0.8));
  animation: trophyGlow 2.5s infinite ease-in-out;
  pointer-events: none;
  z-index: 25;
}

@keyframes trophyGlow {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    filter: drop-shadow(0 0 4px rgba(245, 181, 27, 0.8));
  }
  50% {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 0 8px rgba(245, 181, 27, 1)) drop-shadow(0 0 12px rgba(245, 181, 27, 0.4));
  }
}

.hm-game-mode-projector-final-grid article.is-first {
  position: relative;
  overflow: visible !important;
  box-shadow: 0 0 16px rgba(245, 181, 27, 0.4);
  border: 1px solid rgba(245, 181, 27, 0.6);
}

/* Sweep overlay for overflow-clipped first place card shimmer */
.hm-gold-sweep-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 8px;
  pointer-events: none;
  z-index: 1;
}

.hm-gold-sweep-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 223, 137, 0.75) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg) translateX(-150%);
  animation: goldSweep 3s infinite ease-in-out;
  pointer-events: none;
  z-index: 2;
}

.hm-game-mode-projector-podium article.is-first .hm-gold-sweep-overlay::after {
  animation-delay: 6.2s;
}

/* Premium Glassmorphic Loading Screen for Student Leaderboard */
.hm-game-mode-final-loader-container {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 3.5rem 2rem;
  text-align: center;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1rem 0;
}

.hm-game-mode-loader-ripple {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
}

.hm-game-mode-loader-ripple__circle {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--hm-color-primary-amber, #f5b51b);
  opacity: 0.15;
  animation: hm-loader-ripple 2.2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

.hm-game-mode-loader-ripple__circle:nth-child(2) {
  animation-delay: -0.7s;
}

.hm-game-mode-loader-ripple__circle:nth-child(3) {
  animation-delay: -1.4s;
}

.hm-game-mode-loader-ripple__dot {
  position: relative;
  width: 28px;
  height: 28px;
  background: var(--hm-color-primary-amber, #f5b51b);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--hm-color-primary-amber, #f5b51b);
  animation: hm-loader-core-pulse 1.5s infinite ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hm-game-mode-loader-ripple__dot i {
  color: #111827;
  font-size: 0.85rem;
}

.hm-game-mode-loader-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}

.hm-game-mode-loader-subtitle {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
  font-weight: 400;
  max-width: 280px;
  line-height: 1.4;
}

@keyframes hm-loader-ripple {
  0% {
    transform: scale(0.25);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@keyframes hm-loader-core-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(245, 181, 27, 0.6);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 28px rgba(245, 181, 27, 0.95);
  }
}

/* ---- Locked Exit Chip (MATCH_COMPLETE phase) ---- */
.hm-game-mode-exit-chip.is-locked {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

.hm-game-mode-exit-chip.is-locked .hm-game-mode-exit-button {
  cursor: not-allowed;
}

/* ---- Student Device: Individual Podium (Top 3) ---- */
.hm-game-mode-student-individual-podium {
  grid-column: 1 / -1;
  margin-bottom: 0.25rem;
}

.hm-game-mode-student-podium-title {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0 0 0.6rem;
  text-align: center;
  text-transform: uppercase;
}

.hm-game-mode-student-podium-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hm-game-mode-student-podium-card {
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  padding: 0.65rem 0.9rem;
  transition: background 0.2s ease;
}

.hm-game-mode-student-podium-card.is-first {
  background: rgba(245, 181, 27, 0.12);
  border-color: rgba(245, 181, 27, 0.35);
  box-shadow: 0 0 12px rgba(245, 181, 27, 0.15);
}

.hm-game-mode-student-podium-card.is-me {
  border-color: rgba(99, 207, 207, 0.45);
  background: rgba(57, 196, 196, 0.1);
}

.hm-game-mode-student-podium-medal {
  font-size: 1.25rem;
  line-height: 1;
  text-align: center;
}

.hm-game-mode-student-podium-name {
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-game-mode-student-podium-name em {
  background: rgba(57, 196, 196, 0.25);
  border-radius: 4px;
  color: #39c4c4;
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-left: 0.4rem;
  padding: 1px 5px;
  text-transform: uppercase;
  vertical-align: middle;
}

.hm-game-mode-student-podium-pts {
  color: var(--hm-color-primary-amber, #f5b51b);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

/* Match Complete Phase - Mobile Layout Fix */
@media (max-width: 768px) {
  [data-phase="MATCH_COMPLETE"] .hm-game-mode-question-panel {
    flex: 0;
    min-height: auto;
    margin-bottom: 0.5rem;
    padding-top: 0.5rem;
  }
  [data-phase="MATCH_COMPLETE"] .hm-game-mode-question-panel h1 {
    font-size: clamp(1.2rem, 4.5vw, 1.8rem) !important;
  }
  [data-phase="MATCH_COMPLETE"] .hm-game-mode-student-options {
    gap: 0.8rem;
  }
}
