/* Funkenflug - funkenflug.herrsack.de */

@font-face {
  font-family: "Baloo 2";
  src: url("assets/baloo2.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --nacht: #060a1c;
  --tief: #0b1430;
  --karte: rgba(14, 24, 54, 0.92);
  --text: #eef3ff;
  --text-leise: #b8c4e4;
  --licht: #d8ff6a;
  --licht-dunkel: #8fb83a;
  --gold: #ffd45a;
  --fokus: #ffd45a;
  --rund: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  font-family: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at 50% 20%, #12204a 0%, var(--nacht) 70%);
  display: grid;
  place-items: center;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* --- frame ------------------------------------------------------------ */
.rahmen {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background: var(--nacht);
}

@media (min-width: 900px) and (min-height: 620px) {
  .rahmen {
    width: min(1180px, calc(100vw - 48px));
    height: min(800px, calc(100dvh - 48px));
    border-radius: 26px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(170, 200, 255, 0.08);
  }
}
@media (min-width: 1500px) and (min-height: 900px) {
  .rahmen { width: min(1480px, calc(100vw - 64px)); height: min(960px, calc(100dvh - 64px)); }
  html { font-size: 19px; }
}

.buehne {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.ansicht {
  position: absolute;
  inset: 0;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

/* --- buttons ------------------------------------------------------------ */
.knopf {
  font: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.1;
  color: var(--text);
  background: rgba(20, 34, 72, 0.9);
  border: 2px solid rgba(216, 255, 106, 0.55);
  border-radius: 999px;
  padding: 0.55em 1.3em 0.45em;
  min-height: 48px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  touch-action: manipulation;
}
.knopf:hover { background: rgba(34, 54, 104, 0.95); border-color: var(--licht); }
.knopf:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); }
.knopf[disabled] { opacity: 0.5; cursor: default; border-color: rgba(184, 196, 228, 0.35); }
.knopf[disabled]:hover { background: rgba(20, 34, 72, 0.9); }
.knopf small { font-weight: 600; font-size: 0.8em; color: var(--text-leise); }
.knopf:focus-visible, .pausenknopf:focus-visible, .nacht-feld:focus-visible, a:focus-visible {
  outline: 4px solid var(--fokus);
  outline-offset: 3px;
}
.knopf.haupt {
  color: #13200a;
  background: var(--licht);
  border-color: #f2ffbf;
  font-size: 1.4rem;
  box-shadow: 0 4px 0 var(--licht-dunkel), 0 0 26px rgba(216, 255, 106, 0.35);
}
.knopf.haupt:hover { background: #e6ff93; }
.knopf.klein { font-size: 1rem; padding: 0.45em 1em 0.35em; min-height: 44px; }
.knopf.mini { font-size: 0.9rem; padding: 0.35em 0.9em 0.25em; min-height: 40px; }
.knopf.mini[aria-pressed="false"][data-aktion="ton"] { color: var(--text-leise); border-color: rgba(184, 196, 228, 0.35); }

kbd, .taste {
  font: inherit;
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1;
  padding: 0.25em 0.45em 0.15em;
  border-radius: 6px;
  border: 1.5px solid currentColor;
  opacity: 0.8;
}
.taste { display: none; }
@media (hover: hover) and (pointer: fine) {
  .taste { display: inline-block; }
}

/* --- title -------------------------------------------------------------- */
.titel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}
.titel-kopf { margin-top: 4vh; max-width: 34em; }
.spielname {
  margin: 0;
  font-size: clamp(2.8rem, 10vw, 5rem);
  font-weight: 800;
  line-height: 0.95;
  color: #fff;
  text-shadow: 0 0 22px rgba(216, 255, 106, 0.45), 0 4px 0 rgba(0, 0, 0, 0.5);
}
.spielname span { color: var(--licht); }
.untertitel {
  margin: 0.6em auto 0;
  font-size: clamp(1rem, 3.4vw, 1.25rem);
  font-weight: 600;
  color: var(--text-leise);
  max-width: 26em;
}
.titel-mitte { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.titel-fuss { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.schalter { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.links { display: flex; gap: 6px 18px; flex-wrap: wrap; justify-content: center; font-size: 0.95rem; }
.links a { color: var(--text-leise); font-weight: 600; text-underline-offset: 2px; }
.links a:hover { color: #fff; }

@media (orientation: landscape) and (max-height: 520px) {
  .titel { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; align-items: center; justify-items: center; gap: 8px; }
  .titel-kopf { margin: 0; }
  .titel-fuss { grid-column: 1 / -1; flex-direction: row; justify-content: center; flex-wrap: wrap; }
  .spielname { font-size: 2.8rem; }
}

/* --- in game ------------------------------------------------------------ */
.spiel { touch-action: none; cursor: crosshair; outline: none; pointer-events: auto; }
.hud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}
.hud p { margin: 0; }
.hud-links { display: flex; flex-direction: column; line-height: 1.05; min-width: 6.5em; }
.hud-nacht { font-weight: 700; font-size: 1.1rem; color: var(--text-leise); }
.hud-punkte { font-size: 0.95rem; color: var(--text-leise); font-weight: 600; }
.hud-punkte strong { font-size: 1.3rem; color: #fff; font-variant-numeric: tabular-nums; }
.hud-ziel {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  padding: 6px 16px 4px;
  border-radius: 14px;
  background: rgba(8, 14, 34, 0.6);
  border: 1.5px solid rgba(216, 255, 106, 0.25);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.hud-zahl { font-size: 1.7rem; font-weight: 800; color: #fff; }
.hud-ziel small { font-size: 0.85rem; color: var(--text-leise); font-weight: 600; margin-top: 2px; }
.hud-ziel.erreicht { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 212, 90, 0.45); }
.hud-ziel.erreicht .hud-zahl { color: var(--gold); }
.pausenknopf {
  pointer-events: auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(184, 196, 228, 0.4);
  background: rgba(8, 14, 34, 0.6);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  margin-left: 4.5em;
}
.pausenknopf svg { width: 22px; height: 22px; fill: currentColor; }
.tipp {
  position: absolute;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  max-width: calc(100% - 32px);
  text-align: center;
  font-weight: 600;
  color: var(--text-leise);
  background: rgba(8, 14, 34, 0.7);
  border-radius: 12px;
  padding: 6px 14px 4px;
  pointer-events: none;
}
.ruf {
  position: absolute;
  left: 50%;
  top: max(86px, calc(env(safe-area-inset-top) + 78px));
  transform: translateX(-50%);
  margin: 0;
  font-size: clamp(1.2rem, 4vw, 1.7rem);
  font-weight: 800;
  color: #fff7d6;
  text-shadow: 0 0 18px rgba(255, 212, 90, 0.75), 0 2px 0 rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  pointer-events: none;
  animation: ruf 1.5s ease-out both;
}
.ruf.neu { animation: none; }
@keyframes ruf {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.9); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  70% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -6px) scale(1); }
}
.debug {
  position: absolute;
  left: 8px;
  bottom: 6px;
  margin: 0;
  font: 12px/1.3 ui-monospace, Menlo, monospace;
  color: #ffb4b4;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}
@media (max-width: 560px) {
  .hud-links { min-width: 0; }
  .hud-nacht { font-size: 0.95rem; }
  .hud-punkte strong { font-size: 1.1rem; }
  .hud-zahl { font-size: 1.4rem; }
  .hud-ziel small { font-size: 0.75rem; }
  .pausenknopf { margin-left: 0; width: 44px; height: 44px; }
}

/* --- overlays ----------------------------------------------------------- */
.schicht {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 6, 18, 0.55);
  z-index: 5;
}
/* the end card leaves the meadow visible */
.schicht.unten { background: rgba(3, 6, 18, 0.25); align-items: end; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.karte {
  width: min(100%, 460px);
  max-height: 100%;
  overflow: auto;
  text-align: center;
  background: var(--karte);
  border: 1.5px solid rgba(216, 255, 106, 0.25);
  border-radius: var(--rund);
  padding: 22px 22px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.karte.breit { width: min(100%, 680px); }
.karte h2 { margin: 0 0 6px; font-size: 2rem; line-height: 1.05; color: #fff; }
.karte-satz { margin: 0.3em 0; font-size: 1.1rem; color: var(--text-leise); }
.karte-klein { margin: 0.4em 0 0; font-size: 0.95rem; color: var(--text-leise); }
.knopfreihe { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.karte .schalter { margin-top: 14px; }
.ende-zahl { margin: 0; font-size: 1.3rem; }
.ende-zahl strong { font-size: 2.4rem; color: var(--licht); }
.neu-bild { display: block; width: 240px; height: 150px; max-width: 100%; margin: 0 auto 10px; border-radius: 14px; }
.sterne { margin: 0; font-size: 2.2rem; letter-spacing: 0.15em; line-height: 1.1; }
.sterne span { display: inline-block; color: rgba(184, 196, 228, 0.22); }
.sterne span.an { color: var(--gold); text-shadow: 0 0 14px rgba(255, 212, 90, 0.5); animation: stern 0.55s ease-out both; }
.sterne span.an:nth-child(2) { animation-delay: 0.45s; }
.sterne span.an:nth-child(3) { animation-delay: 0.9s; }
@keyframes stern {
  0% { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.35); opacity: 1; text-shadow: 0 0 26px rgba(255, 212, 90, 0.95); }
  100% { transform: scale(1); }
}
.ende-punkte { margin: 0.2em 0 0; font-size: 1.15rem; }
.ende-punkte strong { font-size: 1.6rem; color: #fff; font-variant-numeric: tabular-nums; }
.ende-punkte.gross strong { font-size: 2.6rem; color: var(--licht); }
.abzeichen { display: inline-block; margin-left: 0.4em; padding: 0.1em 0.6em 0; border-radius: 999px; background: var(--gold); color: #2a1e00; font-weight: 700; font-size: 0.85rem; vertical-align: middle; }
.rekord { margin: 2px 0 0; font-size: 1rem; font-weight: 600; color: var(--text-leise); }
.banner {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 10px 26px 6px;
  border-radius: 16px;
  background: rgba(8, 14, 34, 0.78);
  border: 1.5px solid rgba(216, 255, 106, 0.45);
  font-size: clamp(1.3rem, 4.5vw, 2rem);
  font-weight: 800;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 0 30px rgba(216, 255, 106, 0.18);
}

.raster {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 12px;
}
@media (max-width: 480px) { .raster { grid-template-columns: repeat(4, 1fr); } }
.nacht-feld {
  font: inherit;
  aspect-ratio: 1;
  min-height: 52px;
  border-radius: 14px;
  border: 2px solid rgba(216, 255, 106, 0.5);
  background: rgba(20, 34, 72, 0.9);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  touch-action: manipulation;
}
.nacht-feld:hover { border-color: var(--licht); background: rgba(34, 54, 104, 0.95); }
.nacht-nr { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.nacht-sterne { font-size: 0.85rem; color: var(--gold); line-height: 1; }
.nacht-feld.zu { opacity: 0.45; cursor: default; border-color: rgba(184, 196, 228, 0.25); }
.nacht-feld.zu .nacht-sterne { color: var(--text-leise); font-size: 0.75rem; }

.knopfzeile { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.eintrag { margin-top: 12px; text-align: left; }
.eintrag label { display: block; font-weight: 700; margin-bottom: 6px; }
.eintrag-zeile { display: flex; gap: 8px; }
.eintrag input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  padding: 0.35em 0.7em 0.25em;
  border-radius: 12px;
  border: 2px solid rgba(216, 255, 106, 0.55);
  background: rgba(4, 8, 22, 0.8);
  color: #fff;
  user-select: text;
  -webkit-user-select: text;
}
.eintrag input:focus-visible { outline: 4px solid var(--fokus); outline-offset: 2px; }
.eintrag-info { font-size: 1rem; color: var(--text-leise); min-height: 1.2em; margin: 6px 0 0; }
.eintrag-info.fehler { color: #ffb0a8; font-weight: 700; }
.eintrag-info.gut { color: var(--licht); font-weight: 700; }
.liste { margin: 8px 0 0; padding: 0; list-style: none; text-align: left; max-height: 50vh; overflow-y: auto; }
.liste.kurz { max-height: 24vh; }
.liste:empty { display: none; }
.liste li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; padding: 5px 10px 3px; border-radius: 10px; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.liste li:nth-child(odd) { background: rgba(255, 255, 255, 0.04); }
.liste li.du { background: rgba(255, 212, 90, 0.18); outline: 2px solid var(--gold); color: #fff; font-weight: 700; }
.liste .platz { color: var(--text-leise); }
.liste .wert { font-weight: 700; }
.hinweis {
  position: absolute;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 520px);
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--karte);
  border: 1.5px solid rgba(184, 196, 228, 0.3);
  border-radius: 14px;
  padding: 10px 12px;
  z-index: 4;
}
.hinweis p { margin: 0; font-size: 0.95rem; color: var(--text-leise); }

.noscript { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.3rem; }

[data-ruhig] * { transition: none !important; animation: none !important; }
