/* ============================================================
   PUNKTEFRESSER
   Das Spiel selbst wird komplett im Canvas gezeichnet –
   hier geht es nur um die Seite drumherum.
   ============================================================ */

* { box-sizing: border-box; }

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

header {
  position: relative;
  padding: 26px 0 18px;
  text-align: center;
}

.zurueck {
  position: absolute;
  top: 28px;
  left: 0;
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid #2a2a55;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #8a8aa8;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.zurueck:hover,
.zurueck:focus-visible {
  border-color: #ffd447;
  background: rgba(255, 212, 71, 0.12);
  color: #e8e8f5;
  outline: none;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 800;
  color: #ffd447;
}

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

#spielfeld {
  aspect-ratio: 504 / 604;
  width: 100%;
  border: 2px solid #2a2a55;
  border-radius: 12px;
  overflow: hidden;
  background: #05050f;
  box-shadow: 0 0 70px rgba(70, 70, 255, 0.18);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#hilfe {
  margin: 14px 0 0;
  text-align: center;
  color: #8a8aa8;
  font-size: 13.5px;
}

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;
}

/* ---------------- Steuerkreuz fürs Handy ---------------- */

#steuerkreuz {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  max-width: 260px;
  margin: 16px auto 0;
  touch-action: none;
}

body.touch #steuerkreuz { display: grid; }

.pfeil-knopf {
  height: 66px;
  border: 1px solid #3a3a5c;
  border-bottom-width: 4px;
  border-radius: 12px;
  background: #1a1a2e;
  color: #e8e8f5;
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.pfeil-knopf.aktiv {
  border-bottom-width: 1px;
  background: #2a2a4e;
  transform: translateY(3px);
}

/* Ins Kreuz einsortieren */
.p-hoch   { grid-area: 1 / 2; }
.p-links  { grid-area: 2 / 1; }
.p-mitte  { grid-area: 2 / 2; font-size: 19px; background: #14142a; }
.p-rechts { grid-area: 2 / 3; }
.p-runter { grid-area: 3 / 2; }

/* ---------------- Menü-Knöpfe fürs Handy ---------------- */

#menue-reihe {
  display: none;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 380px;
  margin: 12px auto 0;
  touch-action: none;
}

body.touch #menue-reihe { display: grid; }
#menue-reihe.versteckt { display: none !important; }

.menue-knopf {
  height: 48px;
  border: 1px solid #3a3a5c;
  border-bottom-width: 4px;
  border-radius: 10px;
  background: #16162a;
  color: #e8e8f5;
  font-family: inherit;
  font-size: 19px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.menue-knopf.aktiv {
  border-bottom-width: 1px;
  background: #2a2a4e;
  transform: translateY(3px);
}

body.touch { touch-action: manipulation; }

/* ---------------- 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 #2a2a55;
  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: #e8e8f5;
  font-family: inherit;
  font-size: 15px;
}

#namensfeld input:focus { border-color: #ffd447; outline: none; }

#namensfeld .hinweis {
  flex-basis: 100%;
  text-align: center;
  color: #8a8aa8;
  font-size: 13px;
}

/* Die Rückmeldung nach dem Eintippen */
.name-meldung {
  flex-basis: 100%;
  order: 1;                 /* immer direkt unter das Feld */
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
}

.name-meldung.gut { color: #7dff5e; }
.name-meldung.leer { color: #8a8aa8; font-weight: 400; }
.name-meldung.schlecht { color: #ff8f8f; }

#namensfeld .hinweis { order: 2; }

/* Kurz grün aufleuchten, wenn gespeichert wurde */
#namensfeld input.gespeichert {
  border-color: #7dff5e;
  box-shadow: 0 0 0 3px rgba(125, 255, 94, 0.18);
  transition: border-color 0.12s, box-shadow 0.12s;
}

/* ---------------- Erklärungen ---------------- */

.infos {
  display: grid;
  gap: 14px;
  margin-top: 34px;
}

.infos article {
  padding: 20px 22px;
  border: 1px solid #2a2a55;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.infos h2 { margin: 0 0 10px; font-size: 18px; }
.infos ul { margin: 0; padding-left: 20px; }
.infos li { margin-bottom: 6px; font-size: 14.5px; }

.notiz {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid #2a2a55;
  color: #8a8aa8;
  font-size: 13px;
}

.rot    { color: #ff4444; }
.rosa   { color: #ffabde; }
.cyan   { color: #4ce0ff; }
.orange { color: #ffb852; }

footer {
  max-width: 560px;
  margin: 34px auto 0;
  padding-top: 20px;
  border-top: 1px solid #2a2a55;
  text-align: center;
  color: #8a8aa8;
  font-size: 13.5px;
}

footer a { color: #8fa4ff; }

@media (max-width: 560px) {
  header { padding: 20px 0 14px; }
  .zurueck { position: static; display: block; margin-bottom: 8px; }
  .pfeil-knopf { height: 58px; font-size: 23px; }
  .menue-knopf { height: 44px; font-size: 17px; }
  #steuerkreuz { max-width: 230px; }
}

/* ------------------------------------------------------------
   Die Skin-Farben in der Liste.
   Früher standen die als style="..." direkt im HTML. Das ist
   jetzt verboten: unsere Sicherheitsregel (CSP) lässt nur Stile
   aus richtigen CSS-Dateien zu. Das klingt streng, ist aber
   genau der Schutz, der eingeschleusten Code aussperrt.
   ------------------------------------------------------------ */
.skin.klassisch { color: #ffd447; }
.skin.kirsche   { color: #ff5a5a; }
.skin.limette   { color: #7dff5e; }
.skin.beere     { color: #c86bff; }
.skin.eis       { color: #bfeaff; }

.skin.regenbogen {
  background: linear-gradient(90deg, #ff5a5a, #ffd447, #7dff5e, #6ad4ff, #c86bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
