:root {
  --bg1: #071421;
  --bg2: #102841;
  --panel: #12263f;
  --line: rgba(148, 163, 184, 0.24);
  --text: #e2e8f0;
  --muted: #94a3b8;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Verdana", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 10%, #183b63, transparent 35%),
    radial-gradient(circle at 80% 20%, #334155, transparent 35%),
    linear-gradient(180deg, var(--bg2), var(--bg1));
}

.shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 12px;
}

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

.topbar h1 { margin: 0; font-size: 1.35rem; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }

#restartBtn {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #06b6d4, #0284c7);
  color: #fff;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}

.hud {
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  background: linear-gradient(180deg, #102237, #152f4a);
}

.chip span { color: var(--muted); }

/* HP chip with animated bar */
.hp-chip {
  flex-direction: column;
  gap: 5px;
  align-items: stretch;
}
.hp-chip span { color: var(--muted); font-size: 0.78rem; }
.hp-chip strong { font-size: 1rem; color: #f1f5f9; }
.hp-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(15, 23, 42, 0.7);
  border-radius: 4px;
  overflow: hidden;
}
.hp-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef4444, #f97316);
  border-radius: 4px;
  transition: width 0.35s ease-out, background 0.5s;
}
.hp-bar-fill[style*="width: 0"] { background: #7f1d1d; }

#game {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: block;
  background: #0a1a2d;
}

.controls {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.controls label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

.controls input[type='range'] {
  width: 100%;
}

#shootBtn {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
}

#rewardBtn {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
}

#rewardBtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.reward-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.tip {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 760px) {
  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .controls {
    grid-template-columns: 1fr;
  }
}
