:root {
  color-scheme: dark;
  font:
    14px/1.5 system-ui,
    sans-serif;
  color: #dbe5e9;
  background: #0a0f12;
  --accent: #8ce6c5;
  --warm: #ffdf93;
  --danger: #f28a72;
  --muted: #738791;
  --line: #2a3941;
}
[hidden] {
  display: none !important;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  background: #0a0f12;
}
#game {
  display: block;
  width: 100vw;
  height: 100dvh;
  cursor: none;
  outline: none;
  touch-action: none;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

/* HUD */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: max(14px, env(safe-area-inset-top, 0px)) 16px 14px;
}
.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.panel {
  background: #10171cd9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
.label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #91a5ae;
}
.health {
  width: min(280px, 60vw);
}
.bar {
  height: 10px;
  border-radius: 5px;
  background: #1c272d;
  overflow: hidden;
  margin: 4px 0 2px;
}
#hp-fill {
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}
#hp-fill.low {
  background: var(--danger);
}
.stats {
  display: flex;
  gap: 18px;
}
.stats div {
  text-align: right;
}
.stats .value {
  font-size: 18px;
}
#ammo-panel {
  position: fixed;
  right: 16px;
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  text-align: right;
}
#ammo {
  font-size: 20px;
  color: var(--warm);
}
#ammo.low {
  color: var(--danger);
}
#banner {
  position: fixed;
  top: 22%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(28px, 6vw, 52px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--warm);
  text-shadow: 0 2px 18px #000;
  pointer-events: none;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #0a0f12b8;
  backdrop-filter: blur(2px);
}
.dialog {
  width: min(560px, 100%);
  background: #10171c;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
}
.dialog h1 {
  margin: 0 0 4px;
  font-size: clamp(34px, 8vw, 56px);
  letter-spacing: -0.04em;
  line-height: 1;
}
.dialog h1 span {
  color: var(--danger);
}
.dialog p {
  color: #9bafb8;
  margin: 8px 0 18px;
}
.keys {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  text-align: left;
  width: fit-content;
  margin: 0 auto 22px;
  color: #c4d2d8;
}
kbd {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid #3c515b;
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--warm);
  background: #16212a;
}
button.primary {
  font: inherit;
  font-weight: 600;
  color: #0a0f12;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  padding: 10px 22px;
  cursor: pointer;
}
button.primary:hover {
  filter: brightness(1.1);
}
.small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 16px;
}
.small a {
  color: #85b8b4;
}
#cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}
.card {
  font: inherit;
  color: inherit;
  flex: 1 1 140px;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  padding: 16px 12px;
  background: #16212a;
  border: 1px solid #3c515b;
  border-radius: 10px;
  cursor: pointer;
}
.card:hover {
  border-color: var(--accent);
  background: #1a2a31;
}
.card strong {
  font-size: 16px;
  color: var(--accent);
}
.card span {
  font-size: 13px;
  color: #9bafb8;
}
dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 18px;
  width: fit-content;
  margin: 12px auto 20px;
  text-align: left;
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
}

/* Auto-gun shop, on the between-waves screen */
.dialog.wide {
  width: min(720px, 100%);
}
.overlay {
  overflow-y: auto;
}
.scrap {
  color: #ffb86b;
}
.shop {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 8px 0 4px;
}
.shop-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.shop-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #ffb86b;
}
#shop {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.buy {
  font: inherit;
  color: inherit;
  text-align: left;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  background: #16212a;
  border: 1px solid #3c515b;
  border-radius: 8px;
  cursor: pointer;
}
.buy:hover:not(:disabled) {
  border-color: #ffb86b;
}
.buy:disabled {
  cursor: default;
  opacity: 0.55;
}
.buy .row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.buy strong {
  font-size: 14px;
}
.buy .pips {
  letter-spacing: 2px;
  color: #ffb86b;
}
.buy .next {
  font-size: 12px;
  color: #9bafb8;
}
.buy .cost {
  font-size: 12px;
  color: #ffb86b;
}
