:root {
  --bg: #05060f;
  --neon: #4de3ff;
  --accent: #b967ff;
  --hot: #ff5d8f;
  --text: #e8f4ff;
  --dim: #7d8bb0;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body { position: fixed; inset: 0; }

#app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: flex;
  justify-content: center;
  background:
    radial-gradient(120% 60% at 50% -10%, #151a3d 0%, transparent 60%),
    radial-gradient(90% 50% at 50% 110%, #1a0f2e 0%, transparent 55%),
    var(--bg);
}

#game {
  display: block;
  height: 100%;
  width: min(100vw, 520px);
  touch-action: none;
  box-shadow: 0 0 60px rgba(37, 52, 135, 0.35);
}

.hidden { display: none !important; }

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

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) calc(10px + var(--safe-b)) calc(14px + var(--safe-l));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hud-left { display: flex; flex-direction: column; line-height: 1.1; }
#score { font-size: 22px; font-weight: 800; text-shadow: 0 0 12px rgba(77, 227, 255, .6); }
#best { font-size: 11px; }
#best.dim, .dim { color: var(--dim); text-shadow: none; }

.hud-center {
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--neon);
  padding-top: 6px;
  text-shadow: 0 0 10px rgba(77, 227, 255, .5);
}

.hud-right { display: flex; gap: 8px; pointer-events: auto; }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(120, 160, 255, .25);
  background: rgba(10, 14, 34, .55);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.icon-btn:active { background: rgba(77, 227, 255, .18); }
.icon-btn.off { color: var(--dim); text-decoration: line-through; }

.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  letter-spacing: 2px;
}
#lives { color: var(--hot); text-shadow: 0 0 8px rgba(255, 93, 143, .7); }
#bombs { color: var(--accent); text-shadow: 0 0 8px rgba(185, 103, 255, .7); }

/* ---------- Кнопка бомбы ---------- */

#btnBomb {
  position: absolute;
  right: calc(18px + var(--safe-r));
  bottom: calc(22px + var(--safe-b));
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid rgba(185, 103, 255, .5);
  background: radial-gradient(circle at 35% 30%, rgba(185, 103, 255, .35), rgba(30, 16, 60, .8));
  color: #e6d5ff;
  font-size: 26px;
  box-shadow: 0 0 18px rgba(185, 103, 255, .35);
  cursor: pointer;
  touch-action: none;
}
#btnBomb:active { transform: scale(.92); box-shadow: 0 0 28px rgba(185, 103, 255, .7); }
#btnBomb b {
  position: absolute;
  right: -2px;
  top: -2px;
  font-size: 12px;
  background: var(--accent);
  color: #12041f;
  border-radius: 999px;
  padding: 1px 6px;
}

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

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px calc(20px + var(--safe-l) + var(--safe-r)) calc(24px + var(--safe-b));
  background: rgba(5, 6, 15, .72);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.screen h1 {
  font-size: clamp(44px, 14vw, 76px);
  letter-spacing: .08em;
  font-weight: 900;
  background: linear-gradient(180deg, #eaf7ff, #4de3ff 55%, #2f6fff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(77, 227, 255, .45));
}
.screen h1 .accent {
  background: linear-gradient(180deg, #f4e6ff, #b967ff 60%, #ff5d8f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-left: 10px;
}

.screen h2 {
  font-size: clamp(26px, 8vw, 40px);
  letter-spacing: .06em;
  text-shadow: 0 0 16px rgba(77, 227, 255, .5);
}

.tag {
  letter-spacing: .5em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--dim);
  margin-top: -6px;
}

.cta {
  min-width: 220px;
  min-height: 54px;
  margin-top: 8px;
  border: 1px solid rgba(77, 227, 255, .55);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(77, 227, 255, .18), rgba(47, 111, 255, .18));
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(47, 111, 255, .25);
}
.cta:active { transform: scale(.96); box-shadow: 0 0 30px rgba(77, 227, 255, .5); }
.cta.ghost {
  border-color: rgba(125, 139, 176, .4);
  background: rgba(125, 139, 176, .08);
  font-weight: 500;
  font-size: 15px;
}

.hint { font-size: 14px; line-height: 1.5; color: var(--text); }
.hint b { color: var(--neon); }
.hint.keys { font-size: 11.5px; }

.final { font-size: 17px; }
.final b { color: var(--neon); font-size: 21px; }

/* низкие горизонтальные экраны (телефон-альбом) */
@media (max-height: 480px) {
  .screen { gap: 8px; }
  .screen h1 { font-size: clamp(34px, 9vh, 52px); }
  .hint.keys { display: none; }
  .cta { min-height: 46px; margin-top: 2px; }
}
