/* ==========================================================================
   Игротека — оформление
   ========================================================================== */

:root {
  --bg: #080d18;
  --bg-2: #0c1424;
  --panel: rgba(19, 28, 46, .72);
  --panel-solid: #131c2e;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --ink: #eef3ff;
  --ink-2: #b9c6e0;
  --muted: #7d8ca8;
  --accent: #6c8cff;
  --accent-2: #26d0b8;
  --danger: #ff6b6b;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .45);
  --font: "Segoe UI", Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SF Mono", ui-monospace, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, dl, dd, dt { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
b { font-weight: 650; }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------------- Фон ---------------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1100px 600px at 12% -8%, #16224a 0%, transparent 62%),
    radial-gradient(900px 520px at 92% 4%, #0d2f3c 0%, transparent 58%),
    linear-gradient(180deg, #080d18 0%, #070b14 100%);
}

.backdrop__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
  animation: float 22s ease-in-out infinite;
}
.backdrop__orb--1 { width: 460px; height: 460px; left: -120px; top: -140px; background: #3f5bff; }
.backdrop__orb--2 { width: 380px; height: 380px; right: -100px; top: 120px; background: #14b8a6; animation-delay: -7s; }
.backdrop__orb--3 { width: 520px; height: 520px; left: 38%; bottom: -260px; background: #7c3aed; opacity: .35; animation-delay: -14s; }

.backdrop__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
}

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(24px, -30px, 0) scale(1.08); }
}

/* ---------------- Шапка ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(8, 13, 24, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(140deg, #4f6bff, #14b8a6);
  box-shadow: 0 8px 20px rgba(79, 107, 255, .35);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text b { font-size: 16px; letter-spacing: -.01em; }
.brand__text i { font-size: 11.5px; font-style: normal; color: var(--muted); }

.topnav { display: flex; align-items: center; gap: 6px; }
.topnav__link {
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink-2);
  transition: background .15s, color .15s;
}
.topnav__link:hover { background: rgba(255, 255, 255, .07); color: var(--ink); }
.topnav__link.is-active { color: var(--ink); background: rgba(255, 255, 255, .1); }

.iconbtn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.iconbtn:hover { background: rgba(255, 255, 255, .1); color: var(--ink); border-color: var(--line-2); }
.iconbtn:active { transform: scale(.96); }
.iconbtn .icon-off { display: none; }
.iconbtn[aria-pressed="false"] .icon-on { display: none; }
.iconbtn[aria-pressed="false"] .icon-off { display: block; }

/* ---------------- Кнопки ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .06);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(135deg, #4f6bff, #6f8dff);
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(79, 107, 255, .35);
}
.btn--primary:hover { background: linear-gradient(135deg, #5f79ff, #82a0ff); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { color: var(--ink); }
.btn--danger { background: rgba(255, 107, 107, .12); border-color: rgba(255, 107, 107, .4); color: #ffb3b3; }
.btn--danger:hover { background: rgba(255, 107, 107, .2); }

/* ---------------- Hero ---------------- */

.view { padding: 34px 0 60px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 40px;
  align-items: center;
  padding: 8px 0 46px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 650;
  margin-bottom: 14px;
}

.hero__title {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.04;
  letter-spacing: -.03em;
  font-weight: 720;
  background: linear-gradient(120deg, #ffffff 20%, #9db4ff 62%, #56e3c9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lead {
  margin-top: 18px;
  max-width: 54ch;
  color: var(--ink-2);
  font-size: 16.5px;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.hero__stats {
  display: flex;
  gap: 34px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.hero__stats dt { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.hero__stats dd { font-size: 24px; font-weight: 680; letter-spacing: -.02em; margin-top: 2px; }

/* Арт из плиток */
.hero__art { display: grid; place-items: center; }
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  transform: rotate(-8deg);
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .45));
}
.tile {
  width: 62px; height: 62px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .1);
  animation: tilePulse 6s ease-in-out infinite;
}
.tile--c { background: linear-gradient(145deg, #2dd4bf, #14b8a6); border-color: transparent; animation-delay: .2s; }
.tile--m { background: linear-gradient(145deg, #818cf8, #6366f1); border-color: transparent; animation-delay: .8s; }
.tile--y { background: linear-gradient(145deg, #fbbf24, #f59e0b); border-color: transparent; animation-delay: 1.4s; }
.tile--g { background: linear-gradient(145deg, #4ade80, #22c55e); border-color: transparent; animation-delay: 2s; }

@keyframes tilePulse {
  0%, 100% { transform: translateY(0); opacity: .95; }
  50% { transform: translateY(-7px); opacity: 1; }
}

/* ---------------- Список игр ---------------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.section-head h2 { font-size: 22px; letter-spacing: -.02em; font-weight: 680; }
.section-head p { color: var(--muted); font-size: 13.5px; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(24, 34, 54, .92), rgba(15, 22, 36, .92));
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
  isolation: isolate;
}
.card::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent 85%);
  opacity: .85;
}
.card::after {
  content: "";
  position: absolute;
  right: -70px; top: -70px;
  width: 190px; height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%);
  opacity: .28;
  z-index: -1;
  transition: opacity .2s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: var(--shadow-lg);
}
.card:hover::after { opacity: .5; }

.card__head { display: flex; align-items: flex-start; gap: 13px; }
.card__icon {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  flex: none;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 92%, #fff 8%), color-mix(in srgb, var(--accent) 62%, #000 38%));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}
.card__name { font-size: 18px; font-weight: 680; letter-spacing: -.015em; }
.card__sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  color: var(--ink-2);
  border: 1px solid rgba(255, 255, 255, .07);
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.card__best { font-size: 12.5px; color: var(--muted); }
.card__best b { display: block; font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.card__play {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: color-mix(in srgb, var(--accent) 45%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  transition: background .15s, transform .1s;
}
.card:hover .card__play { background: color-mix(in srgb, var(--accent) 38%, transparent); }
.card__play:active { transform: scale(.97); }

.card--soon { opacity: .55; pointer-events: none; }

/* ---------------- Экран игры ---------------- */

.gamebar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px);
  margin-bottom: 16px;
}
.gamebar__title h1 { font-size: 19px; font-weight: 680; letter-spacing: -.02em; line-height: 1.2; }
.gamebar__title p { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.gamebar__actions { display: flex; gap: 6px; }

.hud { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.hud__item {
  min-width: 78px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  text-align: right;
}
.hud__item span { display: block; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hud__item b { font-size: 16px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.hud__item--accent { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

.stagewrap {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14, 21, 36, .9), rgba(9, 14, 24, .94));
  box-shadow: var(--shadow);
  padding: 20px 16px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

/* ---------------- Оверлей ---------------- */

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 10, 18, .78);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  z-index: 12;
  animation: fadeIn .18s ease;
}
.overlay[hidden] { display: none; }

.overlay__card {
  width: min(430px, 100%);
  padding: 26px 24px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #182238, #111a2b);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.overlay__kicker {
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 650;
}
.overlay__card h2 { font-size: 24px; letter-spacing: -.02em; margin-top: 6px; }
.overlay__text { color: var(--ink-2); font-size: 14px; margin-top: 8px; }
.overlay__stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.overlay__stats li {
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.overlay__stats li b { display: block; font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.overlay__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 20px;
}
.overlay__record {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  color: #ffdf8a;
  background: rgba(255, 199, 61, .14);
  border: 1px solid rgba(255, 199, 61, .4);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- Тост ---------------- */

.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(8px);
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(20, 30, 48, .96);
  border: 1px solid var(--line-2);
  font-size: 13px;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 14;
  white-space: nowrap;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- Справка ---------------- */

.gamehelp {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  animation: fadeIn .18s ease;
}
.gamehelp[hidden] { display: none; }
.gamehelp h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.gamehelp ul { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.gamehelp li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-2); }
.kbd {
  display: inline-block;
  min-width: 26px;
  padding: 3px 8px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  background: rgba(255, 255, 255, .07);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  text-align: center;
}

/* ---------------- Канвас и экранные кнопки (общие) ---------------- */

.gk-canvas {
  display: block;
  border-radius: 14px;
  background: #0b1220;
  border: 1px solid var(--line);
  touch-action: none;
  max-width: 100%;
}

.gk-pad {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.gk-pad__btn {
  flex: 1 1 auto;
  min-width: 58px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  border-bottom-width: 3px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .05));
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background .1s, transform .06s, border-color .1s;
  touch-action: none;
}
.gk-pad__btn.is-down {
  background: color-mix(in srgb, var(--accent) 32%, rgba(255, 255, 255, .06));
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  transform: translateY(2px);
  border-bottom-width: 1px;
}
.gk-pad__btn--wide { flex: 2 1 auto; }

/* ---------------- Страница «Как играть» ---------------- */

.page { max-width: 760px; }
.page h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.03em; font-weight: 720; }
.page__lead { color: var(--ink-2); margin-top: 12px; font-size: 16.5px; }
.prose { margin-top: 30px; display: grid; gap: 26px; }
.prose h2 { font-size: 17px; letter-spacing: -.01em; margin-bottom: 10px; }
.prose ul { display: grid; gap: 8px; }
.prose li {
  position: relative;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 14.5px;
}
.prose li::before {
  content: "";
  position: absolute;
  left: 0; top: .62em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
}
.page__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

/* ---------------- Подвал ---------------- */

.foot {
  border-top: 1px solid var(--line);
  padding: 22px 0 30px;
  margin-top: 20px;
}
.foot__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.foot p { font-size: 12.5px; color: var(--muted); }
.foot__meta { color: #5f6d86; }

/* ---------------- Адаптив ---------------- */

@media (max-width: 1024px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero__art { order: -1; justify-items: start; }
  .tiles { transform: rotate(-6deg) scale(.8); transform-origin: left center; }
  .gamebar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .gamebar .hud { grid-column: 1 / -1; justify-content: flex-start; order: 5; }
}

@media (max-width: 720px) {
  .wrap { width: min(1180px, 100% - 22px); }
  .view { padding: 20px 0 40px; }
  .topbar__inner { height: 58px; }
  .brand__text i { display: none; }
  .hero__title { font-size: clamp(28px, 9vw, 40px); }
  .hero__stats { gap: 22px; }
  .hero__stats dd { font-size: 20px; }
  .cards { grid-template-columns: 1fr; }
  .gamebar { padding: 10px 12px; gap: 10px; }
  .gamebar__title h1 { font-size: 16px; }
  .gamebar__title p { display: none; }
  .btn--back span { display: none; }
  .btn--back { padding: 9px 11px; }
  .hud__item { min-width: 66px; padding: 5px 10px; }
  .hud__item b { font-size: 14px; }
  .stagewrap { padding: 14px 10px; }
  .overlay__card { padding: 20px 16px; }
  .overlay__card h2 { font-size: 20px; }
  .section-head h2 { font-size: 19px; }
}

@media (max-width: 400px) {
  .gk-pad__btn { min-width: 48px; min-height: 44px; padding: 8px 10px; font-size: 15px; }
  .hero__actions .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}