:root {
  --bg-color: #0d0d0e;
  --card-bg: rgba(255, 255, 255, 0.015);
  --card-border: rgba(255, 255, 255, 0.06);
  --text-main: #f5f5f7;
  --text-muted: #86868b;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --radius-card: 20px;
  --header-h: 64px;
  --max-w: 1200px;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  min-height: 100dvh;
  background: var(--bg-color);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Icons', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 1000;
  padding: 8px 16px;
  background: var(--text-main);
  color: var(--bg-color);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus { top: 16px; }

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 14, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
}

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

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 16px 0 40px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  color: var(--text-main);
  font: inherit;
  font-size: 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 0.3s var(--ease-out), background 0.3s var(--ease-out);
}

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

.search-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

/* Hero */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 20px 24px;
}

.hero-inner {
  display: grid;
  gap: 28px;
  align-items: stretch;
}

@media (min-width: 900px) {
  .hero {
    padding: 56px 20px 40px;
  }

  .hero-inner {
    grid-template-columns: 1fr auto;
    gap: 48px;
    align-items: center;
  }
}

.hero-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 14px;
}

.hero-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.5px;
  color: #ffffff;
  margin-bottom: 0;
  line-height: 1.15;
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #d1d1d6;
  margin-bottom: 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.hero-desc {
  color: var(--text-muted);
  font-size: 1.0625rem;
  max-width: 520px;
  line-height: 1.55;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 12px;
  min-width: min(100%, 360px);
}

.stat-card {
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.stat-value {
  display: block;
  font-size: 1.375rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

@media (max-width: 480px) {
  .hero-stats { min-width: 0; }
  .stat-card { padding: 12px 10px; }
  .stat-value { font-size: 1.125rem; }
}

/* Sections */
.catalog {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.section-title {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  color: #ffffff;
}

.catalog-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 24px;
}

.catalog-header .section-title {
  flex-shrink: 0;
  line-height: 1;
}

.catalog-header .section-title::after {
  content: '';
  display: inline-block;
  width: 1px;
  height: 14px;
  background: var(--card-border);
  margin-left: 16px;
  vertical-align: baseline;
  transform: translateY(1px);
}

.catalog-desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1;
  color: var(--text-muted);
  flex: 1;
  min-width: min(100%, 280px);
}

/* Game grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 32px;
}

/* Obsidian game card */
.game-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  transition:
    transform 0.4s var(--ease-out),
    background 0.4s var(--ease-out),
    border-color 0.4s var(--ease-out),
    box-shadow 0.4s var(--ease-out);
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 16px 18px 0;
  width: 100%;
  animation: fadeUp 0.5s var(--ease-out) both;
}

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

.game-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.game-card:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.3);
  outline-offset: 2px;
}

.game-cover-wrap {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.game-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}

.game-card:hover .game-cover {
  transform: scale(1.03);
}

.game-body {
  padding: 14px 0 16px;
}

.game-title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 10px;
  color: #ffffff;
}

.game-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.game-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag {
  padding: 4px 10px;
  background: rgba(13, 13, 14, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #aeaeb2;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.game-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 16px;
}

.engine-tag {
  color: #ffffff;
  font-weight: 500;
  opacity: 0.8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.meta-players {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}

.meta-count {
  color: #ffffff;
  font-weight: 500;
  opacity: 0.8;
  font-size: 12px;
  line-height: 1;
}

.meta-suffix {
  font-size: 10px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.3);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state p {
  margin-bottom: 16px;
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 20px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.3);
  outline-offset: 2px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 32px 20px 48px;
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.875rem;
  border-top: 1px solid var(--card-border);
  margin-top: 24px;
}
