/* ============================================================================
 * Jack's Browser Games — Main Stylesheet (`css/main.css`)
 * Theme: Sleek Dark Neon Arcade
 * ============================================================================ */

:root {
  --bg-obsidian: #07080d;
  --bg-surface: rgba(16, 19, 32, 0.78);
  --bg-surface-hover: rgba(24, 29, 48, 0.92);
  --bg-cabinet: #0c0e18;

  --neon-cyan: #00f3ff;
  --neon-cyan-glow: rgba(0, 243, 255, 0.38);
  --neon-magenta: #ff007f;
  --neon-magenta-glow: rgba(255, 0, 127, 0.35);
  --neon-purple: #8a2be2;
  --neon-green: #00ff9d;

  --text-primary: #f4f7ff;
  --text-secondary: #9ba4c2;
  --text-muted: #636d8e;

  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-neon: rgba(0, 243, 255, 0.45);

  --font-display: "Orbitron", "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --header-height: 76px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background-color: var(--bg-obsidian);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  position: relative;
}

.hidden {
  display: none !important;
}

/* ============================================================================
 * Ambient Neon Background Layers
 * ============================================================================ */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.28;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.orb-cyan {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, var(--neon-cyan), transparent 70%);
  top: -140px;
  left: -100px;
}

.orb-magenta {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, var(--neon-magenta), transparent 70%);
  bottom: -180px;
  right: -120px;
  animation-delay: -7s;
}

.orb-purple {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, var(--neon-purple), transparent 70%);
  top: 35%;
  left: 42%;
  opacity: 0.18;
  animation-delay: -12s;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.85) 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.85) 20%, transparent 80%);
}

@keyframes floatOrb {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(40px, 30px) scale(1.12);
  }
}

/* ============================================================================
 * Top Header Bar
 * ============================================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: rgba(7, 8, 13, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.45);
}

.header-inner {
  max-width: 1360px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease;
}

.brand-group:hover {
  transform: translateY(-1px);
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.16), rgba(255, 0, 127, 0.16));
  border: 1px solid var(--border-neon);
  box-shadow: 0 0 18px var(--neon-cyan-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.site-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffffff 0%, var(--neon-cyan) 55%, var(--neon-magenta) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 24px rgba(0, 243, 255, 0.25);
}

.site-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.game-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0, 255, 157, 0.08);
  border: 1px solid rgba(0, 255, 157, 0.3);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--neon-green);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 10px var(--neon-green);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.65;
  }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 14px rgba(0, 243, 255, 0.25);
  background: rgba(0, 243, 255, 0.08);
}

.icon-btn.muted {
  border-color: rgba(255, 0, 127, 0.4);
  color: var(--text-secondary);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  color: var(--neon-cyan);
}

.icon-btn.muted svg {
  color: var(--neon-magenta);
}

/* ============================================================================
 * Main Layout & Scrollable Menu View
 * ============================================================================ */
.main-container {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px;
  min-height: calc(100vh - var(--header-height));
}

.menu-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 24px;
}

.menu-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-heading {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.section-subheading {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* ============================================================================
 * Music Selector Pop-Up Modal
 * ============================================================================ */
.music-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(5, 6, 12, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInModal 0.18s ease-out;
}

@keyframes fadeInModal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.music-modal-card {
  width: 100%;
  max-width: 380px;
  background: rgba(14, 17, 30, 0.96);
  border: 1px solid var(--border-neon);
  border-radius: var(--radius-lg);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.8),
    0 0 28px rgba(0, 243, 255, 0.22);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.music-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.music-modal-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.music-modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.music-modal-close svg {
  width: 16px;
  height: 16px;
}

.music-modal-close:hover {
  border-color: var(--neon-magenta);
  color: var(--text-primary);
  background: rgba(255, 0, 127, 0.15);
}

.music-track-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.music-track-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.music-track-option:hover {
  border-color: rgba(0, 243, 255, 0.5);
  background: rgba(0, 243, 255, 0.08);
}

.music-track-option.active {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.18), rgba(138, 43, 226, 0.22));
  border-color: var(--neon-cyan);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(0, 243, 255, 0.25);
}

.music-track-check {
  font-size: 0.85rem;
  color: var(--neon-cyan);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.music-track-option.active .music-track-check {
  opacity: 1;
}

.search-box {
  position: relative;
  min-width: 260px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 14px rgba(0, 243, 255, 0.22);
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-pill {
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-pill:hover {
  color: var(--text-primary);
  border-color: rgba(0, 243, 255, 0.4);
}

.category-pill.active {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(138, 43, 226, 0.25));
  border-color: var(--neon-cyan);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.25);
}

/* Scrollable Game Selection Container */
.games-scroll-region {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 230px);
  padding: 6px 6px 28px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-cyan) rgba(255, 255, 255, 0.04);
}

.games-scroll-region::-webkit-scrollbar {
  width: 8px;
}

.games-scroll-region::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.games-scroll-region::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--neon-cyan), var(--neon-magenta));
  border-radius: 8px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 24px;
}

/* ============================================================================
 * Game Tile Card
 * ============================================================================ */
.game-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 0.28s ease,
              box-shadow 0.28s ease;
  backdrop-filter: blur(12px);
}

.game-tile:hover,
.game-tile:focus-visible {
  transform: translateY(-6px);
  border-color: var(--neon-cyan);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.65),
    0 0 24px rgba(0, 243, 255, 0.32);
  outline: none;
}

.tile-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0d1124;
  overflow: hidden;
}

.tile-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.game-tile:hover .tile-thumb {
  transform: scale(1.06);
}

.tile-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 8, 13, 0.1) 0%, rgba(7, 8, 13, 0.82) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.game-tile:hover .tile-overlay,
.game-tile:focus-visible .tile-overlay {
  opacity: 1;
}

.play-cta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
  color: #07080d;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 0 24px rgba(0, 243, 255, 0.6);
  transform: translateY(8px);
  transition: transform 0.25s ease;
}

.game-tile:hover .play-cta-pill,
.game-tile:focus-visible .play-cta-pill {
  transform: translateY(0);
}

.tile-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}

.tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tile-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.tile-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 243, 255, 0.12);
  border: 1px solid rgba(0, 243, 255, 0.3);
  color: var(--neon-cyan);
}

.tile-description {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
  flex: 1;
}

.tile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
}

.tile-tag {
  font-size: 0.74rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

/* Empty Search State */
.empty-search-state {
  text-align: center;
  padding: 64px 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-top: 12px;
}

.empty-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
}

.empty-search-state h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.empty-search-state p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.neon-btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--neon-cyan);
  background: rgba(0, 243, 255, 0.12);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.neon-btn:hover {
  background: var(--neon-cyan);
  color: #07080d;
  box-shadow: 0 0 18px var(--neon-cyan-glow);
}

/* ============================================================================
 * Embedded Arcade Cabinet Player View
 * ============================================================================ */
.player-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  animation: fadeInCabinet 0.28s ease out;
}

@keyframes fadeInCabinet {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.arcade-cabinet {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 580px;
  height: calc(100vh - var(--header-height) - 56px);
  background: var(--bg-cabinet);
  border: 1px solid var(--border-neon);
  border-radius: var(--radius-lg);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.8),
    0 0 35px rgba(0, 243, 255, 0.18);
  overflow: hidden;
}

.cabinet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(14, 18, 32, 0.95);
  border-bottom: 1px solid var(--border-subtle);
}

.cabinet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cabinet-btn svg {
  width: 17px;
  height: 17px;
}

.cabinet-btn:hover {
  border-color: var(--neon-cyan);
  background: rgba(0, 243, 255, 0.12);
  box-shadow: 0 0 14px rgba(0, 243, 255, 0.25);
}

.back-btn {
  border-color: rgba(255, 0, 127, 0.4);
  background: rgba(255, 0, 127, 0.1);
}

.back-btn:hover {
  border-color: var(--neon-magenta);
  background: rgba(255, 0, 127, 0.22);
  box-shadow: 0 0 16px var(--neon-magenta-glow);
}

.active-game-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.playing-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 12px var(--neon-cyan);
}

.active-game-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.cabinet-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.iframe-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  background: #05060a;
}

.game-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
  }

  .site-title {
    font-size: 1.05rem;
  }

  .btn-label {
    display: none;
  }

  .main-container {
    padding: 18px 16px;
  }

  .menu-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    width: 100%;
  }

  .cabinet-bar span {
    display: none;
  }
}
