/* ============ LODE RUNNER — Золото глубин ============ */

:root {
  --bg-deep: #07091200;
  --bg0: #070912;
  --bg1: #0d1122;
  --amber: #ffc65a;
  --amber-hot: #ffe9b0;
  --teal: #3ee0c8;
  --red: #ff5f6d;
  --ink: #cfd6ea;
  --ink-dim: #6b7492;
  --frame-glow: rgba(255, 190, 90, 0.10);
}

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

html, body { height: 100%; }

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #141a33 0%, transparent 60%),
    radial-gradient(900px 500px at 85% 110%, #1a1206 0%, transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0) 70%);
  color: var(--ink);
  font-family: "Tektur", "Segoe UI", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 14px;
  overflow-x: hidden;
}

#stage {
  width: min(1120px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- HUD ---------- */

#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
}

.hud-title {
  font-family: "Bungee", cursive;
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--amber);
  text-shadow: 0 0 18px rgba(255, 198, 90, 0.45);
  line-height: 1;
}
.hud-title span { color: var(--teal); text-shadow: 0 0 18px rgba(62, 224, 200, 0.4); }

.hud-level {
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 3px;
}

.hud-center { text-align: center; }

.hud-score {
  font-family: "Tektur", monospace;
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 6px;
  color: var(--amber-hot);
  text-shadow: 0 0 22px rgba(255, 198, 90, 0.35);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hud-score-label {
  font-size: 10px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.hud-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.hud-gold {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 18px;
  color: var(--amber-hot);
  background: rgba(255, 198, 90, 0.08);
  border: 1px solid rgba(255, 198, 90, 0.22);
  border-radius: 20px;
  padding: 3px 14px 3px 8px;
}
.coin {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3cd, #ffc65a 45%, #b06a14 100%);
  box-shadow: 0 0 10px rgba(255, 198, 90, 0.8);
  animation: coinPulse 1.6s ease-in-out infinite;
}
@keyframes coinPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

.hud-lives { display: flex; gap: 5px; }
.hud-lives .life {
  width: 12px; height: 14px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #9ff5e6, #3ee0c8 60%, #1e8f80);
  box-shadow: 0 0 8px rgba(62, 224, 200, 0.55);
}
.hud-lives .life.lost {
  background: #232a3d;
  box-shadow: none;
  opacity: 0.5;
}

/* ---------- Игровое поле ---------- */

#frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 198, 90, 0.16);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 10px 60px rgba(0, 0, 0, 0.6),
    0 0 90px var(--frame-glow),
    inset 0 0 60px rgba(0, 0, 0, 0.35);
}

#game {
  display: block;
  width: 100%;
  height: auto;
  background: #070912;
}

/* виньетка + лёгкие сканлайны поверх канваса */
#frame::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.38) 100%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.016) 0 1px, transparent 1px 3px);
}

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

#overlay {
  position: absolute; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 13, 0.72);
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 5;
}
#overlay.visible { opacity: 1; pointer-events: auto; }

.ov-box { text-align: center; padding: 20px; animation: ovIn 0.5s ease both; }
@keyframes ovIn {
  from { transform: translateY(14px) scale(0.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.ov-title {
  font-family: "Bungee", cursive;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.05;
  background: linear-gradient(180deg, #ffe9b0 10%, #ffc65a 45%, #e08a1e 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 198, 90, 0.35));
  margin-bottom: 6px;
}
.ov-title.teal {
  background: linear-gradient(180deg, #d6fff7 10%, #3ee0c8 55%, #148a78 90%);
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 0 24px rgba(62, 224, 200, 0.35));
}
.ov-title.red {
  background: linear-gradient(180deg, #ffd3d7 10%, #ff5f6d 55%, #9c1f2c 90%);
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 0 24px rgba(255, 95, 109, 0.35));
}

.ov-sub {
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--ink);
  margin-bottom: 22px;
}
.ov-sub b { color: var(--amber); }

.ov-keys {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 8px 16px;
  text-align: left;
  font-size: 13px;
  color: var(--ink-dim);
  margin-bottom: 26px;
}
.ov-keys div:nth-child(odd) { text-align: right; color: var(--ink); }

.ov-press {
  font-size: 15px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--amber-hot);
  animation: blink 1.3s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.ov-score-final {
  font-family: "Tektur", monospace;
  font-weight: 800;
  font-size: 34px;
  letter-spacing: 6px;
  color: var(--amber-hot);
  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
}

kbd {
  font-family: "Tektur", monospace;
  font-size: 11px;
  background: #1a2036;
  border: 1px solid #303a5c;
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------- Подсказки внизу ---------- */

#help {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  font-size: 12px;
  color: var(--ink-dim);
  padding: 2px 0 6px;
}

@media (max-width: 720px) {
  .hud-score { font-size: 22px; letter-spacing: 3px; }
  .hud-title { font-size: 17px; }
  #help { font-size: 10px; gap: 6px 12px; }
}
