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

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a0e17;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: none;
}

#game-root { width: 100vw; height: 100vh; }
#game-root canvas { display: block; image-rendering: pixelated; }

/* ── тач-управление ── */
#touch {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
#pad { position: absolute; left: 16px; bottom: 22px; display: flex; gap: 14px; }
.btn {
  pointer-events: auto;
  width: 68px; height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  background: rgba(20,24,34,.55);
  color: #fff; font-size: 26px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.btn:active { background: rgba(255,46,46,.6); transform: scale(.94); }
.btn.jump { position: absolute; right: 18px; bottom: 26px; width: 82px; height: 82px; font-size: 30px; }
.btn.attack { position: absolute; right: 104px; bottom: 40px; width: 70px; height: 70px; font-size: 26px; display: none; }
.btn.attack.show { display: flex; }
.btn.attack:active { background: rgba(255,180,40,.6); }

/* прячем тач на десктопе (есть клавиатура) */
@media (hover: hover) and (pointer: fine) { #touch { display: none; } }

/* ── приветственный экран ── */
#welcome {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 28%, #1a2744, #0a0e17 72%);
  padding: 24px; text-align: center; transition: opacity .3s;
}
#welcome.hidden { opacity: 0; pointer-events: none; }
.wcard { max-width: 340px; }
.weagle {
  width: 150px; height: auto; image-rendering: pixelated;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.5)); margin-bottom: 4px;
}
.wgreet { color: #ff5a5a; font-weight: 800; font-size: 18px; }
.wtitle { font-size: 30px; font-weight: 900; margin: 2px 0 12px; }
.wrules { color: #c9d1e0; font-size: 15px; line-height: 1.55; margin-bottom: 24px; }
.wrules b { color: #fff; }
#play-btn {
  background: #ff2e2e; color: #fff; border: 0; border-radius: 14px;
  padding: 16px 44px; font-size: 20px; font-weight: 900; cursor: pointer;
  box-shadow: 0 8px 24px rgba(255,46,46,.4);
}
#play-btn:active { transform: scale(.96); }
.whint { color: #6b7488; font-size: 12px; margin-top: 18px; }

/* ── оверлей победы ── */
#overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,8,14,.85); backdrop-filter: blur(4px);
  z-index: 20; transition: opacity .3s;
}
#overlay.hidden { opacity: 0; pointer-events: none; }
.card {
  background: #12161f; border: 2px solid #ff2e2e; border-radius: 18px;
  padding: 28px 26px; max-width: 320px; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
#ov-eagle {
  width: 120px; height: auto; margin: -66px auto 6px; display: block;
  image-rendering: pixelated; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5));
}
.card p { font-size: 16px; line-height: 1.5; color: #c9d1e0; margin-bottom: 22px; white-space: pre-line; }
#ov-btn {
  background: #ff2e2e; color: #fff; border: none; border-radius: 12px;
  padding: 14px 26px; font-size: 16px; font-weight: 800; cursor: pointer; width: 100%;
}
#ov-btn:active { transform: scale(.97); }
