:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e8eef5;
  --muted: #8b9cb3;
  --accent: #3d9cf5;
  --accent-dim: #2b7bc4;
  --star: #f5c542;
  --danger: #e85d5d;
  --ok: #4cd964;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; width: 100%; min-width: 0; }
.site-main { flex: 1; padding-bottom: 3rem; min-width: 0; width: 100%; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.header-bar {
  display: contents;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-header.nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-header.nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.site-header.nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.logo:hover { color: var(--accent); }

.nav-main { display: flex; align-items: center; gap: 1.25rem; }
.nav-main > a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.nav-main > a:hover { color: var(--accent); }

.nav-dropdown { position: relative; }
.nav-drop-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.nav-drop-btn:hover, .nav-dropdown.open .nav-drop-btn {
  border-color: var(--accent);
  color: var(--accent);
}
.nav-drop-list {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin: 0.35rem 0 0;
  padding: 0.5rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 200px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.nav-dropdown.open .nav-drop-list { display: block; }
.nav-drop-list a {
  display: block;
  padding: 0.45rem 1rem;
  color: var(--text);
  text-decoration: none;
}
.nav-drop-list a:hover { background: var(--bg); color: var(--accent); }

.nav-search {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.nav-search input {
  width: 180px;
  max-width: 40vw;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.nav-search button {
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.nav-search button:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 768px) {
  .header-inner {
    min-height: auto;
    padding: 0.5rem 0;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0;
  }

  .header-bar {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
  }

  .logo {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-toggle {
    display: inline-flex;
    flex-shrink: 0;
  }

  .nav-main {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.75rem 0 0.15rem;
    margin-top: 0.65rem;
    border-top: 1px solid var(--border);
  }

  .site-header.nav-open .nav-main {
    display: flex;
  }

  .nav-main > a {
    padding: 0.4rem 0;
  }

  .nav-dropdown {
    width: 100%;
  }

  .nav-drop-btn {
    width: 100%;
    text-align: left;
  }

  .nav-drop-list {
    position: static;
    right: auto;
    left: auto;
    width: 100%;
    min-width: 0;
    margin-top: 0.35rem;
    box-shadow: none;
    max-height: min(55vh, 320px);
  }

  .nav-search {
    width: 100%;
    margin-top: 0.15rem;
  }

  .nav-search input {
    flex: 1;
    min-width: 0;
    max-width: none;
    width: auto;
  }

  body.nav-menu-open {
    overflow: hidden;
  }
}

.page-title { font-size: 1.75rem; margin: 1.5rem 0 0.5rem; }
.page-sub { color: var(--muted); margin: 0 0 1.5rem; }

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color .15s, transform .15s;
}
.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.game-card-icon {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--bg);
}
.game-card h2 { font-size: 1.05rem; margin: 0; }
.game-card .meta { color: var(--muted); font-size: 0.875rem; }
.stars-row { color: var(--star); letter-spacing: 2px; }
.stars-row .count { color: var(--muted); font-size: 0.8rem; margin-left: 0.35rem; }

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2rem;
}
.pagination a, .pagination span {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--muted);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding: 2rem 0;
}
.footer-inner { text-align: center; }
.footer-brand { color: var(--muted); margin-bottom: 1rem; font-size: 0.9rem; }
.footer-policies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.footer-policies a { color: var(--accent); text-decoration: none; }
.footer-policies a:hover { text-decoration: underline; }
.footer-copy { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* Game single */
.game-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
  margin: 1.5rem 0;
  min-width: 0;
}

.game-hero-text {
  min-width: 0;
  flex: 1 1 12rem;
  overflow-wrap: anywhere;
}
.game-hero-icon {
  width: 120px;
  height: 120px;
  border-radius: 20px;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
}
.game-hero-text h1 { margin: 0 0 0.5rem; font-size: 1.85rem; }
.rate-form { margin: 0.75rem 0; }
.rate-form label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.9rem; }
.star-input { display: flex; gap: 0.25rem; flex-direction: row-reverse; justify-content: flex-end; }
.star-input input { display: none; }
.star-input label {
  cursor: pointer;
  font-size: 1.75rem;
  color: var(--border);
  line-height: 1;
}
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label { color: var(--star); }

.btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font: inherit;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dim); }

.screenshots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(148px, 100%), 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
  min-width: 0;
  width: 100%;
}

.screenshots a {
  display: block;
  min-width: 0;
  overflow: hidden;
  border-radius: 10px;
}

.screenshots img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.prose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.prose img,
.prose video,
.prose iframe {
  max-width: 100%;
  height: auto;
}

.related h2 { font-size: 1.2rem; margin: 2rem 0 1rem; }

/* Policy / static page */
.policy-page h1 { margin-top: 1.5rem; }

/* Messages */
.flash { padding: 0.75rem 1rem; border-radius: 10px; margin: 1rem 0; }
.flash-ok { background: rgba(76, 217, 100, 0.15); border: 1px solid var(--ok); }
.flash-err { background: rgba(232, 93, 93, 0.12); border: 1px solid var(--danger); }
