/* ==========================================================================
   Mågens — styling
   Dagligdags København: himmelblåt, cremefarvede paneler og chunky knapper
   i samme familie som Egernet Albert.
   ========================================================================== */

:root {
  --navy: #22303c;
  --navy-soft: rgba(24, 36, 48, .58);
  --cream: #fff8ea;
  --cream-dim: #f2e7d2;
  --ink: #3a2c1e;
  --ink-soft: #6b5a45;
  --amber: #f0a63c;
  --amber-hi: #ffc96b;
  --amber-lo: #b8761d;
  --teal: #3f7f8c;
  --red: #c94f3f;

  --ui: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --shadow-lg: 0 26px 60px -18px rgba(10, 24, 36, .55);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  font-family: var(--ui);
  color: var(--ink);
  background: linear-gradient(180deg, #6fb9e4 0%, #a8d4ec 45%, #ffe9c2 70%, #54555c 71%, #3f4046 100%);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

.sprite-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico { width: 1em; height: 1em; display: block; flex: 0 0 auto; }

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* --------------------------------------------------------------------------
   HUD
   -------------------------------------------------------------------------- */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px clamp(10px, 2vw, 22px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
body.hud-on .hud { opacity: 1; pointer-events: auto; }

.hud-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--navy-soft);
  border: 1px solid rgba(255, 248, 234, .28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
  backdrop-filter: blur(4px);
  color: var(--cream);
  font-size: clamp(11px, 1.2vw, 14px);
  font-weight: 800;
  letter-spacing: .02em;
}

.lives { display: inline-flex; gap: 3px; }
.life { width: 1.35em; height: 1.35em; color: var(--amber-hi); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); transition: opacity .2s, transform .2s; }
.life.off { opacity: .22; transform: scale(.85); }

.hud-level { white-space: nowrap; }

.bar {
  position: relative;
  width: clamp(70px, 12vw, 150px);
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--amber-hi), var(--amber));
  transition: width .18s ease-out;
}

.bombwrap { display: inline-flex; align-items: center; gap: 6px; }
.bombwrap > .ico { width: 1.3em; height: 1.3em; color: var(--cream-dim); }
.bar--bomb { width: 46px; }
.bar--bomb > span { background: rgba(255, 248, 234, .55); }
.bombwrap.ready .bar--bomb > span { background: #ffe9a8; box-shadow: 0 0 8px rgba(255, 233, 168, .9); }
.bombwrap.ready > .ico { color: #ffe9a8; }

.hud-score b, .hud-best b { color: var(--amber-hi); font-size: 1.15em; }
.hud-best { opacity: .8; }

.iconbtn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--navy);
  background: var(--cream);
  color: var(--navy);
  cursor: pointer;
  font-size: 15px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.iconbtn:active { transform: translateY(1px); }
#btn-mute .ic-mute { display: none; }
#btn-mute.muted .ic-sound { display: none; }
#btn-mute.muted .ic-mute { display: block; }

/* --------------------------------------------------------------------------
   Level-banner
   -------------------------------------------------------------------------- */
.banner {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.banner.on { opacity: 1; }
.banner-in {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  padding: 18px 42px;
  border-radius: 22px;
  background: var(--navy-soft);
  border: 2px solid rgba(255, 248, 234, .4);
  backdrop-filter: blur(5px);
  color: var(--cream);
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.banner.on .banner-in { animation: banner-pop .5s cubic-bezier(.2, 1.5, .4, 1) both; }
.banner-in b { font-size: clamp(24px, 4.4vw, 44px); font-weight: 900; color: var(--amber-hi); text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.banner-in span { font-size: clamp(12px, 1.6vw, 17px); font-weight: 700; opacity: .9; }

@keyframes banner-pop {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Skærme og paneler
   -------------------------------------------------------------------------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 32px);
  overflow: auto;
  background: rgba(16, 28, 40, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.screen.on { opacity: 1; pointer-events: auto; }

.panel {
  width: min(680px, 100%);
  padding: clamp(18px, 3vw, 34px) clamp(16px, 3.4vw, 40px);
  border-radius: 28px;
  border: 3px solid var(--navy);
  background: linear-gradient(178deg, #fffdf6 0%, var(--cream) 55%, var(--cream-dim) 100%);
  box-shadow: var(--shadow-lg), 0 6px 0 rgba(0, 0, 0, .18);
  text-align: center;
}
.panel--small { width: min(460px, 100%); }

.kicker {
  margin: 0 0 4px;
  font-size: clamp(10px, 1.2vw, 13px);
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--teal);
}

.title {
  margin: 0 0 6px;
  font-size: clamp(46px, 9vw, 96px);
  line-height: .95;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--amber);
  text-shadow:
    0 3px 0 var(--navy),
    0 6px 0 rgba(34, 48, 60, .55),
    0 14px 26px rgba(10, 24, 36, .35);
}
.title--small { font-size: clamp(30px, 5vw, 48px); }

.tagline {
  margin: 0 auto 14px;
  max-width: 46ch;
  font-size: clamp(13px, 1.5vw, 16.5px);
  line-height: 1.5;
  color: var(--ink-soft);
}

.menu-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2.4vw, 28px);
  margin: 14px 0 18px;
  text-align: left;
}
.menu-cols h2 {
  margin: 0 0 8px;
  font-size: clamp(11px, 1.2vw, 13px);
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--red);
}
.menu-cols ul { margin: 0; padding: 0; list-style: none; }
.menu-cols li {
  margin: 0 0 8px;
  font-size: clamp(12px, 1.3vw, 14.5px);
  line-height: 1.45;
  color: var(--ink);
}
.score-list b {
  display: inline-block;
  min-width: 2.6em;
  color: var(--amber-lo);
  font-weight: 900;
}
.hint { margin: 6px 0 0; font-size: clamp(11px, 1.2vw, 13px); color: var(--ink-soft); }

.key {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 7px;
  border: 1.5px solid var(--navy);
  border-bottom-width: 3px;
  background: #fff;
  font-size: .86em;
  font-weight: 800;
  color: var(--navy);
}

.menu-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
}
.menu-actions--col { flex-direction: column; align-items: stretch; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: .72em 1.35em;
  border-radius: 999px;
  border: 3px solid var(--navy);
  background: var(--cream);
  color: var(--navy);
  font: 800 clamp(13px, 1.4vw, 16px)/1 var(--ui);
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(34, 48, 60, .35);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(34, 48, 60, .35); }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(34, 48, 60, .35); }
.btn--primary {
  background: linear-gradient(180deg, var(--amber-hi), var(--amber));
  color: var(--navy);
  box-shadow: 0 4px 0 var(--amber-lo);
}
.btn--primary:hover { box-shadow: 0 6px 0 var(--amber-lo); }
.btn--lg { padding: .9em 1.8em; font-size: clamp(15px, 1.8vw, 20px); }

.menu-best {
  margin: 14px 0 0;
  font-size: clamp(11px, 1.2vw, 13.5px);
  font-style: italic;
  color: var(--ink-soft);
}

.statline {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  margin: 4px 0 14px;
  font-size: clamp(12px, 1.4vw, 15px);
  font-weight: 700;
  color: var(--ink-soft);
}
.statline b { color: var(--amber-lo); font-size: 1.2em; }

/* --------------------------------------------------------------------------
   Touch-knapper
   -------------------------------------------------------------------------- */
.touch {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 clamp(14px, 4vw, 34px) clamp(14px, 4vw, 30px);
  pointer-events: none;
}
.tbtn {
  pointer-events: auto;
  width: clamp(76px, 20vw, 104px);
  height: clamp(76px, 20vw, 104px);
  border-radius: 50%;
  border: 3px solid var(--navy);
  background: rgba(255, 248, 234, .92);
  color: var(--navy);
  font: 900 clamp(14px, 3.6vw, 19px)/1 var(--ui);
  letter-spacing: .06em;
  box-shadow: 0 6px 0 rgba(34, 48, 60, .35);
  touch-action: none;
}
.tbtn:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(34, 48, 60, .35); }
.tbtn--bomb { background: linear-gradient(180deg, var(--amber-hi), var(--amber)); font-size: clamp(26px, 7vw, 38px); }
.tbtn--bomb .ico { width: 1em; height: 1em; margin: 0 auto; color: var(--navy); }

@media (pointer: coarse) {
  .touch { display: flex; }
  body.hud-on .touch { display: flex; }
  .foot { display: none; }
}

/* --------------------------------------------------------------------------
   Fod
   -------------------------------------------------------------------------- */
.foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px clamp(12px, 2vw, 22px);
  font-size: clamp(10px, 1vw, 12px);
  font-weight: 600;
  color: rgba(255, 252, 244, .82);
  text-shadow: 0 1px 3px rgba(10, 24, 36, .7);
  pointer-events: none;
}
body.hud-on .foot { opacity: .55; }
.foot-keys .key { background: rgba(255, 255, 255, .9); }

/* --------------------------------------------------------------------------
   Små skærme og reduceret bevægelse
   -------------------------------------------------------------------------- */
@media (max-width: 560px) {
  .menu-cols { grid-template-columns: 1fr; }
  .hud-group { gap: 8px; padding: 6px 10px; }
  .hud-best { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .banner.on .banner-in { animation: none; }
  .btn, .iconbtn, .bar > span, .life, .screen, .hud { transition-duration: .01ms !important; }
}
