@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,600;0,9..40,700;1,9..40,400&display=swap");

:root {
  --bg: #0b1220;
  --surface: #121a2b;
  --border: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-dim: #0ea5e9;
  --card-radius: 14px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1e3a5f 0%, transparent 55%), var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
}

main {
  flex: 1 0 auto;
  max-width: 100%;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.wrap {
  width: min(1180px, 100%);
  margin-inline: auto;
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  flex-wrap: nowrap;
  max-width: 100%;
  min-width: 0;
}

.brand {
  font-weight: 800;
  font-size: clamp(1rem, 3.5vw, 1.35rem);
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover {
  text-decoration: none;
}
.brand span {
  color: var(--accent);
}

nav.site-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: clamp(0.4rem, 1.5vw, 1rem);
  font-size: clamp(0.68rem, 2.2vw, 0.95rem);
  flex-shrink: 1;
  min-width: 0;
}
nav.site-nav a {
  color: var(--muted);
}
nav.site-nav a:hover {
  color: var(--text);
}

.hero {
  padding: 2.5rem 0 1.5rem;
}
.hero h1,
.hero-brand {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 5vw, 2.85rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.hero-brand span {
  color: var(--accent);
}
.hero p.lead {
  margin: 0;
  color: var(--muted);
  max-width: 52ch;
}

/* Homepage uses a single .wrap.home-main so hero, toolbar, and grid share one padded column. */

.toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin: 1.75rem 0 1rem;
  width: 100%;
}

.toolbar-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  width: auto;
  max-width: none;
  justify-content: flex-start;
  min-width: 0;
}

.toolbar-search {
  flex: 1 1 12rem;
}

.toolbar-category {
  flex: 0 1 auto;
}

.toolbar-group label {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.toolbar-search input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 28rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.toolbar-category select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 16rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

/* Homepage + play Similar games: always 5 columns; cards shrink on narrow screens (no horizontal scroll). */
.grid,
.similar-games__row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.35rem, 1.2vw, 1.1rem);
  width: 100%;
  min-width: 0;
}

.grid {
  padding-bottom: 3rem;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover {
  border-color: #334155;
  transform: translateY(-2px);
}
.card a.main {
  color: inherit;
  text-decoration: none;
}
.card a.main:hover {
  text-decoration: none;
}

.card-cover {
  aspect-ratio: 16 / 10;
  background: #0f172a;
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: clamp(0.35rem, 1.2vw, 0.75rem) clamp(0.4rem, 1.2vw, 0.85rem) clamp(0.45rem, 1.2vw, 0.95rem);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.card-body h2 {
  margin: 0;
  font-size: clamp(0.62rem, 2.4vw, 0.98rem);
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.meta {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.card-actions {
  margin-top: auto;
  padding-top: 0.5rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #0b1220;
}
.btn-primary:hover {
  filter: brightness(1.05);
}

.btn.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.3rem, 1vw, 0.45rem) clamp(0.4rem, 1.5vw, 0.75rem);
  border-radius: 8px;
  font-size: clamp(0.65rem, 2vw, 0.85rem);
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.btn.btn-ghost:hover {
  background: rgba(148, 163, 184, 0.08);
  text-decoration: none;
}

.play-shell {
  padding: 1rem 0 2rem;
  max-width: 100%;
  min-width: 0;
}
.play-shell__bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.65rem;
}
.play-shell__title {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  line-height: 1.25;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.play-shell__actions {
  display: flex;
  flex-wrap: nowrap;
  gap: clamp(0.35rem, 1vw, 0.5rem);
  align-items: center;
  flex-shrink: 1;
  min-width: 0;
}

.play-shell__actions .btn.btn-ghost {
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.play-shell__hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 62ch;
}
.play-frame-wrap {
  width: 92%;
  max-width: 100%;
  margin-inline: auto;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  background: #0f172a;
}
.play-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  vertical-align: top;
}

.similar-games {
  margin-top: 5px;
  padding-bottom: 0.5rem;
  max-width: 100%;
  min-width: 0;
}

.similar-games__title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.similar-game {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.similar-game:hover {
  border-color: #334155;
  transform: translateY(-2px);
  text-decoration: none;
}

.similar-game__cover {
  aspect-ratio: 16 / 10;
  background: #0f172a;
}

.similar-game__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.similar-game__title {
  padding: clamp(0.35rem, 1.2vw, 0.75rem) clamp(0.4rem, 1.2vw, 0.85rem) clamp(0.45rem, 1.2vw, 0.95rem);
  font-size: clamp(0.62rem, 2.4vw, 0.98rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ad-container {
  margin-top: 5px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* NativeBanner: 4 ads live inside __stand > __bn-container (not direct children of #container). */
.ad-container [id^="container-"] {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

.ad-container [class*="__stand-name"] {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-bottom: 0.35rem;
  box-sizing: border-box;
}

.ad-container [class*="__stand"]:not([class*="__stand-name"]) {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  gap: clamp(0.35rem, 1.2vw, 0.85rem) !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

.ad-container [class*="__bn-container"] {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: none !important;
  float: none !important;
  box-sizing: border-box;
}

.ad-container [class*="__bn"] {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

.ad-container [class$="__title"] {
  font-size: clamp(0.55rem, 1.8vw, 0.7rem) !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
  overflow: hidden !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  word-break: break-word !important;
}

/* 728×90 banner: scale to container width, no horizontal overflow. */
.ad-banner-slot {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
  line-height: 0;
}

.ad-banner-slot iframe {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  aspect-ratio: 728 / 90;
  min-height: 0;
  border: 0;
  box-sizing: border-box;
}

.detail-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 2rem 0;
}
@media (min-width: 720px) {
  .detail-hero {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    align-items: start;
  }
}

.detail-cover {
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 10;
  background: #0f172a;
}
.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-head {
  display: block;
}
.detail-head h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
}
.detail-head .src {
  margin: 0 0 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.detail-host {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.play-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 1.25rem;
  margin-top: 1rem;
}
.play-panel p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.prose {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 0 3rem;
}
.prose h1 {
  margin-top: 0;
}
.prose h2 {
  margin-top: 1.75rem;
  font-size: 1.15rem;
}
.prose ul {
  padding-left: 1.25rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.25rem 0 1.75rem;
  margin-top: auto;
  font-size: 0.88rem;
  color: var(--muted);
  background: rgba(11, 18, 32, 0.55);
}

.footer-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: 1.75rem 1.25rem;
}

.footer-heading {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
}

.footer-about .footer-heading {
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: -0.02em;
}

.footer-about p {
  margin: 0;
  max-width: 42ch;
  line-height: 1.6;
}

.footer-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-nav a {
  color: var(--muted);
}
.footer-nav a:hover {
  color: var(--accent);
}

.footer-meta {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}
.footer-meta p {
  margin: 0;
  max-width: 75ch;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: #1e293b;
  font-size: 0.72rem;
  color: var(--muted);
}
