/* GameSlope — общие стили игровой страницы */
:root {
  --bg: #06070c;
  --panel: #0e1119;
  --line: rgba(255, 255, 255, 0.09);
  --fg: #e9ecf5;
  --muted: #8b90a6;
  --accent: #c8ff3c;
  --accent-2: #5eead4;
  --pink: #ff5ea8;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(200, 255, 60, 0.10), transparent 60%),
    radial-gradient(700px 500px at 100% 110%, rgba(94, 234, 212, 0.10), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 12px clamp(10px, 2vw, 24px) 10px;
  gap: 10px;
}

.game-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: none;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color .18s, border-color .18s, background .18s;
  white-space: nowrap;
}
.back:hover, .back:focus-visible {
  color: var(--fg);
  border-color: rgba(200, 255, 60, 0.5);
  background: rgba(200, 255, 60, 0.08);
}

.game-title {
  margin: 0;
  font-size: clamp(15px, 2vw, 20px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
}
.game-title span { color: var(--accent); }

.hud {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  flex-wrap: wrap;
}

.hud__item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.hud__item b {
  color: var(--fg);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}
.hud__item.is-accent b { color: var(--accent); }

.sound-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 10px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color .18s, border-color .18s;
}
.sound-btn:hover, .sound-btn:focus-visible { color: var(--fg); border-color: rgba(255, 255, 255, 0.28); }

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)) ,
    #090b12;
  box-shadow: 0 24px 70px -40px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  touch-action: none;
}

.stage canvas {
  display: block;
  touch-action: none;
  border-radius: 4px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  background: rgba(6, 7, 12, 0.78);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.overlay h2 {
  margin: 0;
  font-size: clamp(26px, 5vw, 46px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 0.98;
  font-weight: 800;
}
.overlay p {
  margin: 0;
  color: var(--muted);
  max-width: 46ch;
  line-height: 1.5;
  font-size: clamp(13px, 1.6vw, 15px);
}
.overlay [data-extra] {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-2);
  letter-spacing: 0.04em;
}

.btn {
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  color: #0a0c08;
  background: linear-gradient(180deg, var(--accent), #a9e41f);
  border: 0;
  border-radius: 12px;
  padding: 13px 26px;
  cursor: pointer;
  box-shadow: 0 12px 30px -12px rgba(200, 255, 60, 0.8);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }

.game-footer {
  flex: none;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  min-height: 20px;
}
.game-footer kbd {
  font-family: var(--mono);
  font-size: 10px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 5px;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
}
.game-footer .best { color: var(--accent); }

/* подсказка для «широких» игр на телефоне в портретной ориентации */
.rotate-hint { display: none; color: var(--pink); }
@media (orientation: portrait) and (pointer: coarse) {
  .rotate-hint { display: inline; }
}

/* мобильные кнопки */
.touch-layer {
  position: absolute;
  inset: auto 0 0 0;
  display: none;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  z-index: 4;
  pointer-events: none;
}
.touch-layer button {
  pointer-events: auto;
  width: 66px;
  height: 66px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(12, 15, 23, 0.7);
  color: var(--fg);
  font-size: 22px;
  font-family: var(--mono);
  backdrop-filter: blur(6px);
  touch-action: none;
  user-select: none;
}
.touch-layer button:active { background: rgba(200, 255, 60, 0.18); border-color: rgba(200, 255, 60, 0.5); }
.touch-layer .pair { display: flex; gap: 10px; }

@media (hover: none) and (pointer: coarse) {
  .touch-layer { display: flex; }
  .game-footer .hint { display: none; }
}

@media (max-width: 620px) {
  .game-shell { padding: 8px 8px 6px; gap: 8px; }
  .hud { font-size: 11px; gap: 6px; }
  .hud__item { padding: 5px 8px; }
  .hud__item b { font-size: 12px; }
  .stage { border-radius: 12px; }
  .back { padding: 6px 10px; border-radius: 10px; }
}

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