:root {
  --bg: #0a0b0f;
  --bg-elevated: #15171f;
  --bg-elevated-hover: #1c1f2a;
  --border: #232634;
  --text: #f5f6fa;
  --text-muted: #8b8fa3;
  --accent: #7c5cff;
  --accent-hover: #9579ff;
  --accent-soft: rgba(124, 92, 255, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 16px 32px;
  background: rgba(10, 11, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #5d3fff);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: white;
}

.primary-nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.search {
  margin-left: auto;
  flex: 0 1 280px;
}

#search-input {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

#search-input:focus {
  border-color: var(--accent);
  background: var(--bg-elevated-hover);
}

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

/* Main */
.page {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 32px;
  width: 100%;
}

.hero {
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 16px;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.game-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s, border-color 0.18s;
  display: block;
}

.game-card:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--accent);
  transform: translateY(-3px);
}

.game-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: white;
  position: relative;
  overflow: hidden;
}

.game-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.35));
}

.game-thumb span {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 12px;
}

.game-meta {
  padding: 14px 16px;
}

.game-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.game-tag {
  font-size: 12px;
  color: var(--text-muted);
}

.game-card.placeholder .game-thumb {
  background: var(--bg);
  border-bottom: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.game-card.placeholder .game-thumb::after { display: none; }
.game-card.placeholder { opacity: 0.7; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 32px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* Play page */
.play-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
}

.play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.play-header h1 {
  font-size: 24px;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.game-frame-wrap {
  background: black;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
}

.game-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.play-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}

.play-empty code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent);
}

/* Responsive */
@media (max-width: 720px) {
  .site-header {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 12px;
  }
  .search {
    flex-basis: 100%;
    margin-left: 0;
    order: 3;
  }
  .page, .play-page {
    padding: 24px 16px;
  }
  .hero h1 {
    font-size: 28px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
}
