:root {
  --bg: #0b0f1a;
  --bg2: #121a2e;
  --panel: #151f38;
  --neon: #00e5ff;
  --neon2: #ff2d95;
  --neon3: #ffe74c;
  --text: #d8e2ff;
  --muted: #7a88b0;
  --danger: #ff4d6d;
  --ok: #3ddc97;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: radial-gradient(circle at 20% 0%, #101a33 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--neon); text-decoration: none; }
a:hover { text-shadow: 0 0 8px var(--neon); }

/* ===== Шапка ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 26, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #1f2b4a;
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.brand {
  font-family: "Courier New", monospace;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: var(--neon);
  text-shadow: 0 0 12px var(--neon);
}
.nav-links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.95rem; }
.nav-links a { color: var(--text); }
.nav-links a:hover { color: var(--neon); text-shadow: none; }
.nav-links a.active { color: var(--neon); border-bottom: 2px solid var(--neon); }

.breadcrumb {
  max-width: 1080px;
  margin: 18px auto 0;
  padding: 0 20px;
  font-size: 0.85rem;
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--neon); }

/* ===== Контейнер ===== */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

h1 {
  font-size: 2rem;
  margin-bottom: 6px;
  color: #fff;
}
h2 { font-size: 1.4rem; margin: 26px 0 12px; color: #fff; }
h3 { font-size: 1.1rem; margin: 18px 0 8px; color: var(--neon); }

.subtitle { color: var(--muted); margin-bottom: 24px; font-size: 1.02rem; }

.card {
  background: var(--panel);
  border: 1px solid #243052;
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card h3 { margin-top: 0; }

p { margin-bottom: 12px; }
ul, ol { margin: 0 0 14px 22px; }
li { margin-bottom: 6px; }

hr { border: 0; border-top: 1px solid #22304f; margin: 24px 0; }

kbd, .key {
  display: inline-block;
  background: #1c2a4a;
  border: 1px solid #33457a;
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 1px 8px;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  color: var(--neon);
}

.badge {
  display: inline-block;
  background: #1c2a4a;
  color: var(--neon);
  border-radius: 20px;
  padding: 2px 12px;
  font-size: 0.78rem;
  margin-right: 6px;
  border: 1px solid #2a3b68;
}

/* ===== Кнопки ===== */
.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--neon) 0%, #0099ff 100%);
  color: #03121f;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 26px rgba(0, 229, 255, 0.6); text-shadow: none; }
.btn.btn-pink { background: linear-gradient(135deg, var(--neon2) 0%, #c2007d 100%); box-shadow: 0 0 18px rgba(255, 45, 149, 0.35); }
.btn.btn-pink:hover { box-shadow: 0 0 26px rgba(255, 45, 149, 0.6); }
.btn.btn-ghost { background: transparent; color: #ffffff; border: 2px solid var(--neon); box-shadow: none; }
.btn.btn-ghost:hover { background: rgba(0, 229, 255, 0.1); box-shadow: none; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Сетка карточек (главная) ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 8px;
}
.game-card {
  background: var(--panel);
  border: 1px solid #243052;
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--neon);
  box-shadow: 0 8px 30px rgba(0, 229, 255, 0.15);
}
.game-card .thumb {
  height: 140px;
  background: #0e1526;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  border-bottom: 1px solid #1d2840;
}
.game-card .body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.game-card h3 { margin: 0 0 6px; }
.game-card p { color: var(--muted); font-size: 0.9rem; flex: 1; }
.game-card .actions { margin-top: 14px; display: flex; gap: 8px; }

/* ===== Страница игры ===== */
.play-area {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}
.game-shell {
  background: #070b14;
  border: 1px solid #22304f;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.08);
}
canvas.game-canvas {
  display: block;
  background: #000;
  border-radius: 8px;
  image-rendering: pixelated;
}
.hud {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.hud .stat {
  background: var(--panel);
  border: 1px solid #243052;
  border-radius: 10px;
  padding: 8px 16px;
  text-align: center;
  flex: 1;
  min-width: 90px;
}
.hud .stat .label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.hud .stat .value { font-size: 1.5rem; font-weight: 700; color: var(--neon); font-family: "Courier New", monospace; }
.controls-bar { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.side-panel { flex: 1; min-width: 260px; }

/* ===== Таблица рекордов ===== */
.score-table { width: 100%; border-collapse: collapse; }
.score-table th, .score-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid #1d2840; }
.score-table th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; }
.score-table tr:hover td { background: rgba(0, 229, 255, 0.04); }
.score-table .rank { font-family: "Courier New", monospace; color: var(--neon3); font-weight: 700; }

/* ===== FAQ ===== */
.faq-item { border-bottom: 1px solid #1d2840; padding: 14px 0; }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary { cursor: pointer; font-weight: 600; color: #fff; font-size: 1.02rem; }
.faq-item summary:hover { color: var(--neon); }
.faq-item p { margin: 10px 0 0; color: var(--text); }

/* ===== Список страниц (навигация по 10 страницам) ===== */
.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 4px;
}
.page-nav a {
  background: var(--panel);
  border: 1px solid #243052;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 0.9rem;
  color: var(--text);
}
.page-nav a:hover { border-color: var(--neon); color: var(--neon); text-shadow: none; }
.page-nav a.active { border-color: var(--neon); color: var(--neon); background: rgba(0, 229, 255, 0.06); }

/* ===== Прочее ===== */
.note {
  background: rgba(255, 231, 76, 0.08);
  border-left: 4px solid var(--neon3);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  margin: 16px 0;
}
.tip {
  background: rgba(61, 220, 151, 0.08);
  border-left: 4px solid var(--ok);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  margin: 16px 0;
}
.warn {
  background: rgba(255, 77, 109, 0.08);
  border-left: 4px solid var(--danger);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  margin: 16px 0;
}

footer.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 26px 20px 40px;
  border-top: 1px solid #1a243c;
}
footer.site-footer a { color: var(--muted); }

.game-preview-link { font-weight: 700; }

.hidden { display: none; }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--neon);
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.3);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
#toast.show { opacity: 1; }