:root {
  --bg-primary: #0a0b10;
  --bg-secondary: #121420;
  --bg-glass: rgba(18, 20, 32, 0.85);
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff007f;
  --neon-yellow: #ffe600;
  --neon-green: #39ff14;
  --neon-purple: #b026ff;
  --text-main: #f0f4f8;
  --text-dim: #8b9bb4;
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body.arcade-body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Background Cyber Grid */
.cyber-grid-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(to right, rgba(0, 240, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 0, 127, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 0;
  pointer-events: none;
}

.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  z-index: 0;
  pointer-events: none;
}
.glow-cyan {
  width: 500px;
  height: 500px;
  background: var(--neon-cyan);
  top: -100px;
  left: -100px;
}
.glow-magenta {
  width: 600px;
  height: 600px;
  background: var(--neon-magenta);
  bottom: -150px;
  right: -150px;
}

.app-container {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hidden {
  display: none !important;
}

/* OVERLAYS & PANELS */
.fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 11, 16, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 11, 16, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.arcade-panel {
  background: var(--bg-glass);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.neon-box-cyan {
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.3), inset 0 0 15px rgba(0, 240, 255, 0.1);
}

.neon-box-magenta {
  border: 2px solid var(--neon-magenta);
  box-shadow: 0 0 25px rgba(255, 0, 127, 0.3), inset 0 0 15px rgba(255, 0, 127, 0.1);
}

.glitch-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.text-center { text-align: center; }
.text-uppercase { text-transform: uppercase; }

/* DEVICE SELECTOR */
.device-options {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  justify-content: center;
}

.device-btn {
  background: var(--bg-secondary);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 24px 30px;
  cursor: pointer;
  width: 230px;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-main);
}

.device-btn:hover {
  transform: translateY(-5px);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.btn-gamepad:hover {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 20px rgba(255, 0, 127, 0.4);
}

.device-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.device-label {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.device-subtext {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 6px;
}

.device-badge {
  margin-top: 14px;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

.ready-badge {
  background: rgba(57, 255, 20, 0.2);
  color: var(--neon-green);
  border: 1px solid var(--neon-green);
}

.arcade-input {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.1rem;
  padding: 12px 18px;
  border-radius: 8px;
  outline: none;
  width: 100%;
  max-width: 320px;
  text-align: center;
  transition: border-color 0.2s;
}

.arcade-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* BUTTONS */
.arcade-btn {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 1.5px;
  padding: 14px 28px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.arcade-btn:hover {
  transform: translateY(-2px);
}

.btn-cyan {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}
.btn-cyan:hover {
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.8);
}

.btn-magenta {
  background: var(--neon-magenta);
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
}
.btn-magenta:hover {
  box-shadow: 0 0 25px rgba(255, 0, 127, 0.8);
}

.btn-green {
  background: var(--neon-green);
  color: #000;
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
}
.btn-green:hover {
  box-shadow: 0 0 25px rgba(57, 255, 20, 0.8);
}

.btn-yellow {
  background: var(--neon-yellow);
  color: #000;
  box-shadow: 0 0 15px rgba(255, 230, 0, 0.4);
}

.btn-block { width: 100%; margin-top: 20px; }
.btn-lg { font-size: 1.2rem; padding: 18px 36px; }

/* MAIN MENU VIEW */
.view-panel {
  width: 90%;
  max-width: 1000px;
  height: 90vh;
  display: flex;
  flex-direction: column;
}

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

.arcade-logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 2px;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
}

.user-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
}

.menu-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 40px;
}

.arcade-card {
  background: var(--bg-glass);
  border-radius: 16px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.arcade-card h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.arcade-card p {
  color: var(--text-dim);
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.join-input-group {
  display: flex;
  gap: 12px;
}

/* SETTINGS MODAL */
.settings-form {
  margin-top: 20px;
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 8px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 14px;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--neon-cyan);
}

.close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
}

.setting-row {
  margin-top: 18px;
}

.setting-row label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.btn-group {
  display: flex;
  gap: 8px;
}

.group-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  transition: all 0.2s;
}

.group-btn.active {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

/* 20-GAME CATALOG */
.catalog-selector-box {
  margin-top: 20px;
  background: rgba(0, 0, 0, 0.4);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.catalog-selector-box h4 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--neon-yellow);
  margin-bottom: 12px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.game-checkbox-item {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.game-checkbox-item.checked {
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.1);
}

.game-checkbox-item input {
  margin-right: 10px;
  accent-color: var(--neon-cyan);
}

.game-checkbox-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.game-checkbox-tag {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

/* LOBBY VIEW */
.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-glass);
  padding: 20px 30px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
}

.lobby-code-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lobby-code-box .label {
  font-family: var(--font-display);
  color: var(--text-dim);
}

.lobby-code-box .code {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--neon-green);
  text-shadow: 0 0 10px var(--neon-green);
}

.copy-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-display);
}

.copy-pill:hover { background: rgba(255, 255, 255, 0.2); }

.lobby-meta {
  display: flex;
  gap: 18px;
  font-family: var(--font-display);
  color: var(--text-dim);
}

.lobby-players-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 30px;
  flex: 1;
}

.player-card {
  background: var(--bg-glass);
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
}

.player-card.active-slot {
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.player-card-avatar {
  font-size: 4rem;
  margin: 10px 0;
}

.player-card-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.player-card-controller {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: 20px;
}

.player-status-tag {
  font-family: var(--font-display);
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 6px;
  width: 100%;
}

.status-waiting {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

.status-ready {
  background: rgba(57, 255, 20, 0.2);
  color: var(--neon-green);
  border: 1px solid var(--neon-green);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.4);
}

.empty-slot {
  border-style: dashed;
  opacity: 0.4;
  justify-content: center;
}

.lobby-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding-bottom: 20px;
}

/* COUNTDOWN OVERLAY */
.countdown-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.round-indicator {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--neon-cyan);
  letter-spacing: 2px;
}

.countdown-game-title {
  font-family: var(--font-display);
  font-size: 3.5rem;
  color: #fff;
  text-shadow: 0 0 25px var(--neon-magenta);
  margin: 10px 0;
}

.countdown-game-desc {
  font-size: 1.3rem;
  color: var(--text-dim);
  max-width: 600px;
  margin-bottom: 24px;
}

.controls-hint-box {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 12px 24px;
  border-radius: 30px;
  display: flex;
  gap: 24px;
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 30px;
}

.countdown-number {
  font-family: var(--font-display);
  font-size: 7rem;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 0 30px var(--neon-yellow);
  animation: pulseScale 1s infinite alternate;
}

@keyframes pulseScale {
  0% { transform: scale(1); }
  100% { transform: scale(1.15); }
}

/* GAMEPLAY VIEW */
.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-glass);
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.hud-tag {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--neon-cyan);
}

.hud-pill {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.9rem;
}

.timer-badge {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px var(--neon-yellow);
}

.canvas-container {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.2);
  border: 2px solid rgba(0, 240, 255, 0.4);
  background: #000;
}

#gameCanvas {
  display: block;
  background: #060810;
  max-width: 100%;
  max-height: 70vh;
}

/* SCOREBOARD */
.scoreboard-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
  min-width: 450px;
}

.score-row {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 20px;
  border-radius: 10px;
  font-family: var(--font-display);
}

.score-rank {
  font-size: 1.3rem;
  font-weight: 900;
  width: 40px;
}

.score-player {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  text-align: left;
}

.score-points-added {
  color: var(--neon-green);
  font-weight: 700;
  margin-right: 18px;
}

.score-total {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--neon-cyan);
}

/* GRAND PODIUM */
#confettiCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 101;
}

.podium-content {
  position: relative;
  z-index: 102;
  width: 90%;
  max-width: 900px;
}

.grand-champion-title {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--neon-yellow);
  text-shadow: 0 0 20px var(--neon-yellow);
  margin-bottom: 6px;
}

.podium-stage {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 24px;
  height: 380px;
  margin: 30px 0;
}

.podium-tier {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 180px;
  position: relative;
}

.podium-avatar-wrapper {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.crown-icon {
  font-size: 2.5rem;
  animation: bounceCrown 1.5s infinite alternate;
}

@keyframes bounceCrown {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.podium-avatar {
  font-size: 4rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.champion-glow {
  box-shadow: 0 0 30px var(--neon-yellow), inset 0 0 20px var(--neon-yellow);
  border: 2px solid var(--neon-yellow);
}

.podium-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.podium-score {
  font-family: var(--font-display);
  color: var(--neon-cyan);
  font-size: 1.2rem;
  font-weight: 900;
}

.champion-score {
  color: var(--neon-yellow);
  font-size: 1.4rem;
}

.podium-block {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px 12px 0 0;
}

.podium-rank-num {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.85);
}

.tier-1 .podium-block {
  height: 200px;
  background: linear-gradient(to top, #c79c00, #ffe600);
  box-shadow: 0 0 25px rgba(255, 230, 0, 0.5);
}

.tier-2 .podium-block {
  height: 140px;
  background: linear-gradient(to top, #7d8b99, #d6e0ea);
  box-shadow: 0 0 20px rgba(214, 224, 234, 0.4);
}

.tier-3 .podium-block {
  height: 100px;
  background: linear-gradient(to top, #8b4513, #cd7f32);
  box-shadow: 0 0 20px rgba(205, 127, 50, 0.4);
}

.game-toast {
  position: absolute;
  top: 90px;
  background: rgba(255, 0, 127, 0.85);
  color: #fff;
  padding: 10px 24px;
  border-radius: 30px;
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.6);
  pointer-events: none;
}
