/* ============================================================
   FIETES METEORITEN-FLUG
   Die Seite drumherum. Das Spiel selbst wird komplett im
   Canvas gezeichnet – hier geht es nur um die Verpackung.
   ============================================================ */

* {
  box-sizing: border-box;
}

:root {
  --hintergrund: #07070f;
  --karte: #12122400;
  --rand: #2a2a45;
  --text: #e8e8f5;
  --gedaempft: #9a9ab8;
  --blau: #8fa4ff;
  --gruen: #3dff88;
  --rot: #ff5252;
  --gold: #ffd447;
}

body {
  margin: 0;
  padding: 0 16px 60px;
  background:
    radial-gradient(ellipse at 50% -10%, #1a1035 0%, transparent 60%),
    var(--hintergrund);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
}

/* ---------------- Kopfbereich ---------------- */

header {
  text-align: center;
  padding: 40px 0 24px;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #ffffff 30%, #9fb0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.untertitel {
  margin: 8px 0 0;
  color: var(--gedaempft);
  font-size: 15px;
}

/* ---------------- Das Spielfeld ---------------- */

main {
  max-width: 940px;
  margin: 0 auto;
}

#spielfeld {
  /* Hält das Seitenverhältnis 900:540, egal wie breit der
     Bildschirm ist. Das Canvas skaliert einfach mit. */
  aspect-ratio: 900 / 540;
  width: 100%;
  border: 2px solid var(--rand);
  border-radius: 14px;
  overflow: hidden;
  background: #0d0d1c;
  box-shadow:
    0 0 80px rgba(90, 120, 255, 0.16),
    0 20px 50px rgba(0, 0, 0, 0.5);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#hilfe {
  margin: 18px 0 0;
  text-align: center;
  color: var(--gedaempft);
  font-size: 14px;
}

.maus-tipp {
  display: block;
  margin-top: 6px;
  color: #6a6a88;
  font-size: 13px;
}

/* ---------------- Tasten-Optik ---------------- */

kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid #3a3a5c;
  border-bottom-width: 3px;
  border-radius: 5px;
  background: #1a1a2e;
  color: #dcdcf0;
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------------- Handy-Steuerung ----------------
   Die Leiste wird von src/touch.js gebaut und nur auf
   Geräten mit Touchscreen überhaupt eingehängt.        */

.touch-reihe {
  display: grid;
  gap: 9px;
  align-items: center;
  margin-top: 12px;
  touch-action: none;          /* kein Wegscrollen beim Tippen */
}

/* Erste Reihe: hoch, runter, OK, Feuer */
#touch-haupt {
  grid-template-columns: 1fr 1fr 1fr 1.4fr;
}

/* Zweite Reihe: die Menü-Knöpfe, alle gleich breit */
#touch-menue {
  grid-template-columns: repeat(8, 1fr);
}

/* Auf Touchgeräten darf das Spielfeld nicht wegscrollen,
   wenn man den Finger zum Lenken darüber zieht. */
body.touch canvas {
  touch-action: none;
}

/* Kein Zoom beim schnellen Doppeltippen */
body.touch {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

.touch-knopf {
  height: 62px;
  padding: 0;
  border: 1px solid #3a3a5c;
  border-bottom-width: 4px;
  border-radius: 12px;
  background: #1a1a2e;
  color: var(--text);
  font-family: inherit;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  transition: transform 0.06s, background 0.06s;
}

/* Gedrückt: kurz kleiner und heller */
.touch-knopf.aktiv {
  border-bottom-width: 1px;
  background: #2a2a4e;
  transform: translateY(3px);
}

.k-hoch, .k-runter {
  border-color: #4a5a8c;
  background: #1c2242;
  font-size: 30px;
}

.k-feuer {
  border-color: #2f7a4d;
  background: #123322;
}

.k-ok {
  border-color: #4a5a8c;
  background: #1c2242;
  font-size: 17px;
}

/* Die Menü-Reihe ist flacher und unauffälliger */
#touch-menue .touch-knopf {
  height: 46px;
  font-size: 18px;
  background: #16162a;
}

/* Am Rechner brauchen wir die Leisten nicht */
body:not(.touch) .touch-reihe {
  display: none;
}

/* Auf dem Handy ist das Spielfeld schmal – dann lieber quer halten */
body.touch #hilfe::after {
  display: block;
  margin-top: 8px;
  color: var(--gold);
  content: "Zum Lenken oben oder unten aufs Spielfeld tippen und halten. Handy quer halten macht das Feld größer.";
}

/* ---------------- Namensfeld ---------------- */

#namensfeld {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  padding: 16px 20px;
  border: 1px solid var(--rand);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

#namensfeld label {
  font-size: 15px;
  font-weight: 600;
}

#namensfeld input {
  width: 170px;
  padding: 9px 12px;
  border: 1px solid #3a3a5c;
  border-radius: 8px;
  background: #12122a;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}

#namensfeld input:focus {
  border-color: var(--blau);
  outline: none;
}

#namensfeld .hinweis {
  flex-basis: 100%;
  text-align: center;
  color: var(--gedaempft);
  font-size: 13px;
}

/* ---------------- Info-Kacheln ---------------- */

.infos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 48px;
}

.infos article,
.tasten {
  padding: 22px 24px;
  border: 1px solid var(--rand);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.infos h2,
.tasten h2 {
  margin: 0 0 12px;
  font-size: 19px;
}

.infos ul {
  margin: 0;
  padding-left: 20px;
}

.infos li {
  margin-bottom: 6px;
  font-size: 14.5px;
}

.infos p {
  margin: 0 0 10px;
  font-size: 14.5px;
}

.notiz {
  margin-top: 12px !important;
  margin-bottom: 0 !important;
  padding-top: 12px;
  border-top: 1px solid var(--rand);
  color: var(--gedaempft);
  font-size: 13.5px !important;
}

.gruen { color: var(--gruen); }
.rot   { color: var(--rot); }
.blau  { color: #4db8ff; }
.gold  { color: var(--gold); }
.rosa  { color: #ff5ecd; }

/* ---------------- Tastentabelle ---------------- */

.tasten {
  margin-top: 16px;
}

.tasten table {
  width: 100%;
  border-collapse: collapse;
}

.tasten td {
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14.5px;
  vertical-align: middle;
}

.tasten td:first-child {
  width: 130px;
  white-space: nowrap;
}

.tasten tr:last-child td {
  border-bottom: none;
}

/* ---------------- Fußzeile ---------------- */

footer {
  max-width: 940px;
  margin: 44px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--rand);
  text-align: center;
  color: var(--gedaempft);
  font-size: 14px;
}

footer p {
  margin: 0 0 6px;
}

.klein {
  font-size: 12.5px;
  opacity: 0.7;
}

/* ---------------- Kleine Bildschirme ---------------- */

@media (max-width: 620px) {
  body { padding: 0 12px 40px; }
  header { padding: 22px 0 16px; }
  .infos { margin-top: 32px; }
  .infos article, .tasten { padding: 18px; }

  /* Die Tastatur-Hinweiszeile ist auf dem Handy nur im Weg –
     dort gibt es ja die Knöpfe. */
  body.touch #hilfe kbd { display: none; }
  body.touch #hilfe { font-size: 0; }
  body.touch #hilfe::after { font-size: 13px; }

  .touch-knopf { height: 56px; font-size: 21px; }
  .k-hoch, .k-runter { font-size: 26px; }
  #touch-menue .touch-knopf { height: 42px; font-size: 16px; }
  .touch-reihe { gap: 6px; }
}
