/* Flipper – App-Shell, randlos, kein Scroll. Tischgröße setzt game.js (bühnenrelativ).
   Neon-Weltraum: dunkel, Cyan/Magenta-Glühen. */
:root {
  --bg: #05060f;
  --fg: #eaf2ff;
  --muted: #8a93b5;
  --accent: #00e5ff;
  --accent-2: #ff4dd2;
  --board-bg: #070912;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  min-height: 100dvh; height: 100dvh; overflow: hidden;
  background: var(--bg); color: var(--fg);
  display: flex; flex-direction: column; align-items: center;
  -webkit-user-select: none; user-select: none; touch-action: none;
}
/* Multitouch-Flipper: auf der Spielfläche KEINE Browser-Gesten (Pinch/Pan),
   sonst feuert ein zweiter Finger pointercancel für den ersten -> Flipper fällt.
   touch-action ist nicht vererbt, daher je Container. Modals bleiben scrollbar. */
.top, .wrap, .hud, .stage, .msg { touch-action: none; }
.bg-grid {
  position: fixed; inset: 0; z-index: -1; opacity: 0.6;
  background:
    radial-gradient(circle at 50% -10%, rgba(0,229,255,0.10), transparent 55%),
    radial-gradient(circle at 90% 110%, rgba(255,77,210,0.08), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 42px);
}

.top { flex: 0 0 auto; width: 100%; max-width: 620px; padding: 0.5rem 1.1rem 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.back { color: var(--muted); text-decoration: none; font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.back:hover { color: var(--accent); }
.game-title { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: 0.04em; color: var(--accent); text-shadow: 0 0 18px rgba(0,229,255,0.5); }
.btn { font: inherit; font-weight: 700; color: var(--fg); background: #10142a; border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; padding: 0.45rem 0.9rem; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn-primary { border-color: transparent; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #05060f; }

.wrap { flex: 1 1 auto; min-height: 0; width: 100%; max-width: 620px; padding: 0.4rem 0.9rem 0.5rem; display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem; }
.hud { display: flex; align-items: center; justify-content: center; gap: 1.1rem; font-size: 0.84rem; color: var(--muted); flex-wrap: wrap; }
.hud b { color: var(--fg); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
#balls { color: var(--accent); letter-spacing: 0.1em; }

.stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.board { background: var(--board-bg); border-radius: 12px; border: 1px solid rgba(0,229,255,0.18); box-shadow: 0 0 60px -18px rgba(0,229,255,0.4), 0 18px 50px -22px #000; touch-action: none; }

.ovl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(5,6,15,0.55); border-radius: 12px; pointer-events: none; }
.ovl[hidden] { display: none; }
.ovl-text { font-size: 1.15rem; font-weight: 800; color: var(--accent); text-align: center; padding: 0.6rem 1rem; text-shadow: 0 0 16px rgba(0,229,255,0.6); }

/* Plunger-Halteknopf (unten rechts an der Bühne) */
.plunge {
  position: absolute; right: 0.5rem; bottom: 0.5rem; z-index: 5;
  width: 3.4rem; height: 3.4rem; border-radius: 50%;
  border: 1px solid rgba(0,229,255,0.5); background: rgba(10,14,32,0.85);
  color: var(--accent); cursor: pointer; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center;
  box-shadow: 0 0 22px -6px rgba(0,229,255,0.6); touch-action: none;
}
.plunge-fill { position: absolute; left: 0; bottom: 0; width: 100%; height: 0%; background: linear-gradient(0deg, var(--accent), var(--accent-2)); opacity: 0.55; transition: height 0.03s linear; }
.plunge-label { position: relative; font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding-bottom: 0.35rem; text-shadow: 0 1px 2px #000; }
.plunge[hidden] { display: none; }

.msg { flex: 0 0 auto; min-height: 1.3rem; margin: 0; text-align: center; font-size: 0.86rem; font-weight: 700; color: var(--accent-2); }

/* Bestenliste (wandert per arcade-scores ins Modal) */
.leaderboard { width: 100%; max-width: 620px; }
.wrap > .leaderboard { display: none; }
.lb-title { margin: 0 0 0.2rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.lb-sub { margin: 0 0 0.7rem; font-size: 0.8rem; color: var(--muted); }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-empty { color: var(--muted); font-size: 0.9rem; padding: 0.4rem 0; }
.lb-row { display: grid; grid-template-columns: 2.6rem 1fr auto; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem; margin-bottom: 0.35rem; border: 1px solid rgba(255,255,255,0.07); border-radius: 10px; background: #0c1024; }
.lb-rank { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-score { display: flex; flex-direction: column; align-items: flex-end; font-weight: 800; font-variant-numeric: tabular-nums; }
.lb-date { font-size: 0.68rem; font-weight: 600; color: var(--muted); }
.lb-row--me { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 22px -10px var(--accent); }

/* Overlay (Spielende / Eintrag) */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(3,4,12,0.75); backdrop-filter: blur(3px); }
.overlay[hidden] { display: none; }
.overlay-card { position: relative; width: min(94vw, 370px); background: #0c1024; border: 1px solid rgba(0,229,255,0.18); border-radius: 18px; padding: 1.4rem 1.3rem; text-align: center; box-shadow: 0 24px 60px -20px #000; }
.overlay-close { position: absolute; top: 0.6rem; right: 0.6rem; width: 1.9rem; height: 1.9rem; border-radius: 8px; background: none; border: 1px solid rgba(255,255,255,0.14); color: var(--muted); font-weight: 800; cursor: pointer; }
.overlay-title { margin: 0.2rem 0 0.3rem; font-size: 1.5rem; color: var(--accent); }
.overlay-sub { margin: 0 0 0.9rem; color: var(--muted); }
.overlay-actions { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }
.lb-form { margin: 0.6rem 0; }
.lb-form-label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.4rem; }
.lb-form-row { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.lb-form-row input { flex: 1; min-width: 7rem; font: inherit; font-weight: 700; color: var(--fg); background: #05060f; border: 1px solid rgba(255,255,255,0.16); border-radius: 10px; padding: 0.5rem 0.7rem; }
.lb-result { color: var(--accent-2); font-weight: 700; margin: 0.3rem 0; }

/* Querformat: Tisch nach Höhe, HUD/Text links daneben. */
@media (orientation: landscape) and (min-width: 640px) {
  body { }
  .top { max-width: 1100px; }
  .wrap {
    max-width: 1100px;
    display: grid; column-gap: 1.2rem;
    grid-template-columns: minmax(9rem, 13rem) 1fr;
    grid-template-rows: 1fr auto;
    grid-template-areas: "info board" "msg board";
  }
  .hud { grid-area: info; flex-direction: column; align-items: flex-start; gap: 0.9rem; align-self: center; font-size: 0.95rem; }
  .stage { grid-area: board; align-self: stretch; }
  .msg { grid-area: msg; text-align: left; }
}
