/* ==========================================================================
   Play4ever - дизайн-система
   Тёмная тема с приглушённым сине-зелёным подтоном: тёмный фон не бьёт
   контрастом при переходе от сайта к самой игре, а низконасыщенный акцент
   не спорит с яркими обложками игр.

     --bg-page      #0F1719  фон страницы
     --bg-block     #172224  блоки, карточки
     --bg-hover     #1F2D30  наведение, поля ввода
     --border       #2C3D40  границы
     --accent       #58A697  акцент, кнопки
     --accent-hover #6FBEAE  акцент при наведении
     --accent-2     #C79A6B  второй акцент: рейтинг, метка "новое", избранное
     --text         #E6EFED  основной текст
     --muted        #93A8A6  второстепенный текст
     --danger       #C4736C  ошибки
     --alert        #E5534B  красная метка непрочитанных уведомлений

   Текст на бирюзовых кнопках - тёмный (#0F1719), а не белый: на приглушённом
   фоне белый даёт контраст около 4:1 и на мелком шрифте выглядит грязно,
   тёмный - почти 6:1.
   ========================================================================== */

:root {
  --bg-page: #0f1719;
  --bg-block: #172224;
  --bg-hover: #1f2d30;
  --border: #2c3d40;
  --accent: #58a697;
  --accent-hover: #6fbeae;
  --accent-2: #c79a6b;
  --accent-2-ink: #2e1f10;
  --text: #e6efed;
  --muted: #93a8a6;
  --danger: #c4736c;
  /* Единственный насыщенный цвет интерфейса: метка о новом должна
     замечаться сразу, а приглушённый --danger на тёмной шапке теряется. */
  --alert: #e5534b;

  --ink-on-accent: #0f1719;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --maxw: 1320px;
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --header-h: 68px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Якорные ссылки (#reviews, #rating) не должны уезжать под липкую шапку. */
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-hover); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { color: var(--text); line-height: 1.25; margin-top: 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

img { max-width: 100%; height: auto; }

p { margin: 0 0 1em; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Шапка и навигация ---------- */
.site-header {
  background: var(--bg-block);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header > .container {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand img { width: 36px; height: 36px; display: block; border-radius: 10px; }
.brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.2px;
}
.brand:hover .brand-name { color: var(--accent-hover); }

.nav-toggle {
  display: none;
  position: relative;
  margin-left: auto;
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.main-nav { margin-left: auto; }
/* Только верхний уровень меню: вложенный ul.dropdown-menu управляется своими
   правилами, иначе `display: flex` отсюда перебивал бы его `display: none`
   (специфичность .main-nav ul выше, чем у .dropdown-menu). */
.main-nav > ul {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.main-nav > ul > li > a {
  display: block;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}
.main-nav > ul > li > a:hover { background: var(--bg-hover); color: var(--text); }
.main-nav > ul > li > a.active { color: var(--text); background: var(--bg-hover); }

/* Селектор повторяет `.main-nav > ul > li > a` не ради красоты: у общего
   правила пунктов меню специфичность выше, и при наведении оно перекрашивало
   кнопку в приглушённый `--bg-hover` вместо подсветки акцентом. */
.main-nav > ul > li > a.nav-login {
  background: var(--accent);
  color: var(--ink-on-accent);
  font-weight: 700;
}
.main-nav > ul > li > a.nav-login:hover {
  background: var(--accent-hover);
  color: var(--ink-on-accent);
}

/* "Помощь проекту" выделена не фоном, а цветом текста: рядом с бирюзовой
   кнопкой "Вход" вторая заливка спорила бы с ней за внимание. Тот же приём
   специфичности, что и у `.nav-login`, - иначе :hover сбрасывает цвет. */
.main-nav > ul > li > a.nav-donate { color: var(--accent-2); }
.main-nav > ul > li > a.nav-donate:hover {
  background: var(--bg-hover);
  color: var(--accent-2);
}

/* Меню аккаунта */
.nav-user { position: relative; }
.nav-user-toggle {
  display: flex !important;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text) !important;
  cursor: pointer;
}
.avatar-mini {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink-on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-mini img { width: 100%; height: 100%; object-fit: cover; }

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  margin: 0;
  list-style: none;
  display: none;
  flex-direction: column;
  z-index: 60;
}
.nav-user.open .dropdown-menu { display: flex; }
.dropdown-menu li { list-style: none; }
.dropdown-menu a,
.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.93rem;
  background: none;
  border: 0;
  cursor: pointer;
}
.dropdown-menu a:hover,
.dropdown-menu button:hover { background: var(--bg-hover); color: var(--accent-hover); }
.dropdown-menu form { margin: 0; }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* Уведомления: значок в шапке слева от меню "Кабинет" и всплывающий список
   под ним. Красная метка на значке - есть непрочитанные. */
.nav-notify { position: relative; }
/* Тот же приём специфичности, что и у `.nav-login`: общее правило пунктов
   меню иначе вернуло бы значку поля текстового пункта. */
.main-nav > ul > li > a.nav-notify-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
}
.main-nav > ul > li.nav-notify.open > a.nav-notify-toggle { background: var(--bg-hover); color: var(--text); }
.nav-notify-toggle .icon { display: block; flex-shrink: 0; }
/* Подпись видна только в мобильном меню, где пункты идут списком; в шапке
   её читают лишь программы экранного доступа. */
.nav-notify-label {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.notify-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--alert);
  /* Обводка цветом фона под значком отделяет метку от контура колокола. */
  box-shadow: 0 0 0 2px var(--bg-block);
  pointer-events: none;
}
.nav-notify-toggle:hover .notify-dot,
.nav-notify.open .notify-dot,
.nav-toggle .notify-dot { box-shadow: 0 0 0 2px var(--bg-hover); }
.nav-toggle .notify-dot { top: 3px; right: 3px; }

.notify-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 360px;
  max-width: calc(100vw - 40px);
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 60;
}
.nav-notify.open .notify-panel { display: block; }
.notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--border);
}
.notify-title { font-weight: 700; font-size: 0.95rem; }
.notify-head form,
.notify-item form { margin: 0; }

.notify-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: min(60vh, 440px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notify-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 6px 10px 12px;
  border-radius: var(--radius-sm);
}
.notify-item.is-unread { background: var(--bg-hover); }
.notify-body { flex: 1; min-width: 0; }
.notify-text {
  margin: 0 0 2px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.notify-item:not(.is-unread) .notify-text { color: var(--muted); }
.notify-date { color: var(--muted); font-size: 0.78rem; }
.notify-empty { margin: 0; padding: 22px 16px; color: var(--muted); font-size: 0.9rem; text-align: center; }
.notify-more {
  display: block;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

/* Значок-квадрат справа от уведомления: у непрочитанного это кнопка, и
   галочка в квадрате проступает при наведении; у прочитанного квадрат с
   галочкой просто показывает состояние. Над списком тот же стиль у значка
   "пометить все как прочитанные". */
.notify-mark {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.notify-mark .icon { display: block; }
button.notify-mark:hover { background: var(--border); color: var(--accent-hover); }
button.notify-mark:disabled { opacity: 0.35; cursor: default; background: none; color: var(--muted); }
.notify-item button.notify-mark .notify-tick { opacity: 0; transition: opacity 0.15s; }
.notify-item button.notify-mark:hover .notify-tick,
.notify-item button.notify-mark:focus-visible .notify-tick { opacity: 1; }
.notify-mark.is-done { color: var(--accent); opacity: 0.7; cursor: default; }

/* Страница уведомлений: тот же список, но во всю ширину блока. */
.notify-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 860px;
}
.notify-page-head h1 { margin: 0; }
.notify-list-page {
  max-width: 860px;
  max-height: none;
  overflow: visible;
  padding: 8px;
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- Основная область ---------- */
main { flex: 1 0 auto; padding: 32px 0 56px; }

.page-head { margin-bottom: 28px; }
.page-head h1 { margin-bottom: 6px; }
.page-head .lead { color: var(--muted); margin: 0; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent-hover); }
.breadcrumbs span::before { content: "/"; margin-right: 8px; color: var(--border); }

/* ---------- Блоки и секции ---------- */
.section { margin-bottom: 48px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.section-head h2 { margin: 0; }
.section-head .intro { color: var(--muted); margin: 4px 0 0; width: 100%; }
.section-more { font-weight: 600; font-size: 0.93rem; white-space: nowrap; }

.panel {
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.empty {
  background: var(--bg-block);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 22px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Приветственный блок ---------- */
.hero {
  background: linear-gradient(135deg, #1a2729 0%, #172224 55%, #1f2d30 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  margin-bottom: 44px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(88, 166, 151, 0.18), transparent 70%);
  pointer-events: none;
}
.hero h1 { font-size: 2.3rem; margin-bottom: 12px; max-width: 20ch; }
.hero p { color: var(--muted); font-size: 1.05rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

/* Последние новости проекта внутри приветственного блока: отдельной секции
   для них на главной нет. Карточки берут фон страницы, чтобы читаться
   поверх градиента hero. */
.hero-news { margin-top: 32px; }
.hero-news:first-child { margin-top: 0; }
.hero-news-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.hero-news-head h2 { margin: 0; font-size: 1.15rem; font-weight: 600; color: var(--muted); }
.hero-news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.hero-news-card {
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s;
}
.hero-news-card:hover { border-color: var(--accent); color: var(--text); }
.hero-news-card h3 { margin: 0 0 8px; font-size: 1.02rem; line-height: 1.35; }
.hero-news-card p { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; }
.hero-news-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}
.hero-news-empty { margin: 0; color: var(--muted); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--ink-on-accent);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: center;
}
.btn:hover { background: var(--accent-hover); color: var(--ink-on-accent); }

.btn-outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent-hover);
}
.btn-outline:hover { background: rgba(88, 166, 151, 0.12); color: var(--accent-hover); }

.btn-ghost {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--border); color: var(--text); }

.btn-danger { background: var(--danger); color: #1a0f0e; }
.btn-danger:hover { background: #d3867f; color: #1a0f0e; }

.btn-sm { padding: 7px 14px; font-size: 0.87rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Кнопка "В избранное" */
.btn-fav {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}
.btn-fav:hover { border-color: var(--accent-2); color: var(--accent-2); background: transparent; }
.btn-fav.is-active {
  border-color: var(--accent-2);
  color: var(--accent-2-ink);
  background: var(--accent-2);
}
.btn-fav.is-active:hover { background: #d4aa7e; color: var(--accent-2-ink); }

/* ---------- Сетка карточек игр ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.game-card {
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}
.game-card:hover { border-color: var(--accent); transform: translateY(-2px); }

/* Область обложки - квадрат, а сама картинка вписывается в него целиком
   (`contain`): обложки приходят с разными пропорциями, и кадрировать их
   по `cover` значило бы резать края. Свободные поля закрывает фон блока. */
.game-card-cover {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-hover);
  overflow: hidden;
}
.game-card-cover img { width: 100%; height: 100%; object-fit: contain; display: block; }
.game-card-cover .placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--border);
}
.badge-new {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--accent-2);
  color: var(--accent-2-ink);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}

.game-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.game-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0 0 4px;
}
.game-card-title a { color: var(--text); }
.game-card-title a:hover { color: var(--accent-hover); }
.game-card-meta {
  color: var(--muted);
  font-size: 0.83rem;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.game-card-desc {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card-actions { margin-top: auto; display: flex; gap: 8px; }
.game-card-actions .btn { flex: 1; }
.game-card-actions .btn-fav { flex: 0 0 auto; padding: 7px 12px; }

/* ---------- Звёзды рейтинга ---------- */
.stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent-2);
  font-size: 0.95rem;
  line-height: 1;
}
.stars .star-off { color: var(--border); }
/* Половина звезды: заливка градиентом по тексту - левая половина акцентная,
   правая цвета границы. */
.stars .star-half {
  background: linear-gradient(90deg, var(--accent-2) 50%, var(--border) 50%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.rating-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.83rem;
}
.rating-inline b { color: var(--text); font-weight: 700; }

/* Форма оценки: звёзды-переключатели */
.rate-form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.star-input { display: flex; flex-direction: row-reverse; gap: 4px; }
.star-input input { position: absolute; opacity: 0; width: 0; height: 0; }
.star-input label {
  font-size: 1.7rem;
  line-height: 1;
  color: var(--border);
  cursor: pointer;
  transition: color 0.12s;
}
/* Подсветка выбранной звезды и всех левее неё: разметка идёт от 5 к 1,
   поэтому "левее" - это соседи по ~ в обратном порядке. */
.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label { color: var(--accent-2); }
.star-input input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Страница игры ---------- */
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}

.game-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.game-title-row h1 { margin: 0; }
.game-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 22px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}
.chip:hover { border-color: var(--accent); color: var(--accent-hover); }

/* Проигрыватель игры */
/* Проигрыватель: только кадр с игрой - ни рамки, ни панели кнопок, ни
   постера. Своё оформление и своё управление игра приносит с собой.
   Пропорции кадра приходят из админки в --player-aspect. */
.player {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
}
.player-stage {
  --player-aspect: 16 / 9;
  position: relative;
  width: 100%;
  aspect-ratio: var(--player-aspect);
}
.player-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  /* Сборки объявляют у себя color-scheme: dark. Пока фрейм остаётся светлым,
     цветовые схемы документов расходятся, и браузер обязан залить холст игры
     непрозрачным цветом схемы (в Chrome это #121212) - даже если фона у неё
     нет. Совпали схемы - холст действительно прозрачный, и вокруг игры видно
     фон страницы, а не подложку. */
  color-scheme: dark;
}

/* Скриншоты */
.screenshots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.screenshots a {
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.screenshots img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.screenshots a:hover img { transform: scale(1.04); }

/* Лайтбокс скриншотов */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 19, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 30px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius); }
.lightbox-close {
  position: absolute;
  top: 18px; right: 22px;
  background: var(--bg-block);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
}

/* Боковая колонка страницы игры */
.game-side { display: flex; flex-direction: column; gap: 20px; }
.side-card {
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.side-card h3 { font-size: 1rem; margin-bottom: 12px; }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.side-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9rem; }
.side-list .label { color: var(--muted); }

.rating-big { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.rating-value { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.rating-note { color: var(--muted); font-size: 0.85rem; }

/* ---------- Отзывы ---------- */
.reviews { display: flex; flex-direction: column; gap: 16px; }
.review {
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.review-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.review-author { font-weight: 700; }
.review-date { color: var(--muted); font-size: 0.82rem; }
.review-text { margin: 0; white-space: pre-line; }
.review-actions { margin-top: 10px; display: flex; gap: 10px; }
.link-btn {
  background: none;
  border: 0;
  color: var(--accent-hover);
  font: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { color: var(--accent); }

.replies {
  margin: 14px 0 0;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
}
.reply { background: var(--bg-hover); border-radius: var(--radius-sm); padding: 12px 14px; }
.reply-form { margin-top: 14px; display: none; }
.reply-form.open { display: block; }

.review-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--muted);
}
.review-badge-rejected { border-color: var(--danger); color: var(--danger); }

/* ---------- Формы ---------- */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}
/* Отметка слева, подпись справа. Подпись бывает длинной (согласие на обработку
   персональных данных): она переносится в своей колонке, отметка стоит вровень
   с первой строкой, а подсказка и ошибки выводятся под подписью. */
.form-row.checkbox {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
  align-items: start;
}
.form-row.checkbox input { grid-area: 1 / 1; margin: 3px 0 0; }
.form-row.checkbox label { grid-area: 1 / 2; margin: 0; font-weight: 500; }
.form-row.checkbox .helptext,
.form-row.checkbox .errorlist { grid-column: 2; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
input::placeholder, textarea::placeholder { color: #6d8080; }
textarea { resize: vertical; min-height: 96px; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
input[type="file"] { color: var(--muted); font-size: 0.9rem; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }

.helptext { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 5px; }
.errorlist {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  color: var(--danger);
  font-size: 0.87rem;
}
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.form-note { color: var(--muted); font-size: 0.88rem; }
/* Обычный (не невидимый) виджет SmartCaptcha: место под него резервируется
   заранее, чтобы форма не прыгала при загрузке. */
.smartcaptcha { height: 100px; }

.auth-card {
  max-width: 460px;
  margin: 20px auto;
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 22px; }
.auth-links { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }

/* ---------- Панель фильтров каталога ---------- */
.filters {
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 24px;
}
.filters form {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.filters .form-row { margin: 0; }
.filters .btn { height: 42px; }
.filters-summary {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.87rem;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- Профиль ---------- */
.profile-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.profile-nav {
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  position: sticky;
  top: calc(var(--header-h) + 20px);
}
.profile-user { display: flex; align-items: center; gap: 12px; padding: 6px 6px 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.profile-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  overflow: hidden;
  flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-user-name { font-weight: 700; line-height: 1.2; }
.profile-user-email { color: var(--muted); font-size: 0.82rem; word-break: break-all; }

.profile-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.profile-nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  font-size: 0.93rem;
}
.profile-nav a:hover { background: var(--bg-hover); }
.profile-nav a.active { background: var(--accent); color: var(--ink-on-accent); }
.profile-nav .count {
  background: var(--bg-hover);
  color: var(--muted);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 0.78rem;
}
.profile-nav a.active .count { background: rgba(15, 23, 25, 0.2); color: var(--ink-on-accent); }

.my-review {
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.my-review-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  align-items: baseline;
  margin-bottom: 8px;
}
.my-review-game { font-weight: 700; }

/* ---------- Новости ---------- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.news-card {
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}
.news-card:hover { border-color: var(--accent); }
.news-card-cover { display: block; aspect-ratio: 16 / 9; background: var(--bg-hover); overflow: hidden; }
.news-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.news-card-date { color: var(--muted); font-size: 0.8rem; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.news-card h3 { font-size: 1.05rem; margin: 0 0 8px; }
.news-card h3 a { color: var(--text); }
.news-card h3 a:hover { color: var(--accent-hover); }
.news-card p { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }
.news-card .btn { margin-top: auto; align-self: flex-start; }

.pin-badge {
  background: var(--accent-2);
  color: var(--accent-2-ink);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.news-list { display: flex; flex-direction: column; gap: 16px; }
.news-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}
.news-row:hover { border-color: var(--accent); }
.news-row-plain { grid-template-columns: 1fr; }
.news-row-cover { background: var(--bg-hover); }
.news-row-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-row-body { padding: 18px 20px; }
.news-row h3 { margin: 6px 0 8px; }

/* ---------- Страница "Контакты" ---------- */
.contacts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}
.contacts-intro { margin-bottom: 24px; }
.contacts-layout .panel h2 { font-size: 1.2rem; margin-bottom: 6px; }
.contacts-layout .panel > .form-note { margin-bottom: 18px; }
.contacts-layout .side-card { font-size: 0.93rem; }

/* ---------- Текстовое содержимое (описание игры, новость, страница) ---------- */
.content { line-height: 1.75; }
.content h2 { font-size: 1.3rem; margin: 1.6em 0 0.6em; }
.content h3 { font-size: 1.1rem; margin: 1.4em 0 0.5em; }
.content ul, .content ol { padding-left: 22px; }
.content li { margin-bottom: 6px; }
.content img { border-radius: var(--radius-sm); }
.content blockquote {
  margin: 1.2em 0;
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--bg-hover);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
}
.content code {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.9em;
}
.content a { text-decoration: underline; text-underline-offset: 2px; }
.content pre { background: var(--bg-hover); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; }
.content table { width: 100%; border-collapse: collapse; margin: 1.2em 0; }
.content th, .content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.content th { background: var(--bg-hover); }

/* ---------- Сообщения ---------- */
.messages { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.messages li {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-block);
  font-size: 0.93rem;
}
.messages li.success { border-color: var(--accent); background: rgba(88, 166, 151, 0.12); }
.messages li.danger, .messages li.error { border-color: var(--danger); background: rgba(196, 115, 108, 0.12); }
.messages li.warning { border-color: var(--accent-2); background: rgba(199, 154, 107, 0.12); }

/* ---------- Пагинация ---------- */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 32px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-block);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent-hover); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: var(--ink-on-accent); }

/* ---------- Подвал ---------- */
.site-footer {
  background: var(--bg-block);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  margin-top: auto;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 28px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.footer-brand img { width: 32px; height: 32px; border-radius: 9px; }
.footer-brand strong { color: var(--text); font-size: 1.05rem; }
.footer-col h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-bottom: 12px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--muted); }
.footer-col a:hover { color: var(--accent-hover); }
/* Контакты (подвал и страница "Контакты"): подпись слева, значение справа.
   При нехватке ширины значение переносится на следующую строку, а не
   обрезается. */
.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.contact-list li { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.contact-list .contact-label { color: var(--muted); opacity: 0.8; }
.contact-list a { color: var(--text); }
.contact-list a:hover { color: var(--accent-hover); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

/* ---------- Адаптивность ---------- */
@media (max-width: 1080px) {
  .game-layout,
  .contacts-layout { grid-template-columns: 1fr; }
  .game-side { flex-direction: row; flex-wrap: wrap; }
  .game-side .side-card { flex: 1 1 280px; }
}

@media (max-width: 900px) {
  /* Меню шапки сворачивается в кнопку раньше остальной мобильной вёрстки:
     вошедшему пользователю в строке нужны ещё значок уведомлений и меню
     "Кабинет" - всего около 840px, остальное - запас на полосу прокрутки. */
  .nav-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    background: var(--bg-block);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 12px 20px 18px;
    margin: 0;
  }
  .site-header > .container { position: relative; flex-wrap: wrap; }
  .main-nav.open { display: block; }
  .main-nav > ul { flex-direction: column; align-items: stretch; gap: 4px; }
  .main-nav > ul > li > a { padding: 11px 14px; }
  .nav-user { position: static; }
  .dropdown-menu { position: static; box-shadow: none; border: 0; padding: 4px 0 0 12px; }

  /* В свёрнутом меню значок уведомлений - обычный пункт списка с подписью,
     а список раскрывается под ним, как меню аккаунта. О непрочитанных
     сообщает метка на кнопке меню: пока меню закрыто, значка не видно. */
  .nav-notify { position: static; }
  .main-nav > ul > li > a.nav-notify-toggle {
    width: auto;
    height: auto;
    justify-content: flex-start;
    gap: 10px;
    padding: 11px 14px;
  }
  .nav-notify-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .nav-notify-toggle .notify-dot { top: 10px; right: auto; left: 26px; }
  .notify-panel {
    position: static;
    width: auto;
    max-width: none;
    margin: 4px 0 0 12px;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  /* Заголовок повторил бы подпись пункта сразу над ним - остаётся только
     значок "пометить все как прочитанные". */
  .notify-head { justify-content: flex-end; padding: 0 8px; border-bottom: 0; }
  .notify-title { display: none; }
  .notify-list { max-height: 50vh; }

  .profile-layout { grid-template-columns: 1fr; }
  .profile-nav { position: static; }
  .profile-nav ul { flex-direction: row; flex-wrap: wrap; }
  .profile-nav li { flex: 1 1 auto; }
  .filters form { grid-template-columns: 1fr 1fr; }
  .filters form .form-row:first-child { grid-column: 1 / -1; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .news-row { grid-template-columns: 1fr; }
  .news-row-cover { aspect-ratio: 16 / 7; }
}

@media (max-width: 760px) {
  h1 { font-size: 1.6rem; }
  .hero { padding: 30px 22px; }
  .hero h1 { font-size: 1.75rem; }
  main { padding: 22px 0 40px; }
  .filters form { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .game-card-body { padding: 12px; }

  /* Ширину кадра на телефоне задаёт колонка, и горизонтальные пропорции из
     админки сплющили бы его в полоску: вёрстка игры в таком кадре решает, что
     попала на телефон, повёрнутый набок, и перестаёт помещаться по ширине.
     Поэтому кадр вертикальный - во всю колонку и по высоте экрана. Второе
     объявление высоты - для браузеров с svh: это высота окна без учёта
     скрывающихся панелей, с обычным vh низ кадра уезжал бы под адресную
     строку. */
  .player-stage {
    aspect-ratio: auto;
    height: min(90vh, 820px);
    height: min(90svh, 820px);
  }
}

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