/* Каталог аркады: меню игровой приставки — экран с демо, описание, ряд плиток. */
@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #7b5cff;
}
:root {
  --accent: #7b5cff;
  --bg: #06070c;
  --fg: #f4f4f5;
  --muted: #9ca3af;
  --line: rgba(255, 255, 255, 0.1);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --a-soft: color-mix(in srgb, var(--accent) 28%, transparent);
  --a-glow: color-mix(in srgb, var(--accent) 55%, transparent);
  color-scheme: dark;
  transition: --accent 0.6s ease;
}
* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  color: var(--fg); font-family: var(--font); background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
/* лёгкие сканлайны поверх всего */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px);
}

/* ─────────── фон ─────────── */
.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(80% 60% at 72% 18%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
    radial-gradient(60% 50% at 8% 95%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(120% 80% at 50% 120%, #000 30%, transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, #07080e), #05060a 70%);
}
.backdrop__fx { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ─────────── каркас ─────────── */
.app {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
  max-width: 1240px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 56px) max(16px, env(safe-area-inset-left));
}
.top { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; font-weight: 800; letter-spacing: 0.32em; text-transform: uppercase; }
.brand__mark { width: 30px; height: 30px; color: var(--accent); filter: drop-shadow(0 0 8px var(--a-glow)); }
.brand__sub { margin: 0; color: var(--muted); font-size: 13px; display: none; }
.counter { margin-left: auto; font: 600 13px/1 var(--mono); color: var(--muted); letter-spacing: 0.08em; }
.counter__now { color: var(--fg); font-size: 20px; margin-right: 2px; text-shadow: 0 0 12px var(--a-glow); }

/* ─────────── сцена ─────────── */
.stage { flex: 1; display: flex; flex-direction: column; gap: 16px; margin-top: 10px; min-height: 0; }
.stage[hidden] { display: none; }

.screen {
  position: relative; flex: 1 1 auto; min-height: 230px; max-height: 50vh; max-height: 50dvh;
  border-radius: 22px; overflow: hidden; isolation: isolate; touch-action: pan-y;
  background: #04050a;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, rgba(255, 255, 255, 0.1));
  box-shadow:
    0 0 0 5px rgba(255, 255, 255, 0.025),
    0 0 0 6px rgba(255, 255, 255, 0.06),
    0 24px 70px -18px var(--a-glow),
    0 0 120px -40px var(--accent);
  user-select: none; -webkit-user-select: none;
}
.screen__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.screen__glass { position: absolute; inset: 0; pointer-events: none; }
.screen__glass::before {
  content: ''; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.6));
}
.screen__glass::after {
  content: ''; position: absolute; top: -50%; bottom: -50%; left: -60%; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07) 45%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.07) 55%, transparent);
  transform: rotate(18deg); animation: sweep 7s ease-in-out 1.5s infinite;
}
@keyframes sweep { 0% { left: -60%; } 30%, 100% { left: 130%; } }
.screen__hud {
  position: absolute; inset: 12px 14px auto; display: flex; justify-content: space-between; gap: 8px;
  font: 700 10px/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255, 255, 255, 0.72);
  pointer-events: none;
}
.screen__live { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.45); }
.screen__live i { width: 6px; height: 6px; border-radius: 50%; background: #ff4d6d; box-shadow: 0 0 8px #ff4d6d; animation: blink 1.6s steps(2) infinite; }
.screen__slug { padding: 5px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.45); }
@keyframes blink { 50% { opacity: 0.25; } }
.screen__nav {
  position: absolute; top: 50%; width: 42px; height: 42px; margin-top: -21px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(6, 7, 12, 0.5); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0.75; transition: opacity 0.2s, background 0.2s, transform 0.2s;
}
.screen__nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.screen__nav--prev { left: 10px; }
.screen__nav--next { right: 10px; }
.screen__nav:hover, .screen__nav:focus-visible { opacity: 1; background: color-mix(in srgb, var(--accent) 35%, rgba(6, 7, 12, 0.6)); }
.screen__nav:active { transform: scale(0.92); }
.screen__nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ─────────── описание ─────────── */
.info { display: flex; flex-direction: column; gap: 8px; min-width: 0; touch-action: pan-y; container-type: inline-size; }
.info__chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px;
  font: 700 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 55%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, rgba(0, 0, 0, 0.3));
}
.chip svg { width: 13px; height: 13px; fill: currentColor; }
.chip--hot { color: #0b0b10; border-color: transparent; background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--accent) 60%, #fff)); }

.title {
  position: relative; margin: 0; min-width: 0; height: 80px; display: flex; align-items: center;
  --len: 8;
  font-size: min(84px, calc(100cqi / (var(--len) * 0.8))); white-space: nowrap; line-height: 0.9; font-weight: 900; font-style: italic;
  letter-spacing: -0.015em; text-transform: uppercase;
}
.title__text {
  display: inline-block; padding: 0 0.08em 0.06em 0;
  background: linear-gradient(180deg, #fff 0%, #fff 30%, color-mix(in srgb, var(--accent) 45%, #fff) 48%, var(--accent) 52%, color-mix(in srgb, var(--accent) 55%, #000) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 16px var(--a-glow)) drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6));
}
.title::after {
  content: attr(data-text); position: absolute; left: 0.05em; top: 50%; z-index: -1; transform: translateY(calc(-50% + 0.05em));
  padding: 0 0.08em 0.06em 0; color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--accent) 70%, transparent);
  opacity: 0.55; pointer-events: none;
}
.tagline { margin: 0; min-height: 2.7em; font-size: 17px; line-height: 1.35; color: #e4e4e7; text-wrap: balance; }

.info__row { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.best { display: flex; flex-direction: column; gap: 4px; min-width: 84px; }
.best__label { font: 700 10px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.best__value { font: 800 24px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--fg); text-shadow: 0 0 14px var(--a-glow); }
.best__value.is-empty { font-size: 14px; color: var(--muted); text-shadow: none; font-weight: 600; }

.play {
  position: relative; flex: 1; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: 60px; padding: 0 30px; border-radius: 16px;
  font: 900 19px/1 var(--font); letter-spacing: 0.2em; text-transform: uppercase; text-decoration: none;
  color: #07070b;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 55%, #fff) 0%, var(--accent) 55%, color-mix(in srgb, var(--accent) 70%, #000) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -3px 0 rgba(0, 0, 0, 0.25),
    0 12px 32px -8px var(--a-glow),
    0 0 44px -12px var(--accent);
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
  animation: pulse 2.4s ease-in-out infinite;
}
.play svg { width: 20px; height: 20px; fill: currentColor; margin-left: -4px; }
.play::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; z-index: -1;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg); animation: shine 3.2s ease-in-out infinite;
}
.play:hover { transform: translateY(-2px); filter: brightness(1.08); }
.play:active { transform: translateY(1px) scale(0.98); }
.play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@keyframes shine { 0%, 55% { left: -40%; } 100% { left: 130%; } }
@keyframes pulse {
  50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -3px 0 rgba(0, 0, 0, 0.25), 0 14px 40px -6px var(--a-glow), 0 0 64px -8px var(--accent); }
}

/* смена игры */
.info.is-swap .info__chips { animation: rise 0.35s ease-out both; }
.info.is-swap .title { animation: rise 0.4s 0.03s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.info.is-swap .tagline { animation: rise 0.4s 0.08s ease-out both; }
.info.is-swap .best { animation: rise 0.4s 0.12s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ─────────── ряд плиток ─────────── */
.dock { margin-top: 16px; }
.dock .hint { position: relative; }
.tiles {
  list-style: none; margin: -12px -16px -16px; padding: 26px 16px 28px;
  display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}
.tiles::-webkit-scrollbar { display: none; }
.tiles li { flex: none; scroll-snap-align: center; }
.tiles li:first-child { margin-left: auto; }
.tiles li:last-child { margin-right: auto; }
.tile {
  --c: var(--accent);
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 82px; height: 92px; border-radius: 18px; text-decoration: none; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 20%, #12141d), #0b0d14 75%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 18px rgba(0, 0, 0, 0.4);
  opacity: 0.6; filter: saturate(0.55);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3), opacity 0.25s, filter 0.25s, border-color 0.25s, box-shadow 0.25s;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.tile__icon { width: 34px; height: 34px; color: var(--c); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 60%, transparent)); }
.tile__name { font: 700 10px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; color: #d4d4d8; }
.tile__no { position: absolute; top: 7px; left: 9px; font: 700 9px/1 var(--mono); color: rgba(255, 255, 255, 0.4); }
.tile__badge {
  position: absolute; top: -7px; right: -5px; padding: 3px 6px; border-radius: 6px;
  font: 800 9px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: #0b0b10; background: var(--c); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent);
}
.tile:hover { opacity: 0.9; filter: none; }
.tile.is-active {
  opacity: 1; filter: none; transform: translateY(-4px) scale(1.1);
  border-color: color-mix(in srgb, var(--c) 80%, #fff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 0 2px color-mix(in srgb, var(--c) 35%, transparent), 0 10px 30px -4px color-mix(in srgb, var(--c) 60%, transparent);
}
.tile.is-active .tile__name { color: #fff; }
.tile.is-active::after {
  content: ''; position: absolute; left: 50%; bottom: -10px; width: 18px; height: 3px; margin-left: -9px; border-radius: 2px;
  background: var(--c); box-shadow: 0 0 8px var(--c);
}
.tile:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

.hint { margin: 4px 0 0; text-align: center; font: 600 11px/1.4 var(--mono); letter-spacing: 0.06em; color: var(--muted); }
.hint kbd {
  display: inline-block; min-width: 22px; padding: 3px 6px; margin: 0 2px; border-radius: 5px;
  font: 700 11px/1 var(--mono); color: var(--fg); text-align: center;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); border-bottom-width: 2px;
}

/* ─────────── без JS: обычный список ссылок ─────────── */
html:not(.js) .tiles { flex-direction: column; overflow: visible; -webkit-mask-image: none; mask-image: none; margin: 0; padding: 0; }
html:not(.js) .tiles li { margin: 0; }
html:not(.js) .counter { display: none; }
html:not(.js) .tile { width: auto; height: auto; padding: 16px 18px; opacity: 1; filter: none; align-items: flex-start; font-size: 20px; font-weight: 800; }

/* ─────────── невысокие телефоны ─────────── */
@media (max-height: 700px) and (max-width: 899px) {
  .screen { min-height: 190px; }
  .title { height: 58px; font-size: min(60px, calc(100cqi / (var(--len) * 0.8))); }
  .tagline { font-size: 15px; }
  .play { height: 52px; }
  .hint { display: none; }
}

/* ─────────── десктоп ─────────── */
@media (min-width: 900px) {
  .app { padding-top: calc(env(safe-area-inset-top) + 22px); padding-bottom: 60px; }
  .brand__sub { display: block; padding-left: 14px; border-left: 1px solid var(--line); }
  .stage {
    display: grid; grid-template-columns: minmax(300px, 0.85fr) 1.35fr; align-items: center; gap: 44px; margin-top: 18px;
  }
  .screen { order: 2; flex: none; height: auto; max-height: none; min-height: 0; aspect-ratio: 16 / 10.5; max-height: calc(100dvh - 330px); width: 100%; }
  .info { order: 1; gap: 12px; }
  .title { height: 100px; font-size: min(104px, calc(100cqi / (var(--len) * 0.8))); }
  .tagline { font-size: 21px; max-width: 26ch; }
  .info__row { margin-top: 14px; }
  .play { flex: none; min-width: 230px; height: 66px; font-size: 21px; }
  .best__value { font-size: 30px; }
  .tiles { gap: 14px; padding-top: 18px; }
  .tile { width: 108px; height: 116px; border-radius: 22px; gap: 9px; }
  .tile__icon { width: 44px; height: 44px; }
  .tile__name { font-size: 11px; }
  .tile.is-active { transform: translateY(-6px) scale(1.1); }
}
@media (min-width: 900px) and (max-height: 760px) {
  .screen { max-height: calc(100dvh - 300px); }
  .tile { height: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
