:root { --power: 0; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000;
  touch-action: none; overscroll-behavior: none;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; font-family: system-ui, sans-serif; }
#flash { position: fixed; inset: 0; pointer-events: none; background: transparent; }
#fallback { position: fixed; inset: 0; display: grid; place-items: center;
  color: #eee; font-family: system-ui, sans-serif; }
#fallback[hidden] { display: none; }
#flash.on { animation: dmg 0.35s ease-out; }
@keyframes dmg {
  from { background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 0, 0, 0.45)); }
  to { background: transparent; }
}

.ui-root { width: 100%; height: 100%; }

.screen {
  position: absolute; inset: 0; display: grid; place-items: center;
  align-content: center; gap: 12px; text-align: center;
  background: rgba(10, 14, 20, 0.65); color: #f2ede2; pointer-events: auto;
}
.screen h1 { font-size: 56px; letter-spacing: 0.12em; margin: 0; }
.screen p { margin: 0; opacity: 0.85; font-size: 20px; }
.screen .controls { font-weight: 600; opacity: 1; font-size: 28px; }
.screen .credits { font-size: 14px; opacity: 0.55; }
.screen button {
  font-size: 20px; padding: 10px 34px; margin-top: 10px; cursor: pointer;
  background: #ffd257; border: none; border-radius: 6px; font-weight: 700;
}
.screen button:hover { background: #ffe28a; }

.hud { position: absolute; inset: 0; color: #f2ede2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.top-left { position: absolute; top: 16px; left: 16px; }
/* Monster radar: the dish chrome and display size live here; radar.js
   draws the moving marks onto the canvas per frame. */
.radar { display: block; width: 132px; height: 132px; margin-bottom: 10px;
  box-sizing: border-box; border-radius: 50%; background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 210, 87, 0.3); }
.hp-bar { width: 220px; height: 14px; background: rgba(0, 0, 0, 0.45);
  border-radius: 7px; overflow: hidden; }
.hp-fill { height: 100%; background: linear-gradient(90deg, #d64545, #6fbf4a);
  transition: width 0.2s; }
.hp-text { margin-top: 4px; font-size: 13px; }
.top-right { position: absolute; top: 16px; right: 16px; text-align: right; }
.score { font-size: 30px; font-weight: 700; }
.wave { font-size: 14px; opacity: 0.9; }

.quiver { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.slot { display: flex; gap: 6px; align-items: baseline; padding: 6px 12px;
  background: rgba(0, 0, 0, 0.45); border-radius: 6px; font-size: 14px;
  border: 1px solid transparent; color: inherit; font-family: inherit;
  text-shadow: inherit; cursor: pointer; pointer-events: auto; touch-action: none; }
.slot:active, .slot.active { background: rgba(60, 45, 0, 0.6); }
.slot.active { border-color: #ffd257; }
.slot.empty { opacity: 0.45; }
.slot .count { font-variant-numeric: tabular-nums; }

/* Touch controls: shoot button in the right thumb zone, pause up top. */
.fire-btn { position: absolute; right: calc(20px + env(safe-area-inset-right));
  bottom: calc(90px + env(safe-area-inset-bottom)); width: 88px; height: 88px;
  border-radius: 50%; border: 2px solid rgba(255, 210, 87, 0.3); pointer-events: auto;
  touch-action: none; font-size: 36px; color: #f2ede2; cursor: pointer;
  background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; }
.fire-btn:active { background: rgba(60, 45, 0, 0.6); }
.fire-ring { position: absolute; inset: -2px; border-radius: 50%;
  background: conic-gradient(#ffd257 calc(var(--power) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(circle closest-side, transparent 88%, #000 90%);
  mask: radial-gradient(circle closest-side, transparent 88%, #000 90%); }
/* Shot power stepper: left middle of the screen (left thumb zone on touch). */
.power-controls { position: absolute; left: calc(16px + env(safe-area-inset-left));
  top: 50%; transform: translateY(-50%); display: flex; flex-direction: column;
  gap: 8px; align-items: center; }
.power-btn { width: 56px; height: 56px; border-radius: 50%; cursor: pointer;
  border: 2px solid rgba(255, 210, 87, 0.3); background: rgba(0, 0, 0, 0.45);
  color: #f2ede2; font-size: 28px; line-height: 1; pointer-events: auto;
  touch-action: none; display: grid; place-items: center; }
.power-btn:active { background: rgba(60, 45, 0, 0.6); }
.power-value { font-size: 14px; font-variant-numeric: tabular-nums;
  padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.45); }
.pause-btn { position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 36px; border: none; border-radius: 6px; cursor: pointer;
  background: rgba(0, 0, 0, 0.45); color: #f2ede2; font-size: 14px;
  pointer-events: auto; }

/* Narrow (portrait phone) screens: compact HUD. */
@media (max-width: 520px) {
  .hp-bar { width: 140px; }
  .radar { width: 96px; height: 96px; }
  .power-btn { width: 48px; height: 48px; font-size: 24px; }
  .slot { padding: 8px 10px; }
  .screen h1 { font-size: 40px; }
  .screen p { padding: 0 20px; font-size: 16px; }
  .screen .controls { font-size: 16px; }
}

