/* app/assets/stylesheets/time_attack.css */

.time-attack-wrapper {
  min-height: 85vh;
  background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #0f172a 50%, #020617 100%);
  color: #f8fafc;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  padding: 1.5rem 1rem 3rem 1rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

.time-attack-container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* Header Banner */
.time-attack-header {
  text-align: center;
  margin-bottom: 2rem;
}

.time-attack-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fde047;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
  margin-bottom: 0.75rem;
}

.time-attack-title {
  font-size: 2.5rem;
  font-weight: 900;
  margin: 0;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 30%, #fde047 70%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
}

.time-attack-subtitle {
  color: #94a3b8;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* Speed Selection Lobby Screen */
.time-attack-lobby {
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.5rem;
  padding: 2.25rem 2rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  text-align: center;
  transition: all 0.3s ease;
}

.speed-select-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.speeds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.speed-card {
  background: rgba(30, 41, 59, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.25rem;
  padding: 1.5rem 1rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  user-select: none;
}

.speed-card:hover {
  transform: translateY(-4px);
  background: rgba(30, 41, 59, 0.9);
}

.speed-card.speed-slow:hover,
.speed-card.speed-slow.selected {
  border-color: #10b981;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.18) 0%, rgba(30, 41, 59, 0.8) 100%);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.3);
}

.speed-card.speed-medium:hover,
.speed-card.speed-medium.selected {
  border-color: #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.2) 0%, rgba(30, 41, 59, 0.8) 100%);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.35);
}

.speed-card.speed-fast:hover,
.speed-card.speed-fast.selected {
  border-color: #ef4444;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.2) 0%, rgba(30, 41, 59, 0.8) 100%);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.35);
}

.speed-card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.speed-card-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.speed-card-seconds {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.speed-slow .speed-card-seconds { color: #34d399; }
.speed-medium .speed-card-seconds { color: #fde047; }
.speed-fast .speed-card-seconds { color: #f87171; }

.speed-card-desc {
  font-size: 0.76rem;
  color: #94a3b8;
  line-height: 1.35;
}

/* Active Booster Notification */
.time-attack-booster-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.3) 100%);
  border: 1.5px solid rgba(251, 191, 36, 0.5);
  border-radius: 1rem;
  padding: 0.6rem 1.25rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
}

.booster-badge-icon {
  font-size: 1.3rem;
  animation: boosterPulse 1.8s ease-in-out infinite;
}

@keyframes boosterPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.btn-start-time-attack {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
  color: #ffffff;
  border: 2px solid #fde047;
  font-size: 1.25rem;
  font-weight: 900;
  padding: 1rem 3rem;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(217, 119, 6, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.5);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-start-time-attack:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 35px rgba(217, 119, 6, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.8);
  border-color: #ffffff;
}

/* ==========================================================================
   GAME ARENA
   ========================================================================== */
.time-attack-arena {
  display: none;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.5rem;
  padding: 2rem;
  backdrop-filter: blur(14px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

/* Top Live Stats Bar */
.arena-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.arena-stat-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.85rem;
  padding: 0.45rem 0.9rem;
}

.stat-icon {
  font-size: 1.25rem;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.arena-stat-box .stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  font-weight: 700;
}

.arena-stat-box .stat-value {
  font-size: 1.15rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
}

/* Live Timer Widget */
.arena-timer-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.timer-circle-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 2.25rem;
  font-weight: 900;
  font-family: 'Poppins', monospace, sans-serif;
  color: #38bdf8;
  text-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
  transition: all 0.3s ease;
}

.timer-circle-display.warning {
  color: #f59e0b;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.8);
}

.timer-circle-display.danger {
  color: #ef4444;
  text-shadow: 0 0 25px rgba(239, 68, 68, 0.9);
  animation: timerPulseDanger 0.8s infinite;
}

@keyframes timerPulseDanger {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.timer-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.timer-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #38bdf8, #10b981);
  border-radius: 9999px;
  transition: width 0.25s linear, background-color 0.3s ease;
}

/* Word Prompt Arena */
.arena-word-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
  transition: all 0.25s ease;
}

.word-audio-btn {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 2px solid #38bdf8;
  color: #ffffff;
  font-size: 1.4rem;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.6);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 1rem;
}

.word-audio-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.7);
}

.word-audio-btn:active {
  transform: scale(0.95);
}

.word-audio-btn.speaking {
  animation: audioPulse 1.2s infinite;
}

@keyframes audioPulse {
  0%, 100% { box-shadow: 0 0 25px rgba(56, 189, 248, 0.4); }
  50% { box-shadow: 0 0 45px rgba(56, 189, 248, 0.9), 0 0 70px rgba(14, 165, 233, 0.6); }
}

.word-clue-text {
  font-size: 1.1rem;
  color: #cbd5e1;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.word-length-hint {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* User Spelling Input Bar */
.arena-input-group {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 580px;
  margin: 0 auto 1.5rem auto;
}

.time-attack-input {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid rgba(56, 189, 248, 0.4);
  border-radius: 1rem;
  padding: 0.9rem 1.25rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  text-align: center;
  letter-spacing: 0.08em;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.time-attack-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.35), inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.btn-submit-word {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1.5px solid #6ee7b7;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  padding: 0.9rem 1.5rem;
  border-radius: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-submit-word:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Microphone Voice Input Button */
.btn-mic-record {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border: 2px solid #818cf8;
  color: #ffffff;
  font-size: 1.25rem;
  width: 54px;
  height: 54px;
  min-width: 54px;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-mic-record:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.55);
  border-color: #c7d2fe;
}

.btn-mic-record.recording {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: #fca5a5;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.8), 0 0 50px rgba(239, 68, 68, 0.5);
  animation: micPulse 1s infinite alternate;
}

@keyframes micPulse {
  0% { transform: scale(1); box-shadow: 0 0 15px rgba(239, 68, 68, 0.6); }
  100% { transform: scale(1.1); box-shadow: 0 0 35px rgba(239, 68, 68, 0.95); }
}

.voice-status-pill {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  margin: 0 auto 0.85rem auto;
  width: fit-content;
}

.voice-status-pill.active {
  display: inline-flex;
}

.voice-wave-dot {
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: 50%;
  animation: pulseDot 0.8s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Visible Target Word Badge */
.target-word-display {
  display: none;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(99, 102, 241, 0.25) 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  border-radius: 1rem;
  padding: 0.5rem 1.5rem;
  margin: 0.5rem auto 1rem auto;
  width: fit-content;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

.target-word-display.visible {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.visible-word-text {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
  text-transform: uppercase;
}

/* Secondary Action Buttons */
.arena-actions-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-arena-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-arena-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.btn-arena-secondary.active-toggle {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

/* Powerups Quick Bar */
.arena-powerups-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
  margin-bottom: 0.85rem;
}

.btn-powerup {
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  user-select: none;
}

.btn-powerup:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.04);
}

.btn-powerup:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn-powerup:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #64748b;
  box-shadow: none;
}

.powerup-stock-badge {
  font-size: 0.72rem;
  font-weight: 900;
  padding: 0.12rem 0.45rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  margin-left: 0.15rem;
}

/* 1. Amber Hourglass Specifics */
.btn-powerup-hourglass {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.25) 100%);
  color: #fef08a;
}
.btn-powerup-hourglass:hover:not(:disabled) {
  border-color: #fde047;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35) 0%, rgba(217, 119, 6, 0.5) 100%);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.5);
  color: #ffffff;
}
.btn-powerup-hourglass .powerup-stock-badge {
  background: #d97706;
  color: #ffffff;
  border-color: #fde047;
}

/* 2. Frost Flask Specifics */
.btn-powerup-frost {
  border-color: rgba(56, 189, 248, 0.4);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(2, 132, 199, 0.25) 100%);
  color: #e0f2fe;
}
.btn-powerup-frost:hover:not(:disabled) {
  border-color: #67e8f9;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.35) 0%, rgba(2, 132, 199, 0.5) 100%);
  box-shadow: 0 0 25px rgba(6, 182, 212, 0.55);
  color: #ffffff;
}
.btn-powerup-frost .powerup-stock-badge {
  background: #0284c7;
  color: #ffffff;
  border-color: #7dd3fc;
}

/* 3. Hyperdrive Spark Specifics */
.btn-powerup-hyperdrive {
  border-color: rgba(192, 132, 252, 0.4);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(236, 72, 153, 0.25) 100%);
  color: #fdf4ff;
}
.btn-powerup-hyperdrive:hover:not(:disabled) {
  border-color: #f472b6;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.35) 0%, rgba(236, 72, 153, 0.5) 100%);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.55);
  color: #ffffff;
}
.btn-powerup-hyperdrive .powerup-stock-badge {
  background: #9333ea;
  color: #ffffff;
  border-color: #f472b6;
}

/* Active Status Badge over Timer */
.timer-active-powerup-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.95rem;
  border-radius: 9999px;
  margin-bottom: 0.5rem;
  animation: summaryPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}
.timer-active-powerup-badge.frost-mode {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1.5px solid #7dd3fc;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
}
.timer-active-powerup-badge.hyperdrive-mode {
  background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
  border: 1.5px solid #f472b6;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.6);
}

/* Timer Animations & States */
.timer-bonus-time-burst {
  animation: bonusTimePulse 0.8s ease-out;
}
@keyframes bonusTimePulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 0px #f59e0b); }
  50% { transform: scale(1.25); color: #fde047; filter: drop-shadow(0 0 25px #f59e0b); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0px #f59e0b); }
}

/* Frost Freeze Clock Animations */
.timer-frost-freeze-burst {
  animation: frostFreezeBurst 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes frostFreezeBurst {
  0% { transform: scale(1); filter: drop-shadow(0 0 0px #06b6d4); }
  35% { transform: scale(1.28); color: #e0f2fe; filter: drop-shadow(0 0 35px #38bdf8) drop-shadow(0 0 60px #0284c7); }
  100% { transform: scale(1); filter: drop-shadow(0 0 15px #06b6d4); }
}

.arena-timer-container.timer-frozen {
  border-color: #38bdf8 !important;
  background: linear-gradient(135deg, rgba(8, 47, 73, 0.85) 0%, rgba(3, 105, 161, 0.6) 100%) !important;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.7), inset 0 0 25px rgba(224, 242, 254, 0.4) !important;
  animation: frostCrystalPulse 1.2s infinite alternate !important;
}
.arena-timer-container.timer-frozen .timer-seconds {
  color: #e0f2fe !important;
  text-shadow: 0 0 20px #38bdf8, 0 0 35px #0284c7 !important;
}
.arena-timer-container.timer-frozen .timer-progress-fill {
  background: linear-gradient(90deg, #38bdf8, #e0f2fe) !important;
  box-shadow: 0 0 15px #38bdf8 !important;
}
@keyframes frostCrystalPulse {
  0% { box-shadow: 0 0 25px rgba(56, 189, 248, 0.5), inset 0 0 15px rgba(224, 242, 254, 0.3); transform: scale(1); }
  100% { box-shadow: 0 0 45px rgba(56, 189, 248, 0.9), inset 0 0 30px rgba(224, 242, 254, 0.6); transform: scale(1.03); }
}

/* Hyperdrive Spark Clock Animations */
.timer-hyperdrive-burst {
  animation: hyperdriveBurst 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes hyperdriveBurst {
  0% { transform: scale(1); filter: drop-shadow(0 0 0px #a855f7); }
  35% { transform: scale(1.28) rotate(-2deg); color: #fef08a; filter: drop-shadow(0 0 35px #c084fc) drop-shadow(0 0 65px #facc15); }
  70% { transform: scale(1.15) rotate(2deg); }
  100% { transform: scale(1) rotate(0); filter: drop-shadow(0 0 15px #a855f7); }
}

.arena-timer-container.timer-hyperdrive-active {
  border-color: #c084fc !important;
  background: linear-gradient(135deg, rgba(59, 7, 100, 0.85) 0%, rgba(147, 51, 234, 0.6) 100%) !important;
  box-shadow: 0 0 40px rgba(192, 132, 252, 0.75), 0 0 70px rgba(250, 204, 21, 0.4), inset 0 0 25px rgba(244, 114, 182, 0.4) !important;
  animation: hyperdriveEnergyPulse 0.5s infinite alternate !important;
}
.arena-timer-container.timer-hyperdrive-active .timer-seconds {
  color: #fef08a !important;
  text-shadow: 0 0 20px #facc15, 0 0 35px #c084fc !important;
}
.arena-timer-container.timer-hyperdrive-active .timer-progress-fill {
  background: linear-gradient(90deg, #facc15, #ec4899, #a855f7) !important;
  box-shadow: 0 0 20px #facc15 !important;
}
@keyframes hyperdriveEnergyPulse {
  0% { box-shadow: 0 0 25px rgba(192, 132, 252, 0.6), 0 0 45px rgba(250, 204, 21, 0.3); transform: scale(1); }
  100% { box-shadow: 0 0 50px rgba(192, 132, 252, 1), 0 0 80px rgba(250, 204, 21, 0.6); transform: scale(1.04); }
}

/* Floating Time Gain Burst Indicator */
.time-burst-float {
  position: absolute;
  top: -15px;
  right: -25px;
  font-size: 1.3rem;
  font-weight: 900;
  color: #fde047;
  text-shadow: 0 0 15px rgba(0, 0, 0, 0.8), 0 0 20px currentColor;
  animation: timeBurstFloatUp 1s ease-out forwards;
  pointer-events: none;
  z-index: 100;
}
@keyframes timeBurstFloatUp {
  0% { transform: translateY(0) scale(0.7); opacity: 0; }
  30% { transform: translateY(-15px) scale(1.25); opacity: 1; }
  100% { transform: translateY(-45px) scale(1); opacity: 0; }
}

/* Feedback Animations */
.word-success-flash {
  animation: successFlash 0.45s ease-out;
}

@keyframes successFlash {
  0% { background: rgba(16, 185, 129, 0.4); border-color: #10b981; }
  100% { background: rgba(30, 41, 59, 0.5); border-color: rgba(255, 255, 255, 0.08); }
}

.word-error-shake {
  animation: errorShake 0.4s ease-in-out;
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); border-color: #ef4444; }
  40%, 80% { transform: translateX(8px); border-color: #ef4444; }
}

/* ==========================================================================
   GAME OVER / VICTORY SUMMARY MODAL
   ========================================================================== */
.time-attack-summary-modal {
  display: none;
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  background: rgba(3, 7, 18, 0.88) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 999999 !important;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
  overflow-y: auto;
}

.summary-card {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 60%, #172554 100%);
  border: 2px solid rgba(251, 191, 36, 0.5);
  border-radius: 1.75rem;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 520px;
  text-align: center;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8), 0 0 35px rgba(245, 158, 11, 0.25);
  position: relative;
  animation: summaryPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes summaryPopIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.summary-icon-trophy {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.summary-title {
  font-size: 1.85rem;
  font-weight: 900;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
}

.summary-subtitle {
  color: #cbd5e1;
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
}

.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.summary-stat-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  padding: 0.85rem 0.5rem;
}

.summary-stat-pill .num {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fde047;
  display: block;
}

.summary-stat-pill .lbl {
  font-size: 0.68rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
}

.summary-xp-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(217, 119, 6, 0.35) 100%);
  border: 1.5px solid #fde047;
  border-radius: 1.25rem;
  padding: 1.25rem 1rem;
  margin-bottom: 1.75rem;
}

.summary-xp-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fde047;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary-xp-amount {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 15px rgba(253, 224, 71, 0.8);
  margin: 0.25rem 0;
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-play-again {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: 1.5px solid #fde047;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 900;
  padding: 0.85rem 1.5rem;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(217, 119, 6, 0.4);
  transition: all 0.2s ease;
}

.btn-play-again:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(217, 119, 6, 0.6);
}

.btn-back-hub {
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.4rem;
  transition: color 0.2s ease;
}

.btn-back-hub:hover {
  color: #ffffff;
}

/* ==========================================================================
   RESPONSIVE DESIGN FOR MOBILE
   ========================================================================== */
@media (max-width: 640px) {
  .time-attack-wrapper {
    padding: 1rem 0.65rem 2.5rem 0.65rem;
  }

  .time-attack-title {
    font-size: 1.85rem;
  }

  .time-attack-lobby {
    padding: 1.5rem 1rem;
    border-radius: 1.2rem;
  }

  .speeds-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .speed-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    text-align: left;
  }

  .speed-card-icon {
    font-size: 2rem;
    margin-bottom: 0;
  }

  .speed-card-name {
    font-size: 1.05rem;
    margin-bottom: 0;
  }

  .speed-card-seconds {
    font-size: 1.3rem;
    margin-bottom: 0;
  }

  .speed-card-desc {
    display: none;
  }

  .btn-start-time-attack {
    font-size: 1.05rem;
    padding: 0.85rem 2rem;
    width: 100%;
    justify-content: center;
  }

  .time-attack-arena {
    padding: 1.25rem 0.85rem;
    border-radius: 1.2rem;
  }

  .arena-top-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
  }

  .arena-stat-box {
    padding: 0.35rem 0.65rem;
    flex: 1 1 45%;
  }

  .arena-stat-box .stat-value {
    font-size: 0.95rem;
  }

  .arena-timer-widget {
    order: -1;
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .arena-word-card {
    padding: 1.5rem 1rem;
  }

  .word-audio-btn {
    width: 58px;
    height: 58px;
    font-size: 1.2rem;
  }

  .arena-input-group {
    flex-direction: column;
    gap: 0.5rem;
  }

  .time-attack-input {
    font-size: 1.2rem;
    padding: 0.75rem 1rem;
  }

  .btn-submit-word {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
  }

  .summary-card {
    padding: 1.75rem 1.25rem;
    border-radius: 1.25rem;
  }

  .summary-stats-grid {
    gap: 0.5rem;
  }

  .summary-stat-pill .num {
    font-size: 1.15rem;
  }
}

/* ==========================================================================
   Cosmic Galaxy Animations & Keyframes
   ========================================================================== */
@keyframes nebulaMorph {
  0% {
    transform: rotate(0deg) scale(1) translate(0, 0);
    filter: hue-rotate(0deg) brightness(1.05);
    opacity: 0.85;
  }
  33% {
    transform: rotate(120deg) scale(1.2) translate(30px, -20px);
    filter: hue-rotate(45deg) brightness(1.25);
    opacity: 1;
  }
  66% {
    transform: rotate(240deg) scale(1.1) translate(-25px, 25px);
    filter: hue-rotate(-30deg) brightness(1.15);
    opacity: 0.92;
  }
  100% {
    transform: rotate(360deg) scale(1) translate(0, 0);
    filter: hue-rotate(0deg) brightness(1.05);
    opacity: 0.85;
  }
}

@keyframes nebulaCounterFlow {
  0% {
    transform: rotate(360deg) scale(1.15);
    opacity: 0.7;
  }
  50% {
    transform: rotate(180deg) scale(0.95);
    opacity: 0.95;
  }
  100% {
    transform: rotate(0deg) scale(1.15);
    opacity: 0.7;
  }
}

@keyframes starTwinkleGlow {
  0%, 100% { 
    opacity: 0.2; 
    transform: scale(0.7) translateY(0); 
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
  }
  50% { 
    opacity: 1; 
    transform: scale(1.4) translateY(-4px); 
    filter: drop-shadow(0 0 12px #ffffff) drop-shadow(0 0 20px #c084fc);
  }
}

@keyframes shootingMeteor1 {
  0% {
    transform: translate(-100px, -50px) rotate(40deg);
    opacity: 0;
  }
  6% {
    opacity: 1;
  }
  20% {
    transform: translate(750px, 450px) rotate(40deg);
    opacity: 0;
  }
  100% {
    transform: translate(750px, 450px) rotate(40deg);
    opacity: 0;
  }
}

@keyframes shootingMeteor2 {
  0% {
    transform: translate(100px, -50px) rotate(-35deg);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  22% {
    transform: translate(-650px, 400px) rotate(-35deg);
    opacity: 0;
  }
  100% {
    transform: translate(-650px, 400px) rotate(-35deg);
    opacity: 0;
  }
}

/* ==========================================================================
   Time Attack Skin Galaxia Profunda (Theme Galaxy)
   ========================================================================== */
.time-attack-wrapper.theme-galaxy {
  background: radial-gradient(circle at 50% 50%, #150d2a 0%, #0c071a 50%, #050210 100%) !important;
  position: relative;
  overflow: hidden;
}

.time-attack-wrapper.theme-galaxy::before {
  content: '';
  position: absolute;
  top: -150%;
  left: -150%;
  width: 400%;
  height: 400%;
  transform-origin: center center;
  background: 
    radial-gradient(circle at 25% 30%, rgba(147, 51, 234, 0.6) 0%, transparent 45%),
    radial-gradient(circle at 75% 65%, rgba(236, 72, 153, 0.5) 0%, transparent 45%),
    radial-gradient(circle at 45% 85%, rgba(56, 189, 248, 0.45) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.55) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(192, 132, 252, 0.4) 0%, transparent 55%);
  animation: nebulaMorph 7.5s infinite ease-in-out;
  pointer-events: none;
  z-index: 0;
}

.time-attack-wrapper.theme-galaxy::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 90px 75px, #c084fc, rgba(0,0,0,0)),
    radial-gradient(2.5px 2.5px at 180px 140px, #38bdf8, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 270px 50px, #f472b6, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 340px 220px, #fef08a, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 60px 190px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 230px 290px, #c084fc, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 310px 130px, #38bdf8, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 360px 360px;
  pointer-events: none;
  opacity: 0.85;
  z-index: 0;
}

.time-attack-wrapper.theme-galaxy > *:not(.time-attack-summary-modal):not(#summaryModal):not(.floating-xp-bubble):not(#floatingXpBubble):not(.galaxy-stars-overlay) {
  position: relative;
  z-index: 2;
}

.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay,
.galaxy-stars-overlay {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
  overflow: hidden !important;
  border-radius: inherit !important;
  z-index: 1 !important;
}

.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star,
.galaxy-stars-overlay .g-star {
  position: absolute !important;
  display: inline-block !important;
  color: #ffffff;
  animation: starTwinkleGlow 2.5s infinite ease-in-out;
  pointer-events: none !important;
  user-select: none !important;
  z-index: 1 !important;
}

.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s1 { top: 8%; left: 7%; animation-delay: 0s; font-size: 1.3rem; color: #ffffff; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s2 { top: 16%; right: 10%; animation-delay: 0.7s; font-size: 0.9rem; color: #bae6fd; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s3 { top: 66%; left: 5%; animation-delay: 1.4s; font-size: 1.15rem; color: #fbcfe8; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s4 { top: 80%; right: 8%; animation-delay: 1.9s; font-size: 1.35rem; color: #e0e7ff; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s5 { top: 38%; left: 14%; animation-delay: 0.4s; font-size: 0.8rem; color: #fef08a; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s6 { top: 48%; right: 4%; animation-delay: 1.6s; font-size: 1.05rem; color: #c084fc; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s7 { top: 90%; left: 28%; animation-delay: 2.2s; font-size: 0.9rem; color: #38bdf8; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s8 { top: 5%; right: 35%; animation-delay: 1.1s; font-size: 1rem; color: #f472b6; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s9 { top: 28%; left: 32%; animation-delay: 0.6s; font-size: 0.85rem; color: #ffffff; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s10 { top: 72%; left: 22%; animation-delay: 1.8s; font-size: 1.1rem; color: #fde047; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s11 { top: 24%; right: 28%; animation-delay: 1.3s; font-size: 0.75rem; color: #a78bfa; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s12 { top: 84%; left: 48%; animation-delay: 0.3s; font-size: 1rem; color: #67e8f9; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s13 { top: 58%; right: 22%; animation-delay: 2.1s; font-size: 0.95rem; color: #f43f5e; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s14 { top: 12%; left: 22%; animation-delay: 1.5s; font-size: 0.7rem; color: #e9d5ff; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s15 { top: 92%; right: 32%; animation-delay: 0.8s; font-size: 1.2rem; color: #ffffff; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s16 { top: 44%; left: 4%; animation-delay: 2.4s; font-size: 0.85rem; color: #fcd34d; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s17 { top: 32%; right: 15%; animation-delay: 1.0s; font-size: 1.05rem; color: #38bdf8; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s18 { top: 76%; right: 40%; animation-delay: 1.7s; font-size: 0.8rem; color: #ec4899; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s19 { top: 20%; left: 45%; animation-delay: 0.2s; font-size: 0.9rem; color: #fef08a; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s20 { top: 62%; right: 12%; animation-delay: 2.5s; font-size: 1.25rem; color: #c084fc; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s21 { top: 35%; left: 25%; animation-delay: 1.2s; font-size: 0.7rem; color: #bae6fd; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s22 { top: 88%; right: 18%; animation-delay: 0.5s; font-size: 1.1rem; color: #f472b6; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s23 { top: 15%; right: 48%; animation-delay: 2.0s; font-size: 0.85rem; color: #ffffff; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s24 { top: 52%; left: 10%; animation-delay: 0.9s; font-size: 1.15rem; color: #38bdf8; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s25 { top: 95%; left: 12%; animation-delay: 1.6s; font-size: 0.95rem; color: #e0e7ff; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s26 { top: 4%; left: 42%; animation-delay: 2.3s; font-size: 0.8rem; color: #fde047; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s27 { top: 68%; right: 28%; animation-delay: 0.7s; font-size: 1rem; color: #a78bfa; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s28 { top: 26%; left: 8%; animation-delay: 1.9s; font-size: 0.75rem; color: #67e8f9; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s29 { top: 40%; right: 36%; animation-delay: 1.4s; font-size: 1.2rem; color: #fbcfe8; }
.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-star.s30 { top: 82%; left: 38%; animation-delay: 2.7s; font-size: 0.9rem; color: #ffffff; }

.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-meteor.m1 {
  position: absolute;
  top: -5%;
  left: 12%;
  width: 150px;
  height: 2.5px;
  background: linear-gradient(90deg, #ffffff, rgba(192,132,252,0.9), transparent);
  box-shadow: 0 0 12px #ffffff, 0 0 24px #a855f7;
  border-radius: 9999px;
  transform-origin: left;
  animation: shootingMeteor1 5.5s infinite ease-in-out;
  opacity: 0;
}

.time-attack-wrapper.theme-galaxy .galaxy-stars-overlay .g-meteor.m2 {
  position: absolute;
  top: -5%;
  right: 15%;
  width: 140px;
  height: 2px;
  background: linear-gradient(90deg, #ffffff, rgba(56,189,248,0.9), transparent);
  box-shadow: 0 0 12px #ffffff, 0 0 24px #0284c7;
  border-radius: 9999px;
  transform-origin: right;
  animation: shootingMeteor2 7s 2.8s infinite ease-in-out;
  opacity: 0;
}

.time-attack-wrapper.theme-galaxy .time-attack-lobby {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(192, 132, 252, 0.5);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.6), 0 0 35px rgba(168, 85, 247, 0.3);
}

.time-attack-wrapper.theme-galaxy .time-attack-arena {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(192, 132, 252, 0.4);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(147, 51, 234, 0.25);
}

.time-attack-wrapper.theme-galaxy .arena-word-card {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(192, 132, 252, 0.5);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.6), 0 0 35px rgba(168, 85, 247, 0.3);
}

.time-attack-wrapper.theme-galaxy .time-attack-input {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(192, 132, 252, 0.5);
  color: #f3e8ff;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 0 15px rgba(168, 85, 247, 0.2);
}

.time-attack-wrapper.theme-galaxy .time-attack-input:focus {
  border-color: #e879f9;
  box-shadow: 0 0 28px rgba(192, 132, 252, 0.7);
}

/* ==========================================================================
   Mobile Galaxy Background Performance Optimizer Toggle Button
   (STRICTLY only visible on mobile screens <= 768px when Galaxy Theme is active,
    completely hidden on desktop/PC computers)
   ========================================================================== */
.mobile-galaxy-optimizer-container {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-galaxy-optimizer-container {
    display: flex !important;
    justify-content: center;
    width: 100%;
    margin-top: 0.85rem;
  }
}

  .btn-galaxy-perf-toggle {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.85) 0%, rgba(88, 28, 135, 0.65) 50%, rgba(15, 23, 42, 0.9) 100%);
    border: 1.5px solid rgba(192, 132, 252, 0.65);
    color: #f5d0fe;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 0.55rem 1.35rem;
    border-radius: 9999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 18px rgba(126, 34, 206, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.25), 0 0 12px rgba(168, 85, 247, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    text-shadow: 0 0 10px rgba(192, 132, 252, 0.8);
    user-select: none;
    width: auto;
    max-width: 92%;
  }

  .btn-galaxy-perf-toggle:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: #e879f9;
    box-shadow: 0 6px 24px rgba(168, 85, 247, 0.6), inset 0 1px 3px rgba(255, 255, 255, 0.4), 0 0 20px rgba(232, 121, 249, 0.4);
    color: #ffffff;
  }

  .btn-galaxy-perf-toggle:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 2px 10px rgba(126, 34, 206, 0.4);
  }

  .btn-galaxy-perf-toggle .perf-status-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 6px #fde047);
    transition: transform 0.25s ease;
  }

  .btn-galaxy-perf-toggle:hover .perf-status-icon {
    transform: scale(1.15) rotate(10deg);
  }

  .btn-galaxy-perf-toggle.is-optimized {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.9) 0%, rgba(13, 148, 136, 0.75) 50%, rgba(15, 23, 42, 0.95) 100%);
    border-color: #34d399;
    color: #a7f3d0;
    box-shadow: 0 0 22px rgba(52, 211, 153, 0.5), 0 4px 18px rgba(0, 0, 0, 0.6), inset 0 1px 3px rgba(255, 255, 255, 0.35);
    text-shadow: 0 0 12px rgba(52, 211, 153, 0.9);
  }

  .btn-galaxy-perf-toggle.is-optimized .perf-status-icon {
    filter: drop-shadow(0 0 8px #34d399);
  }
}

/* ==========================================================================
   Galaxy Skin High-Performance / Low-Lag Engine (.galaxy-optimized)
   Preserves 100% of the visual elements (Nebula colors, Star texture, 
   30 Constellation Stars, Meteors, Moon Glass Tiles) while switching to 
   low-overhead GPU rendering for silky-smooth 60 FPS mobile gameplay.
   ========================================================================== */
.time-attack-wrapper.theme-galaxy.galaxy-optimized {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* 1. Nebula Layer: Replaces heavy rotating 400% repaint with static vibrant multi-nebula canvas */
.time-attack-wrapper.theme-galaxy.galaxy-optimized::before {
  animation: none !important;
  transform: none !important;
  width: 100% !important;
  height: 100% !important;
  top: 0 !important;
  left: 0 !important;
  background: 
    radial-gradient(circle at 20% 25%, rgba(147, 51, 234, 0.55) 0%, transparent 55%),
    radial-gradient(circle at 80% 65%, rgba(236, 72, 153, 0.5) 0%, transparent 55%),
    radial-gradient(circle at 45% 85%, rgba(56, 189, 248, 0.45) 0%, transparent 55%),
    radial-gradient(circle at 75% 20%, rgba(99, 102, 241, 0.55) 0%, transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(192, 132, 252, 0.4) 0%, transparent 60%) !important;
  will-change: auto !important;
}

/* 2. Star field texture: Static hardware-accelerated star pattern */
.time-attack-wrapper.theme-galaxy.galaxy-optimized::after {
  opacity: 0.9 !important;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* 3. 30 Constellation Stars: Kept 100% intact, using efficient opacity pulse */
.time-attack-wrapper.theme-galaxy.galaxy-optimized .galaxy-stars-overlay .g-star {
  text-shadow: 0 0 6px currentColor;
  animation: starTwinkleOptimized 3s infinite ease-in-out !important;
  will-change: opacity;
}

@keyframes starTwinkleOptimized {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1.0; }
}

/* 4. Meteors: Smooth lightweight trajectories */
.time-attack-wrapper.theme-galaxy.galaxy-optimized .galaxy-stars-overlay .g-meteor {
  box-shadow: 0 0 8px #ffffff, 0 0 14px #a855f7 !important;
}

/* 5. Glassmorphism cards: Solid dark moon glass eliminating per-frame backdrop-blur GPU thrashing */
.time-attack-wrapper.theme-galaxy.galaxy-optimized .arena-word-card,
.time-attack-wrapper.theme-galaxy.galaxy-optimized .time-attack-lobby,
.time-attack-wrapper.theme-galaxy.galaxy-optimized .summary-card {
  background: rgba(15, 23, 42, 0.92) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: rgba(192, 132, 252, 0.6) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(168, 85, 247, 0.25) !important;
}

/* ==========================================================================
   Time Attack Floating XP Bubble Styling & Top-Layer Positioning
   ========================================================================== */
.floating-xp-bubble {
  position: fixed !important;
  top: 40% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 1000005 !important;
  pointer-events: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 110px !important;
  height: 110px !important;
  border-radius: 50% !important;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.85) 0%, rgba(253, 224, 71, 0.65) 45%, rgba(2, 132, 199, 0.95) 100%) !important;
  border: 3.5px solid #fde047 !important;
  box-shadow: 0 0 35px rgba(253, 224, 71, 0.85), 0 0 70px rgba(2, 132, 199, 0.65), inset 0 0 22px rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  cursor: pointer !important;
  animation: xpFloatBounce 2.2s ease-in-out infinite, xpBubbleGlow 2.2s ease-in-out infinite !important;
  user-select: none !important;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.floating-xp-bubble.double-xp-boosted {
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.9) 0%, rgba(251, 191, 36, 0.85) 40%, rgba(220, 38, 38, 0.95) 100%) !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 45px rgba(239, 68, 68, 0.85), 0 0 85px rgba(245, 158, 11, 0.75), inset 0 0 25px rgba(255, 255, 255, 0.7) !important;
}

.floating-xp-bubble:hover {
  transform: translate(-50%, -50%) scale(1.18) !important;
  border-color: #ffffff !important;
}

.floating-xp-bubble.popped {
  animation: xpPopBurst 0.5s ease-out forwards !important;
  pointer-events: none !important;
}

