/* ONYX GAMES • Luxury Cyberpunk Arcade Stylesheet */
:root {
  --onyx-dark: #07090e;
  --onyx-card: #0f172a;
  --neon-blue: #38bdf8;
  --neon-orange: #f97316;
  --neon-purple: #a855f7;
  --neon-gold: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

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

body {
  background: radial-gradient(circle at 50% 10%, #1e1b4b 0%, var(--onyx-dark) 100%);
  color: var(--text-main);
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* NAVBAR */
header {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.brand-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 10px var(--neon-blue));
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fff 0%, var(--neon-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.65rem;
  padding: 3px 8px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--neon-blue);
  border-radius: 20px;
  color: var(--neon-blue);
  font-weight: 700;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.device-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.device-indicator:hover {
  border-color: var(--neon-blue);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.device-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

/* MULTIPLAYER LOBBY BAR */
.lobby-bar {
  width: 100%;
  max-width: 1200px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
}

.lobby-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

.lobby-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #c084fc;
}

.lobby-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lobby-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lobby-input {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px 14px;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  width: 140px;
}

.lobby-input:focus {
  outline: none;
  border-color: var(--neon-purple);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.btn-lobby {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-lobby:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.5);
}

.btn-lobby-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-lobby-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

/* HUB HERO & GAMES GRID */
main {
  width: 100%;
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.5rem;
}

.game-card {
  background: var(--onyx-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
  position: relative;
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--neon-blue);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.25);
}

.card-banner {
  height: 150px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-banner-rocket {
  background: radial-gradient(circle at 50% 50%, #0369a1 0%, #082f49 100%);
}

.card-banner-fortnite {
  background: radial-gradient(circle at 50% 50%, #7e22ce 0%, #3b0764 100%);
}

.card-banner-block {
  background: radial-gradient(circle at 50% 50%, #b45309 0%, #451a03 100%);
}

.card-banner-blackjack {
  background: radial-gradient(circle at 50% 50%, #064e3b 0%, #022c22 100%);
}

.card-banner-icon {
  font-size: 4rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
  transition: transform 0.3s ease;
}

.game-card:hover .card-banner-icon {
  transform: scale(1.12) rotate(-5deg);
}

.card-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.card-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 1.25rem;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-meta {
  font-size: 0.7rem;
  font-weight: 700;
  color: #38bdf8;
}

.btn-play {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  border: none;
  border-radius: 12px;
  padding: 8px 18px;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.btn-play:hover {
  transform: scale(1.04);
}

/* GAME ARENA MODAL CONTAINER */
#game-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(16px);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#game-modal.active {
  display: flex;
}

body.in-game {
  overflow: hidden !important;
  touch-action: none !important;
}

.modal-header {
  width: 100%;
  max-width: 1000px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
}

.modal-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 900;
}

.modal-close-btn {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid #ef4444;
  color: #fca5a5;
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  touch-action: manipulation;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 1000px;
  max-height: 85vh;
  aspect-ratio: 1000 / 600;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(56, 189, 248, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  touch-action: none;
}

body.mode-phone .canvas-wrapper {
  max-height: calc(100vh - 80px);
  border-radius: 8px;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* MOBILE ON-SCREEN CONTROLS */
#mobile-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}

body.mode-phone #mobile-controls {
  display: block;
}

/* Left Joystick */
.joystick-zone {
  position: absolute;
  left: 15px;
  bottom: 15px;
  width: 140px;
  height: 140px;
  pointer-events: auto;
  touch-action: none;
}

.joystick-base {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.25);
  position: relative;
  touch-action: none;
}

.joystick-stick {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--neon-blue);
  box-shadow: 0 0 16px var(--neon-blue);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Right Action Buttons */
.action-buttons-zone {
  position: absolute;
  right: 20px;
  bottom: 20px;
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.touch-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  border: 2px solid var(--neon-blue);
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  touch-action: none;
}

.touch-btn:active {
  transform: scale(0.9);
  background: var(--neon-blue);
  color: #000;
}

.touch-btn-boost {
  border-color: var(--neon-orange);
  color: var(--neon-orange);
}

.touch-btn-boost:active {
  background: var(--neon-orange);
  color: #000;
}

.touch-btn-fortnite {
  width: 54px;
  height: 54px;
  font-size: 0.75rem;
}

/* DESKTOP KEYBIND HINTS */
.desktop-hints {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

body.mode-phone .desktop-hints {
  display: none;
}

.key-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* FOOTER */
footer {
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto 1rem;
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
  header { padding: 0.75rem 1rem; }
  .brand-title { font-size: 1.15rem; }
  .lobby-card { flex-direction: column; align-items: stretch; }
  .lobby-inputs { flex-direction: column; width: 100%; }
  .lobby-input { width: 100%; }
  .btn-lobby { width: 100%; text-align: center; padding: 12px; }
  
  /* Zero-Scroll Full Phone Screen Game Modal */
  #game-modal {
    padding: 0 !important;
    justify-content: flex-start !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  .modal-header {
    width: 100%;
    padding: 6px 12px;
    height: 46px;
    flex-shrink: 0;
  }

  .canvas-wrapper { 
    border-radius: 0; 
    border: none;
    width: 100vw;
    height: calc(100dvh - 46px);
    max-height: calc(100dvh - 46px);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
  }

  #game-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  
  .joystick-zone { 
    width: 125px; 
    height: 125px; 
    bottom: 15px;
    left: 12px;
  }
  
  .action-buttons-zone {
    right: 12px;
    bottom: 15px;
    gap: 8px;
  }

  .touch-btn { 
    width: 56px; 
    height: 56px; 
    font-size: 0.72rem; 
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  }

  .touch-btn-fortnite {
    width: 50px;
    height: 50px;
    font-size: 0.68rem;
  }
}

/* Phone Toast Banner */
#phone-banner {
  display: none;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 12px;
  margin: 0.75rem auto 0;
  max-width: 1200px;
  width: calc(100% - 3rem);
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: fadeIn 0.4s ease;
}

body.mode-phone #phone-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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