/* ================================================================
   JGA-Arcade - gemeinsame Styles
   Bewusst ohne Webfonts: in einer Bar mit schwachem WLAN ist jede
   externe Anfrage ein Risiko.
   ================================================================ */
:root {
  --bg: #14101f;
  --bg2: #1d1730;
  --panel: #241d3c;
  --line: #3a2f5c;
  --text: #f3eefc;
  --muted: #a99cc9;
  --gold: #f0b429;
  --pink: #e8657f;
  --blue: #5aa9e6;
  --green: #4caf50;
  --red: #ff6b6b;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Dokument-Seiten (Startseite, Quiz, Bingo) duerfen scrollen.
   WICHTIG: overflow hier auf "visible" zuruecksetzen, NICHT auf "auto".
   Mit "auto" wird der body ein eigener Scroll-Container, hat aber keinen
   eigenen Scrollweg (er waechst ja mit dem Inhalt). Zusammen mit
   overscroll-behavior:none schluckt er dann Wheel- und Touch-Events,
   statt sie an die Seite weiterzureichen: Wischen und Mausrad tun nichts,
   nur das Ziehen der Scrollleiste funktioniert noch. Genau dieser Fehler
   ist auf Handy und Laptop aufgetreten.
   Mit "visible" scrollt wieder das Dokument selbst - der Normalfall. */
html.scroll,
html.scroll body,
body.scroll {
  overflow: visible;
  overscroll-behavior: auto;
  height: auto;
  min-height: 100%;
}

h1, h2, h3 { margin: 0 0 .4em; letter-spacing: .04em; }
h1 { font-size: clamp(22px, 6vw, 38px); text-transform: uppercase; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  color: inherit;
  background: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: 14px 26px;
  border-radius: 12px;
  background: var(--gold);
  color: #1a1206;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: .06em;
  text-transform: uppercase;
  box-shadow: 0 4px 0 #a87a13, 0 8px 18px rgba(0, 0, 0, .45);
  transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #a87a13; }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--line);
  box-shadow: none;
}
.btn.ghost:active { transform: translateY(2px); }
.btn:disabled { opacity: .4; pointer-events: none; }

/* ---------------- Spielbühne ---------------- */
#stage-wrap {
  position: fixed;
  inset: 0;
  background: #000;
}
/* Gilt fuer unser eigenes Canvas (main-Branch) UND das von Phaser
   erzeugte (phaser4-Branch) */
#game,
#stage-wrap canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}
#game { width: 100%; height: 100%; }

/* ---------------- HUD ---------------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

#hud-top {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

#hud-gap {
  flex: 1;
  max-width: 260px;
  background: rgba(10, 6, 20, .55);
  border: 2px solid rgba(255, 255, 255, .25);
  border-radius: 8px;
  height: 20px;
  padding: 3px;
  position: relative;
  overflow: hidden;
}
#hud-gap::after {
  content: "\1F45B  Abstand";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-shadow: 0 1px 2px #000;
  opacity: .85;
}
#hud-gap-fill {
  height: 100%;
  width: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  transition: width .08s linear;
}
#hud-gap.danger #hud-gap-fill { background: var(--red); animation: pulse .35s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

#hud-meters {
  font-size: clamp(18px, 5vw, 28px);
  font-weight: 900;
  letter-spacing: .06em;
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(0, 0, 0, .8);
  white-space: nowrap;
}

#hud-progress {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 34px;
  height: 4px;
  background: rgba(10, 6, 20, .5);
  border-radius: 3px;
  overflow: hidden;
}
#hud-progress-fill { height: 100%; width: 0; background: var(--blue); transition: width .12s linear; }

#hud-effects {
  position: absolute;
  left: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 6px;
}
.chip {
  --c: #fff;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: rgba(10, 6, 20, .7);
  border: 2px solid var(--c);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  font-size: 18px;
}
.chip.bad { animation: pulse .5s infinite; }
.chip i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: var(--c);
  width: 100%;
}

#hud-badges {
  position: absolute;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 6px;
}
.badge {
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
  background: rgba(10, 6, 20, .7);
  border: 2px solid var(--blue);
}
.badge.smash { border-color: #c8873c; }

#hud-toast {
  position: absolute;
  left: 50%;
  top: 32%;
  transform: translate(-50%, 0) scale(.9);
  font-size: clamp(14px, 4vw, 20px);
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #000, 0 0 14px rgba(0, 0, 0, .9);
  opacity: 0;
  transition: opacity .12s, transform .12s;
  text-align: center;
  white-space: nowrap;
}
#hud-toast.show { opacity: 1; transform: translate(-50%, -6px) scale(1); }

/* Touch-Zonen nur als dezenter Hinweis in den ersten Sekunden */
#hud-zones {
  position: absolute;
  inset: 0;
  display: flex;
  opacity: 0;
  transition: opacity .4s;
}
#hud-zones.show { opacity: .5; }
#hud-zones div {
  flex: 1;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .8);
  text-shadow: 0 2px 4px #000;
}
#hud-zones div:first-child { border-right: 2px dashed rgba(255, 255, 255, .25); }

/* ---------------- Overlay-Screens ---------------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(15, 11, 28, .93);
  backdrop-filter: blur(3px);
  z-index: 20;
  overflow-y: auto;
}
.screen.show { display: grid; }
.screen .box {
  width: min(520px, 100%);
  text-align: center;
  padding: 8px 0;
}

.kicker {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.muted { color: var(--muted); font-size: 14px; line-height: 1.55; }

.howto {
  display: flex;
  gap: 10px;
  margin: 18px 0;
}
.howto div {
  flex: 1;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 8px;
}
.howto b { display: block; font-size: 22px; margin-bottom: 4px; }
.howto span { font-size: 12px; color: var(--muted); line-height: 1.4; }

.score-big {
  font-size: clamp(46px, 15vw, 76px);
  font-weight: 900;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 4px 0 rgba(0, 0, 0, .5);
  margin: 6px 0;
}
.score-sub { font-size: 14px; color: var(--muted); margin-bottom: 18px; }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.actions .btn { width: 100%; }

.pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.pill.practice { border-color: var(--blue); color: var(--blue); }
.pill.last { border-color: var(--red); color: var(--red); }

/* Querformat-Hinweis */
#rotate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  text-align: center;
  background: var(--bg);
  padding: 24px;
}
#rotate.show { display: grid; }
#rotate .icon { font-size: 54px; animation: tip 1.6s ease-in-out infinite; }
@keyframes tip {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(-90deg); }
}


/* ================================================================
   Querformat auf dem Handy: nur ~360px Hoehe. Start- und Endscreen
   muessen OHNE Scrollen komplett sichtbar sein - sonst sucht man in
   der Bar den Los-geht's-Knopf.
   ================================================================ */
@media (orientation: landscape) and (max-height: 520px) {
  .screen { padding: 10px 16px; }
  .screen .box { width: min(700px, 96vw); }
  .screen h1 { font-size: 20px; margin-bottom: 2px; }
  .kicker { margin-bottom: 2px; font-size: 11px; }
  .screen .muted { font-size: 12px; line-height: 1.35; }
  .screen p.muted { margin: 4px 0; }
  .howto { margin: 8px 0; gap: 8px; }
  .howto div { padding: 7px 6px; }
  .howto b { font-size: 16px; margin-bottom: 1px; }
  .howto span { font-size: 10.5px; }
  #start-status { margin-bottom: 6px !important; }
  #start-status br { display: none; }
  .actions { flex-direction: row; gap: 10px; margin-top: 8px; }
  .btn { padding: 10px 16px; font-size: 13.5px; }
  .score-big { font-size: 38px; margin: 2px 0; }
  .score-sub { margin-bottom: 6px; font-size: 12.5px; }
}
