/* games.css - Games page styles */

  /* Light mode variables */
  [data-theme="light"] {
    --bg: #f1f5f9;
    --bg2: #e2e8f0;
    --text: #0f172a;
    --text-dim: #475569;
    --accent: #4f46e5;
    --accent-hover: #6366f1;
    --border: #cbd5e1;
    --card-bg: #ffffff;
  }

  /* styles */
  .main {
    margin-top: 130px;
    padding: 20px 24px 60px;
    text-align: center;
    transition: 0.3s;
  }

  body.games-open .main {
    display: none;
  }

  .title {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(145deg, #e2e8ff, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
  }

  [data-theme="light"] .title {
    background: linear-gradient(145deg, #4f46e5, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .ad-top {
    width: min(728px, 90%);
    height: 90px;
    margin: 18px auto;
    background: var(--card-bg);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    color: var(--text-dim);
  }

  .search {
    margin: 28px auto;
    max-width: 480px;
  }

  .search input {
    width: 100%;
    padding: 14px 24px;
    border-radius: 60px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: all 0.25s;
  }

  .search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
  }

  .games-stats {
    background: rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(8px);
    padding: 8px 20px;
    border-radius: 40px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 10px auto 20px;
    border: 1px solid var(--border);
    color: var(--text);
  }

  .games-stats i {
    color: var(--accent);
    font-size: 1rem;
  }

  .games-stats span {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
  }

  .grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 40px auto 0;
    padding: 0 12px;
  }

@media (max-width: 1100px) { .grid { grid-template-columns: repeat(5,1fr); } }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(4,1fr); } }
@media (max-width: 650px) { .grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 450px) { .grid { grid-template-columns: repeat(2,1fr); } }

.game {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.game:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 10px 25px -8px rgba(0,0,0,0.3);
  border-color: var(--accent);
}

.game img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.game:hover img {
  transform: scale(1.05);
}

.game-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  padding: 12px 6px 8px;
  font-weight: 600;
  font-size: 0.7rem;
  text-align: center;
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
  color: white;
}

.game:hover .game-name {
  transform: translateY(0);
}

.suggestion-card {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border: 2px solid rgba(255,255,255,0.3);
}

.suggestion-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 0 25px rgba(99,102,241,0.5);
}

/* Floating Closeable Ads - 160x600 */
.floating-ad {
  position: fixed;
  width: 160px;
  min-height: 600px;
  z-index: 1000;
  transition: all 0.3s ease;
}

.floating-ad-left {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.floating-ad-right {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.ad-close-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 28px;
  height: 28px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 1001;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.ad-close-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.floating-ad.hidden {
  display: none;
}

.ad-content {
  width: 160px;
  min-height: 600px;
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

@media (max-width: 1200px) {
  .floating-ad {
    display: none;
  }
}

/* Viewer - Exact same as your reference */
.viewer {
  position: fixed;
  top: 105px;
  left: 0;
  width: 100%;
  height: calc(100vh - 105px);
  display: none;
  z-index: 1040;
  background: #000;
}

[data-theme="light"] .viewer {
  background: #0f172a;
}

.viewer.active {
  display: block;
}

.game-box {
  width: 100%;
  height: 100%;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
}

.game-area {
  flex: 1;
  overflow: hidden;
}

#frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Bottom Controls - Exactly like reference */
.controls {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--controls-bg);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.08);
}

[data-theme="light"] .controls {
  border-top: 1px solid var(--border);
}

.current-game {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.current-game i {
  color: var(--accent);
  font-size: 1rem;
}

.current-game span {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.ctrl-btn {
  background: #1e293b;
  border: none;
  color: white;
  padding: 8px 18px;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

[data-theme="light"] .ctrl-btn {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.ctrl-btn:hover {
  background: var(--accent);
  transform: translateY(-2px);
  color: white;
}

/* Loader */
#loader {
  position: fixed;
  top: 105px;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, #020617, #000000dd);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

[data-theme="light"] #loader {
  background: rgba(255, 255, 255, 0.95);
}

#loader.active {
  opacity: 1;
  pointer-events: all;
}

.loader-content {
  text-align: center;
}

#loaderIcon {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 2rem;
  animation: floatIcon 2s ease-in-out infinite;
}

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

#loaderTitle {
  margin-top: 12px;
  font-size: 1.2rem;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#loaderText {
  margin-top: 5px;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.progress {
  width: 200px;
  height: 4px;
  background: #1e293b;
  border-radius: 10px;
  margin: 15px auto 0;
  overflow: hidden;
}

[data-theme="light"] .progress {
  background: var(--border);
}

.bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
  transition: width 2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

@media (max-width: 860px) {
  .browser-bar { padding: 6px 16px; }
  .navbar { padding: 0 16px; }
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg2);
    flex-direction: column;
    padding: 12px;
    border-radius: 0 0 16px 16px;
    gap: 5px;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }
  .controls { padding: 0 16px; }
  .current-game span { max-width: 120px; font-size: 0.7rem; }
  .ctrl-btn span { display: none; }
  .ctrl-btn i { margin: 0; font-size: 1rem; }
  .ctrl-btn { padding: 8px 12px; }
  .grid { gap: 12px; }
}