/* SPITZE – Der Park ist dein Revier
   Dark theme, CSS-Vars, full-bleed Canvas, responsive HUD. */

:root {
  --bg: #10141a;
  --panel: #1a222c;
  --panel-edge: rgba(255, 255, 255, 0.08);
  --text: #f2ede3;
  --muted: #9aa4b2;
  --accent: #ffb347;
  --accent-2: #7ec8ff;
  --danger: #ff5a5a;
  --hud-bg: rgba(10, 14, 20, 0.55);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: manipulation; /* Pinch-Zoom aus, Clicks bleiben intakt */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none; /* nur auf dem Spielfeld: Drag = Steuerung */
  cursor: crosshair;
}

/* ---------- HUD ---------- */

#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-right, 0px)) 0 calc(10px + env(safe-area-inset-left, 0px));
  pointer-events: none;
  z-index: 10;
}

.hud-cell { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.hud-mid { align-items: center; flex: 1; }
.hud-right { align-items: flex-end; }

.btn-row { display: flex; gap: 6px; }

#btnPause, #btnSound, #btnHome {
  width: 44px;
  height: 44px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hud-bg);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#btnPause:active, #btnSound:active, #btnHome:active { transform: scale(0.93); }
#btnSound.on {
  background: rgba(255, 179, 71, 0.28);
  border-color: var(--accent);
}

#hearts {
  font-size: 21px;
  letter-spacing: 3px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  line-height: 1;
}
#hearts .lost { opacity: 0.22; }

#bonecount {
  background: var(--hud-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

#timewrap { display: flex; align-items: center; gap: 7px; }

#fxTags { display: flex; gap: 6px; min-height: 24px; }

#comboTag, #puTag {
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
#comboTag {
  background: rgba(255, 179, 71, 0.28);
  border: 1px solid var(--accent);
  color: var(--accent);
}
#puTag {
  background: rgba(126, 200, 255, 0.22);
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
}

#timerbar {
  width: min(44vw, 240px);
  height: 8px;
  background: var(--hud-bg);
  border-radius: 999px;
  overflow: hidden;
}
#timerfill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ffd166, #ff7b3f);
  border-radius: 999px;
}
#timerfill.low { background: var(--danger); }
#timesec {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  min-width: 30px;
  text-align: left;
}

#score {
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
#leveltag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Overlay ---------- */

#overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 10, 14, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 20;
}
#overlay.show { display: flex; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 22px;
  padding: 26px 24px 28px;
  max-width: 430px;
  width: 100%;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.panel .paw { font-size: 52px; line-height: 1; margin-bottom: 4px; }

.panel h1 {
  font-size: clamp(38px, 10vw, 60px);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--accent);
  line-height: 1.05;
  margin-bottom: 2px;
}

.panel h2 {
  font-size: clamp(24px, 6vw, 34px);
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.panel .sub {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 16px;
}

.rules {
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 14.5px;
  line-height: 1.5;
}
.rules p { margin-bottom: 8px; }
.rules p:last-child { margin-bottom: 0; }
.rules b { color: var(--accent); }
.rules .hint { color: var(--muted); font-size: 12.5px; }

.bigscore {
  font-size: 40px;
  font-weight: 900;
  color: var(--accent);
  margin: 8px 0 2px;
  line-height: 1;
}
.bigscore-lbl {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

.tops {
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
}
.tops b { color: var(--accent); }
.tops p { margin: 2px 0 0; color: var(--text); }
.tops .dim { color: var(--muted); font-size: 11.5px; }

a.back {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 8px;
}
a.back:hover, a.back:active { color: var(--accent); }

.skins {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.skin {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 14px 6px 7px;
  min-height: 36px;
  cursor: pointer;
}
.skin span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: inline-block;
}
.skin.on {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 179, 71, 0.14);
}
.skin:active { transform: scale(0.95); }

.statsline {
  color: var(--accent-2) !important;
  font-size: 13px;
  margin-bottom: 10px;
}

#achToast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  background: rgba(26, 34, 44, 0.94);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 800;
  font-size: 15px;
  padding: 11px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 30;
  max-width: 86vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#achToast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.btn-row-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.cta {
  pointer-events: auto;
  background: var(--accent);
  color: #241a08;
  font-weight: 800;
  font-size: 18px;
  font-family: inherit;
  border: none;
  border-radius: 14px;
  padding: 13px 34px;
  min-height: 48px;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.cta:active { transform: scale(0.96); }
.cta.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.banner .panel { padding: 22px 24px; }
.banner .panel h2 { color: var(--accent); }

/* ---------- Small phones ---------- */

@media (max-width: 480px) {
  #score { font-size: 22px; }
  #hearts { font-size: 18px; }
  #bonecount { font-size: 12.5px; padding: 3px 11px; }
  #timerbar { width: 38vw; }
  #leveltag { display: none; }
  #comboTag, #puTag { font-size: 11.5px; padding: 2px 9px; }
  .rules { font-size: 13.5px; padding: 12px 13px; }
  .panel { padding: 20px 18px 22px; }
  .cta { font-size: 17px; padding: 12px 28px; }
}

@media (max-height: 500px) {
  .rules { display: none; }
  .panel .paw { font-size: 34px; }
}
