/* Layout: Hochformat-Spielfeld in der Mitte, HUD oben, Messleisten und Kick-Taste unten. Nachtspiel unter Flutlicht. */
:root {
  --night: #050d22;
  --navy: #0b2559;
  --royal: #1d4fb8;
  --silver: #b6c0cb;
  --silver-dim: #8793a1;
  --chalk: #f1f4f8;
  --ok: #66d6a0;
  --bad: #ec5a66;
  --line: rgba(182, 192, 203, 0.22);
  --display: 'Big Shoulders Display', 'Impact', 'Arial Narrow', sans-serif;
  --body: 'Barlow Semi Condensed', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--chalk);
  font-family: var(--body);
  font-size: 16px;
  padding-block: 8px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app {
  height: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--chalk); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* HUD */
.hud { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1; }
.star { width: 22px; height: 22px; color: var(--silver); flex: none; }
.stats { display: flex; align-items: flex-end; gap: 16px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.lab { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--silver-dim); font-weight: 600; }
.val { font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.lives { display: flex; gap: 5px; height: 26px; align-items: center; }
.ball { display: block; width: 19px; height: 12px; border-radius: 50%; background: var(--silver); transition: opacity 0.3s, transform 0.3s; }
.ball.lost { opacity: 0.18; transform: scale(0.8); }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--silver); border-radius: 6px; padding: 5px 9px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; }
.icon-btn[aria-pressed="false"] { color: var(--silver-dim); text-decoration: line-through; }

/* Spielfeld */
.stage { position: relative; flex: 1; min-height: 0; border-radius: 14px; overflow: hidden; background: #06142f; border: 1px solid var(--line); }
#scene { display: block; width: 100%; height: 100%; object-fit: contain; }
.chip { position: absolute; top: 10px; display: flex; flex-direction: column; gap: 2px; padding: 6px 11px; background: rgba(5, 13, 34, 0.72); border: 1px solid var(--line); border-radius: 8px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.chip .val { font-size: 22px; }
.chip-dist { left: 10px; }
.chip-wind { right: 10px; align-items: flex-end; }

/* Overlays */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(4, 10, 28, 0.82); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); overflow-y: auto; }
.overlay[hidden] { display: none; }
.panel { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.star.big { width: 44px; height: 44px; }
h1, h2 { margin: 0; font-family: var(--display); font-weight: 800; text-transform: uppercase; line-height: 0.95; letter-spacing: 0.02em; text-wrap: balance; }
h1 { font-size: 58px; }
h2 { font-size: 42px; }
.lead { margin: 0; color: var(--silver); font-size: 18px; line-height: 1.35; text-wrap: balance; }
.hint { margin: 0; color: var(--silver-dim); font-size: 14px; }
.how { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; text-align: left; width: 100%; font-size: 16px; line-height: 1.3; }
.how li { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.how b { color: var(--chalk); }
.note { margin: 0; min-height: 1.3em; color: var(--silver); font-size: 14px; }
.row { display: flex; gap: 10px; width: 100%; justify-content: center; flex-wrap: wrap; }
.final { display: flex; flex-direction: column; align-items: center; }
.final span { font-family: var(--display); font-weight: 800; font-size: 84px; line-height: 0.9; font-variant-numeric: tabular-nums; }
.final small { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--silver-dim); font-weight: 600; }

.btn { border-radius: 6px; padding: 12px 22px; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid transparent; line-height: 1.1; }
.btn.primary { background: var(--silver); color: #07163a; }
.btn.primary:hover { background: var(--chalk); }
.btn.ghost { background: transparent; border-color: var(--silver-dim); color: var(--silver); }
.btn.ghost:hover { border-color: var(--chalk); color: var(--chalk); }
.btn:disabled { opacity: 0.5; cursor: default; }

form { display: grid; gap: 8px; width: 100%; text-align: left; }
form label { font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--silver-dim); font-weight: 600; }
form input { width: 100%; padding: 12px; font: 600 18px var(--body); color: var(--chalk); background: rgba(255, 255, 255, 0.07); border: 1px solid var(--silver-dim); border-radius: 6px; }
form .btn { justify-self: stretch; }

.board { margin: 0; padding: 0; list-style: none; width: 100%; max-height: 46vh; overflow-y: auto; display: grid; gap: 4px; counter-reset: rank; }
.board li { counter-increment: rank; display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; align-items: baseline; padding: 7px 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); text-align: left; font-size: 17px; font-weight: 600; }
.board li::before { content: counter(rank); font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--silver-dim); }
.board li.me { background: rgba(182, 192, 203, 0.2); }
.board li span:last-child { font-family: var(--display); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.board li.empty { display: block; text-align: center; color: var(--silver-dim); font-weight: 500; }
.board li.empty::before { content: none; }

/* Steuerung */
.controls { display: grid; gap: 8px; }
.meter { opacity: 0.5; transition: opacity 0.2s; }
.meter.active { opacity: 1; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; color: var(--silver); }
.hint2 { font-size: 12px; letter-spacing: 0.02em; text-transform: none; font-weight: 500; color: var(--silver-dim); }
.bar { position: relative; height: 20px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); }
.meter.active .bar { border-color: var(--silver); }
.zone { position: absolute; top: 0; bottom: 0; background: rgba(102, 214, 160, 0.3); border-left: 2px solid var(--ok); border-right: 2px solid var(--ok); }
.needle { position: absolute; top: -4px; bottom: -4px; width: 5px; left: 50%; margin-left: -2.5px; border-radius: 2px; background: var(--chalk); box-shadow: 0 0 8px rgba(241, 244, 248, 0.7); }
.kick { height: 54px; border: 0; border-radius: 8px; background: var(--royal); color: #fff; font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: 0.1em; text-transform: uppercase; }
.kick:active:not(:disabled) { transform: translateY(1px); background: #1a45a0; }
.kick:disabled { background: #17305f; color: var(--silver-dim); cursor: default; }

@media (max-height: 640px) {
  h1 { font-size: 44px; }
  .final span { font-size: 64px; }
  .how li { padding: 6px 10px; }
  .panel { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
