/* Aussehen der Hubschrauber-App: Farben (hell und dunkel), Spiel, Impressum und Datenschutz */

:root {
  --bg: #eaf4fb;
  --card: #ffffff;
  --text: #10263b;
  --muted: #4d6478;
  --accent: #1a5e9f;
  --accent-ink: #165289;
  --on-accent: #ffffff;
  --line: #cfe1ef;
  --r-l: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1a29;
    --card: #12263a;
    --text: #e6f0f8;
    --muted: #9db3c6;
    --accent: #4fb0ee;
    --accent-ink: #7cc4f3;
    --on-accent: #0b1a29;
    --line: #22405c;
    color-scheme: dark;
  }
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 1rem; line-height: 1.5;
}
h1 { font-size: 1.8rem; line-height: 1.2; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0; line-height: 1.45; }

/* Links zu Impressum und Datenschutz */
.legal-foot { margin: 28px 0 4px; text-align: center; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.legal-foot a { display: inline-block; padding: 13px 8px; color: var(--muted); text-underline-offset: 3px; }
.legal-foot a:hover { color: var(--accent-ink); }

/* ---------- Spiel ---------- */

.spiel-body { overflow: hidden; overscroll-behavior: none; }
.spiel {
  position: fixed; inset: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
#leinwand { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Anzeige oben: Strecke, Sterne, Ton */
.hud {
  position: absolute; z-index: 1;
  top: calc(10px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left)); right: calc(12px + env(safe-area-inset-right));
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.hud-wert, .hud-knopf {
  background: rgba(255, 255, 255, 0.9); color: #10263b; font-weight: 800; font-variant-numeric: tabular-nums;
  padding: 6px 12px; border-radius: 999px; box-shadow: 0 2px 10px rgba(16, 38, 59, 0.18);
}
.hud-knopf { margin-left: auto; pointer-events: auto; border: 0; font: inherit; min-width: 44px; min-height: 44px; cursor: pointer; }
.hud-level {
  display: flex; flex-direction: column; gap: 4px; min-width: 88px; padding: 5px 12px 7px; border-radius: 14px;
  background: rgba(16, 38, 59, 0.88); color: #ffffff; font-weight: 800; line-height: 1.2; box-shadow: 0 2px 10px rgba(16, 38, 59, 0.25);
}
.hud-balken { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.hud-balken span { display: block; height: 100%; width: 100%; border-radius: 3px; background: #ffd43b; transform: scaleX(0); transform-origin: left; }
.hud-punkte { min-width: 76px; text-align: center; font-size: 1.1rem; }
.hud-level.hoch { animation: level-hoch 0.6s ease-out; }
@keyframes level-hoch { 0% { transform: scale(1); } 30% { transform: scale(1.25); background: #d9443a; } 100% { transform: scale(1); } }

/* Hinweis unten: „Tippen zum Starten“, „Pause“ */
.tipp {
  position: absolute; z-index: 1; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  margin: 0; padding: 10px 16px; width: max-content; max-width: calc(100% - 32px); text-align: center;
  background: rgba(16, 38, 59, 0.84); color: #ffffff; font-weight: 700; border-radius: 999px; pointer-events: none;
  animation: tipp-puls 1.6s ease-in-out infinite;
}
@keyframes tipp-puls { 50% { opacity: 0.72; } }

/* Karten für Start und Ende */
.karte {
  position: relative; z-index: 2; width: min(400px, 100%); max-height: 100%; overflow: auto; touch-action: pan-y;
  background: var(--card); color: var(--text); border-radius: 24px; padding: 22px 20px 0; text-align: center;
  box-shadow: 0 16px 48px rgba(16, 38, 59, 0.28);
}
.karte h1, .karte h2 { margin: 0 0 6px; }
.karte h2 { font-size: 1.6rem; line-height: 1.2; }
.karte .sub { font-size: 0.95rem; }
/* Pilot und Gegner: zwei runde Fotos zum Antippen */
.fotowahl { display: flex; justify-content: center; gap: 32px; margin: 20px 0 12px; }
.platz { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.platz-knopf { position: relative; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.platz-knopf canvas { display: block; width: 96px; height: 96px; border-radius: 50%; box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--accent); }
.platz-knopf::after {
  content: "📷"; position: absolute; right: -6px; bottom: -6px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 17px; background: var(--card); box-shadow: 0 1px 6px rgba(16, 38, 59, 0.3);
}
.platz-knopf:focus-visible { outline: 3px solid var(--accent); outline-offset: 8px; }
.platz-knopf canvas.gegner-bild { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px #d9443a; }
.fotowahl { align-items: flex-end; }
.platz-zahl {
  position: absolute; left: -8px; top: -8px; min-width: 30px; height: 30px; padding: 0 7px; border-radius: 999px;
  display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; background: var(--accent); color: var(--on-accent);
}
.platz-name { font-weight: 800; margin-top: 4px; }
.platz-weg {
  font: inherit; font-size: 0.85rem; color: var(--muted); background: none; border: 0; padding: 4px 8px; min-height: 32px;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.hinweis { margin: 0; font-size: 0.9rem; color: var(--muted); line-height: 1.4; }
.hinweis-ok { margin-top: 6px; font-size: 0.8rem; }
.meldung { margin: 8px 0 0; font-size: 0.9rem; font-weight: 600; color: var(--accent-ink); }

/* Schwierigkeit: Leicht · Mittel · Schwer */
.grad-block { margin: 16px 0 0; }
.grad-titel { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.grade { display: inline-flex; gap: 2px; padding: 3px; border: 1.5px solid var(--line); border-radius: 999px; }
.grade button {
  font: inherit; font-weight: 700; color: var(--accent-ink); background: none; border: 0; border-radius: 999px;
  padding: 8px 14px; min-height: 40px; cursor: pointer;
}
.grade button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.grade button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.meldung:empty { display: none; }
.knopf {
  font: inherit; font-weight: 700; color: var(--accent-ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 999px; padding: 9px 16px; min-height: 44px; cursor: pointer;
}
.knopf:hover { border-color: var(--accent); }
.knopf:focus-visible, .hud-knopf:focus-visible, .legal-foot a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.knopf-los {
  display: block; width: 100%; margin-top: 18px; padding: 13px 18px; font-size: 1.1rem;
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
.knopf-los:hover { filter: brightness(1.08); }
.knopf-zweit { display: block; width: 100%; margin-top: 8px; }
/* Als App installieren: gelb und zweizeilig, damit er neben „Los geht’s!“ auffällt; Symbol in Textfarbe */
.knopf-installieren {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; padding: 10px 18px;
  background: #ffd43b; border-color: #f5b800; color: #10263b; box-shadow: 0 3px 0 #e0a800;
}
.knopf-installieren:hover { border-color: #e0a800; filter: brightness(1.04); }
.install-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.install-text b { font-size: 1.05rem; }
.install-text small { font-size: 0.8rem; font-weight: 600; opacity: 0.8; }
.knopf-installieren:not([hidden]) { animation: install-hinweis 1.2s ease-out 0.6s 2; }
@keyframes install-hinweis { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.04); } }
.knopf-installieren .ic { width: 26px; height: 26px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.install-hilfe { margin: 8px 0 0; font-size: 0.9rem; color: var(--text); line-height: 1.4; text-align: left; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.rekord { margin: 10px 0 0; font-weight: 700; color: var(--muted); }
.rekord:empty { display: none; }
.rekord.neu { color: #c27c00; }
.ende-punkte { margin: 6px 0 0; font-size: 1.15rem; font-weight: 700; color: var(--muted); }
.ende-punkte span { display: block; font-size: 2.4rem; line-height: 1.1; font-weight: 900; color: var(--text); font-variant-numeric: tabular-nums; }
.ende-werte { margin: 6px 0 0; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.karte-fuss { margin: 10px 0 4px; }

@media (prefers-color-scheme: dark) {
  .rekord.neu { color: #ffd43b; }
}

@media (prefers-reduced-motion: reduce) {
  .tipp, .hud-level.hoch, .knopf-installieren { animation: none; }
}

/* ---------- Impressum und Datenschutz ---------- */

.legal {
  width: 100%; max-width: 640px; margin: 0 auto; padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(32px + env(safe-area-inset-bottom));
  line-height: 1.6; overflow-wrap: break-word;
}
.legal h1 { margin-top: 12px; }
.legal h2 { font-size: 1.15rem; margin: 1.6em 0 0.5em; }
.legal p, .legal ul { margin: 0 0 0.8em; }
.legal ul { padding-left: 1.3em; }
.legal li + li { margin-top: 4px; }
.legal a { color: var(--accent-ink); font-weight: 700; text-underline-offset: 3px; }
.legal p a, .legal li a { padding-block: 12px; } /* Links im Text: Tippfläche 44 pt hoch, ohne die Zeilen zu verschieben */
.legal .legal-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-left: -6px; text-decoration: none; }
.legal-back .ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.legal-box { margin: 18px 0; padding: 2px 16px 4px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-l); }
.legal-box h2 { margin-top: 0.8em; }
.legal-date { margin-top: 2em; color: var(--muted); font-size: 0.9rem; }
.legal-date a { display: inline-flex; align-items: center; min-height: 44px; }
