/* ============================================================
   Brain Rot Trainer - Complete Stylesheet
   Dark Neon Cyberpunk Theme | Mobile-First | Responsive
   ============================================================ */

/* ----- RESET & BASE ----- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000008 url('img/menu_bg_brain.png') center/cover no-repeat fixed;
  color: #ffffff;
  font-family: 'Rajdhani', 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ----- SCROLLBAR ----- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ----- PARTICLES BACKGROUND ----- */
#particles-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ----- SCREENS ----- */
.screen {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 24px;
  background: rgba(0,0,8,0.55);
}

.screen.active {
  display: flex;
}

#screen-menu {
  background: transparent;
}

/* ----- TYPOGRAPHY ----- */
.title {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  text-shadow: 0 0 30px currentColor;
  line-height: 1.1;
  text-align: center;
}

.title-pink {
  color: #ff33aa;
}

.title-green {
  color: #1aff55;
}

.title-blue {
  color: #33aaff;
}

.title-purple {
  color: #aa33ff;
}

.title-gold {
  color: #ffcc33;
}

.title-red {
  color: #ff3333;
}

.subtitle {
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: #8888aa;
  text-align: center;
  line-height: 1.5;
  max-width: 500px;
}

.text-muted {
  color: #555577;
}

.text-secondary {
  color: #8888aa;
}

.text-pink {
  color: #ff33aa;
}

.text-green {
  color: #1aff55;
}

.text-blue {
  color: #33aaff;
}

.text-purple {
  color: #aa33ff;
}

.text-gold {
  color: #ffcc33;
}

.text-red {
  color: #ff3333;
}

.text-glow-pink {
  color: #ff33aa;
  text-shadow: 0 0 20px rgba(255, 51, 170, 0.5);
}

.text-glow-green {
  color: #1aff55;
  text-shadow: 0 0 20px rgba(26, 255, 85, 0.5);
}

.text-glow-blue {
  color: #33aaff;
  text-shadow: 0 0 20px rgba(51, 170, 255, 0.5);
}

.text-glow-gold {
  color: #ffcc33;
  text-shadow: 0 0 20px rgba(255, 204, 51, 0.5);
}

/* ----- BUTTONS ----- */
.btn {
  padding: 16px 40px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  text-decoration: none;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: scale(1.05);
  filter: brightness(1.15);
}

.btn:active {
  transform: scale(0.95);
  filter: brightness(0.9);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.btn-play {
  background: #1aff55;
  color: #0d0d14;
  box-shadow: 0 0 30px rgba(26, 255, 85, 0.3);
}

.btn-play:hover {
  box-shadow: 0 0 50px rgba(26, 255, 85, 0.5);
}

.btn-online {
  background: #ff33aa;
  color: #ffffff;
  box-shadow: 0 0 30px rgba(255, 51, 170, 0.3);
}

.btn-online:hover {
  box-shadow: 0 0 50px rgba(255, 51, 170, 0.5);
}

.btn-danger {
  background: #ff3333;
  color: #ffffff;
  box-shadow: 0 0 30px rgba(255, 51, 51, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 0 50px rgba(255, 51, 51, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-gold {
  background: #ffcc33;
  color: #0d0d14;
  box-shadow: 0 0 30px rgba(255, 204, 51, 0.3);
}

.btn-gold:hover {
  box-shadow: 0 0 50px rgba(255, 204, 51, 0.5);
}

.btn-purple {
  background: #aa33ff;
  color: #ffffff;
  box-shadow: 0 0 30px rgba(170, 51, 255, 0.3);
}

.btn-purple:hover {
  box-shadow: 0 0 50px rgba(170, 51, 255, 0.5);
}

.btn-blue {
  background: #33aaff;
  color: #0d0d14;
  box-shadow: 0 0 30px rgba(51, 170, 255, 0.3);
}

.btn-blue:hover {
  box-shadow: 0 0 50px rgba(51, 170, 255, 0.5);
}

.btn-small {
  padding: 10px 24px;
  font-size: 14px;
  min-height: 40px;
}

.btn-large {
  padding: 20px 56px;
  font-size: 22px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 12px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 12px;
}

.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ----- CARDS & PANELS ----- */
.panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 24px;
}

.panel-glow-pink {
  border-color: rgba(255, 51, 170, 0.2);
  box-shadow: 0 0 30px rgba(255, 51, 170, 0.05);
}

.panel-glow-green {
  border-color: rgba(26, 255, 85, 0.2);
  box-shadow: 0 0 30px rgba(26, 255, 85, 0.05);
}

.panel-glow-blue {
  border-color: rgba(51, 170, 255, 0.2);
  box-shadow: 0 0 30px rgba(51, 170, 255, 0.05);
}

.panel-glow-gold {
  border-color: rgba(255, 204, 51, 0.2);
  box-shadow: 0 0 30px rgba(255, 204, 51, 0.05);
}

.card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.2s ease;
}

.card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ----- GAME CONTAINER ----- */
#game-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.game-area {
  width: min(500px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  will-change: transform;
  transform: translateZ(0);
}

/* GPU acceleration for gameplay */
#game-container, #countdown-overlay {
  will-change: transform, opacity;
  transform: translateZ(0);
}

/* ----- GAMEPLAY HUD ----- */
#gameplay-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 20;
  pointer-events: none;
}

#gameplay-hud > * {
  pointer-events: auto;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.hud-score {
  color: #33aaff;
  font-size: 20px;
}

.hud-timer {
  color: #ff33aa;
  font-size: 20px;
}

.hud-timer.warning {
  color: #ff3333;
  animation: glow 0.5s ease infinite;
}

.hud-combo {
  color: #ffcc33;
}

.hud-streak {
  color: #aa33ff;
}

/* ----- OPPONENT SCORE PANEL ----- */
#opponent-score-panel {
  position: absolute;
  top: 60px;
  right: 16px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(255, 51, 170, 0.2);
  z-index: 20;
  display: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#opponent-score-panel.visible {
  display: block;
}

.opponent-name {
  font-size: 12px;
  color: #8888aa;
  margin-bottom: 4px;
}

.opponent-score {
  font-size: 20px;
  font-weight: 900;
  color: #ff33aa;
}

/* ----- ONLINE SPLIT-SCREEN LAYOUT ----- */
.gameplay-split {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
  gap: 0;
}

.game-side {
  flex: 0 0 60%;
  width: 60%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-right: 1px solid rgba(170, 51, 255, 0.15);
}

.opponent-side {
  flex: 0 0 40%;
  width: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(170, 51, 255, 0.04) 0%, transparent 70%);
}

/* -- Online HUD bar -- */
.online-hud-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 8px 20px;
  gap: 2px;
}

.online-hud-vs {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
}

.online-hud-player,
.online-hud-opponent {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.online-hud-player {
  border-color: rgba(51, 170, 255, 0.3);
}

.online-hud-opponent {
  border-color: rgba(255, 51, 170, 0.3);
}

.online-hud-name {
  color: #8888aa;
  font-size: 0.85rem;
  font-weight: 600;
}

.online-hud-player .online-hud-pts {
  color: #33aaff;
  font-size: 1.2rem;
  font-weight: 900;
  transition: transform 0.2s;
}

.online-hud-opponent .online-hud-pts {
  color: #ff33aa;
  font-size: 1.2rem;
  font-weight: 900;
  transition: transform 0.2s;
}

.online-hud-vs-text {
  font-size: 0.9rem;
  font-weight: 900;
  color: #ffcc33;
  text-shadow: 0 0 10px rgba(255, 204, 51, 0.4);
}

.online-hud-round {
  font-size: 0.8rem;
  color: #555577;
}

/* -- Opponent live panel -- */
.opp-live-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 16px;
  width: 100%;
  max-width: 280px;
}

.opp-live-name {
  font-size: 1.1rem;
  font-weight: 900;
  color: #ff33aa;
  text-shadow: 0 0 15px rgba(255, 51, 170, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.opp-live-game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(170, 51, 255, 0.2);
  border-radius: 12px;
  width: 100%;
}

.opp-live-game-icon {
  font-size: 2rem;
}

.opp-live-game-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #aa33ff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* -- Activity bars -- */
.opp-activity {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 40px;
  opacity: 0.3;
  transition: opacity 0.3s;
}

.opp-activity.active {
  opacity: 1;
}

.opp-activity-bar {
  width: 6px;
  height: 10px;
  background: #aa33ff;
  border-radius: 3px;
  transition: height 0.15s ease;
}

.opp-activity.active .opp-activity-bar {
  animation: oppBarBounce 0.6s ease-in-out infinite alternate;
}

.opp-activity.active .opp-activity-bar:nth-child(1) { animation-delay: 0s; }
.opp-activity.active .opp-activity-bar:nth-child(2) { animation-delay: 0.1s; }
.opp-activity.active .opp-activity-bar:nth-child(3) { animation-delay: 0.2s; }
.opp-activity.active .opp-activity-bar:nth-child(4) { animation-delay: 0.3s; }
.opp-activity.active .opp-activity-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes oppBarBounce {
  0% { height: 8px; background: #6622aa; }
  100% { height: 36px; background: #ff33aa; }
}

/* -- Status text -- */
.opp-live-status {
  font-size: 0.9rem;
  font-weight: 900;
  color: #ffcc33;
  text-shadow: 0 0 10px rgba(255, 204, 51, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  min-height: 24px;
}

/* -- Round dots -- */
.opp-round-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 240px;
}

.opp-round-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s;
}

.opp-round-dot.current {
  background: #ffcc33;
  border-color: #ffcc33;
  box-shadow: 0 0 10px rgba(255, 204, 51, 0.6);
  animation: brainrotPulse 1.5s ease-in-out infinite;
}

.opp-round-dot.won {
  background: #1aff55;
  border-color: #1aff55;
  box-shadow: 0 0 8px rgba(26, 255, 85, 0.4);
}

.opp-round-dot.lost {
  background: #ff3333;
  border-color: #ff3333;
  box-shadow: 0 0 8px rgba(255, 51, 51, 0.4);
}

.opp-round-dot.tied {
  background: #aa33ff;
  border-color: #aa33ff;
  box-shadow: 0 0 8px rgba(170, 51, 255, 0.4);
}

/* -- Score comparison bar -- */
.score-compare-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-compare-label {
  font-size: 0.7rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-height: 16px;
}

.score-compare-bar {
  display: flex;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
}

.score-compare-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 2px;
}

.score-compare-you {
  background: linear-gradient(90deg, #33aaff, #1aff55);
}

.score-compare-opp {
  background: linear-gradient(90deg, #ff33aa, #ff3333);
}

.score-compare-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
}

.score-compare-values span:first-child {
  color: #33aaff;
}

.score-compare-values span:last-child {
  color: #ff33aa;
}

/* -- Opponent score reveal overlay -- */
.opp-score-reveal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 10;
  pointer-events: none;
  text-align: center;
  background: rgba(13, 13, 20, 0.85);
  padding: 16px 24px;
  border-radius: 16px;
  border: 1px solid rgba(170, 51, 255, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* -- Mobile adjustments for split-screen -- */
@media (max-width: 600px) {
  .gameplay-split {
    flex-direction: column;
  }

  .game-side {
    flex: 0 0 55%;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(170, 51, 255, 0.15);
  }

  .opponent-side {
    flex: 0 0 45%;
    width: 100%;
  }

  .opp-live-panel {
    gap: 8px;
    padding: 10px 12px;
  }

  .opp-live-name {
    font-size: 0.9rem;
  }

  .opp-live-game-card {
    padding: 8px 14px;
    flex-direction: row;
    gap: 8px;
  }

  .opp-live-game-icon {
    font-size: 1.4rem;
  }

  .opp-live-game-name {
    font-size: 0.75rem;
  }

  .opp-activity {
    height: 28px;
  }

  .opp-round-dot {
    width: 10px;
    height: 10px;
  }

  .online-hud-vs {
    font-size: 0.85rem;
    gap: 8px;
  }

  .online-hud-player .online-hud-pts,
  .online-hud-opponent .online-hud-pts {
    font-size: 1rem;
  }
}

/* ----- COUNTDOWN OVERLAY ----- */
#countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 30;
  background: rgba(13, 13, 20, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  gap: 16px;
}

.countdown-number {
  font-size: clamp(4rem, 20vw, 10rem);
  font-weight: 900;
  color: #ff33aa;
  text-shadow: 0 0 40px rgba(255, 51, 170, 0.6), 0 0 80px rgba(255, 51, 170, 0.3);
  animation: countdownPop 0.5s ease-out;
}

.countdown-text {
  font-size: 1.5rem;
  color: #8888aa;
  font-weight: 600;
}

@keyframes countdownPop {
  0% {
    transform: scale(2);
    opacity: 0;
  }
  60% {
    transform: scale(0.9);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ----- QUESTION / PROMPT DISPLAY ----- */
.question-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
}

.question-text {
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.4;
  word-break: break-word;
}

.question-image {
  max-width: 100%;
  max-height: 200px;
  border-radius: 12px;
  margin: 12px auto;
  display: block;
  object-fit: contain;
}

/* ----- ANSWER BUTTONS ----- */
.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.answer-btn {
  padding: 18px 16px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  transition: all 0.15s ease;
  min-height: 56px;
  text-align: center;
  word-break: break-word;
  line-height: 1.3;
}

.answer-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.02);
}

.answer-btn:active {
  transform: scale(0.97);
}

.answer-btn.correct {
  background: rgba(26, 255, 85, 0.15);
  border-color: #1aff55;
  color: #1aff55;
  box-shadow: 0 0 20px rgba(26, 255, 85, 0.2);
}

.answer-btn.incorrect {
  background: rgba(255, 51, 51, 0.15);
  border-color: #ff3333;
  color: #ff3333;
  box-shadow: 0 0 20px rgba(255, 51, 51, 0.2);
}

.answer-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* ----- TEXT INPUT ANSWER ----- */
.answer-input-wrapper {
  width: 100%;
  display: flex;
  gap: 10px;
}

.answer-input {
  flex: 1;
  padding: 16px 20px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  font-size: 18px;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s ease;
}

.answer-input::placeholder {
  color: #555577;
}

.answer-input:focus {
  border-color: #33aaff;
  box-shadow: 0 0 20px rgba(51, 170, 255, 0.15);
}

/* ----- PROGRESS BAR ----- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
  background: linear-gradient(90deg, #33aaff, #ff33aa);
}

.progress-fill.timer {
  background: linear-gradient(90deg, #1aff55, #ffcc33, #ff3333);
  transition: width 0.1s linear;
}

/* ----- MATCHMAKING / SEARCHING ----- */
.matchmaking-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.search-icon {
  font-size: 4rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.matchmaking-status {
  font-size: 1.2rem;
  color: #8888aa;
}

.matchmaking-timer {
  font-size: 2rem;
  font-weight: 900;
  color: #ff33aa;
  text-shadow: 0 0 20px rgba(255, 51, 170, 0.5);
}

.matchmaking-tip {
  font-size: 0.9rem;
  color: #555577;
  max-width: 300px;
}

/* ----- RESULTS SCREEN ----- */
.results-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  width: min(500px, 90vw);
}

.score-big {
  font-size: clamp(4rem, 15vw, 8rem);
  font-weight: 900;
  line-height: 1;
}

.score-big.win {
  color: #1aff55;
  text-shadow: 0 0 40px rgba(26, 255, 85, 0.5), 0 0 80px rgba(26, 255, 85, 0.2);
}

.score-big.lose {
  color: #ff3333;
  text-shadow: 0 0 40px rgba(255, 51, 51, 0.5), 0 0 80px rgba(255, 51, 51, 0.2);
}

.score-big.draw {
  color: #ffcc33;
  text-shadow: 0 0 40px rgba(255, 204, 51, 0.5), 0 0 80px rgba(255, 204, 51, 0.2);
}

.rank-text {
  font-size: 2rem;
  font-weight: 700;
}

.score-label {
  font-size: 1rem;
  color: #8888aa;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Results - VS Layout */
.vs-layout {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.vs-player {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.vs-player-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.vs-player-score {
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 900;
  line-height: 1;
}

.vs-divider {
  font-size: 1.5rem;
  font-weight: 900;
  color: #555577;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Results - Stats Row */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 900;
}

.stat-label {
  font-size: 0.75rem;
  color: #555577;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Results - Rewards */
.rewards-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.reward-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 204, 51, 0.1);
  border: 1px solid rgba(255, 204, 51, 0.2);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #ffcc33;
}

/* ----- LEADERBOARD ----- */
.leaderboard-wrapper {
  width: min(500px, 90vw);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
}

.leaderboard-tabs {
  display: flex;
  gap: 8px;
}

.lb-tab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: #8888aa;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lb-tab.active {
  background: rgba(51, 170, 255, 0.15);
  color: #33aaff;
}

.lb-tab:hover {
  background: rgba(255, 255, 255, 0.08);
}

.leaderboard-list {
  overflow-y: auto;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.lb-entry {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 12px;
  transition: background 0.15s ease;
}

.lb-entry:last-child {
  border-bottom: none;
}

.lb-entry:nth-child(odd) {
  background: rgba(255, 255, 255, 0.015);
}

.lb-entry:hover {
  background: rgba(255, 255, 255, 0.04);
}

.lb-entry.gold {
  border-left: 3px solid #ffcc33;
}

.lb-entry.silver {
  border-left: 3px solid #c0c0cc;
}

.lb-entry.bronze {
  border-left: 3px solid #cc8833;
}

.lb-entry.self {
  background: rgba(51, 170, 255, 0.08);
}

.lb-entry.self:nth-child(odd) {
  background: rgba(51, 170, 255, 0.1);
}

.lb-rank {
  font-size: 14px;
  font-weight: 900;
  color: #555577;
  min-width: 32px;
  text-align: center;
}

.lb-entry.gold .lb-rank {
  color: #ffcc33;
}

.lb-entry.silver .lb-rank {
  color: #c0c0cc;
}

.lb-entry.bronze .lb-rank {
  color: #cc8833;
}

.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.lb-name {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-score {
  font-size: 15px;
  font-weight: 900;
  color: #33aaff;
  min-width: 60px;
  text-align: right;
}

.lb-empty {
  text-align: center;
  padding: 40px 20px;
  color: #555577;
  font-size: 14px;
}

/* ----- CONNECTION STATUS ----- */
#connection-status {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #8888aa;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.online {
  background: #1aff55;
  box-shadow: 0 0 8px rgba(26, 255, 85, 0.5);
}

.status-dot.offline {
  background: #ff3333;
  box-shadow: 0 0 8px rgba(255, 51, 51, 0.5);
}

.status-dot.reconnecting {
  background: #ffcc33;
  box-shadow: 0 0 8px rgba(255, 204, 51, 0.5);
  animation: pulse 1s ease-in-out infinite;
}

/* ----- DISCONNECT OVERLAY ----- */
#disconnect-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  text-align: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.disconnect-icon {
  font-size: 4rem;
  margin-bottom: 8px;
}

.disconnect-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #ff3333;
  text-shadow: 0 0 20px rgba(255, 51, 51, 0.4);
}

.disconnect-message {
  font-size: 1rem;
  color: #8888aa;
  max-width: 350px;
}

/* ----- TOAST / NOTIFICATIONS ----- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  pointer-events: auto;
  animation: slideInRight 0.3s ease-out;
  max-width: 320px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast-success {
  background: rgba(26, 255, 85, 0.15);
  border: 1px solid rgba(26, 255, 85, 0.3);
  color: #1aff55;
}

.toast-error {
  background: rgba(255, 51, 51, 0.15);
  border: 1px solid rgba(255, 51, 51, 0.3);
  color: #ff3333;
}

.toast-info {
  background: rgba(51, 170, 255, 0.15);
  border: 1px solid rgba(51, 170, 255, 0.3);
  color: #33aaff;
}

.toast-warning {
  background: rgba(255, 204, 51, 0.15);
  border: 1px solid rgba(255, 204, 51, 0.3);
  color: #ffcc33;
}

.toast.fade-out {
  animation: slideOutRight 0.3s ease-in forwards;
}

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

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

/* ----- MODAL ----- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: #151520;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 32px;
  max-width: 440px;
  width: 100%;
  animation: slideUp 0.3s ease-out;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 12px;
}

.modal-body {
  color: #8888aa;
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ----- SETTINGS / FORM ELEMENTS ----- */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(400px, 90vw);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-label {
  font-size: 15px;
  font-weight: 600;
}

.setting-description {
  font-size: 12px;
  color: #555577;
  margin-top: 2px;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  transition: all 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease;
}

.toggle input:checked + .toggle-slider {
  background: #1aff55;
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Select */
.select-input {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.select-input:focus {
  border-color: #33aaff;
}

/* Text Input */
.text-input {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
}

.text-input::placeholder {
  color: #555577;
}

.text-input:focus {
  border-color: #33aaff;
  box-shadow: 0 0 16px rgba(51, 170, 255, 0.1);
}

/* ----- MENU / NAVIGATION ----- */
.menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(400px, 85vw);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

.menu-item:active {
  transform: translateX(2px) scale(0.98);
}

.menu-item-icon {
  font-size: 1.5rem;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.menu-item-text {
  flex: 1;
}

.menu-item-title {
  font-size: 16px;
  font-weight: 700;
}

.menu-item-desc {
  font-size: 12px;
  color: #555577;
  margin-top: 2px;
}

.menu-item-arrow {
  color: #555577;
  font-size: 18px;
}

/* ----- PROFILE / AVATAR ----- */
.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.player-name {
  font-size: 1.5rem;
  font-weight: 900;
}

.player-level {
  font-size: 0.9rem;
  color: #aa33ff;
  font-weight: 700;
}

/* ----- COINS / CURRENCY ----- */
.coin-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  color: #ffcc33;
}

.coin-icon {
  font-size: 1.2em;
}

/* ----- LOADING / SPINNER ----- */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #ff33aa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-small {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

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

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* ----- BADGES / TAGS ----- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pink {
  background: rgba(255, 51, 170, 0.15);
  color: #ff33aa;
}

.badge-green {
  background: rgba(26, 255, 85, 0.15);
  color: #1aff55;
}

.badge-blue {
  background: rgba(51, 170, 255, 0.15);
  color: #33aaff;
}

.badge-gold {
  background: rgba(255, 204, 51, 0.15);
  color: #ffcc33;
}

.badge-purple {
  background: rgba(170, 51, 255, 0.15);
  color: #aa33ff;
}

/* ----- DIVIDER ----- */
.divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 0;
}

/* ----- UTILITY CLASSES ----- */
.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-row {
  display: flex;
  flex-direction: row;
}

.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.gap-xl { gap: 32px; }

.w-full { width: 100%; }
.text-center { text-align: center; }

.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }

/* ----- ANIMATIONS ----- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

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

@keyframes glow {
  0%, 100% {
    text-shadow: 0 0 20px currentColor;
  }
  50% {
    text-shadow: 0 0 40px currentColor, 0 0 80px currentColor;
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes bounceIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.15);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes scoreFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(1.5);
  }
}

.animate-in {
  animation: fadeIn 0.4s ease-out;
}

.animate-out {
  animation: fadeOut 0.3s ease-in forwards;
}

.animate-bounce {
  animation: bounceIn 0.5s ease-out;
}

.animate-shake {
  animation: shake 0.5s ease;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Score floating text */
.score-float {
  position: absolute;
  pointer-events: none;
  font-size: 1.5rem;
  font-weight: 900;
  animation: scoreFloat 0.8s ease-out forwards;
  z-index: 50;
}

.score-float.positive {
  color: #1aff55;
}

.score-float.negative {
  color: #ff3333;
}

/* ----- RESPONSIVE ----- */
@media (max-width: 600px) {
  .screen {
    padding: 16px;
  }

  .title {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .subtitle {
    font-size: clamp(0.85rem, 3vw, 1.1rem);
  }

  .btn {
    padding: 14px 32px;
    font-size: 16px;
    width: 100%;
  }

  .btn-small {
    padding: 10px 20px;
    font-size: 13px;
    width: auto;
  }

  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .panel {
    padding: 18px;
  }

  .question-card {
    padding: 20px 16px;
  }

  .question-text {
    font-size: clamp(1.1rem, 4.5vw, 1.5rem);
  }

  .answers-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .answer-btn {
    padding: 14px 12px;
    font-size: 15px;
  }

  #gameplay-hud {
    padding: 10px 12px;
  }

  .hud-item {
    padding: 6px 10px;
    font-size: 14px;
  }

  .hud-score,
  .hud-timer {
    font-size: 17px;
  }

  .score-big {
    font-size: clamp(3rem, 18vw, 5rem);
  }

  .rank-text {
    font-size: 1.5rem;
  }

  .vs-layout {
    gap: 12px;
  }

  .vs-player-score {
    font-size: clamp(2rem, 12vw, 3rem);
  }

  .stats-row {
    gap: 16px;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .modal {
    padding: 24px;
    border-radius: 16px;
  }

  .leaderboard-wrapper {
    max-height: 75vh;
  }

  .lb-entry {
    padding: 10px 12px;
  }

  .menu-item {
    padding: 14px 16px;
  }

  .settings-group {
    width: 100%;
  }

  .toast-container {
    top: 8px;
    right: 8px;
    left: 8px;
  }

  .toast {
    max-width: 100%;
  }
}

@media (max-width: 360px) {
  .screen {
    padding: 12px;
  }

  .btn {
    padding: 12px 24px;
    font-size: 15px;
  }

  .game-area {
    gap: 12px;
  }

  .panel {
    padding: 14px;
  }

  .avatar-large {
    width: 64px;
    height: 64px;
    font-size: 32px;
  }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .btn {
    padding: 10px 28px;
    font-size: 15px;
  }

  .game-area {
    gap: 8px;
  }

  .question-card {
    padding: 14px;
  }

  .score-big {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }
}

/* Large screens */
@media (min-width: 1024px) {
  .game-area {
    width: min(550px, 80vw);
  }

  .answers-grid {
    gap: 14px;
  }

  .answer-btn {
    padding: 20px;
    font-size: 17px;
  }

  .answer-btn:hover {
    transform: scale(1.03);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Safe area for notched devices */
@supports (padding: env(safe-area-inset-top)) {
  #gameplay-hud {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  #connection-status {
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
  }

  .toast-container {
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
  }
}

/* ============================================================
   GEN Z WORD POP-OFF ANIMATIONS - THEY HIT DIFFERENT FR FR
   ============================================================ */

/* Base brainrot word animation class */
.brainrot-word {
  display: inline-block;
  animation: brainrotPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  cursor: default;
}

.brainrot-word:hover {
  animation: brainrotShake 0.3s ease-in-out;
}

/* Pop in from nothing - words SLAM onto screen */
@keyframes brainrotPop {
  0% {
    transform: scale(0) rotate(-15deg);
    opacity: 0;
    filter: blur(10px);
  }
  50% {
    transform: scale(1.4) rotate(5deg);
    opacity: 1;
    filter: blur(0);
  }
  70% {
    transform: scale(0.9) rotate(-2deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Shake on hover */
@keyframes brainrotShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  10% { transform: translateX(-8px) rotate(-5deg); }
  20% { transform: translateX(8px) rotate(5deg); }
  30% { transform: translateX(-6px) rotate(-3deg); }
  40% { transform: translateX(6px) rotate(3deg); }
  50% { transform: translateX(-4px) rotate(-2deg); }
  60% { transform: translateX(4px) rotate(2deg); }
  70% { transform: translateX(-2px) rotate(-1deg); }
  80% { transform: translateX(2px) rotate(1deg); }
}

/* SLAM effect - word slams down from above */
.brainrot-slam {
  animation: brainrotSlam 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes brainrotSlam {
  0% {
    transform: translateY(-200px) scale(2.5) rotate(-10deg);
    opacity: 0;
  }
  60% {
    transform: translateY(10px) scale(0.95) rotate(2deg);
    opacity: 1;
  }
  80% {
    transform: translateY(-5px) scale(1.05) rotate(-1deg);
  }
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

/* BOUNCE effect - words bounce in */
.brainrot-bounce {
  animation: brainrotBounce 0.8s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes brainrotBounce {
  0% { transform: scale(0) translateY(100px); opacity: 0; }
  30% { transform: scale(1.3) translateY(-30px); opacity: 1; }
  50% { transform: scale(0.9) translateY(10px); }
  65% { transform: scale(1.1) translateY(-5px); }
  80% { transform: scale(0.97) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}

/* SPIN effect - words spin in */
.brainrot-spin {
  animation: brainrotSpin 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes brainrotSpin {
  0% { transform: rotate(720deg) scale(0); opacity: 0; }
  70% { transform: rotate(-15deg) scale(1.1); opacity: 1; }
  100% { transform: rotate(0deg) scale(1); }
}

/* GLITCH effect - words glitch in */
.brainrot-glitch {
  animation: brainrotGlitch 0.5s steps(10) both;
}

@keyframes brainrotGlitch {
  0% { clip-path: inset(80% 0 0 0); transform: translate(-5px, 5px); }
  10% { clip-path: inset(10% 0 60% 0); transform: translate(5px, -5px); }
  20% { clip-path: inset(40% 0 30% 0); transform: translate(-3px, 3px); }
  30% { clip-path: inset(60% 0 10% 0); transform: translate(3px, -3px); }
  40% { clip-path: inset(20% 0 50% 0); transform: translate(-2px, 2px); }
  50% { clip-path: inset(70% 0 5% 0); transform: translate(2px, -2px); }
  60% { clip-path: inset(5% 0 70% 0); transform: translate(-1px, 1px); }
  70% { clip-path: inset(30% 0 40% 0); transform: translate(1px, -1px); }
  80% { clip-path: inset(50% 0 20% 0); transform: translate(0, 0); }
  90% { clip-path: inset(0% 0 80% 0); transform: translate(0, 0); }
  100% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
}

/* RAINBOW GLOW - pulsing rainbow text */
.brainrot-rainbow {
  animation: brainrotPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both, rainbowGlow 2s linear infinite;
  background: linear-gradient(90deg, #ff3399, #ff6633, #ffcc00, #33ff66, #3399ff, #cc33ff, #ff3399);
  background-size: 400% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes rainbowGlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 400% 50%; }
}

/* MEGA POP - for special moments like wins */
.brainrot-mega {
  animation: brainrotMega 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes brainrotMega {
  0% { transform: scale(0); opacity: 0; text-shadow: 0 0 0 transparent; }
  30% { transform: scale(2); opacity: 1; text-shadow: 0 0 60px currentColor; }
  50% { transform: scale(0.8); text-shadow: 0 0 20px currentColor; }
  70% { transform: scale(1.2); text-shadow: 0 0 40px currentColor; }
  85% { transform: scale(0.95); text-shadow: 0 0 15px currentColor; }
  100% { transform: scale(1); text-shadow: 0 0 20px currentColor; }
}

/* Stagger delays for multiple words */
.brainrot-delay-1 { animation-delay: 0.1s; }
.brainrot-delay-2 { animation-delay: 0.2s; }
.brainrot-delay-3 { animation-delay: 0.3s; }
.brainrot-delay-4 { animation-delay: 0.4s; }
.brainrot-delay-5 { animation-delay: 0.5s; }

/* FLOAT effect - words float up continuously */
.brainrot-float {
  animation: brainrotFloat 3s ease-in-out infinite;
}

@keyframes brainrotFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-15px) rotate(2deg); }
}

/* PULSE GLOW effect */
.brainrot-pulse {
  animation: brainrotPulse 1.5s ease-in-out infinite;
}

@keyframes brainrotPulse {
  0%, 100% {
    text-shadow: 0 0 10px currentColor;
    transform: scale(1);
  }
  50% {
    text-shadow: 0 0 40px currentColor, 0 0 80px currentColor;
    transform: scale(1.08);
  }
}

/* --- RANK ANIMATIONS --- */
@keyframes rankPulse {
  0%, 100% { box-shadow: 0 0 15px currentColor; }
  50% { box-shadow: 0 0 35px currentColor, 0 0 60px currentColor; }
}

@keyframes rankCrimson {
  0%, 100% { border-color: #ff2222; box-shadow: 0 0 25px rgba(255,34,34,0.5), 0 0 50px rgba(255,34,34,0.2); }
  50% { border-color: #ffcc33; box-shadow: 0 0 35px rgba(255,34,34,0.7), 0 0 70px rgba(255,204,51,0.3); }
}

/* --- MENU BACKGROUND ANIMATION --- */
@keyframes menuBgDrift {
  0% { transform: scale(1.1) translate(0, 0); }
  25% { transform: scale(1.15) translate(-1%, -2%); }
  50% { transform: scale(1.2) translate(1%, -1%); }
  75% { transform: scale(1.15) translate(-1%, 1%); }
  100% { transform: scale(1.1) translate(0, 0); }
}

.menu-bg-animated {
  animation: menuBgDrift 25s ease-in-out infinite;
  will-change: transform;
}

/* JELLO wobble */
.brainrot-jello {
  animation: brainrotJello 0.9s both;
}

@keyframes brainrotJello {
  0% { transform: scale3d(1,1,1); }
  11.1% { transform: skewX(-5deg) skewY(-5deg); }
  22.2% { transform: skewX(4deg) skewY(4deg); }
  33.3% { transform: skewX(-3deg) skewY(-3deg); }
  44.4% { transform: skewX(2deg) skewY(2deg); }
  55.5% { transform: skewX(-1deg) skewY(-1deg); }
  66.6% { transform: skewX(0.5deg) skewY(0.5deg); }
  77.7% { transform: skewX(0deg) skewY(0deg); }
  100% { transform: scale3d(1,1,1); }
}

/* Shop styles */
.shop-header {
  position: sticky;
  top: 0;
  background: #0d0d14;
  padding: 15px 20px;
  z-index: 10;
  width: 100%;
  text-align: center;
}

.shop-cats {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 10px 0;
}

.shop-cat {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s;
}

.shop-cat.active {
  opacity: 1;
  transform: scale(1.1);
}

.shop-items {
  width: 100%;
  max-width: 600px;
  padding: 0 20px 80px;
  margin: 0 auto;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.shop-item:hover {
  background: rgba(255,255,255,0.08);
  transform: translateX(5px);
}

.shop-item.owned {
  background: rgba(46,204,64,0.08);
  border-left: 3px solid #2ecc40;
}

.shop-preview {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
}

.shop-info { flex: 1; min-width: 0; }
.shop-info h3 { font-size: 16px; margin-bottom: 2px; }
.shop-info p { font-size: 12px; color: #777; }

.shop-price {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.shop-price:hover { filter: brightness(1.2); }
.shop-price.owned-btn { background: #2a4a2a; cursor: default; }

/* Daily reward styles */
.daily-days {
  display: flex;
  gap: 8px;
  margin: 20px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.daily-day {
  width: 65px;
  height: 75px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.3s;
}

.daily-day.claimed { background: #2a5a2a; color: #8f8; }
.daily-day.today {
  background: #8f7a10;
  color: #ffd700;
  box-shadow: 0 0 20px rgba(255,215,0,0.4);
  animation: brainrotPulse 1.5s ease-in-out infinite;
}
.daily-day.future { background: #222233; color: #666; }

/* Login/Profile styles */
.profile-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(170,51,255,0.2);
  border-radius: 16px;
  padding: 24px;
  margin: 10px 0;
  width: 100%;
  max-width: 400px;
}

.profile-stat {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.profile-stat:last-child { border-bottom: none; }

.profile-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 2px solid rgba(170,51,255,0.3);
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.profile-input:focus {
  border-color: #aa33ff;
  box-shadow: 0 0 15px rgba(170,51,255,0.2);
}

/* Scrollable screen override */
.screen-scrollable {
  overflow-y: auto;
  justify-content: flex-start;
  padding-top: 20px;
}

/* ============================================================
   SPLIT-SCREEN ONLINE 1v1 LAYOUT
   ============================================================ */

/* Gameplay split container */
.gameplay-split {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
}

.gameplay-split .game-side {
  flex: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.gameplay-split .opponent-side {
  flex: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border-left: 1px solid rgba(255, 51, 170, 0.2);
}

/* Opponent live panel */
.opp-live-panel {
  width: 90%;
  max-width: 300px;
  text-align: center;
  padding: 20px;
}

.opp-live-header {
  font-size: 0.75rem;
  color: #555577;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.opp-live-name {
  font-size: 1.3rem;
  font-weight: 900;
  color: #ff33aa;
  text-shadow: 0 0 15px rgba(255, 51, 170, 0.4);
  margin-bottom: 16px;
}

.opp-live-game-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

.opp-live-game-name {
  font-size: 1rem;
  font-weight: bold;
  color: #33aaff;
  margin-bottom: 12px;
}

.opp-live-status {
  font-size: 1.1rem;
  font-weight: 900;
  min-height: 30px;
}

.opp-live-status.playing {
  color: #ffcc33;
  animation: brainrotPulse 1.5s ease-in-out infinite;
}

.opp-live-status.done {
  color: #1aff55;
}

.opp-live-status.waiting {
  color: #8888aa;
}

/* Animated dots for "COOKING..." */
.opp-dots::after {
  content: '';
  animation: oppDots 1.5s steps(4) infinite;
}

@keyframes oppDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Opponent score reveal */
.opp-live-score {
  font-size: 2.5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  margin: 10px 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.opp-live-score.reveal {
  animation: brainrotSlam 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

/* Score comparison bar */
.score-compare-bar {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin: 12px 0 8px;
}

.score-compare-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease, background 0.3s ease;
  background: linear-gradient(90deg, #1aff55, #33aaff);
}

.score-compare-fill.losing {
  background: linear-gradient(90deg, #ff3333, #ff8833);
}

.score-compare-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.score-compare-labels .you {
  color: #33aaff;
  font-weight: bold;
}

.score-compare-labels .opp {
  color: #ff33aa;
  font-weight: bold;
}

/* Round history in opponent panel */
.opp-round-history {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.opp-round-dot {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.06);
  color: #555577;
  transition: all 0.3s;
}

.opp-round-dot.won { background: rgba(26, 255, 85, 0.2); color: #1aff55; }
.opp-round-dot.lost { background: rgba(255, 51, 51, 0.2); color: #ff3333; }
.opp-round-dot.tied { background: rgba(170, 51, 255, 0.2); color: #aa33ff; }
.opp-round-dot.current {
  background: rgba(255, 204, 51, 0.2);
  color: #ffcc33;
  animation: brainrotPulse 1s ease-in-out infinite;
  transform: scale(1.2);
}

/* Opponent playing animation - fake activity */
.opp-activity {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 10px 0;
}

.opp-activity-bar {
  width: 6px;
  height: 30px;
  background: #ff33aa;
  border-radius: 3px;
  animation: oppActivityBar 0.8s ease-in-out infinite;
}

.opp-activity-bar:nth-child(1) { animation-delay: 0s; }
.opp-activity-bar:nth-child(2) { animation-delay: 0.1s; }
.opp-activity-bar:nth-child(3) { animation-delay: 0.2s; }
.opp-activity-bar:nth-child(4) { animation-delay: 0.3s; }
.opp-activity-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes oppActivityBar {
  0%, 100% { height: 10px; opacity: 0.3; }
  50% { height: 35px; opacity: 1; }
}

/* HUD redesign for split screen */
.gameplay-split-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 20px;
  z-index: 20;
  pointer-events: none;
  gap: 20px;
}

.hud-player-score, .hud-opp-score {
  padding: 8px 20px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  text-align: center;
  min-width: 120px;
}

.hud-player-score {
  border: 1px solid rgba(51, 170, 255, 0.2);
}

.hud-opp-score {
  border: 1px solid rgba(255, 51, 170, 0.2);
}

.hud-vs {
  font-size: 1.2rem;
  font-weight: 900;
  color: #aa33ff;
  text-shadow: 0 0 15px rgba(170, 51, 255, 0.5);
}

.hud-round-center {
  font-size: 0.85rem;
  color: #8888aa;
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .gameplay-split {
    flex-direction: column;
  }

  .gameplay-split .game-side {
    flex: 7;
  }

  .gameplay-split .opponent-side {
    flex: 3;
    border-left: none;
    border-top: 1px solid rgba(255, 51, 170, 0.2);
    padding: 10px;
  }

  .opp-live-panel {
    padding: 8px;
  }

  .opp-live-score {
    font-size: 1.8rem;
  }

  .opp-activity-bar {
    height: 20px;
  }

  @keyframes oppActivityBar {
    0%, 100% { height: 8px; opacity: 0.3; }
    50% { height: 22px; opacity: 1; }
  }
}

/* ============================================================
   PROGRESSION SYSTEM STYLES
   ============================================================ */

/* XP Bar */
.xp-bar-container {
  width: 100%;
  max-width: 380px;
  margin: 8px auto;
}

.xp-bar {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #aa33ff, #ff33aa);
  transition: width 0.5s ease;
}

.xp-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #555577;
  margin-top: 3px;
}

/* Streak badge */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
}

.streak-badge.active {
  background: rgba(255,136,0,0.15);
  border: 1px solid rgba(255,136,0,0.3);
  color: #ff8800;
  animation: brainrotPulse 2s ease-in-out infinite;
}

.streak-badge.none {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  color: #555577;
}

/* Rarity system */
.rarity-common { border-color: rgba(136,136,170,0.3); }
.rarity-rare { border-color: rgba(51,102,255,0.4); box-shadow: 0 0 15px rgba(51,102,255,0.1); }
.rarity-epic { border-color: rgba(170,51,255,0.4); box-shadow: 0 0 20px rgba(170,51,255,0.15); }
.rarity-legendary { border-color: rgba(255,204,51,0.5); box-shadow: 0 0 25px rgba(255,204,51,0.2); }

.rarity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 1px;
}

.rarity-badge.common { background: rgba(136,136,170,0.2); color: #8888aa; }
.rarity-badge.rare { background: rgba(51,102,255,0.2); color: #5588ff; }
.rarity-badge.epic { background: rgba(170,51,255,0.2); color: #bb66ff; }
.rarity-badge.legendary { background: rgba(255,204,51,0.2); color: #ffcc33; animation: brainrotPulse 2s ease-in-out infinite; }

/* Legendary shimmer */
.legendary-shimmer {
  position: relative;
  overflow: hidden;
}

.legendary-shimmer::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255,204,51,0.08) 50%, transparent 60%);
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

/* Challenge cards */
.challenge-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s;
}

.challenge-card.completed {
  background: rgba(26,255,85,0.05);
  border-color: rgba(26,255,85,0.2);
}

.challenge-progress {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.challenge-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #33aaff, #1aff55);
  transition: width 0.3s ease;
}

/* Achievement cards */
.achievement-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s;
}

.achievement-card.unlocked {
  background: rgba(26,255,85,0.04);
  border-color: rgba(26,255,85,0.2);
}

.achievement-card.locked {
  opacity: 0.4;
  filter: grayscale(0.5);
}

.achievement-icon {
  font-size: 2rem;
  min-width: 44px;
  text-align: center;
}

/* Lucky spin wheel */
.spin-wheel-container {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto;
}

.spin-pointer {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 25px solid #ff33aa;
  z-index: 10;
  filter: drop-shadow(0 0 8px rgba(255,51,170,0.5));
}

/* Menu XP section */
.menu-xp-section {
  width: 100%;
  max-width: 380px;
  margin: 12px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.menu-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(170,51,255,0.15), rgba(255,51,170,0.08));
  border: 1px solid rgba(170,51,255,0.25);
  font-size: 0.85rem;
  font-weight: bold;
  color: #aa33ff;
}

.menu-challenges-preview {
  width: 100%;
  max-width: 380px;
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(255,204,51,0.04);
  border: 1px solid rgba(255,204,51,0.15);
  border-radius: 12px;
  font-size: 0.75rem;
  color: #8888aa;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.menu-challenges-preview:hover {
  border-color: rgba(255,204,51,0.3);
  background: rgba(255,204,51,0.08);
}
