:root {
  --bg: #0c1118;
  --panel: rgba(14, 20, 28, 0.72);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #ecf2ff;
  --muted: #a1adb8;
  --accent: #7ee0ba;
  --danger: #ff6b6b;
  --hud-bg: rgba(12, 16, 21, 0.46);
  --hud-border: rgba(255, 255, 255, 0.09);
  --shadow: rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(circle at center, #111b26 0%, #090d12 55%, #05080b 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  display: grid;
  place-items: center;
}

#game-shell {
  position: relative;
  width: min(92vw, 1200px);
  height: min(78vw, 720px);
  max-height: 720px;
  min-height: 540px;
  box-shadow: 0 30px 80px var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  overflow: hidden;
  background: #0b0d12;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #10171d;
  cursor: crosshair;
}

#hud {
  position: absolute;
  top: 18px;
  left: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  z-index: 10;
  pointer-events: none;
}

.hud-item {
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(2px);
  font-size: 15px;
  font-weight: 700;
}

#gameOverOverlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 11, 0.76);
  z-index: 20;
}

#gameOverOverlay.hidden {
  display: none;
}

.panel {
  width: min(420px, 78%);
  padding: 26px 24px 20px;
  border-radius: 18px;
  background: rgba(18, 24, 34, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  text-align: center;
}

.panel h1 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 4vw, 2.6rem);
  letter-spacing: 0.04em;
  color: #ffb7b7;
}

.stats {
  display: grid;
  gap: 10px;
  margin: 18px 0 26px;
}

.stats p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.95rem;
}

.stats strong {
  color: var(--text);
  font-size: 1.05rem;
}

#restartBtn {
  appearance: none;
  border: none;
  background: linear-gradient(180deg, #6fe5b1 0%, #3bbc88 100%);
  color: #0c1711;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  border-radius: 12px;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  box-shadow: 0 12px 24px rgba(59, 188, 136, 0.28);
}

#restartBtn:hover {
  transform: translateY(-1px);
}

#restartBtn:active {
  transform: translateY(1px);
}

@media (max-width: 700px) {
  #game-shell {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    min-height: 100vh;
  }

  #hud {
    gap: 8px;
    top: 12px;
    left: 12px;
  }

  .hud-item {
    min-width: 90px;
    font-size: 13px;
    padding: 6px 10px;
  }
}
