/* Public site layout and components. */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

/* ---- header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 22px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; image-rendering: pixelated; }
.brand-name { font: 800 19px/1 var(--font-display); letter-spacing: -.02em; }
.brand-name b { color: var(--accent); font-weight: 800; }
.brand-sub { display: block; font: 600 10px/1 var(--font-mono); letter-spacing: .18em; color: var(--muted); text-transform: uppercase; margin-top: 3px; }
.nav { display: flex; gap: 4px; }
.nav a { white-space: nowrap; padding: 8px 12px; border-radius: var(--radius); color: var(--text-soft); font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.header-search { margin-left: auto; position: relative; width: min(300px, 32vw); }
.header-search .input { padding-left: 34px; min-height: 36px; }
.header-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.header-tools { display: flex; gap: 6px; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--border); background: transparent; color: var(--text-soft); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.site-notice { background: var(--accent-soft); color: var(--text); font-size: 13px; text-align: center; padding: 6px 16px; }

main { min-height: calc(100vh - 64px - 140px); }
.page { padding: 36px 0 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--muted); }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-inner nav { display: flex; gap: 16px; }
.footer-inner a { color: var(--muted); }

/* ---- hero ---- */
.hero { position: relative; border-bottom: 1px solid var(--border); overflow: hidden; }
.hero-bg { position: absolute; inset: 0; opacity: .18; background-size: cover; background-position: center; image-rendering: pixelated; filter: blur(2px) saturate(1.2); transform: scale(1.05); }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg) 25%, transparent 80%), linear-gradient(0deg, var(--bg) 0%, transparent 40%); }
.hero-inner { position: relative; display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; align-items: center; padding: 56px 28px 64px; }
.hero h1 { font-size: clamp(36px, 5.2vw, 64px); margin: 12px 0 14px; }
.hero-desc { font-size: 17px; color: var(--text-soft); max-width: 56ch; }
.hero-meta { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 26px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-cover { justify-self: end; width: min(340px, 100%); aspect-ratio: 3 / 4; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-strong); box-shadow: var(--shadow); }
.hero-cover img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.hero-empty { padding: 72px 28px; }

/* ---- sections ---- */
.section { padding: 44px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { margin: 0; }

/* ---- game cards ---- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid-featured { grid-template-columns: repeat(4, 1fr); }
.grid-featured .game-card:first-child { grid-column: span 2; grid-row: span 2; }
.game-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; color: var(--text); text-decoration: none;
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.game-card:hover, .game-card:focus-visible { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 28px rgba(0, 0, 0, .3); text-decoration: none; }
.game-card .cover { aspect-ratio: 3 / 4; background: var(--surface-2); overflow: hidden; }
.game-card .cover img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: transform .3s var(--ease); }
.game-card:hover .cover img { transform: scale(1.03); }
.game-card .cover-empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font: 700 12px var(--font-mono); }
.game-card .body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.game-card .title { font-weight: 700; font-size: 15px; line-height: 1.25; }
.game-card .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.game-card .state { position: absolute; top: 10px; left: 10px; }
.game-card.upcoming .cover img { filter: grayscale(.5) brightness(.75); }
.grid-featured .game-card:first-child .title { font-size: 20px; }

/* ---- categories ---- */
.cat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.cat-card { padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); color: var(--text); display: grid; gap: 6px; text-decoration: none; }
.cat-card:hover { border-color: var(--accent); text-decoration: none; }
.cat-card .count { font: 700 12px var(--font-mono); color: var(--accent-text); letter-spacing: .08em; text-transform: uppercase; }
.cat-card.empty .count { color: var(--muted); }
.cat-card p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---- catalog filters ---- */
.catalog-layout { display: grid; grid-template-columns: 250px 1fr; gap: 28px; align-items: start; }
.filters { position: sticky; top: 84px; display: grid; gap: 4px; }
.filters .field { margin-bottom: 10px; }
.year-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.results-bar .input { width: auto; }
.empty-state { padding: 48px 24px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--muted); }
.load-more { display: flex; justify-content: center; margin-top: 24px; }

/* ---- detail page ---- */
.detail { display: grid; grid-template-columns: 320px 1fr; gap: 40px; align-items: start; }
.detail-cover { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-strong); aspect-ratio: 3 / 4; background: var(--surface-2); }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.detail-side { display: grid; gap: 14px; position: sticky; top: 84px; }
.detail h1 { margin-top: 8px; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.play-box { padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); display: grid; gap: 12px; }
.play-box .size { display: flex; justify-content: space-between; font-size: 14px; }
.play-box .size b { font-family: var(--font-mono); }
.detail-section { margin-top: 30px; }
.detail-section h2 { font-size: 18px; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.shots figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.shots img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.shots figcaption { font-size: 12.5px; color: var(--muted); padding: 6px 10px; }
.version { font: 12px var(--font-mono); color: var(--muted); }
.description { font-size: 16px; color: var(--text-soft); max-width: 72ch; white-space: pre-line; }

/* ---- ad slot ---- */
.ad-slot { margin: 28px 0 0; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--text-soft); }
.ad-slot img { width: 72px; height: 48px; object-fit: cover; border-radius: 4px; }
.ad-slot .ad-label { font: 700 10px var(--font-mono); letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }

/* ---- servers ---- */
.server-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 18px; align-items: center; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; }
.dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 8px; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* ---- contact ---- */
.two-col { display: grid; grid-template-columns: 1.3fr .7fr; gap: 28px; align-items: start; }

/* ---- player ---- */
body.playing .site-header, body.playing .site-footer, body.playing .site-notice { display: none; }
body.playing main { min-height: 100vh; }
.player-shell { height: 100vh; display: grid; grid-template-rows: 48px 1fr; background: #000; color: #f3f5f9; }
.player-bar { display: flex; align-items: center; gap: 10px; padding: 0 12px; background: #07080b; border-bottom: 1px solid #1b2030; }
.player-bar .name { font-weight: 700; font-size: 14px; margin-right: auto; display: flex; align-items: center; gap: 10px; }
.player-bar .btn { --b-bg: #141821; --b-fg: #f3f5f9; --b-bd: #262c3b; min-height: 32px; font-size: 13px; }
.player-stage { position: relative; overflow: hidden; display: grid; place-items: center; background: #000; }
.player-stage:fullscreen { width: 100vw; height: 100vh; }
.player-frame { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.player-stage > .player-frame { position: absolute; inset: 0; }
.stage-menu-btn { position: absolute; top: 10px; right: 10px; z-index: 6; opacity: .55; --b-bg: #141821; --b-fg: #f3f5f9; --b-bd: #262c3b; }
.stage-menu-btn:hover, .stage-menu-btn:focus-visible { opacity: 1; }
.player-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(4, 6, 10, .92); z-index: 5; padding: 24px; }
.loader { width: min(520px, 100%); display: grid; gap: 14px; }
.loader h2 { font-size: 24px; margin: 0; }
.loader .op { font: 13px var(--font-mono); color: #9fb3cc; min-height: 1.4em; }
.progress { height: 10px; background: #141a26; border-radius: 2px; overflow: hidden; position: relative; border: 1px solid #222a3a; }
.progress > i { position: absolute; inset: 0 auto 0 0; width: 0; background: repeating-linear-gradient(90deg, #1e90ff 0 10px, #4fb0ff 10px 12px); transition: width .15s linear; }
.progress.indeterminate > i { width: 30%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { left: -30%; } 100% { left: 100%; } }
.loader .pct { display: flex; justify-content: space-between; font: 600 13px var(--font-mono); color: #cfd8e6; }
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: #6f7b8e; }
.steps li.done { color: #9fb3cc; }
.steps li.done::before { content: "■ "; color: #2fd27f; }
.steps li.active { color: #f3f5f9; }
.steps li.active::before { content: "▶ "; color: #1e90ff; }
.steps li.pending::before { content: "□ "; }
.player-menu { width: min(420px, 100%); background: #0c0f15; border: 1px solid #262c3b; border-radius: var(--radius-lg); padding: 20px; display: grid; gap: 8px; }
.player-menu h2 { font-size: 18px; margin: 0 0 6px; }
.player-menu .btn { justify-content: flex-start; --b-bg: #141821; --b-fg: #f3f5f9; --b-bd: #262c3b; }
.player-menu .btn-primary { --b-bg: #1e90ff; --b-bd: #1e90ff; }
.player-menu .btn-danger { --b-bg: rgba(255, 84, 104, .14); --b-fg: #ff7486; }
.player-menu .note { font-size: 12px; color: #8d97a7; }
.player-error { width: min(560px, 100%); display: grid; gap: 12px; }
.player-error .tech { font: 12px var(--font-mono); color: #8d97a7; background: #0c0f15; border: 1px solid #222a3a; padding: 10px; border-radius: var(--radius); white-space: pre-wrap; }
.controls-table { width: 100%; font-size: 14px; border-collapse: collapse; }
.controls-table td { padding: 6px 4px; border-bottom: 1px solid #1d2331; }
.controls-table td:last-child { font-family: var(--font-mono); text-align: right; color: #9fd0ff; }
.player-shell .notice { background: #111723; border-color: #222a3a; color: #cfd8e6; }

/* ---- responsive (desktop-first; keep smaller widths usable) ---- */
@media (max-width: 1080px) {
  .grid-featured { grid-template-columns: repeat(3, 1fr); }
  .catalog-layout { grid-template-columns: 1fr; }
  .filters { position: static; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
}
@media (max-width: 860px) {
  .container { padding: 0 16px; }
  .hero-inner { grid-template-columns: 1fr; padding: 36px 16px 44px; }
  .hero-cover { justify-self: start; width: 220px; }
  .detail { grid-template-columns: 1fr; }
  .detail-side { position: static; grid-template-columns: 200px 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .nav { display: none; }
  .header-search { width: auto; flex: 1; }
  .grid-featured { grid-template-columns: repeat(2, 1fr); }
  .server-row { grid-template-columns: 1fr; gap: 6px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}
@media (max-width: 520px) {
  .brand-sub { display: none; }
  .detail-side { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
