/* --- 🌌 CORE DESIGN SYSTEM & CYBERPUNK VARIABLES --- */
:root {
  --color-bg: #04040d;
  --color-surface: rgba(9, 9, 30, 0.65);
  --color-surface-glow: rgba(0, 240, 255, 0.05);
  
  /* Neon Palette */
  --neon-cyan: #00f0ff;
  --neon-pink: #ff007f;
  --neon-purple: #7000ff;
  --neon-gold: #ffb700;
  --neon-green: #39ff14;
  --neon-red: #ff3131;

  /* Typography */
  --font-cyber: 'Outfit', 'Vazirmatn', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- 🛑 GLOBAL RESET & SCROLLBARS --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background-color: var(--color-bg);
  color: #f0f0f8;
  font-family: var(--font-cyber);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: relative;
  direction: rtl;
}

/* Cyber Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}
::-webkit-scrollbar-thumb {
  background: var(--neon-cyan);
  border-radius: 4px;
  box-shadow: 0 0 10px var(--neon-cyan);
}

/* --- 📺 CANVAS BACKGROUND & CRT MONITOR EFFECTS --- */
#bg-starfield {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  pointer-events: none;
  opacity: 0.4;
}

/* --- 🎛️ FLOATING OPTIONS BAR (SOUND / INSTALL) --- */
.top-bar {
  position: absolute;
  top: 15px;
  left: 20px;
  display: flex;
  gap: 15px;
  z-index: 100;
}

.floating-btn {
  background: var(--color-surface);
  border: 1px solid var(--neon-cyan);
  color: #fff;
  padding: 10px 15px;
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-cyber);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
  transition: var(--transition-smooth);
  backdrop-filter: blur(10px);
}

.floating-btn:hover {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 20px var(--neon-cyan);
  transform: translateY(-2px);
}

.floating-btn i {
  font-size: 16px;
}

.hidden {
  display: none !important;
}

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

/* --- 🖥️ SCREEN MANAGERS --- */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  padding: 20px;
  justify-content: center;
  align-items: center;
}

.screen.active {
  display: flex;
}

/* --- 💎 PREMIUM GLASSMORPHIC CARD & CYBER-PANEL --- */
.glass-card {
  background: var(--color-surface);
  border: 1px solid rgba(0, 240, 255, 0.15);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5), 
              inset 0 0 15px rgba(0, 240, 255, 0.05);
  backdrop-filter: blur(12px);
  border-radius: 16px;
}

.cyber-panel {
  width: 100%;
  max-width: 480px;
  padding: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cyber-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-purple), var(--neon-cyan));
}

.cyber-badge {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--neon-cyan);
  font-weight: 800;
  margin-bottom: 15px;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

.glow-title {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff, #b3e5fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.2));
}

.panel-subtitle {
  font-size: 14px;
  color: #a0a0c0;
  line-height: 1.6;
  margin-bottom: 30px;
}

/* --- 📝 INPUT ELEMENT STYLES --- */
.input-group {
  margin-bottom: 25px;
  text-align: right;
}

.input-group label {
  display: block;
  font-size: 12px;
  color: var(--neon-cyan);
  margin-bottom: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i {
  position: absolute;
  right: 15px;
  color: var(--neon-cyan);
  font-size: 16px;
}

.input-wrapper input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 240, 255, 0.2);
  padding: 15px 45px 15px 15px;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-cyber);
  font-size: 15px;
  outline: none;
  transition: var(--transition-smooth);
}

.input-wrapper input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
  background: rgba(0, 0, 0, 0.6);
}

/* --- ⚡ PREMIUM BUTTON SYSTEMS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-cyber);
  font-weight: 800;
  font-size: 15px;
  padding: 15px 30px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-pink) 0%, var(--neon-purple) 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px var(--neon-pink);
}

.btn-glow {
  position: relative;
  overflow: hidden;
}

.btn-glow::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: rotate(45deg);
  transition: 0.5s;
}

.btn-glow:hover::after {
  left: 120%;
}

.btn-small {
  padding: 8px 15px;
  font-size: 12px;
  width: auto;
  border-radius: 4px;
  background: var(--neon-cyan);
  color: #000;
}

.btn-small:hover {
  box-shadow: 0 0 10px var(--neon-cyan);
}

/* --- 🕹️ REAL-TIME DASHBOARD LAYOUT (GAME SCREEN) --- */
.game-dashboard {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 20px;
  max-width: 1600px;
}

/* Side Panels */
.side-panel {
  width: 320px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.panel-header i {
  font-size: 18px;
}

.panel-header h3 {
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  letter-spacing: 0.5px;
}

.panel-divider {
  border: none;
  border-top: 1px solid rgba(0, 240, 255, 0.1);
  margin: 15px 0;
}

.text-gold {
  color: var(--neon-gold);
}
.text-cyan {
  color: var(--neon-cyan);
}

/* --- 🏆 LEADERBOARD ONLINE LIST --- */
.leaderboard-list {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
  border-radius: 8px;
  transition: var(--transition-smooth);
}

.leaderboard-item.highlight-me {
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.05);
}

.rank-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  margin-left: 10px;
}

.rank-1 { background: var(--neon-gold); color: #000; box-shadow: 0 0 8px var(--neon-gold); }
.rank-2 { background: #c0c0c0; color: #000; }
.rank-3 { background: #cd7f32; color: #000; }
.rank-other { background: rgba(255, 255, 255, 0.1); color: #fff; }

.player-name-lbl {
  flex-grow: 1;
  font-size: 13px;
  font-weight: 700;
  color: #e0e0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.player-score-lbl {
  font-size: 14px;
  font-weight: 800;
  color: var(--neon-cyan);
  font-family: var(--font-cyber);
}

/* Profile Section in Sidebar */
.profile-editor {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 240, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.profile-name {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--neon-cyan);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  color: var(--neon-pink);
  transform: scale(1.1);
}

#name-edit-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

#name-edit-form input {
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 4px;
  padding: 5px 10px;
  color: #fff;
  font-family: var(--font-cyber);
  font-size: 12px;
  outline: none;
}

/* --- 📡 LIVE ACTIVITY FEED LOGS --- */
.activity-feed {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-item {
  font-size: 11px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-right: 2px solid var(--neon-purple);
  border-radius: 0 4px 4px 0;
  color: #b0b0d0;
  line-height: 1.4;
  text-align: right;
  animation: slide-in 0.3s ease-out;
}

.feed-item.system {
  border-right-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.feed-item.record {
  border-right-color: var(--neon-pink);
  color: var(--neon-pink);
  font-weight: bold;
}

/* --- 🚀 CORE GAMEPLAY AREA (CENTER) --- */
.gameplay-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.game-stats-header {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 15px 30px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 11px;
  color: #a0a0c0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 900;
}

.cyber-num {
  font-family: var(--font-cyber);
}

/* Canvas Box & Wrapper */
.canvas-container {
  flex-grow: 1;
  position: relative;
  background: rgba(3, 3, 10, 0.8);
  border: 1px solid rgba(0, 240, 255, 0.1);
  border-radius: 12px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.mobile-controls-tip {
  position: absolute;
  bottom: 15px;
  width: 100%;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  animation: pulse-glow 2s infinite ease-in-out;
}

/* Overlays / Prompts */
.overlay-prompt {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 4, 13, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  z-index: 10;
  text-align: center;
  animation: fade-in 0.4s ease-out;
}

.alert-title {
  font-size: 36px;
  font-weight: 900;
  color: var(--neon-pink);
  margin-bottom: 10px;
  text-shadow: 0 0 15px var(--neon-pink);
}

.alert-desc {
  font-size: 14px;
  color: #b0b0d0;
  margin-bottom: 25px;
  max-width: 400px;
  line-height: 1.6;
}

.overlay-scores {
  display: flex;
  gap: 30px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 240, 255, 0.15);
  padding: 15px 25px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.overlay-scores span {
  font-size: 14px;
  color: #a0a0c0;
}

.overlay-scores strong {
  font-family: var(--font-cyber);
  font-size: 20px;
  color: #fff;
  font-weight: 800;
}

.overlay-scores strong#final-score {
  color: var(--neon-cyan);
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  color: var(--neon-cyan);
  font-size: 13px;
  height: 100%;
}

/* --- 🎬 PREMIUM ANIMATIONS & RESPONSIVENESS --- */
@keyframes pulse-glow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

@keyframes slide-in {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes animate-zoom {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.animate-zoom {
  animation: animate-zoom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

/* Screen Shaking Effect */
.shake-effect {
  animation: screen-shake 0.15s infinite;
}

@keyframes screen-shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(0px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(2px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(2px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* --- 📱 RESPONSIVE ADAPTABILITY --- */
@media (max-width: 1024px) {
  body {
    overflow-y: auto;
  }
  
  .game-dashboard {
    flex-direction: column;
    height: auto;
    gap: 15px;
    padding-top: 60px; /* Space for absolute floating top bar */
  }

  .side-panel {
    width: 100%;
    height: 300px;
  }

  .gameplay-area {
    order: -1;
  }

  .canvas-container {
    height: 60vh;
    min-height: 400px;
  }
}
