/* BOOM-BOMB: Canvas 624×528 (13:11), Touch-Layout für 360×640. Nur relative Pfade. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; background: #12141a; color: #e8e9ec; font-family: system-ui, sans-serif;
  overscroll-behavior: none; overflow: hidden;
}
body { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }

main {
  height: 100%; height: 100dvh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; padding: 8px;
}
header { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
h1 { margin: 0; font-size: 22px; letter-spacing: 2px; }
#hud {
  color: #b4bac5; font-size: 14px; line-height: 1.5; text-align: center; font-variant-numeric: tabular-nums;
}
#hud span { color: #fff; font-weight: 600; }
#skull { color: #fca5a5 !important; }
#upgrades { display: block; font-size: 12px; font-weight: 400 !important; color: #9aa0ab !important; }
#pause, #stumm {
  margin-left: 6px; padding: 2px 10px; border: 1px solid #4b5160; border-radius: 6px;
  background: #1f2330; color: #e8e9ec; font: inherit; font-size: 12px; cursor: pointer;
}
#stumm[aria-pressed="true"] { color: #fca5a5; border-color: #7f3a3a; }

/* Spielfeld: immer 13:11, so groß wie Breite und Resthöhe erlauben */
#spielfeld {
  position: relative; width: min(100%, 624px, calc((100vh - 190px) * 13 / 11));
  width: min(100%, 624px, calc((100dvh - 190px) * 13 / 11)); aspect-ratio: 13 / 11;
}
canvas {
  display: block; width: 100%; height: 100%; background: #1c1f27; border: 1px solid #343843;
  border-radius: 8px; touch-action: none;
}

#overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; border-radius: 8px;
  background: rgba(10, 12, 18, 0.82); cursor: pointer;
}
#overlay h2 { margin: 0 0 6px; font-size: clamp(22px, 6vw, 40px); letter-spacing: 1px; }
#overlay p { margin: 0; font-size: clamp(12px, 3vw, 17px); color: #d5d8de; }
#overlay[data-bildschirm="gameover"] h2 { color: #f87171; }
#overlay[data-bildschirm="gewonnen"] h2, #overlay[data-bildschirm="levelende"] h2 { color: #86efac; }

.hilfe { margin: 0; color: #7d8390; font-size: 12px; text-align: center; }

/* Touch-Bedienung: nur bei grobem Zeiger */
#touch { display: none; }
@media (pointer: coarse) {
  main { gap: 4px; padding: 4px; justify-content: flex-start; }
  h1, .hilfe { display: none; }
  #hud { font-size: 12px; line-height: 1.35; }
  #upgrades { font-size: 11px; }
  #spielfeld { width: min(100%, calc((100dvh - 230px) * 13 / 11)); }
  #touch {
    display: flex; flex: 1; width: 100%; max-width: 480px; min-height: 0;
    align-items: center; justify-content: space-between; padding: 0 12px 8px; touch-action: none;
  }
}

/* Handy im Querformat: kein eigenes Layout, nur der Hinweis (das Spiel pausiert, main.js) */
#drehen { display: none; }
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #drehen {
    display: flex; position: fixed; inset: 0; z-index: 10; align-items: center; justify-content: center;
    background: #12141a; text-align: center; padding: 16px;
  }
  #drehen p { margin: 0; font-size: 22px; font-weight: 600; }
}

#dpad {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  width: min(45vw, 168px); aspect-ratio: 1; gap: 3px; touch-action: none;
}
#dpad button { background: #262b38; border: 1px solid #3d4455; border-radius: 10px; color: #e8e9ec; font-size: 20px; padding: 0; touch-action: none; pointer-events: none; }
#dpad [data-richtung="hoch"] { grid-area: 1 / 2; }
#dpad [data-richtung="links"] { grid-area: 2 / 1; }
#dpad [data-richtung="rechts"] { grid-area: 2 / 3; }
#dpad [data-richtung="runter"] { grid-area: 3 / 2; }
#dpad button.aktiv, #aktionen button.aktiv { background: #3b82f6; border-color: #93c5fd; }

#aktionen { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#aktionen button {
  width: 92px; height: 92px; border-radius: 50%; border: 2px solid #7f3a3a; background: #3b2226;
  color: #fff; font: inherit; font-weight: 700; font-size: 15px; touch-action: none;
}
#aktionen [data-aktion="zuenden"] { width: 70px; height: 70px; border-color: #8a6d1a; background: #3a3118; font-size: 13px; }
