:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --text: #1c2030;
  --muted: #646b80;
  --accent: #2563eb;
  --border: #e1e4ec;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
  /* viewport-fit=cover: keep content out of notches / rounded corners in landscape */
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* ---------- header / footer ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .container { padding-top: 14px; padding-bottom: 14px; }
.site-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* RU | EN switcher (Sprint 6) */
.lang-switch { display: flex; align-items: center; gap: 4px; flex: none; font-size: 14px; }
.lang-link {
  display: inline-block;
  min-width: 32px;
  padding: 6px 6px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.lang-link:hover { color: var(--accent); }
.lang-link.is-active { color: var(--text); background: var(--bg, #f1f3f8); }
.lang-sep { color: var(--border); }

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.logo span {
  margin-left: 10px;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

main.container { padding-top: 8px; padding-bottom: 40px; }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}
.site-footer .container { padding-top: 20px; padding-bottom: 20px; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }

/* ---------- category navigation ---------- */

.category-nav { border-top: 1px solid var(--border); }
.category-nav-list {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  padding-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.chip {
  flex: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.breadcrumbs { margin-top: 16px; font-size: 14px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs + h1 { margin-top: 6px; }
.section-note { margin-top: -8px; color: var(--muted); }

h1 { font-size: 28px; margin: 20px 0 16px; }
h2 { font-size: 20px; margin: 28px 0 12px; }

.empty { color: var(--muted); }

.catalog-section + .catalog-section { margin-top: 12px; }

/* ---------- catalog ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}
.card {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover,
.card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(28, 32, 48, 0.08);
  transform: translateY(-2px);
}

.card-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #dfe3ee;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px 16px;
}
.card-title { font-weight: 600; }
.card-category {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.card-text { flex: 1; font-size: 14px; color: var(--muted); }
.card-play {
  align-self: flex-start;
  margin-top: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

/* ---------- game page ---------- */

.text-block { white-space: pre-line; }

.preview-banner {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #fff4d6;
  color: #7a5200;
}

/* Game shell, iframe and ad slots: public/css/game-shell.css */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 2px 10px;
  border-radius: 999px;
  background: #e5e9f4;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- 404 / error ---------- */

.message-page { padding: 40px 0; }

.button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ---------- mock ad overlay ---------- */

.mock-ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 20, 0.85);
}

.mock-ad-box {
  width: min(420px, calc(100% - 32px));
  padding: 28px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}
.mock-ad-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.mock-ad-title { margin: 8px 0; font-size: 20px; font-weight: 600; }
.mock-ad-countdown { font-variant-numeric: tabular-nums; color: var(--muted); }

@media (max-width: 600px) {
  h1 { font-size: 24px; }
  .logo span { display: none; }
}

/* ---------- Sprint 7: footer links, privacy page, Metrika noscript pixel ---------- */

.footer-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.metrika-pixel { position: absolute; left: -9999px; }
.text-page { max-width: 760px; padding-bottom: 24px; }
.text-page h2 { margin-top: 28px; font-size: 20px; }
.text-page p, .text-page li { line-height: 1.6; }
.text-page .section-note { color: var(--muted); }
