/* Zombie-Bøh! — menuer, HUD og touch. Ingen eksterne fonte. */
:root {
  --ink: #2b1a4d;
  --sun: #ffd23f;
  --sky: #5ec8ff;
  --grass: #6fd05a;
  --pink: #ff5d8f;
  --orange: #ff9f1c;
  --purple: #7b4dff;
  --white: #fff;
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --mm: 176px;
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--sky);
  font-family: var(--font);
  color: var(--ink);
}

body {
  position: fixed;
  inset: 0;
}

canvas#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#app {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
}

svg { display: block; }

.screen {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: auto;
}
.screen.show { display: flex; }

/* ---------- Menu ---------- */
#menu {
  touch-action: pan-y;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 88% 14%, #fff7b0 0 7%, var(--sun) 7.2% 11%, rgba(255, 210, 63, 0) 11.5%),
    radial-gradient(ellipse 14% 6% at 18% 20%, #fff 0 98%, transparent 100%),
    radial-gradient(ellipse 11% 5% at 70% 30%, #fff 0 98%, transparent 100%),
    linear-gradient(180deg, rgba(94, 200, 255, 0.94) 0%, rgba(190, 236, 255, 0.94) 62%, rgba(111, 208, 90, 0.96) 100%);
}
#menu * { touch-action: pan-y; }

.menu-inner {
  margin: auto;
  width: 100%;
  max-width: 1100px;
  padding: calc(var(--sat) + 10px) calc(var(--sar) + 18px) calc(var(--sab) + 14px) calc(var(--sal) + 18px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2.2vh, 22px);
}

#title {
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  font-size: clamp(40px, 11vh, 96px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.01em;
  padding-bottom: 6px;
}
#title span {
  display: inline-block;
  color: var(--c);
  text-shadow:
    -4px -4px 0 var(--ink), 4px -4px 0 var(--ink), -4px 4px 0 var(--ink), 4px 4px 0 var(--ink),
    0 -4px 0 var(--ink), 0 4px 0 var(--ink), -4px 0 0 var(--ink), 4px 0 0 var(--ink),
    0 8px 0 var(--ink);
  transform: rotate(var(--r));
  animation: letter-in 0.7s cubic-bezier(0.3, 1.6, 0.5, 1) both;
  animation-delay: calc(var(--i) * 60ms);
}
@keyframes letter-in {
  from { transform: translateY(-120%) rotate(0) scale(0.4); opacity: 0; }
  to { transform: translateY(0) rotate(var(--r)) scale(1); opacity: 1; }
}

.cards {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 2.4vw, 26px);
}

.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 5px solid var(--ink);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 0 9px 0 var(--ink);
  transition: transform 0.1s, box-shadow 0.1s;
  text-align: center;
}
.card:active {
  transform: translateY(7px) scale(0.985);
  box-shadow: 0 2px 0 var(--ink);
}
.card .art {
  aspect-ratio: 240 / 170;
  width: 100%;
  max-height: 38vh;
  background: linear-gradient(180deg, #aee4ff, #e6f8ff);
  border-bottom: 5px solid var(--ink);
}
.card .art svg { width: 100%; height: 100%; }
.card .strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  min-height: 72px;
  color: #fff;
  font-size: clamp(28px, 5.2vh, 42px);
  font-weight: 900;
  text-shadow: 0 3px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink);
}
.card-cannon .strip { background: var(--orange); }
.card-run .strip { background: var(--pink); }
.card-sneak .strip { background: var(--purple); }
.card .go {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--ink);
  position: relative;
}
.card .go::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 10px;
  border-style: solid;
  border-width: 11px 0 11px 17px;
  border-color: transparent transparent transparent var(--ink);
}

.diffs {
  display: flex;
  gap: clamp(8px, 2vw, 18px);
  justify-content: center;
  width: 100%;
}
.diff {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 8px 22px 8px 16px;
  background: #fff;
  border: 5px solid var(--ink);
  border-radius: 40px;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform 0.1s, background 0.1s;
}
.diff:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.diff[aria-checked="true"] {
  background: var(--sun);
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 9px 0 var(--ink);
}
.faces { display: flex; gap: 2px; }
.faces svg { width: 34px; height: 34px; }

.amounts {
  display: flex;
  gap: clamp(8px, 2vw, 18px);
  justify-content: center;
  width: 100%;
}
.amt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 124px;
  min-height: 84px;
  padding: 6px 18px 6px;
  background: #d6f5c9;
  border: 5px solid var(--ink);
  border-radius: 20px;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform 0.1s, background 0.1s;
}
.amt:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.amt[aria-checked="true"] {
  background: #5ef06a;
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 9px 0 var(--ink);
}
.crowd svg { width: 66px; height: 46px; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; display: none; pointer-events: none; z-index: 10; }
body.playing #hud { display: block; }

.pill {
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  min-height: 52px;
  font-size: 24px;
  font-weight: 900;
}

#hearts {
  position: absolute;
  left: calc(var(--sal) + 14px);
  top: calc(var(--sat) + 12px);
  gap: 3px;
  padding: 4px 10px;
}
#hearts .h { width: 34px; height: 34px; transition: transform 0.2s; }
#hearts .h.full path { fill: #ff3b5c; }
#hearts .h.empty path { fill: #d9d3e6; }
#hearts .h.lost { animation: heart-lost 0.5s ease-out; }
@keyframes heart-lost {
  0% { transform: scale(1.5) rotate(-12deg); }
  100% { transform: scale(1) rotate(0); }
}

#hud-top {
  position: absolute;
  top: calc(var(--sat) + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100% - 2 * (var(--mm) + var(--sar) + 28px));
}
#objective { max-width: 100%; white-space: nowrap; }
#obj-icon { font-size: 30px; line-height: 1; }
#obj-text { overflow: hidden; text-overflow: ellipsis; }
#objective.empty { display: none; }

.round-btn {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sun);
  border: 4px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.round-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.round-btn svg { width: 28px; height: 28px; fill: var(--ink); stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.round-btn .wave { stroke-width: 2.4; }
#menu-btn { background: #ff5d8f; }
#mute-btn .snd-off { display: none; }
#mute-btn.muted .snd-on { display: none; }
#mute-btn.muted .snd-off { display: block; }
#mute-btn.muted { background: #d9d3e6; }

#energy {
  position: absolute;
  left: 50%;
  top: calc(var(--sat) + 76px);
  transform: translateX(-50%);
  min-height: 40px;
  padding: 3px 12px;
  display: none;
}
#energy.show { display: flex; }
#energy .bolt { font-size: 22px; }
#energy .track {
  width: 190px;
  height: 18px;
  border-radius: 9px;
  background: #e3dcf1;
  border: 3px solid var(--ink);
  overflow: hidden;
}
#energy-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ffb703, #ffe14d);
  transform-origin: left center;
  transition: transform 0.12s linear;
}
#energy.low #energy-fill { background: #ff6b6b; }

/* ---------- Joystick ---------- */
#joy-hint, #joy-base {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: none;
  z-index: 12;
}
#joy-hint {
  left: calc(var(--sal) + 7vw);
  bottom: calc(var(--sab) + 9vh);
  border: 5px dashed rgba(255, 255, 255, 0.95);
  background: rgba(43, 26, 77, 0.18);
  box-shadow: 0 0 0 3px rgba(43, 26, 77, 0.45);
  opacity: 0.6;
  align-items: center;
  justify-content: center;
}
#joy-hint span {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 4px solid var(--ink);
}
body.playing:not(.joy-active) #joy-hint { display: flex; }
#joy-base {
  left: 0;
  top: 0;
  background: rgba(255, 255, 255, 0.4);
  border: 6px solid #fff;
  box-shadow: 0 0 0 4px var(--ink), inset 0 0 0 3px rgba(43, 26, 77, 0.35);
  align-items: center;
  justify-content: center;
  will-change: transform;
}
body.joy-active #joy-base { display: flex; }
#joy-knob {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #fff;
  border: 5px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  will-change: transform;
}

/* ---------- Handlingsknap ---------- */
#action-btn {
  position: absolute;
  right: calc(var(--sar) + 34px);
  bottom: calc(var(--sab) + 30px);
  width: 132px;
  height: 132px;
  border-radius: 50%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: radial-gradient(circle at 35% 30%, #ff9a6b, #ff4d4d 70%);
  border: 6px solid var(--ink);
  box-shadow: 0 9px 0 var(--ink);
  color: #fff;
  z-index: 12;
  transition: transform 0.07s, box-shadow 0.07s;
}
body.playing #action-btn { display: flex; }
#ab-icon { font-size: 54px; line-height: 1; }
#ab-label {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink);
}
#action-btn.down {
  transform: translateY(7px) scale(0.96);
  box-shadow: 0 2px 0 var(--ink);
}
#action-btn.glow { animation: glow 0.9s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: 0 9px 0 var(--ink), 0 0 0 0 rgba(255, 230, 60, 0.9); }
  50% { box-shadow: 0 9px 0 var(--ink), 0 0 0 20px rgba(255, 230, 60, 0); transform: scale(1.07); }
}
#action-btn.glow.down { animation: none; }
#action-btn.disabled {
  filter: grayscale(1) brightness(1.05);
  opacity: 0.7;
  animation: none;
  box-shadow: 0 5px 0 var(--ink);
}

/* ---------- Effekter ---------- */
#hurt {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 0 14px rgba(255, 93, 143, 0.85), inset 0 0 120px 30px rgba(255, 93, 143, 0.6);
}
#hurt.go { animation: hurt 0.55s ease-out; }
@keyframes hurt { 0% { opacity: 1; } 100% { opacity: 0; } }

#toast {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, 0);
  z-index: 20;
  max-width: 80%;
  padding: 12px 28px;
  background: var(--sun);
  border: 5px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 7px 0 var(--ink);
  font-size: 34px;
  font-weight: 900;
  text-align: center;
  display: none;
}
#toast.show { display: block; animation: toast-in 0.35s cubic-bezier(0.3, 1.7, 0.5, 1); }
@keyframes toast-in { from { transform: translate(-50%, 20px) scale(0.5); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }

/* ---------- Intro ---------- */
#intro {
  z-index: 30;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(43, 26, 77, 0.28);
}
#intro.show { animation: intro-fade 2s ease-in-out forwards; }
@keyframes intro-fade { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.intro-card {
  width: min(560px, 82vw);
  background: #fff;
  border: 6px solid var(--ink);
  border-radius: 34px;
  box-shadow: 0 10px 0 var(--ink);
  overflow: hidden;
  text-align: center;
}
#intro-art { aspect-ratio: 240 / 170; max-height: 42vh; width: 100%; background: linear-gradient(180deg, #aee4ff, #e6f8ff); border-bottom: 5px solid var(--ink); margin: 0 auto; }
#intro-art svg { width: 100%; height: 100%; }
#intro-text { padding: 14px 20px 18px; font-size: clamp(24px, 4.4vh, 34px); font-weight: 900; }

/* ---------- Pause + resultat ---------- */
#pause, #result {
  z-index: 40;
  align-items: center;
  justify-content: center;
  background: rgba(43, 26, 77, 0.45);
  padding: var(--sat) var(--sar) var(--sab) var(--sal);
}
.panel {
  width: min(620px, 92vw);
  max-height: 96%;
  background: #fff;
  border: 6px solid var(--ink);
  border-radius: 36px;
  box-shadow: 0 11px 0 var(--ink);
  padding: 20px 24px 26px;
  text-align: center;
  animation: panel-in 0.4s cubic-bezier(0.3, 1.5, 0.5, 1);
}
@keyframes panel-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.panel h2 { margin: 6px 0 8px; font-size: clamp(34px, 6vh, 50px); font-weight: 900; }
.panel p { margin: 0 0 14px; font-size: clamp(20px, 3.4vh, 28px); font-weight: 800; }
.panel-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.big-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 170px;
  min-height: 84px;
  padding: 10px 26px;
  border: 5px solid var(--ink);
  border-radius: 44px;
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  box-shadow: 0 8px 0 var(--ink);
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink);
}
.big-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--ink); }
.big-btn svg { width: 36px; height: 36px; fill: #fff; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.big-btn.green { background: #3fcf5a; }
.big-btn.orange { background: var(--orange); }
.big-btn.pink { background: var(--pink); }

#r-stars { display: flex; justify-content: center; gap: 8px; }
#r-stars svg { width: clamp(70px, 14vh, 110px); height: auto; transform: scale(0); }
#r-stars svg.on { animation: star-pop 0.5s cubic-bezier(0.3, 1.8, 0.5, 1) forwards; animation-delay: var(--d); }
#r-stars svg.off { animation: star-off 0.3s ease-out forwards; animation-delay: var(--d); }
@keyframes star-pop { 0% { transform: scale(0) rotate(-40deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes star-off { to { transform: scale(0.85); } }
#r-stars svg:nth-child(2) { margin-top: -14px; }

/* ---------- Hop ---------- */
#jump-btn {
  position: absolute;
  right: calc(var(--sar) + 190px);
  bottom: calc(var(--sab) + 30px);
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #8fe3ff, #2f9bff 70%);
  border: 6px solid var(--ink);
  box-shadow: 0 9px 0 var(--ink);
  color: #fff;
  z-index: 12;
  transition: transform 0.07s, box-shadow 0.07s;
}
body.playing #jump-btn { display: flex; }
#jb-icon { font-size: 44px; line-height: 1; font-weight: 900; text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink); }
#jb-label {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink);
}
#jump-btn.down { transform: translateY(7px) scale(0.96); box-shadow: 0 2px 0 var(--ink); }

/* ---------- Økse ---------- */
#axe-btn {
  position: absolute;
  right: calc(var(--sar) + 52px);
  bottom: calc(var(--sab) + 180px);
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #ff9f1c 70%);
  border: 6px solid var(--ink);
  box-shadow: 0 8px 0 var(--ink);
  color: #fff;
  z-index: 12;
  transition: transform 0.07s, box-shadow 0.07s;
}
body.playing #axe-btn { display: flex; }
#axe-icon { font-size: 38px; line-height: 1; }
#axe-label {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.1;
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink);
}
#axe-count {
  position: absolute;
  top: -10px;
  left: -10px;
  min-width: 36px;
  height: 36px;
  line-height: 26px;
  border-radius: 50%;
  border: 5px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
  text-align: center;
}
#axe-btn.down { transform: translateY(6px) scale(0.96); box-shadow: 0 2px 0 var(--ink); }
#axe-btn.disabled { filter: grayscale(1) brightness(1.05); opacity: 0.7; box-shadow: 0 5px 0 var(--ink); }

/* ---------- Minikort ---------- */
#minimap {
  position: absolute;
  right: calc(var(--sar) + 14px);
  top: calc(var(--sat) + 12px);
  width: var(--mm);
  height: var(--mm);
  border-radius: 50%;
  border: 6px solid var(--ink);
  background: rgba(43, 26, 77, 0.35);
  box-shadow: 0 5px 0 var(--ink);
  pointer-events: none;
  display: block;
}

/* ---------- Layout-varianter ---------- */
@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; }
  .card { flex-direction: row; }
  .card .art { width: 48%; max-height: none; border-bottom: 0; border-right: 5px solid var(--ink); }
  .card .strip { flex: 1; }
  .diffs { flex-wrap: wrap; }
  #hud-top { max-width: calc(100% - 20px); top: calc(var(--sat) + 74px); }
  :root { --mm: 112px; }
  #minimap { top: calc(var(--sat) + 140px); border-width: 4px; }
  #energy { top: calc(var(--sat) + 140px); left: calc(var(--sal) + 14px); transform: none; }
  #energy .track { width: 120px; }
  .amt { min-width: 96px; padding: 6px 10px; }
  #jump-btn { right: calc(var(--sar) + 160px); width: 96px; height: 96px; }
  #action-btn { right: calc(var(--sar) + 16px); }
  #axe-btn { right: calc(var(--sar) + 34px); }
}
@media (max-aspect-ratio: 1/1) {
  #hearts .h { width: 28px; height: 28px; }
  #hud-top { left: calc(var(--sal) + 14px); transform: none; max-width: calc(100% - var(--mm) - var(--sar) - var(--sal) - 44px); top: calc(var(--sat) + 68px); }
  #energy { top: calc(var(--sat) + 132px); left: calc(var(--sal) + 14px); transform: none; }
}
@media (max-height: 560px) {
  .card .strip { min-height: 56px; padding: 6px 14px; }
  .diff { min-height: 64px; }
  :root { --mm: 148px; }
  .card .art { max-height: 30vh; }
  #action-btn { width: 124px; height: 124px; }
  /* Lav skærm: over handlingsknappen ville øksen ramme kortet, så den står i rækken ved siden af Hop */
  #axe-btn { right: calc(var(--sar) + 304px); bottom: calc(var(--sab) + 30px); width: 88px; height: 88px; }
}

@media (max-width: 640px) {
  #hud-top { left: 50%; transform: translateX(-50%); max-width: calc(100% - 20px); top: calc(var(--sat) + 74px); }
  #energy { top: calc(var(--sat) + 140px); }
}

@media (prefers-reduced-motion: reduce) {
  #title span { animation: none; }
  #action-btn.glow { animation: none; outline: 8px solid rgba(255, 230, 60, 0.9); }
}
