/* Boar Hunter — PWA styles. Full-screen canvas game with DOM HUD/overlays. */
:root {
  --ui-dark: rgba(16, 24, 18, 0.72);
  --accent: #e8792b;
  --accent-2: #5fbf5a;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #12241a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #eef3ea;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ---------------- HUD ---------------- */
.hud {
  position: fixed;
  top: calc(10px + var(--safe-t));
  left: calc(12px + var(--safe-l));
  right: calc(12px + var(--safe-r));
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}
.hud-left { display: flex; flex-direction: column; gap: 8px; }
.health {
  width: 160px;
  max-width: 42vw;
  height: 16px;
  background: var(--ui-dark);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  overflow: hidden;
}
.health-fill {
  height: 100%;
  width: 100%;
  background: var(--accent-2);
  border-radius: 8px;
  transition: width 0.15s ease, background 0.2s ease;
}
.ammo {
  font-size: 20px;
  letter-spacing: 2px;
  color: #ffd98a;
  background: var(--ui-dark);
  padding: 2px 10px;
  border-radius: 8px;
  align-self: flex-start;
}
.counter {
  font-size: 18px;
  font-weight: 700;
  background: var(--ui-dark);
  padding: 8px 12px;
  border-radius: 10px;
}
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--ui-dark);
  padding: 6px 16px;
  border-radius: 12px;
}
.timer {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #eef3ea;
}
.score {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: #ffd98a;
}
.score::before { content: "★ "; color: var(--accent); }

/* ---------------- Touch controls ---------------- */
.touch {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: none;
  pointer-events: none;
}
.stick-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 45%;
  height: 55%;
  pointer-events: auto;
  touch-action: none;
}
.stick-base {
  position: absolute;
  width: 108px;
  height: 108px;
  margin-left: -54px;
  margin-top: -54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.28);
  opacity: 0;
  transition: opacity 0.12s ease;
}
.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin-left: -26px;
  margin-top: -26px;
  border-radius: 50%;
  background: rgba(232, 121, 43, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.5);
}
.touch-buttons {
  position: absolute;
  right: calc(24px + var(--safe-r));
  bottom: calc(30px + var(--safe-b));
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}
.btn-round {
  pointer-events: auto;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  touch-action: none;
}
.btn-shoot {
  width: 92px;
  height: 92px;
  background: radial-gradient(circle at 35% 30%, #ff9a4d, #c9531a);
  border: 3px solid rgba(255, 255, 255, 0.35);
}
.btn-shoot:active { transform: scale(0.94); }
.btn-reload {
  width: 60px;
  height: 60px;
  background: rgba(40, 56, 44, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.25);
  font-size: 28px;
}
.btn-reload:active { transform: scale(0.94); }

/* ---------------- Action button ---------------- */
.action-btn {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  transform: translateX(-50%) translateY(20px);
  z-index: 11;
  padding: 14px 22px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: rgba(28, 74, 44, 0.92);
  border: 2px solid var(--accent-2);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.action-btn.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(95, 191, 90, 0.5); }
  50% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), 0 0 0 8px rgba(95, 191, 90, 0); }
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(70px + var(--safe-t));
  transform: translateX(-50%) translateY(-10px);
  z-index: 12;
  padding: 10px 18px;
  background: var(--ui-dark);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- Overlays ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 16, 11, 0.55);
  backdrop-filter: blur(3px);
}
.panel {
  width: min(420px, 92vw);
  padding: 28px 24px 32px;
  text-align: center;
  background: rgba(20, 34, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.title {
  font-size: 42px;
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--accent);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}
.title span { display: block; color: #eef3ea; font-size: 30px; letter-spacing: 6px; }
.title.win { color: var(--accent-2); font-size: 30px; }
.title.lose { color: #e05b5b; }
.subtitle { margin: 10px 0 20px; color: #c6d2c2; font-size: 15px; }
.btn-primary {
  display: inline-block;
  padding: 14px 34px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #6fce67, #46a341);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 6px 0 #2f7a2c, 0 8px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.btn-primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #2f7a2c, 0 4px 8px rgba(0, 0, 0, 0.4); }
.btn-ghost {
  display: inline-block;
  margin-top: 14px;
  padding: 10px 24px;
  font-size: 15px;
  color: #cfe0cb;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  cursor: pointer;
}
/* ---- result stats block ---- */
.stats {
  margin: 6px auto 22px;
  text-align: left;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  padding: 8px 14px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 7px 2px;
  font-size: 15px;
  color: #c6d2c2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.stat-row:last-child { border-bottom: none; }
.stat-row b { color: #eef3ea; font-variant-numeric: tabular-nums; }
.stat-row.big { font-size: 17px; }
.stat-row.big b { color: var(--accent); font-size: 24px; font-weight: 900; }
.record-badge {
  margin: 0 auto 12px;
  padding: 8px 14px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #12241a;
  background: linear-gradient(180deg, #ffd76a, #e8a72b);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  animation: pop 0.4s ease;
}
@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.best {
  margin-top: 12px;
  font-size: 15px;
  font-weight: 700;
  color: #ffd98a;
  font-variant-numeric: tabular-nums;
}

.hint {
  margin: 22px auto 8px;
  font-size: 13px;
  line-height: 1.7;
  color: #b9c7b4;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 14px;
  border-radius: 12px;
}
.goaltext { margin-top: 14px; font-size: 14px; color: #e5d3a0; }

@media (max-width: 380px) {
  .title { font-size: 34px; }
  .btn-shoot { width: 80px; height: 80px; }
}
