:root {
  --bg-main: #0F2F4F;
  --bg-dark: #071A2C;
  --bg-section: #2F5D7C;

  --surface0: #1A3A57;
  --surface1: #224B6B;
  --surface2: #2F5D7C;

  --accent: #35E0F3;
  --accent-glow: #7FF5FF;

  --text: #E6EEF5;
  --subtext: #A8B8C6;

  --border: #1A2A38;
}

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

#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #444;
  border-top: 5px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-main), var(--bg-dark));
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 70px;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  gap: 1.2rem;
  border-right: 1px solid var(--border);
  position: fixed;
  height: 100%;
  padding-top: 1.2rem;
}

.sidebar a {
  color: var(--subtext);
  padding: 0.6rem;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.sidebar a:hover {
  background: var(--surface0);
  color: var(--accent);
}

.sidebar a.active {
  background: var(--accent);
  color: #071A2C;
  box-shadow: 0 0 10px var(--accent-glow);
}

.logo {
  margin-bottom: 1rem;
}

.logo img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 12px;
  transition: 0.2s;
}

.logo img:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.content {
  margin-left: 70px;
  width: calc(100% - 70px);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
}

#search {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: var(--surface0);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

#search::placeholder {
  color: var(--subtext);
}

#search:focus {
  box-shadow: 0 0 0 2px var(--accent), 0 0 10px var(--accent-glow);
}

#loaderUI {
  width: 100%;
  text-align: center;
  padding: 40px 20px;
}

.loading-text {
  margin-bottom: 10px;
  font-size: 16px;
  color: #ccc;
}

.progress-bar {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: #333;
  border-radius: 5px;
  margin: 0 auto;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #4cafef;
  transition: width 0.3s ease;
}

.grid {
  flex: 1;
  overflow-y: auto;
  padding: 20px;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}

.game-card {
  background: var(--surface0);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid transparent;
  height: 220px;
}

.game-card:hover {
  transform: translateY(-6px);
  background: var(--surface1);
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(53, 224, 243, 0.25);
}

.game-card img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.game-card img.loaded {
  opacity: 1;
}

.game-card div {
  font-size: 14px;
  color: var(--text);
}

#gameContainer {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  display: none;
  flex-direction: column;
  z-index: 999;
  height: 100%;
}

#gameHeader {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.nav-btn {
  background: var(--surface0);
  border: none;
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}

.nav-btn:hover {
  background: var(--surface1);
  color: var(--accent);
}

#gameContent {
  flex: 1;
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
}